diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-04-16 13:46:37 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-04-17 14:36:39 +0200 |
commit | 7a2b5237d11116ff481877706f75fcc756730071 (patch) | |
tree | 81e0366f70877416908dc29bdc529fd200dc8a21 | |
parent | e7ee9063719457dfd9af2c762266a542b5528827 (diff) | |
download | systemd-7a2b5237d11116ff481877706f75fcc756730071.tar.gz |
logind: skip polkit query with --no-wall
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1800875.
(cherry picked from commit 5644d47b7c288c4126aab60d2d6a65923f7df4cc)
-rw-r--r-- | src/login/logind-dbus.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 15201f900f..047f835327 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -3170,6 +3170,12 @@ static int method_set_wall_message( if (r < 0) return r; + /* Short-circuit the operation if the desired state is already in place, to + * avoid an unnecessary polkit permission check. */ + if (streq_ptr(m->wall_message, empty_to_null(wall_message)) && + m->enable_wall_messages == enable_wall_messages) + goto done; + r = bus_verify_polkit_async(message, CAP_SYS_ADMIN, "org.freedesktop.login1.set-wall-message", @@ -3189,6 +3195,7 @@ static int method_set_wall_message( m->enable_wall_messages = enable_wall_messages; + done: return sd_bus_reply_method_return(message, NULL); } |