tools/libs/store: drop read-only functionality
authorJuergen Gross <jgross@suse.com>
Fri, 2 Oct 2020 15:41:39 +0000 (17:41 +0200)
committerWei Liu <wl@xen.org>
Thu, 8 Oct 2020 12:47:57 +0000 (12:47 +0000)
Today it is possible to open the connection in read-only mode via
xs_daemon_open_readonly(). This is working only with Xenstore running
as a daemon in the same domain as the user. Additionally it doesn't
add any security as accessing the socket used for that functionality
requires the same privileges as the socket used for full Xenstore
access.

So just drop the read-only semantics in all cases, leaving the
interface existing only for compatibility reasons. This in turn
requires to just ignore the XS_OPEN_READONLY flag.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wl@xen.org>
tools/libs/store/include/xenstore.h
tools/libs/store/xs.c

index cbc7206a0f72a095bce350c26cd14cfea384580c..158e69ef83591520f0c3f76c9ac1a9d8c6fb7d5e 100644 (file)
@@ -60,15 +60,12 @@ typedef uint32_t xs_transaction_t;
 /* Open a connection to the xs daemon.
  * Attempts to make a connection over the socket interface,
  * and if it fails, then over the  xenbus interface.
- * Mode 0 specifies read-write access, XS_OPEN_READONLY for
- * read-only access.
  *
  * * Connections made with xs_open(0) (which might be shared page or
  *   socket based) are only guaranteed to work in the parent after
  *   fork.
  * * xs_daemon_open*() and xs_domain_open() are deprecated synonyms
  *   for xs_open(0).
- * * XS_OPEN_READONLY has no bearing on any of this.
  *
  * Returns a handle or NULL.
  */
@@ -83,11 +80,6 @@ void xs_close(struct xs_handle *xsh /* NULL ok */);
  */
 struct xs_handle *xs_daemon_open(void);
 struct xs_handle *xs_domain_open(void);
-
-/* Connect to the xs daemon (readonly for non-root clients).
- * Returns a handle or NULL.
- * Deprecated, please use xs_open(XS_OPEN_READONLY) instead
- */
 struct xs_handle *xs_daemon_open_readonly(void);
 
 /* Close the connection to the xs daemon.
index 320734416f70259da4281fe1a82e2ca8da0f138e..4ac73ec3178a53a6a2fc3116cbafe29adf06a32b 100644 (file)
@@ -302,7 +302,7 @@ struct xs_handle *xs_daemon_open(void)
 
 struct xs_handle *xs_daemon_open_readonly(void)
 {
-       return xs_open(XS_OPEN_READONLY);
+       return xs_open(0);
 }
 
 struct xs_handle *xs_domain_open(void)
@@ -314,10 +314,7 @@ struct xs_handle *xs_open(unsigned long flags)
 {
        struct xs_handle *xsh = NULL;
 
-       if (flags & XS_OPEN_READONLY)
-               xsh = get_handle(xs_daemon_socket_ro());
-       else
-               xsh = get_handle(xs_daemon_socket());
+       xsh = get_handle(xs_daemon_socket());
 
        if (!xsh)
                xsh = get_handle(xs_domain_dev());