From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com
Subject: [Qemu-devel] [PATCH 2/8] VNC: Make 'auth' key mandatory
Date: Thu, 14 Jan 2010 14:50:53 -0200 [thread overview]
Message-ID: <1263487859-6318-3-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1263487859-6318-1-git-send-email-lcapitulino@redhat.com>
There is no reason to have it as optional and the code
in the server and client gets slightly simpler if the
key is mandatory.
While there also do some cleanup on how the server info is
collected.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
vnc.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/vnc.c b/vnc.c
index ef86ef7..b5f3b64 100644
--- a/vnc.c
+++ b/vnc.c
@@ -122,7 +122,7 @@ static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
return 0;
}
-static int vnc_qdict_local_addr(QDict *qdict, int fd)
+static int vnc_server_addr_put(QDict *qdict, int fd)
{
struct sockaddr_storage sa;
socklen_t salen;
@@ -199,6 +199,16 @@ static const char *vnc_auth_name(VncDisplay *vd) {
return "unknown";
}
+static int vnc_server_info_put(QDict *qdict)
+{
+ if (vnc_server_addr_put(qdict, vnc_display->lsock) < 0) {
+ return -1;
+ }
+
+ qdict_put(qdict, "auth", qstring_from_str(vnc_auth_name(vnc_display)));
+ return 0;
+}
+
static QDict *do_info_vnc_client(Monitor *mon, VncState *client)
{
QDict *qdict;
@@ -263,8 +273,7 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
monitor_printf(mon, " address: %s:%s\n",
qdict_get_str(server, "host"),
qdict_get_str(server, "service"));
- monitor_printf(mon, " auth: %s\n",
- qdict_haskey(server, "auth") ? qdict_get_str(server, "auth") : "none");
+ monitor_printf(mon, " auth: %s\n", qdict_get_str(server, "auth"));
clients = qdict_get_qlist(server, "clients");
if (qlist_empty(clients)) {
@@ -285,7 +294,7 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
* - "enabled": true or false
* - "host": server's IP address
* - "service": server's port number
- * - "auth": authentication method (optional)
+ * - "auth": authentication method
* - "clients": a QList of all connected clients
*
* Clients are described by a QDict, with the following information:
@@ -323,14 +332,7 @@ void do_info_vnc(Monitor *mon, QObject **ret_data)
QOBJECT(clist));
assert(*ret_data != NULL);
- qdict = qobject_to_qdict(*ret_data);
-
- if (vnc_display->auth != VNC_AUTH_NONE) {
- qdict_put(qdict, "auth",
- qstring_from_str(vnc_auth_name(vnc_display)));
- }
-
- if (vnc_qdict_local_addr(qdict, vnc_display->lsock) < 0) {
+ if (vnc_server_info_put(qobject_to_qdict(*ret_data)) < 0) {
qobject_decref(*ret_data);
*ret_data = NULL;
}
--
1.6.6
next prev parent reply other threads:[~2010-01-14 16:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 16:50 [Qemu-devel] [PATCH v0 0/8]: VNC events and cleanup Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 1/8] VNC: Use 'enabled' key instead of 'status' Luiz Capitulino
2010-01-19 22:39 ` Anthony Liguori
2010-01-14 16:50 ` Luiz Capitulino [this message]
2010-01-14 16:50 ` [Qemu-devel] [PATCH 3/8] VNC: Rename client's 'username' key Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 4/8] VNC: Add 'family' key Luiz Capitulino
2010-01-15 7:54 ` Gerd Hoffmann
2010-01-15 11:54 ` Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 5/8] VNC: Cache client info at connection time Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 6/8] QMP: Introduce VNC_CONNECTED event Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 7/8] QMP: Introduce VNC_DISCONNECTED event Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 8/8] QMP: Introduce VNC_INITIALIZED event Luiz Capitulino
2010-01-14 17:32 ` [Qemu-devel] Re: [PATCH v0 0/8]: VNC events and cleanup Daniel P. Berrange
2010-01-14 19:01 ` Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263487859-6318-3-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).