diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index 748132ae6127f8f99a7de180650ce4caa701a2c3..afe4fb47a256807da2e5e7de1df37c66e934c17a 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -354,6 +354,23 @@ static void virNetServerClientSockTimerFunc(int timer, } +/** + * virNetServerClientAuthMethodImpliesAuthenticated: + * @auth: authentication method to check + * + * Check if the passed authentication method implies that a client is + * automatically authenticated. + * + * Returns true if @auth implies that a client is automatically + * authenticated, otherwise false. + */ +static bool +virNetServerClientAuthMethodImpliesAuthenticated(int auth) +{ + return auth == VIR_NET_SERVER_SERVICE_AUTH_NONE; +} + + static virNetServerClientPtr virNetServerClientNewInternal(unsigned long long id, virNetSocketPtr sock, @@ -1521,7 +1538,7 @@ int virNetServerClientSendMessage(virNetServerClientPtr client, bool virNetServerClientNeedAuthLocked(virNetServerClientPtr client) { - return !(client->auth == VIR_NET_SERVER_SERVICE_AUTH_NONE); + return !virNetServerClientAuthMethodImpliesAuthenticated(client->auth); }