WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] xenstore fixes for read-only connections.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] xenstore fixes for read-only connections.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Fri, 10 Jun 2005 15:18:00 +0000
Delivery-date: Fri, 10 Jun 2005 16:02:17 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1720, 2005/06/10 16:18:00+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        xenstore fixes for read-only connections.



 xenstored_core.c   |   16 ++++++++++++----
 xenstored_core.h   |    3 +++
 xenstored_domain.c |    3 +++
 xs_test.c          |    4 ++--
 4 files changed, 20 insertions(+), 6 deletions(-)


diff -Nru a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   2005-06-10 12:03:15 -04:00
+++ b/tools/xenstore/xenstored_core.c   2005-06-10 12:03:15 -04:00
@@ -617,7 +617,7 @@
                return false;
        }
 
-       if (!conn->write && (perm & XS_PERM_WRITE)) {
+       if (!conn->can_write && (perm & XS_PERM_WRITE)) {
                errno = EROFS;
                return false;
        }
@@ -938,6 +938,12 @@
                return do_set_perms(conn, in);
 
        case XS_SHUTDOWN:
+               /* FIXME: Implement gentle shutdown too. */
+               /* Only tools can do this. */
+               if (conn->id != 0)
+                       return send_error(conn, EACCES);
+               if (!conn->can_write)
+                       return send_error(conn, EROFS);
                send_ack(conn, XS_SHUTDOWN);
                /* Everything hangs off auto-free context, freed at exit. */
                exit(0);
@@ -1137,6 +1143,7 @@
        new->transaction = NULL;
        new->write = write;
        new->read = read;
+       new->can_write = true;
 
        talloc_set_fail_handler(out_of_mem, &talloc_fail);
        if (setjmp(talloc_fail)) {
@@ -1170,10 +1177,11 @@
        if (fd < 0)
                return;
 
-       conn = new_connection(canwrite ? writefd : NULL, readfd);
-       if (conn)
+       conn = new_connection(writefd, readfd);
+       if (conn) {
                conn->fd = fd;
-       else
+               conn->can_write = canwrite;
+       } else
                close(fd);
 }
 
diff -Nru a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h   2005-06-10 12:03:15 -04:00
+++ b/tools/xenstore/xenstored_core.h   2005-06-10 12:03:15 -04:00
@@ -56,6 +56,9 @@
        /* Are we blocked waiting for a transaction to end?  Contains node. */
        char *blocked;
 
+       /* Is this a read-only connection? */
+       bool can_write;
+
        /* Our current event.  If all used, we're waiting for ack. */
        struct watch_event *event;
 
diff -Nru a/tools/xenstore/xenstored_domain.c 
b/tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c 2005-06-10 12:03:15 -04:00
+++ b/tools/xenstore/xenstored_domain.c 2005-06-10 12:03:15 -04:00
@@ -268,6 +268,9 @@
        if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec))
                return send_error(conn, EINVAL);
 
+       if (!conn->can_write)
+               return send_error(conn, EROFS);
+
        /* Hang domain off "in" until we're finished. */
        domain = talloc(in, struct domain);
        domain->domid = atoi(vec[0]);
diff -Nru a/tools/xenstore/xs_test.c b/tools/xenstore/xs_test.c
--- a/tools/xenstore/xs_test.c  2005-06-10 12:03:15 -04:00
+++ b/tools/xenstore/xs_test.c  2005-06-10 12:03:15 -04:00
@@ -176,11 +176,11 @@
             "  watch <path> <prio>\n"
             "  waitwatch\n"
             "  ackwatch\n"
-            "  unwatch <path>\n"
+            "  unwatch <path> <token>\n"
             "  close\n"
             "  start <node>\n"
             "  abort\n"
-            "  introduce <domid> <mfn> <eventchn>\n"
+            "  introduce <domid> <mfn> <eventchn> <path>\n"
             "  commit\n"
             "  sleep <seconds>\n"
             "  dump\n");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] xenstore fixes for read-only connections., BitKeeper Bot <=