[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] ioemu: handle empty vnc passwd
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |