[PATCH 4/4] rpc: Check client limits in more places

Martin Kletzander mkletzan at redhat.com
Mon Jan 2 15:59:24 UTC 2023


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2033879
Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/rpc/virnetserver.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 2ec4b9a6c947..bf0fda04ee89 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -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;
     }
-- 
2.39.0



More information about the libvir-list mailing list