forked from enlightenment/enlightenment
polkit - fix user id we're authing to and be explicit which one it is
@fix
This commit is contained in:
parent
b16b2fac74
commit
d2c0c1bf19
|
@ -213,7 +213,7 @@ polkit_auth(const char *cookie, unsigned int auth_uid)
|
||||||
if (!m) BARF("Cannot get method call: AuthenticationAgentResponse2");
|
if (!m) BARF("Cannot get method call: AuthenticationAgentResponse2");
|
||||||
iter = eldbus_message_iter_get(m);
|
iter = eldbus_message_iter_get(m);
|
||||||
if (!iter) BARF("Cannot set iter on proxy");
|
if (!iter) BARF("Cannot set iter on proxy");
|
||||||
if (!eldbus_message_iter_arguments_append(iter, "us", uid, cookie))
|
if (!eldbus_message_iter_arguments_append(iter, "us", auth_uid, cookie))
|
||||||
BARF("Cannot append 'us' args");
|
BARF("Cannot append 'us' args");
|
||||||
if (!eldbus_message_iter_arguments_append(iter, "(sa{sv})", &subj))
|
if (!eldbus_message_iter_arguments_append(iter, "(sa{sv})", &subj))
|
||||||
BARF("Cannot append '(sa{sv})' args");
|
BARF("Cannot append '(sa{sv})' args");
|
||||||
|
@ -365,7 +365,7 @@ main(int argc, char **argv)
|
||||||
fprintf(stderr, "AUTH: Password OK\n");
|
fprintf(stderr, "AUTH: Password OK\n");
|
||||||
if (polkit_mode == 1)
|
if (polkit_mode == 1)
|
||||||
{
|
{
|
||||||
if (polkit_auth(polkit_cookie, polkit_uid) == 0)
|
if (polkit_auth(polkit_cookie, uid) == 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "AUTH: Polkit AuthenticationAgentResponse2 success\n");
|
fprintf(stderr, "AUTH: Polkit AuthenticationAgentResponse2 success\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -42,6 +42,7 @@ _cb_ok(void *data EINA_UNUSED, Evas_Object *obj,
|
||||||
if (!ps) return;
|
if (!ps) return;
|
||||||
if (ps->exe_exit_handler) return;
|
if (ps->exe_exit_handler) return;
|
||||||
elm_object_disabled_set(evas_object_data_get(obj, "label"), EINA_TRUE);
|
elm_object_disabled_set(evas_object_data_get(obj, "label"), EINA_TRUE);
|
||||||
|
elm_object_disabled_set(evas_object_data_get(obj, "label2"), EINA_TRUE);
|
||||||
elm_object_disabled_set(evas_object_data_get(obj, "entry"), EINA_TRUE);
|
elm_object_disabled_set(evas_object_data_get(obj, "entry"), EINA_TRUE);
|
||||||
e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 0, 1);
|
e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 0, 1);
|
||||||
e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 1, 1);
|
e_dialog_button_disable_num_set(evas_object_data_get(obj, "dia"), 1, 1);
|
||||||
|
@ -86,7 +87,9 @@ void
|
||||||
auth_ui(Polkit_Session *ps)
|
auth_ui(Polkit_Session *ps)
|
||||||
{
|
{
|
||||||
E_Dialog *dia;
|
E_Dialog *dia;
|
||||||
Evas_Object *o, *win, *box, *fr, *lab, *ent;
|
Evas_Object *o, *win, *box, *fr, *lab, *lab2, *ent;
|
||||||
|
char buf[512];
|
||||||
|
struct passwd *pass;
|
||||||
|
|
||||||
dia = e_dialog_new(NULL, "E", "_polkit_auth");
|
dia = e_dialog_new(NULL, "E", "_polkit_auth");
|
||||||
e_dialog_title_set(dia, _("Please enter password"));
|
e_dialog_title_set(dia, _("Please enter password"));
|
||||||
|
@ -133,6 +136,26 @@ auth_ui(Polkit_Session *ps)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_data_set(win, "label", o);
|
evas_object_data_set(win, "label", o);
|
||||||
|
|
||||||
|
fr = o = elm_frame_add(win);
|
||||||
|
elm_object_style_set(o, "pad_medium");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, 0.0, 0.0);
|
||||||
|
elm_box_pack_end(box, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
pass = getpwuid(ps->target_uid);
|
||||||
|
if ((pass) && (pass->pw_name))
|
||||||
|
snprintf(buf, sizeof(buf), _("Enter password for <b>%s</b>"), pass->pw_name);
|
||||||
|
else
|
||||||
|
snprintf(buf, sizeof(buf), _("Enter passowrd for UID %u"), ps->target_uid);
|
||||||
|
lab2 = o = elm_label_add(win);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
|
||||||
|
elm_object_text_set(o, buf);
|
||||||
|
elm_object_content_set(fr, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_data_set(win, "label2", o);
|
||||||
|
|
||||||
fr = o = elm_frame_add(win);
|
fr = o = elm_frame_add(win);
|
||||||
elm_object_style_set(o, "pad_medium");
|
elm_object_style_set(o, "pad_medium");
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
@ -149,6 +172,7 @@ auth_ui(Polkit_Session *ps)
|
||||||
elm_object_part_text_set(o, "elm.guide", "Enter Password");
|
elm_object_part_text_set(o, "elm.guide", "Enter Password");
|
||||||
evas_object_data_set(o, "session", ps);
|
evas_object_data_set(o, "session", ps);
|
||||||
evas_object_data_set(o, "label", lab);
|
evas_object_data_set(o, "label", lab);
|
||||||
|
evas_object_data_set(o, "label2", lab2);
|
||||||
evas_object_data_set(o, "entry", ent);
|
evas_object_data_set(o, "entry", ent);
|
||||||
evas_object_data_set(o, "dia", dia);
|
evas_object_data_set(o, "dia", dia);
|
||||||
evas_object_smart_callback_add(o, "activated", _cb_ok, win);
|
evas_object_smart_callback_add(o, "activated", _cb_ok, win);
|
||||||
|
|
Loading…
Reference in New Issue