diff options
author | Luca Boccassi <bluca@debian.org> | 2022-12-15 12:20:28 +0000 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-12-15 23:27:06 +0900 |
commit | 4895bacccb1bf607ecfd341027399c6f924bdf07 (patch) | |
tree | 64ef83f56d24e6779b5e5820552f4defa04961db /src/core/dbus-manager.c | |
parent | b3f1afc08910044f2f55188c266264738a538d10 (diff) | |
download | systemd-4895bacccb1bf607ecfd341027399c6f924bdf07.tar.gz |
Manager: also log caller of daemon-reexec
Diffstat (limited to 'src/core/dbus-manager.c')
-rw-r--r-- | src/core/dbus-manager.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 79e96f948c..f01c67ecf1 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1451,7 +1451,7 @@ int verify_run_space_and_log(const char *message) { return 0; } -static void log_reload_caller(sd_bus_message *message, Manager *manager) { +static void log_caller(sd_bus_message *message, Manager *manager, const char *method) { _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL; const char *comm = NULL; Unit *caller; @@ -1459,6 +1459,7 @@ static void log_reload_caller(sd_bus_message *message, Manager *manager) { assert(message); assert(manager); + assert(method); if (sd_bus_query_sender_creds(message, SD_BUS_CREDS_PID|SD_BUS_CREDS_AUGMENT|SD_BUS_CREDS_COMM, &creds) < 0) return; @@ -1470,8 +1471,8 @@ static void log_reload_caller(sd_bus_message *message, Manager *manager) { (void) sd_bus_creds_get_comm(creds, &comm); caller = manager_get_unit_by_pid(manager, pid); - log_info("Reloading requested from client PID " PID_FMT " ('%s') (from unit '%s')...", - pid, strna(comm), strna(caller ? caller->id : NULL)); + log_info("%s requested from client PID " PID_FMT " ('%s') (from unit '%s')...", + method, pid, strna(comm), strna(caller ? caller->id : NULL)); } static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *error) { @@ -1495,7 +1496,7 @@ static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error * return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ /* Write a log message noting the unit or process who requested the Reload() */ - log_reload_caller(message, m); + log_caller(message, m, "Reloading"); /* Check the rate limit after the authorization succeeds, to avoid denial-of-service issues. */ if (!ratelimit_below(&m->reload_ratelimit)) { @@ -1540,6 +1541,9 @@ static int method_reexecute(sd_bus_message *message, void *userdata, sd_bus_erro if (r == 0) return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + /* Write a log message noting the unit or process who requested the Reexecute() */ + log_caller(message, m, "Reexecuting"); + /* We don't send a reply back here, the client should * just wait for us disconnecting. */ |