chiark / gitweb /
Prep v239: Fix and add debug messages to method_can_shutdown_or_sleep()
authorSven Eden <yamakuzure@gmx.net>
Fri, 31 Aug 2018 06:07:35 +0000 (08:07 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 31 Aug 2018 06:37:46 +0000 (08:37 +0200)
src/libelogind/sd-bus/bus-convenience.c
src/login/logind-dbus.c

index 41910515dbbbf190fb7ae1a0ee17d6ac8455262a..68a419c6d27593b68476692a170caccae6927e59 100644 (file)
@@ -529,6 +529,11 @@ _public_ int sd_bus_query_sender_creds(sd_bus_message *call, uint64_t mask, sd_b
                         return sd_bus_get_owner_creds(call->bus, mask, creds);
         }
 
+        log_debug_elogind("Called by UID %u ; %s [%s] (%s)", c->uid,
+                          c->unique_name ? c->unique_name : "no name",
+                          c->label       ? c->label       : "no label",
+                          c->description ? c->description : "no desc");
+
         return bus_creds_extend_by_pid(c, mask, creds);
 }
 
index e75fb023b2de7fb456d14a4cb07e3e75185c2eb9..9d70928691eda62c0c8f8772964c8c08a59799d4 100644 (file)
@@ -2367,8 +2367,9 @@ static int method_can_shutdown_or_sleep(
         blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL);
 
         handle = handle_action_from_string(sleep_verb);
-#if 0 /// elogind uses its own variant, which can use the handle directly.
+
         if (handle >= 0) {
+#if 0 /// elogind uses its own variant, which can use the handle directly.
                 const char *target;
 
                 target = manager_target_for_action(handle);
@@ -2384,12 +2385,12 @@ static int method_can_shutdown_or_sleep(
                                 goto finish;
                         }
                 }
-#else
-                if ( _HANDLE_ACTION_INVALID == handle ) {
-                        result = "no";
-                        goto finish;
         }
+#else
+                log_debug_elogind("CanShutDownOrSleep: %s [%d] %s blocked",
+                                  sleep_verb, handle, blocked ? "is" : "not");
 #endif // 0
+        }
 
         if (multiple_sessions) {
                 r = bus_test_polkit(message, CAP_SYS_BOOT, action_multiple_sessions, NULL, UID_INVALID, &challenge, error);
@@ -2402,6 +2403,8 @@ static int method_can_shutdown_or_sleep(
                         result = "challenge";
                 else
                         result = "no";
+                log_debug_elogind("CanShutDownOrSleep: multiple_sessions: %s = %s",
+                                  action_multiple_sessions, result);
         }
 
         if (blocked) {
@@ -2415,6 +2418,8 @@ static int method_can_shutdown_or_sleep(
                         result = "challenge";
                 else
                         result = "no";
+                log_debug_elogind("CanShutDownOrSleep: blocked          : %s = %s",
+                                  action_ignore_inhibit, result);
         }
 
         if (!multiple_sessions && !blocked) {
@@ -2431,6 +2436,8 @@ static int method_can_shutdown_or_sleep(
                         result = "challenge";
                 else
                         result = "no";
+                log_debug_elogind("CanShutDownOrSleep: regular          : %s = %s",
+                                  action, result);
         }
 
  finish: