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().
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "bus-util.h"
|
||||
|
||||
int ask_password_agent_open(void);
|
||||
void ask_password_agent_close(void);
|
||||
|
||||
int ask_password_agent_open_if_enabled(BusTransport transport, bool ask_password);
|
||||
|
||||
Reference in New Issue
Block a user