Blob Blame History Raw
From 342133607ff39eac851667f4a86abd9b97f3cf22 Mon Sep 17 00:00:00 2001
Message-Id: <342133607ff39eac851667f4a86abd9b97f3cf22@dist-git>
From: Erik Skultety <eskultet@redhat.com>
Date: Tue, 2 Aug 2016 08:47:44 +0200
Subject: [PATCH] admin: Retrieve the SASL context for both local and remote
 connection

When commit 4a0e9108 added a support for client information retrieval, it made
the API return SASL identity info only for clients connected remotely, yet SASL
can be happily used with UNIX sockets as well.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
(cherry picked from commit 385ec6280fdad8548b5997577b91931d1ed79aaa)

https://bugzilla.redhat.com/show_bug.cgi?id=1361948
Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 daemon/admin_server.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/daemon/admin_server.c b/daemon/admin_server.c
index 9f24f68..5bbf229 100644
--- a/daemon/admin_server.c
+++ b/daemon/admin_server.c
@@ -237,19 +237,19 @@ adminClientGetInfo(virNetServerClientPtr client,
                                  readonly) < 0)
         goto cleanup;
 
+    if (virIdentityGetSASLUserName(identity, &attr) < 0 ||
+        (attr &&
+         virTypedParamsAddString(&tmpparams, nparams, &maxparams,
+                                 VIR_CLIENT_INFO_SASL_USER_NAME,
+                                 attr) < 0))
+        goto cleanup;
+
     if (!virNetServerClientIsLocal(client)) {
         if (virTypedParamsAddString(&tmpparams, nparams, &maxparams,
                                     VIR_CLIENT_INFO_SOCKET_ADDR,
                                     sock_addr) < 0)
             goto cleanup;
 
-        if (virIdentityGetSASLUserName(identity, &attr) < 0 ||
-            (attr &&
-             virTypedParamsAddString(&tmpparams, nparams, &maxparams,
-                                     VIR_CLIENT_INFO_SASL_USER_NAME,
-                                     attr) < 0))
-            goto cleanup;
-
         if (virIdentityGetX509DName(identity, &attr) < 0 ||
             (attr &&
              virTypedParamsAddString(&tmpparams, nparams, &maxparams,
-- 
2.9.2