summaryrefslogtreecommitdiff
path: root/src
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:45:44 +0100
commitd2c0c1bf1937efbff6f5b2532a5ebb1b927b0956 (patch)
treeb2d013ce330282223a9d85846c05069c570acbac /src
parentb16b2fac743e51871cff18bc45154271660ac2e2 (diff)
polkit - fix user id we're authing to and be explicit which one it is
@fix
Diffstat (limited to 'src')
-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 bc70f2997..63514049a 100644
--- a/src/bin/e_ckpasswd_main.c
+++ b/src/bin/e_ckpasswd_main.c
@@ -213,7 +213,7 @@ polkit_auth(const char *cookie, unsigned int auth_uid)
213 if (!m) BARF("Cannot get method call: AuthenticationAgentResponse2"); 213 if (!m) BARF("Cannot get method call: AuthenticationAgentResponse2");
214 iter = eldbus_message_iter_get(m); 214 iter = eldbus_message_iter_get(m);
215 if (!iter) BARF("Cannot set iter on proxy"); 215 if (!iter) BARF("Cannot set iter on proxy");
216 if (!eldbus_message_iter_arguments_append(iter, "us", uid, cookie)) 216 if (!eldbus_message_iter_arguments_append(iter, "us", auth_uid, cookie))
217 BARF("Cannot append 'us' args"); 217 BARF("Cannot append 'us' args");
218 if (!eldbus_message_iter_arguments_append(iter, "(sa{sv})", &subj)) 218 if (!eldbus_message_iter_arguments_append(iter, "(sa{sv})", &subj))
219 BARF("Cannot append '(sa{sv})' args"); 219 BARF("Cannot append '(sa{sv})' args");
@@ -365,7 +365,7 @@ main(int argc, char **argv)
365 fprintf(stderr, "AUTH: Password OK\n"); 365 fprintf(stderr, "AUTH: Password OK\n");
366 if (polkit_mode == 1) 366 if (polkit_mode == 1)
367 { 367 {
368 if (polkit_auth(polkit_cookie, polkit_uid) == 0) 368 if (polkit_auth(polkit_cookie, uid) == 0)
369 { 369 {
370 fprintf(stderr, "AUTH: Polkit AuthenticationAgentResponse2 success\n"); 370 fprintf(stderr, "AUTH: Polkit AuthenticationAgentResponse2 success\n");
371 return 0; 371 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);