[PATCH v2 05/14] rpc: Be more precise in which cases the authentication is needed and introduce *Locked

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

 



Be more precise in which cases the authentication is needed and
introduce *Locked.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Stefan Zimmermann <stzi@xxxxxxxxxxxxxxxxxx>
Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/libvirt_remote.syms      |  1 +
 src/rpc/virnetserverclient.c | 15 +++++++++++----
 src/rpc/virnetserverclient.h |  1 +
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 1c107e1d69aa..cecd71c49e7f 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -143,6 +143,7 @@ virNetServerClientIsLocal;
 virNetServerClientIsSecure;
 virNetServerClientLocalAddrStringSASL;
 virNetServerClientNeedAuth;
+virNetServerClientNeedAuthLocked;
 virNetServerClientNew;
 virNetServerClientNewPostExecRestart;
 virNetServerClientPreExecRestart;
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index f4a2571f55c5..748132ae6127 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1518,12 +1518,19 @@ int virNetServerClientSendMessage(virNetServerClientPtr client,
 }
 
 
-bool virNetServerClientNeedAuth(virNetServerClientPtr client)
+bool
+virNetServerClientNeedAuthLocked(virNetServerClientPtr client)
 {
-    bool need = false;
+    return !(client->auth == VIR_NET_SERVER_SERVICE_AUTH_NONE);
+}
+
+
+bool
+virNetServerClientNeedAuth(virNetServerClientPtr client)
+{
+    bool need;
     virObjectLock(client);
-    if (client->auth)
-        need = true;
+    need = virNetServerClientNeedAuthLocked(client);
     virObjectUnlock(client);
     return need;
 }
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
index 2569f93c3b52..1182d53c7059 100644
--- a/src/rpc/virnetserverclient.h
+++ b/src/rpc/virnetserverclient.h
@@ -147,6 +147,7 @@ int virNetServerClientSendMessage(virNetServerClientPtr client,
                                   virNetMessagePtr msg);
 
 bool virNetServerClientNeedAuth(virNetServerClientPtr client);
+bool virNetServerClientNeedAuthLocked(virNetServerClientPtr client);
 
 int virNetServerClientGetTransport(virNetServerClientPtr client);
 int virNetServerClientGetInfo(virNetServerClientPtr client,
-- 
2.13.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux