rpc: Check client limits in more places

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2033879
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Martin Kletzander 2023-01-02 16:23:08 +01:00
parent f007940cb2
commit 35afa1d2d6

View File

@ -370,6 +370,13 @@ virNetServerNew(const char *name,
g_autoptr(virNetServer) srv = NULL;
g_autofree char *jobName = g_strdup_printf("rpc-%s", name);
if (max_clients < max_anonymous_clients) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("The overall maximum number of clients must not be less "
"than the number of clients waiting for authentication"));
return NULL;
}
if (virNetServerInitialize() < 0)
return NULL;
@ -449,6 +456,12 @@ virNetServerNewPostExecRestart(virJSONValue *object,
_("Malformed max_anonymous_clients data in JSON document"));
return NULL;
}
if (max_clients < max_anonymous_clients) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("The overall maximum number of clients must not be less "
"than the number of clients waiting for authentication"));
return NULL;
}
} else {
max_anonymous_clients = max_clients;
}