summaryrefslogtreecommitdiff
path: root/src/procman_pkexec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/procman_pkexec.cpp')
-rw-r--r--src/procman_pkexec.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/procman_pkexec.cpp b/src/procman_pkexec.cpp
new file mode 100644
index 0000000..f67be6a
--- /dev/null
+++ b/src/procman_pkexec.cpp
@@ -0,0 +1,33 @@
+#include <config.h>
+
+#include "procman_pkexec.h"
+
+gboolean
+procman_pkexec_create_root_password_dialog (const char *command)
+{
+ gchar *command_line;
+ gboolean success;
+ GError *error = NULL;
+
+ command_line = g_strdup_printf ("pkexec --disable-internal-agent %s/msm-%s",
+ LIBEXEC_DIR, command);
+ success = g_spawn_command_line_sync (command_line, NULL, NULL, NULL, &error);
+ g_free (command_line);
+
+ if (!success) {
+ g_critical ("Could not run pkexec (\"%s\") : %s\n",
+ command, error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+
+ g_debug ("pkexec did fine\n");
+ return TRUE;
+}
+
+gboolean
+procman_has_pkexec (void)
+{
+ return g_file_test("/usr/bin/pkexec", G_FILE_TEST_EXISTS);
+}
+