We do have a similar method, serving the same purpose, for TLS, but we lack
one for SASL. So introduce one, in order for other modules to be able to find
out, if a SASL session is active, or better said, that a SASL session exists
at all.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/rpc/virnetserverclient.c | 9 +++++++++
src/rpc/virnetserverclient.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index a7b3b15..396b0cc 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -863,6 +863,15 @@ virNetSASLSessionPtr
virNetServerClientGetSASLSession(virNetServerClientPtr clie
virObjectUnlock(client);
return sasl;
}
+
+bool virNetServerClientHasSASLSession(virNetServerClientPtr client)
+{
+ bool has = false;
+ virObjectLock(client);
+ has = !!client->sasl;
+ virObjectUnlock(client);
+ return has;
+}
#endif
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
index 267e4ec..b576fde 100644
--- a/src/rpc/virnetserverclient.h
+++ b/src/rpc/virnetserverclient.h
@@ -91,6 +91,7 @@ int virNetServerClientGetTLSKeySize(virNetServerClientPtr client);
# endif
# ifdef WITH_SASL
+bool virNetServerClientHasSASLSession(virNetServerClientPtr client);
void virNetServerClientSetSASLSession(virNetServerClientPtr client,
virNetSASLSessionPtr sasl);
virNetSASLSessionPtr virNetServerClientGetSASLSession(virNetServerClientPtr client);
--
2.4.11