summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-25 13:43:28 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-25 13:47:58 +0100
commit68dc80f25a0b86074ce40075ab6eccbdc06a46f8 (patch)
treeb2237df639fb82c2154eed31e867fd09795363ac
parent8a641727dafa866e181024bc8b9179f1be14227c (diff)
polkit - fix user id we're authing to and be explicit which one it is
@fix
-rw-r--r--src/bin/e_ckpasswd_main.c4
-rw-r--r--src/modules/polkit/auth_ui.c26
2 files changed, 27 insertions, 3 deletions
diff --git a/src/bin/e_ckpasswd_main.c b/src/bin/e_ckpasswd_main.c
index 08de4bc3d..576af98dc 100644
--- a/src/bin/e_ckpasswd_main.c
+++ b/src/bin/e_ckpasswd_main.c
@@ -214,7 +214,7 @@ polkit_auth(const char *cookie, unsigned int auth_uid)
214 if (!m) BARF("Cannot get method call: AuthenticationAgentResponse2"); 214 if (!m) BARF("Cannot get method call: AuthenticationAgentResponse2");
215 iter = eldbus_message_iter_get(m); 215 iter = eldbus_message_iter_get(m);
216 if (!iter) BARF("Cannot set iter on proxy"); 216 if (!iter) BARF("Cannot set iter on proxy");
217 if (!eldbus_message_iter_arguments_append(iter, "us", uid, cookie)) 217 if (!eldbus_message_iter_arguments_append(iter, "us", auth_uid, cookie))
218 BARF("Cannot append 'us' args"); 218 BARF("Cannot append 'us' args");
219 if (!eldbus_message_iter_arguments_append(iter, "(sa{sv})", &subj)) 219 if (!eldbus_message_iter_arguments_append(iter, "(sa{sv})", &subj))
220 BARF("Cannot append '(sa{sv})' args"); 220 BARF("Cannot append '(sa{sv})' args");
@@ -366,7 +366,7 @@ main(int argc, char **argv)
366 fprintf(stderr, "AUTH: Password OK\n"); 366 fprintf(stderr, "AUTH: Password OK\n");
367 if (polkit_mode == 1) 367 if (polkit_mode == 1)
368 { 368 {
369 if (polkit_auth(polkit_cookie, polkit_uid) == 0) 369 if (polkit_auth(polkit_cookie, uid) == 0)
370 { 370 {
371 fprintf(stderr, "AUTH: Polkit AuthenticationAgentResponse2 success\n"); 371 fprintf(stderr, "AUTH: Polkit AuthenticationAgentResponse2 success\n");
372 return 0; 372 return 0;
diff --git a/src/modules/polkit/auth_ui.c b/src/modules/polkit/auth_ui.c
index fc146c4bc..d8d10aa87 100644
--- a/src/modules/polkit/auth_ui.c
+++ b/src/modules/polkit/auth_ui.c
@@ -42,6 +42,7 @@ _cb_ok(void *data EINA_UNUSED, Evas_Object *obj,
42 if (!ps) return; 42 if (!ps) return;
43 if (ps->exe_exit_handler) return; 43 if (ps->exe_exit_handler) return;
44 elm_object_disabled_set(evas_object_data_get(obj, "label"), EINA_TRUE); 44 elm_object_disabled_set(evas_object_data_get(obj, "label"), EINA_TRUE);
45 elm_object_disabled_set(evas_object_data_get(obj, "label2"), EINA_TRUE);
45 elm_object_disabled_set(evas_object_data_get(obj, "entry"), EINA_TRUE); 46 elm_object_disabled_set(evas_object_data_get(obj, "entry"), EINA_TRUE);
46 e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 0, 1); 47 e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 0, 1);
47 e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 1, 1); 48 e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 1, 1);
@@ -86,7 +87,9 @@ void
86auth_ui(Polkit_Session *ps) 87auth_ui(Polkit_Session *ps)
87{ 88{
88 E_Dialog *dia; 89 E_Dialog *dia;
89 Evas_Object *o, *win, *box, *fr, *lab, *ent; 90 Evas_Object *o, *win, *box, *fr, *lab, *lab2, *ent;
91 char buf[512];
92 struct passwd *pass;
90 93
91 dia = e_dialog_new(NULL, "E", "_polkit_auth"); 94 dia = e_dialog_new(NULL, "E", "_polkit_auth");
92 e_dialog_title_set(dia, _("Please enter password")); 95 e_dialog_title_set(dia, _("Please enter password"));
@@ -136,6 +139,26 @@ auth_ui(Polkit_Session *ps)
136 fr = o = elm_frame_add(win); 139 fr = o = elm_frame_add(win);
137 elm_object_style_set(o, "pad_medium"); 140 elm_object_style_set(o, "pad_medium");
138 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 141 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
142 evas_object_size_hint_align_set(o, 0.0, 0.0);
143 elm_box_pack_end(box, o);
144 evas_object_show(o);
145
146 pass = getpwuid(ps->target_uid);
147 if ((pass) && (pass->pw_name))
148 snprintf(buf, sizeof(buf), _("Enter password for <b>%s</b>"), pass->pw_name);
149 else
150 snprintf(buf, sizeof(buf), _("Enter passowrd for UID %u"), ps->target_uid);
151 lab2 = o = elm_label_add(win);
152 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
153 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
154 elm_object_text_set(o, buf);
155 elm_object_content_set(fr, o);
156 evas_object_show(o);
157 evas_object_data_set(win, "label2", o);
158
159 fr = o = elm_frame_add(win);
160 elm_object_style_set(o, "pad_medium");
161 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
139 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 1.0); 162 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 1.0);
140 elm_box_pack_end(box, o); 163 elm_box_pack_end(box, o);
141 evas_object_show(o); 164 evas_object_show(o);
@@ -149,6 +172,7 @@ auth_ui(Polkit_Session *ps)
149 elm_object_part_text_set(o, "elm.guide", "Enter Password"); 172 elm_object_part_text_set(o, "elm.guide", "Enter Password");
150 evas_object_data_set(o, "session", ps); 173 evas_object_data_set(o, "session", ps);
151 evas_object_data_set(o, "label", lab); 174 evas_object_data_set(o, "label", lab);
175 evas_object_data_set(o, "label2", lab2);
152 evas_object_data_set(o, "entry", ent); 176 evas_object_data_set(o, "entry", ent);
153 evas_object_data_set(o, "dia", dia); 177 evas_object_data_set(o, "dia", dia);
154 evas_object_smart_callback_add(o, "activated", _cb_ok, win); 178 evas_object_smart_callback_add(o, "activated", _cb_ok, win);