2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2013-11-18 16:58:43 +01:00
|
|
|
#pragma once
|
2011-07-25 04:58:02 +02:00
|
|
|
|
2017-10-30 09:57:53 +01:00
|
|
|
#include "bus-util.h"
|
|
|
|
|
2012-04-11 18:50:16 +02:00
|
|
|
int polkit_agent_open(void);
|
|
|
|
void polkit_agent_close(void);
|
2017-10-30 09:57:53 +01:00
|
|
|
|
2018-04-16 21:37:12 +02:00
|
|
|
static inline int polkit_agent_open_if_enabled(
|
2017-10-30 09:57:53 +01:00
|
|
|
BusTransport transport,
|
|
|
|
bool ask_password) {
|
|
|
|
|
|
|
|
/* Open the polkit agent as a child process if necessary */
|
|
|
|
|
|
|
|
if (transport != BUS_TRANSPORT_LOCAL)
|
2018-04-16 21:37:12 +02:00
|
|
|
return 0;
|
2017-10-30 09:57:53 +01:00
|
|
|
|
|
|
|
if (!ask_password)
|
2018-04-16 21:37:12 +02:00
|
|
|
return 0;
|
2017-10-30 09:57:53 +01:00
|
|
|
|
2018-04-16 21:37:12 +02:00
|
|
|
return polkit_agent_open();
|
2017-10-30 09:57:53 +01:00
|
|
|
}
|