From: Erik Skultety Date: Fri, 22 Apr 2016 10:54:26 +0000 (+0200) Subject: virneserverclient: Introduce virNetServerClientHasSASLSession X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bde2cb613632c396f0d14f6e9ea18b8319ed4f93;p=libvirt.git virneserverclient: Introduce virNetServerClientHasSASLSession 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 --- diff --git a/src/libvirt_sasl.syms b/src/libvirt_sasl.syms index 1241884b77..723c59787b 100644 --- a/src/libvirt_sasl.syms +++ b/src/libvirt_sasl.syms @@ -27,6 +27,7 @@ virNetSASLSessionServerStep; # rpc/virnetserverclient.h virNetServerClientGetSASLSession; +virNetServerClientHasSASLSession; virNetServerClientSetSASLSession; diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index a7b3b15622..396b0cc274 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 f44b7caba0..22daf50249 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);