summaryrefslogtreecommitdiff
path: root/src/shared/spawn-ask-password-agent.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-11-15 11:11:52 +0100
committerLennart Poettering <lennart@poettering.net>2019-11-15 11:11:52 +0100
commitc59e2ec6961e6ce1acb97bb2cdb7499dc23bc23d (patch)
treea07981df67c58ab09c25cf5b78f0b50faa99dcb1 /src/shared/spawn-ask-password-agent.c
parent385d581b7429f9d1d6d2826eac82e581468656f9 (diff)
downloadsystemd-c59e2ec6961e6ce1acb97bb2cdb7499dc23bc23d.tar.gz
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.c13
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();
+}