mirror of
https://github.com/xemu-project/xemu.git
synced 2024-12-03 17:11:01 +00:00
vnc: misc fixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJVXEatAAoJEEy22O7T6HE4YswP/RDw7kbNH6ZKwp+z88Ex8OLj /CvK3X/LA/+IDj19w17j1DvGETGfCkj7RmbZTA2WDOUV3wRvwaO6TRf3nzRVJLGL 00CbE0V+76e9bzr4COKjU3HseFHsuXyICyk1qmqOgt+Jv3ZwEVavqlSwodoschtV WjD6C+oyb2vzEQBQxHyfx6tDxlF4xMiIe0lnztwd98sejLAslkrF8qZ3zfen21mt zf67QHumW+sooFge7Q0Ur4nGdty6rU5DNK7hv1RWow/riqtlp13Ewi2WYIbjPY3B rF0yaBOT/6LwdJyu5AcqGLRz6dHW1bUOpcjnLYgF398RuXZwt1vxTrB9oA67abaz XXLPoTjFfkEDkhbr7VqCLOqHqG1JNt6+/V8LvDAVZMFovianKKZSbOScgHlLPd/0 vNzk9hY56Ih07F58yP+Sv9NBebGvOJ4JFQO31ARqSwVXpn8qki34T90a0qCFCmAG 35IUxn2wk2ZFzdEYtcICICzh4HdjoHYu1USqmrg14HGfDl6InjYJKz2HfVyHRXwH OgivIo06xwPCGEfGF94VYdTFWU6k+dgKHVc/EI+ikYZGdl+pixihvf7oK/gbmPLx ZN+P0sCe6dn5mc/ZHVnhoxyaR9pMQAdWsGMExXgMBUgBQyrZPPievXFEV2Rm5Yia 2Db2RyyrSo1/jy/5Wnf7 =oeH6 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20150520-1' into staging vnc: misc fixes. # gpg: Signature made Wed May 20 09:32:45 2015 BST using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-vnc-20150520-1: qemu-sockets: Report explicit error if unlink fails vnc: Tweak error when init fails vnc: Don't assert if opening unix socket fails ui: remove check for failure of qemu_acl_init() Strip brackets from vnc host Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
9e549d36e9
23
ui/vnc.c
23
ui/vnc.c
@ -3482,7 +3482,14 @@ void vnc_display_open(const char *id, Error **errp)
|
|||||||
|
|
||||||
h = strrchr(vnc, ':');
|
h = strrchr(vnc, ':');
|
||||||
if (h) {
|
if (h) {
|
||||||
char *host = g_strndup(vnc, h - vnc);
|
char *host;
|
||||||
|
size_t hlen = h - vnc;
|
||||||
|
|
||||||
|
if (vnc[0] == '[' && vnc[hlen - 1] == ']') {
|
||||||
|
host = g_strndup(vnc + 1, hlen - 2);
|
||||||
|
} else {
|
||||||
|
host = g_strndup(vnc, hlen);
|
||||||
|
}
|
||||||
qemu_opt_set(sopts, "host", host, &error_abort);
|
qemu_opt_set(sopts, "host", host, &error_abort);
|
||||||
qemu_opt_set(wsopts, "host", host, &error_abort);
|
qemu_opt_set(wsopts, "host", host, &error_abort);
|
||||||
qemu_opt_set(sopts, "port", h+1, &error_abort);
|
qemu_opt_set(sopts, "port", h+1, &error_abort);
|
||||||
@ -3602,10 +3609,6 @@ void vnc_display_open(const char *id, Error **errp)
|
|||||||
aclname = g_strdup_printf("vnc.%s.x509dname", vs->id);
|
aclname = g_strdup_printf("vnc.%s.x509dname", vs->id);
|
||||||
}
|
}
|
||||||
vs->tls.acl = qemu_acl_init(aclname);
|
vs->tls.acl = qemu_acl_init(aclname);
|
||||||
if (!vs->tls.acl) {
|
|
||||||
fprintf(stderr, "Failed to create x509 dname ACL\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
g_free(aclname);
|
g_free(aclname);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3619,10 +3622,6 @@ void vnc_display_open(const char *id, Error **errp)
|
|||||||
aclname = g_strdup_printf("vnc.%s.username", vs->id);
|
aclname = g_strdup_printf("vnc.%s.username", vs->id);
|
||||||
}
|
}
|
||||||
vs->sasl.acl = qemu_acl_init(aclname);
|
vs->sasl.acl = qemu_acl_init(aclname);
|
||||||
if (!vs->sasl.acl) {
|
|
||||||
fprintf(stderr, "Failed to create username ACL\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
g_free(aclname);
|
g_free(aclname);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3685,6 +3684,9 @@ void vnc_display_open(const char *id, Error **errp)
|
|||||||
/* listen for connects */
|
/* listen for connects */
|
||||||
if (strncmp(vnc, "unix:", 5) == 0) {
|
if (strncmp(vnc, "unix:", 5) == 0) {
|
||||||
vs->lsock = unix_listen(vnc+5, NULL, 0, errp);
|
vs->lsock = unix_listen(vnc+5, NULL, 0, errp);
|
||||||
|
if (vs->lsock < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
vs->is_unix = true;
|
vs->is_unix = true;
|
||||||
} else {
|
} else {
|
||||||
vs->lsock = inet_listen_opts(sopts, 5900, errp);
|
vs->lsock = inet_listen_opts(sopts, 5900, errp);
|
||||||
@ -3777,8 +3779,7 @@ int vnc_init_func(QemuOpts *opts, void *opaque)
|
|||||||
vnc_display_init(id);
|
vnc_display_init(id);
|
||||||
vnc_display_open(id, &local_err);
|
vnc_display_open(id, &local_err);
|
||||||
if (local_err != NULL) {
|
if (local_err != NULL) {
|
||||||
error_report("Failed to start VNC server on `%s': %s",
|
error_report("Failed to start VNC server: %s",
|
||||||
qemu_opt_get(opts, "display"),
|
|
||||||
error_get_pretty(local_err));
|
error_get_pretty(local_err));
|
||||||
error_free(local_err);
|
error_free(local_err);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -729,7 +729,12 @@ int unix_listen_opts(QemuOpts *opts, Error **errp)
|
|||||||
qemu_opt_set(opts, "path", un.sun_path, &error_abort);
|
qemu_opt_set(opts, "path", un.sun_path, &error_abort);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(un.sun_path);
|
if ((access(un.sun_path, F_OK) == 0) &&
|
||||||
|
unlink(un.sun_path) < 0) {
|
||||||
|
error_setg_errno(errp, errno,
|
||||||
|
"Failed to unlink socket %s", un.sun_path);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
|
if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
|
||||||
error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path);
|
error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path);
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user