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] [xen-unstable] ioemu: handle empty vnc passwd

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] ioemu: handle empty vnc passwd
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jan 2008 07:10:13 -0800
Delivery-date: Thu, 24 Jan 2008 07:11:07 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201111957 0
# Node ID 05e36e506c09438c0df10371116f9d2083a2f37e
# Parent  ed540d61339ef01d557aa76d3fb2b3bd54cc788b
ioemu: handle empty vnc passwd
Have xenstore_read_vncpasswd return -1 when it is unable to read the
passwd from XenStore (and store an empty password).  However, don't
exit in such case since it may just mean that the use didn't set a
passwd. If he really did, xend would have given the passwd flag in the
-vnc option, and the empty passwd would make the vnc authentication
reject any password anyway.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Acked-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tools/ioemu/vl.c       |    3 +--
 tools/ioemu/vl.h       |    2 +-
 tools/ioemu/xenstore.c |   29 ++++++++++++-----------------
 3 files changed, 14 insertions(+), 20 deletions(-)

diff -r ed540d61339e -r 05e36e506c09 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Wed Jan 23 18:05:27 2008 +0000
+++ b/tools/ioemu/vl.c  Wed Jan 23 18:12:37 2008 +0000
@@ -7756,8 +7756,7 @@ int main(int argc, char **argv)
        int vnc_display_port;
        char password[20];
        vnc_display_init(ds);
-       if (xenstore_read_vncpasswd(domid, password, sizeof(password)) < 0)
-           exit(0);
+       xenstore_read_vncpasswd(domid, password, sizeof(password));
        vnc_display_password(ds, password);
        if ((vnc_display_port = vnc_display_open(ds, vnc_display, vncunused)) < 
0) 
            exit (0);
diff -r ed540d61339e -r 05e36e506c09 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Wed Jan 23 18:05:27 2008 +0000
+++ b/tools/ioemu/vl.h  Wed Jan 23 18:12:37 2008 +0000
@@ -1463,7 +1463,7 @@ void xenstore_record_dm_state(char *stat
 void xenstore_record_dm_state(char *state);
 void xenstore_check_new_media_present(int timeout);
 void xenstore_write_vncport(int vnc_display);
-int xenstore_read_vncpasswd(int domid, char *pwbuf, size_t pwbuflen);
+void xenstore_read_vncpasswd(int domid, char *pwbuf, size_t pwbuflen);
 
 int xenstore_domain_has_devtype(struct xs_handle *handle,
                                 const char *devtype);
diff -r ed540d61339e -r 05e36e506c09 tools/ioemu/xenstore.c
--- a/tools/ioemu/xenstore.c    Wed Jan 23 18:05:27 2008 +0000
+++ b/tools/ioemu/xenstore.c    Wed Jan 23 18:12:37 2008 +0000
@@ -489,19 +489,20 @@ void xenstore_write_vncport(int display)
     free(buf);
 }
 
-int xenstore_read_vncpasswd(int domid, char *pwbuf, size_t pwbuflen)
+void xenstore_read_vncpasswd(int domid, char *pwbuf, size_t pwbuflen)
 {
     char *buf = NULL, *path, *uuid = NULL, *passwd = NULL;
     unsigned int i, len, rc = 0;
 
-    if (xsh == NULL) {
-        return -1;
-    }
+    pwbuf[0] = '\0';
+
+    if (xsh == NULL)
+        return;
 
     path = xs_get_domain_path(xsh, domid);
     if (path == NULL) {
         fprintf(logfile, "xs_get_domain_path() error. domid %d.\n", domid);
-        return -1;
+        return;
     }
 
     pasprintf(&buf, "%s/vm", path);
@@ -509,35 +510,29 @@ int xenstore_read_vncpasswd(int domid, c
     if (uuid == NULL) {
         fprintf(logfile, "xs_read(): uuid get error. %s.\n", buf);
         free(path);
-        return -1;
+        return;
     }
 
     pasprintf(&buf, "%s/vncpasswd", uuid);
     passwd = xs_read(xsh, XBT_NULL, buf, &len);
     if (passwd == NULL) {
         fprintf(logfile, "xs_read(): vncpasswd get error. %s.\n", buf);
-        pwbuf[0] = '\0';
         free(uuid);
         free(path);
-        return rc;
-    }
-
-    for (i=0; i<len && i<pwbuflen; i++) {
+        return;
+    }
+
+    for (i=0; i<len && i<pwbuflen; i++)
         pwbuf[i] = passwd[i];
-    }
     pwbuf[len < (pwbuflen-1) ? len : (pwbuflen-1)] = '\0';
     passwd[0] = '\0';
     pasprintf(&buf, "%s/vncpasswd", uuid);
-    if (xs_write(xsh, XBT_NULL, buf, passwd, len) == 0) {
+    if (xs_write(xsh, XBT_NULL, buf, passwd, len) == 0)
         fprintf(logfile, "xs_write() vncpasswd failed.\n");
-        rc = -1;
-    }
 
     free(passwd);
     free(uuid);
     free(path);
-
-    return rc;
 }
 
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] ioemu: handle empty vnc passwd, Xen patchbot-unstable <=