summaryrefslogtreecommitdiff
path: root/src/programs/pkexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/programs/pkexec.c')
-rw-r--r--src/programs/pkexec.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c
index 5952c47..9217954 100644
--- a/src/programs/pkexec.c
+++ b/src/programs/pkexec.c
@@ -35,6 +35,8 @@
#include <pwd.h>
#include <errno.h>
+#include <glib/gi18n.h>
+
#ifdef POLKIT_AUTHFW_PAM
#include <security/pam_appl.h>
#endif /* POLKIT_AUTHFW_PAM */
@@ -640,19 +642,41 @@ main (int argc, char *argv[])
goto out;
}
- details = polkit_details_new ();
+ action_id = find_action_for_path (authority, path);
+ g_assert (action_id != NULL);
- polkit_details_insert (details, "command-line", command_line);
- s = g_strdup_printf ("%s (%s)", pw->pw_gecos, pw->pw_name);
+ details = polkit_details_new ();
+ if (pw->pw_gecos != NULL && strlen (pw->pw_gecos) > 0)
+ s = g_strdup_printf ("%s (%s)", pw->pw_gecos, pw->pw_name);
+ else
+ s = g_strdup_printf ("%s", pw->pw_name);
polkit_details_insert (details, "user", s);
g_free (s);
- s = g_strdup_printf ("%d", (gint) pw->pw_uid);
- polkit_details_insert (details, "uid", s);
- g_free (s);
polkit_details_insert (details, "program", path);
-
- action_id = find_action_for_path (authority, path);
- g_assert (action_id != NULL);
+ polkit_details_insert (details, "command_line", command_line);
+ if (g_strcmp0 (action_id, "org.freedesktop.policykit.exec") == 0)
+ {
+ if (pw->pw_uid == 0)
+ {
+ polkit_details_insert (details, "polkit.message",
+ /* Translators: message shown when trying to run a program as root. Do not
+ * translate the $(program) fragment - it will be expanded to the path
+ * of the program e.g. /bin/bash.
+ */
+ N_("Authentication is needed to run `$(program)' as the super user"));
+ }
+ else
+ {
+ polkit_details_insert (details, "polkit.message",
+ /* Translators: message shown when trying to run a program as another user.
+ * Do not translate the $(program) or $(user) fragments - the former will
+ * be expanded to the path of the program e.g. "/bin/bash" and the latter
+ * to the user e.g. "John Doe (johndoe)" or "johndoe".
+ */
+ N_("Authentication is needed to run `$(program)' as user $(user)"));
+ }
+ }
+ polkit_details_insert (details, "polkit.gettext_domain", GETTEXT_PACKAGE);
try_again:
error = NULL;