]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Log when we exceed max_names_per_connection (aka max_services_per_connection)
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 18 Nov 2014 19:19:37 +0000 (19:19 +0000)
committerSimon McVittie <smcv@debian.org>
Tue, 16 Aug 2016 16:44:30 +0000 (17:44 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442

bus/services.c

index 6a4c8848d9d3722e3c7c0e0f102cbc8654581330..127edda0ecd9c30002a0049eb39318540970521c 100644 (file)
@@ -392,7 +392,8 @@ bus_registry_acquire_service (BusRegistry      *registry,
   BusActivation  *activation;
   BusSELinuxID *sid;
   BusOwner *primary_owner;
+  int limit;
+
   retval = FALSE;
 
   if (!_dbus_validate_bus_name (service_name, 0,
@@ -478,15 +479,24 @@ bus_registry_acquire_service (BusRegistry      *registry,
       goto out;
     }
 
-  if (bus_connection_get_n_services_owned (connection) >=
-      bus_context_get_max_services_per_connection (registry->context))
+  limit = bus_context_get_max_services_per_connection (registry->context);
+
+  if (bus_connection_get_n_services_owned (connection) >= limit)
     {
-      dbus_set_error (error, DBUS_ERROR_LIMITS_EXCEEDED,
+      DBusError tmp_error;
+
+      dbus_error_init (&tmp_error);
+      dbus_set_error (&tmp_error, DBUS_ERROR_LIMITS_EXCEEDED,
                       "Connection \"%s\" is not allowed to own more services "
-                      "(increase limits in configuration file if required)",
+                      "(increase limits in configuration file if required; "
+                      "max_names_per_connection=%d)",
                       bus_connection_is_active (connection) ?
                       bus_connection_get_name (connection) :
-                      "(inactive)");
+                      "(inactive)",
+                      limit);
+      bus_context_log (registry->context, DBUS_SYSTEM_LOG_WARNING,
+          "%s", tmp_error.message);
+      dbus_move_error (&tmp_error, error);
       goto out;
     }