[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xl: 'xl vncviewer' accesses port 0 by any invalid domid



commit 2a8cc1a55329ead252ed323ec4bbee534d5c0f23
Author:     Chunyan Liu <cyliu@xxxxxxxx>
AuthorDate: Fri Jul 18 14:18:04 2014 +0800
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri Jul 18 13:37:47 2014 +0100

    xl: 'xl vncviewer' accesses port 0 by any invalid domid
    
    Currently, with command:
      xl vncviewer invalid_domid
    it always brings user to the domU using vncport 5900.
    The invalid domid could be an non-existing one or Dom0.
    It's better to report error in this case.
    
    Correct libxl_vncviewer_exec:
      In existing code, when vncport is NULL, it still continues
      and will show vncport 5900. So, with 'xl vncviewer 0' it also
      wrongly shows domU using vncport 5900. Correct it to report error
      if vncport is NULL.
    
    Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index a9205d1..3526539 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1719,8 +1719,12 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, 
int autopass)
     vnc_port = libxl__xs_read(gc, XBT_NULL,
                             libxl__sprintf(gc,
                             "/local/domain/%d/console/vnc-port", domid));
-    if ( vnc_port )
-        port = atoi(vnc_port) - 5900;
+    if (!vnc_port) {
+        LOG(ERROR, "Cannot get vnc-port of domain %d", domid);
+        goto x_fail;
+    }
+
+    port = atoi(vnc_port) - 5900;
 
     vnc_listen = libxl__xs_read(gc, XBT_NULL,
                                 libxl__sprintf(gc,
--
generated by git-patchbot for /home/xen/git/xen.git#master

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.