summaryrefslogtreecommitdiffstats
path: root/src/gsm_pkexec.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:59:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:59:44 +0000
commitfb31765cbe33890f325a87015507364156741321 (patch)
tree0c5cd12aee0a0a6a6e2d542520df5846859bd40d /src/gsm_pkexec.cpp
parentInitial commit. (diff)
downloadgnome-system-monitor-upstream.tar.xz
gnome-system-monitor-upstream.zip
Adding upstream version 42.0.upstream/42.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/gsm_pkexec.cpp')
-rw-r--r--src/gsm_pkexec.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gsm_pkexec.cpp b/src/gsm_pkexec.cpp
new file mode 100644
index 0000000..868969b
--- /dev/null
+++ b/src/gsm_pkexec.cpp
@@ -0,0 +1,38 @@
+/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#include <config.h>
+
+#include "application.h"
+#include "gsm_pkexec.h"
+#include "util.h"
+
+gboolean gsm_pkexec_create_root_password_dialog(const char *command)
+{
+ gboolean ret = FALSE;
+ gint *exit_status = NULL;
+ GError *error = NULL;
+ gchar *command_line = g_strdup_printf("pkexec --disable-internal-agent %s/gsm-%s",
+ GSM_LIBEXEC_DIR, command);
+ if (!g_spawn_command_line_sync(command_line, NULL, NULL, exit_status, &error)) {
+ g_critical("Could not run pkexec(\"%s\") : %s\n",
+ command, error->message);
+ g_error_free(error);
+ }
+ else
+ {
+ g_debug("pkexec did fine\n");
+ ret = TRUE;
+ }
+
+ g_free (command_line);
+
+ return ret;
+}
+
+
+
+gboolean
+procman_has_pkexec(void)
+{
+ return g_file_test("/usr/bin/pkexec", G_FILE_TEST_EXISTS);
+}
+