| 1 |
/* |
| 2 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 3 |
*/ |
| 4 |
|
| 5 |
#include "config.h" |
| 6 |
|
| 7 |
#include "gsm_pkexec.h" |
| 8 |
|
| 9 |
|
| 10 |
gboolean |
| 11 |
gsm_pkexec_create_root_password_dialog (const char *command) |
| 12 |
{ |
| 13 |
g_autoptr (GError) error = NULL; |
| 14 |
g_autofree char *command_line = NULL; |
| 15 |
gboolean ret = FALSE; |
| 16 |
int *exit_status = NULL; |
| 17 |
|
| 18 |
command_line = g_strdup_printf ("pkexec --disable-internal-agent %s/gsm-%s", |
| 19 |
GSM_LIBEXEC_DIR, |
| 20 |
command); |
| 21 |
|
| 22 |
if (!g_spawn_command_line_sync (command_line, NULL, NULL, exit_status, &error)) { |
| 23 |
g_critical ("Could not run pkexec(\"%s\") : %s\n", |
| 24 |
command, |
| 25 |
error->message); |
| 26 |
} else { |
| 27 |
g_debug ("pkexec did fine\n"); |
| 28 |
ret = TRUE; |
| 29 |
} |
| 30 |
|
| 31 |
return ret; |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
gboolean |
| 36 |
procman_has_pkexec (void) |
| 37 |
{ |
| 38 |
return g_file_test ("/usr/bin/pkexec", G_FILE_TEST_EXISTS); |
| 39 |
} |