Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
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 892091dd83..f4a62491e5 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -126,6 +126,7 @@ virNetServerGetMaxUnauthClients;
virNetServerGetName;
virNetServerGetThreadPoolParameters;
virNetServerHasClients;
+virNetServerNeedsAuth;
virNetServerNew;
virNetServerNewPostExecRestart;
virNetServerNextClientID;
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 894feae406..e229f57bab 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -1098,6 +1098,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 3205dde78f..5e42c7f23b 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -119,6 +119,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