From 821601ea5b02a68ada479731a4d3d07a9876632a Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 16 Mar 2011 13:33:36 +0100 Subject: Make VNC support optional Per default VNC is enabled. Signed-off-by: Jes Sorensen Signed-off-by: Anthony Liguori --- ui/vnc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/vnc.c b/ui/vnc.c index fdc4a70d02..0b5aad2952 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2638,16 +2638,19 @@ int vnc_display_disable_login(DisplayState *ds) int vnc_display_password(DisplayState *ds, const char *password) { + int ret = 0; VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; if (!vs) { - return -1; + ret = -EINVAL; + goto out; } if (!password) { /* This is not the intention of this interface but err on the side of being safe */ - return vnc_display_disable_login(ds); + ret = vnc_display_disable_login(ds); + goto out; } if (vs->password) { @@ -2656,8 +2659,11 @@ int vnc_display_password(DisplayState *ds, const char *password) } vs->password = qemu_strdup(password); vs->auth = VNC_AUTH_VNC; - - return 0; +out: + if (ret != 0) { + qerror_report(QERR_SET_PASSWD_FAILED); + } + return ret; } int vnc_display_pw_expire(DisplayState *ds, time_t expires) -- cgit v1.2.3