Replace virNetServerClientNeedAuth with
virNetServerClientIsAuthenticated because it makes it clearer what it
means.
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi(a)linux.vnet.ibm.com>
---
src/libvirt_remote.syms | 2 +-
src/rpc/virnetserverclient.c | 8 ++++----
src/rpc/virnetserverclient.h | 2 +-
src/rpc/virnetserverprogram.c | 7 +++----
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 10583dc241ad..3ba1e3f33243 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -138,12 +138,12 @@ virNetServerClientGetUNIXIdentity;
virNetServerClientImmediateClose;
virNetServerClientInit;
virNetServerClientInitKeepAlive;
+virNetServerClientIsAuthenticated;
virNetServerClientIsAuthPendingLocked;
virNetServerClientIsClosedLocked;
virNetServerClientIsLocal;
virNetServerClientIsSecure;
virNetServerClientLocalAddrStringSASL;
-virNetServerClientNeedAuth;
virNetServerClientNew;
virNetServerClientNewPostExecRestart;
virNetServerClientPreExecRestart;
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 81dfc41a5967..24994bc471b8 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1551,13 +1551,13 @@ int virNetServerClientSendMessage(virNetServerClientPtr client,
bool
-virNetServerClientNeedAuth(virNetServerClientPtr client)
+virNetServerClientIsAuthenticated(virNetServerClientPtr client)
{
- bool need;
+ bool authenticated;
virObjectLock(client);
- need = !virNetServerClientAuthMethodImpliesAuthenticated(client->auth);
+ authenticated = virNetServerClientAuthMethodImpliesAuthenticated(client->auth);
virObjectUnlock(client);
- return need;
+ return authenticated;
}
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
index 6f20ab4c06a0..66ef5cd68235 100644
--- a/src/rpc/virnetserverclient.h
+++ b/src/rpc/virnetserverclient.h
@@ -146,7 +146,7 @@ const char
*virNetServerClientRemoteAddrStringURI(virNetServerClientPtr client);
int virNetServerClientSendMessage(virNetServerClientPtr client,
virNetMessagePtr msg);
-bool virNetServerClientNeedAuth(virNetServerClientPtr client);
+bool virNetServerClientIsAuthenticated(virNetServerClientPtr client);
bool virNetServerClientIsAuthPendingLocked(virNetServerClientPtr client);
void virNetServerClientSetAuthPendingLocked(virNetServerClientPtr client, bool
auth_pending);
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index 1e8dfc2f1128..557651ffbd91 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -397,11 +397,10 @@ virNetServerProgramDispatchCall(virNetServerProgramPtr prog,
goto error;
}
- /* If client is marked as needing auth, don't allow any RPC ops
- * which are except for authentication ones
- */
+ /* If the client is not authenticated, don't allow any RPC ops
+ * which are except for authentication ones */
if (dispatcher->needAuth &&
- virNetServerClientNeedAuth(client)) {
+ !virNetServerClientIsAuthenticated(client)) {
/* Explicitly *NOT* calling remoteDispatchAuthError() because
we want back-compatibility with libvirt clients which don't
support the VIR_ERR_AUTH_FAILED error code */
--
2.13.4