summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Zeuthen <zeuthen@gmail.com>2012-07-11 12:58:06 -0400
committerDavid Zeuthen <zeuthen@gmail.com>2012-07-11 13:09:50 -0400
commit963692acad3cd4e6e431162d203c61f369b14620 (patch)
tree097a3a07af460fa28e304c3331c67267bf9bc7c5 /src
parent50dcb370edc365114fa6640770ebc253d39570ab (diff)
downloadpolkit-963692acad3cd4e6e431162d203c61f369b14620.tar.gz
pkexec: add support for argv1 annotation and mention shebang-wrappers
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/programs/pkexec.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c
index d87825c..840eb3c 100644
--- a/src/programs/pkexec.c
+++ b/src/programs/pkexec.c
@@ -230,6 +230,7 @@ fdwalk (FdCallback callback,
static gchar *
find_action_for_path (PolkitAuthority *authority,
const gchar *path,
+ const gchar *argv1,
gboolean *allow_gui)
{
GList *l;
@@ -255,6 +256,7 @@ find_action_for_path (PolkitAuthority *authority,
for (l = actions; l != NULL; l = l->next)
{
PolkitActionDescription *action_desc = POLKIT_ACTION_DESCRIPTION (l->data);
+ const gchar *argv1_for_action;
const gchar *path_for_action;
const gchar *allow_gui_annotation;
@@ -262,8 +264,17 @@ find_action_for_path (PolkitAuthority *authority,
if (path_for_action == NULL)
continue;
+ argv1_for_action = polkit_action_description_get_annotation (action_desc, "org.freedesktop.policykit.exec.argv1");
+
if (g_strcmp0 (path_for_action, path) == 0)
{
+ /* check against org.freedesktop.policykit.exec.argv1 but only if set */
+ if (argv1_for_action != NULL)
+ {
+ if (g_strcmp0 (argv1, argv1_for_action) != 0)
+ continue;
+ }
+
action_id = g_strdup (polkit_action_description_get_action_id (action_desc));
allow_gui_annotation = polkit_action_description_get_annotation (action_desc, "org.freedesktop.policykit.exec.allow_gui");
@@ -664,7 +675,10 @@ main (int argc, char *argv[])
goto out;
}
- action_id = find_action_for_path (authority, path, &allow_gui);
+ action_id = find_action_for_path (authority,
+ path,
+ exec_argv[1],
+ &allow_gui);
g_assert (action_id != NULL);
details = polkit_details_new ();