Skip to content

systemctl: fix various aspects of polkit authorization in legacy tools.#1227

Merged
poettering merged 5 commits intosystemd:masterfrom
intelfx:systemctl-legacy-tools-polkit
Sep 10, 2015
Merged

systemctl: fix various aspects of polkit authorization in legacy tools.#1227
poettering merged 5 commits intosystemd:masterfrom
intelfx:systemctl-legacy-tools-polkit

Conversation

@intelfx
Copy link
Copy Markdown
Contributor

@intelfx intelfx commented Sep 9, 2015

This deals with multiple concerns raised in the issue #213.

First, disallow interactive polkit auth(orization|entication) if we're being called not as systemctl but as one of the legacy tools (halt, poweroff, reboot, shutdown, telinit).

Then, relax preliminary root permission check in halt_main() to allow (non-interactive) polkit auth to kick in the "activate special target" code path (i. e. non-root non-logind non-delayed non-forced mode).

Finally, there are three ad-hoc fixes:

  • fix logind bus call error handling in halt_main() to make it look similar to the call in start_special(),
  • improve error messages in the logind call code path (reboot_with_logind()) to make it clear for the user which exact operation had failed,
  • and (while at it) refactor repeated comparisons into applications of IN_SET().

(Maybe I'm overzealous with the last one.)

Fixes (the main concern of) issue #213.
intelfx referenced this pull request Sep 9, 2015
Prefix the action parameter with "dry-" in case the --dry-run command
line switch was passed.
@poettering
Copy link
Copy Markdown
Member

Looks good to me otherwise.

@zonque can you comment on the arg_dry issue @intelfx was wondering about, please?

@poettering poettering added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks systemctl labels Sep 10, 2015
Handle -EOPNOTSUPP and -EINPROGRESS like in start_special().
Thus we allow (non-interactive) polkit auth to kick in for legacy commands
(halt, poweroff, reboot, telinit) as well.

Fixes (another aspect of) issue #213.
@poettering
Copy link
Copy Markdown
Member

@zonque suggested that @intelfx is right regarding the arg_dry thing. Hence merging.

poettering added a commit that referenced this pull request Sep 10, 2015
systemctl: fix various aspects of polkit authorization in legacy tools.
@poettering poettering merged commit 3227b2b into systemd:master Sep 10, 2015
@intelfx intelfx deleted the systemctl-legacy-tools-polkit branch October 13, 2015 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks systemctl

Development

Successfully merging this pull request may close these issues.

2 participants