[PATCH 01/29] rpc: add API for checking whether an auth scheme is in use on a server

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

 



Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/libvirt_remote.syms |  1 +
 src/rpc/virnetserver.c  | 17 +++++++++++++++++
 src/rpc/virnetserver.h  |  3 +++
 3 files changed, 21 insertions(+)

diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 99fe3dd07c..17d656fb3f 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -124,6 +124,7 @@ virNetServerGetMaxUnauthClients;
 virNetServerGetName;
 virNetServerGetThreadPoolParameters;
 virNetServerHasClients;
+virNetServerNeedsAuth;
 virNetServerNew;
 virNetServerNewPostExecRestart;
 virNetServerNextClientID;
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 0f3fa63fbb..19f49ba4c3 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -953,6 +953,23 @@ virNetServerGetCurrentUnauthClients(virNetServerPtr srv)
     return ret;
 }
 
+
+bool virNetServerNeedsAuth(virNetServerPtr srv,
+                           int auth)
+{
+    bool ret = false;
+    size_t i;
+
+    virObjectLock(srv);
+    for (i = 0; i < srv->nservices; i++) {
+        if (virNetServerServiceGetAuth(srv->services[i]) == auth)
+            ret = true;
+    }
+    virObjectUnlock(srv);
+
+    return ret;
+}
+
 int
 virNetServerGetClients(virNetServerPtr srv,
                        virNetServerClientPtr **clts)
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 6b2541588c..4d4afd51b4 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -96,6 +96,9 @@ unsigned long long virNetServerNextClientID(virNetServerPtr srv);
 virNetServerClientPtr virNetServerGetClient(virNetServerPtr srv,
                                             unsigned long long id);
 
+bool virNetServerNeedsAuth(virNetServerPtr srv,
+                           int auth);
+
 int virNetServerGetClients(virNetServerPtr srv,
                            virNetServerClientPtr **clients);
 
-- 
2.21.0

--
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