diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-11-15 11:11:52 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-11-15 11:11:52 +0100 |
commit | c59e2ec6961e6ce1acb97bb2cdb7499dc23bc23d (patch) | |
tree | a07981df67c58ab09c25cf5b78f0b50faa99dcb1 /src/shared/spawn-ask-password-agent.c | |
parent | polkit-agent: don't use an inline function (diff) | |
download | systemd-c59e2ec6961e6ce1acb97bb2cdb7499dc23bc23d.tar.xz systemd-c59e2ec6961e6ce1acb97bb2cdb7499dc23bc23d.zip |
ask-password-agent: introduce ask_password_agent_open_if_enabled()
This makes the ask-password agent handling more alike the polkit agent
handling again, and introduces ask_password_agent_open_if_enabled() that
works just like the already existing polkit_agent_open_if_enabled().
Diffstat (limited to 'src/shared/spawn-ask-password-agent.c')
-rw-r--r-- | src/shared/spawn-ask-password-agent.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/spawn-ask-password-agent.c b/src/shared/spawn-ask-password-agent.c index 309071c89d..ddaebf0f61 100644 --- a/src/shared/spawn-ask-password-agent.c +++ b/src/shared/spawn-ask-password-agent.c @@ -46,3 +46,16 @@ void ask_password_agent_close(void) { (void) wait_for_terminate(agent_pid, NULL); agent_pid = 0; } + +int ask_password_agent_open_if_enabled(BusTransport transport, bool ask_password) { + + /* Open the ask password agent as a child process if necessary */ + + if (transport != BUS_TRANSPORT_LOCAL) + return 0; + + if (!ask_password) + return 0; + + return ask_password_agent_open(); +} |