diff options
9 files changed, 695 insertions, 0 deletions
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0001-greeter-set-visible-when-switch-to-input-user.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0001-greeter-set-visible-when-switch-to-input-user.patch new file mode 100644 index 0000000000..e01dc7fa7c --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0001-greeter-set-visible-when-switch-to-input-user.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From f6b8e141e00c4837239f5b69af4e7bee1204abba Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Thu, 17 Dec 2020 10:18:58 +0800 | ||
| 4 | Subject: [PATCH 1/8] greeter: set visible when switch to input user | ||
| 5 | |||
| 6 | It switches back to input user entry if press Esc key when input the | ||
| 7 | password. At this time, the user name input is shown as '*' rather than | ||
| 8 | plain text. Set the visibility to fix this issue. And clean the text as | ||
| 9 | well. | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 12 | |||
| 13 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 14 | --- | ||
| 15 | src/greeter.c | 2 ++ | ||
| 16 | 1 file changed, 2 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/src/greeter.c b/src/greeter.c | ||
| 19 | index 2c6e5be..f100c72 100644 | ||
| 20 | --- a/src/greeter.c | ||
| 21 | +++ b/src/greeter.c | ||
| 22 | @@ -139,6 +139,8 @@ static void switch_to_input_user(void) | ||
| 23 | pass=NULL; | ||
| 24 | } | ||
| 25 | gtk_label_set_text( GTK_LABEL(prompt), _("User:")); | ||
| 26 | + gtk_entry_set_text(GTK_ENTRY(login_entry), ""); | ||
| 27 | + gtk_entry_set_visibility(GTK_ENTRY(login_entry), TRUE); | ||
| 28 | gtk_widget_show(prompt); | ||
| 29 | if(user_list) | ||
| 30 | { | ||
| 31 | -- | ||
| 32 | 2.25.1 | ||
| 33 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0002-greeter-gdk.c-fix-typo.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0002-greeter-gdk.c-fix-typo.patch new file mode 100644 index 0000000000..da02129756 --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0002-greeter-gdk.c-fix-typo.patch | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | From 3a3c5c644c9790cb3f88f3ce3757c2803cff90c5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Thu, 17 Dec 2020 14:32:40 +0800 | ||
| 4 | Subject: [PATCH 2/8] greeter-gdk.c: fix typo | ||
| 5 | |||
| 6 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 7 | |||
| 8 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 9 | --- | ||
| 10 | src/greeter-gdk.c | 2 +- | ||
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/src/greeter-gdk.c b/src/greeter-gdk.c | ||
| 14 | index 1b27d2e..5aa3e7f 100644 | ||
| 15 | --- a/src/greeter-gdk.c | ||
| 16 | +++ b/src/greeter-gdk.c | ||
| 17 | @@ -299,7 +299,7 @@ void ui_prepare(void) | ||
| 18 | attr.wclass = GDK_INPUT_OUTPUT; | ||
| 19 | win = gdk_window_new(root, &attr, mask); | ||
| 20 | gdk_window_set_decorations(win,0); | ||
| 21 | - gdk_window_set_title(win,"lxdm-greter-gdk"); | ||
| 22 | + gdk_window_set_title(win,"lxdm-greeter-gdk"); | ||
| 23 | |||
| 24 | scr=gdk_screen_get_default(); | ||
| 25 | g_signal_connect(scr, "size-changed", G_CALLBACK(on_screen_size_changed), win); | ||
| 26 | -- | ||
| 27 | 2.25.1 | ||
| 28 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0003-check-whether-password-expired-with-pam.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0003-check-whether-password-expired-with-pam.patch new file mode 100644 index 0000000000..c64854373d --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0003-check-whether-password-expired-with-pam.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | From 497e0fc7010969759c8247f7013a89589c44234a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Thu, 17 Dec 2020 18:12:29 +0800 | ||
| 4 | Subject: [PATCH 3/8] check whether password expired with pam | ||
| 5 | |||
| 6 | Introduce a new enum AuthResult type AUTH_PASSWD_EXPIRE. When user's | ||
| 7 | password is expired, return it. Only work with pam. | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 10 | |||
| 11 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 12 | --- | ||
| 13 | src/lxdm.h | 1 + | ||
| 14 | src/pam.c | 4 ++++ | ||
| 15 | 2 files changed, 5 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/src/lxdm.h b/src/lxdm.h | ||
| 18 | index 568573f..1c2f837 100644 | ||
| 19 | --- a/src/lxdm.h | ||
| 20 | +++ b/src/lxdm.h | ||
| 21 | @@ -41,6 +41,7 @@ enum AuthResult | ||
| 22 | AUTH_SUCCESS, | ||
| 23 | AUTH_BAD_USER, | ||
| 24 | AUTH_FAIL, | ||
| 25 | + AUTH_PASSWD_EXPIRE, | ||
| 26 | AUTH_PRIV, | ||
| 27 | AUTH_ERROR | ||
| 28 | }; | ||
| 29 | diff --git a/src/pam.c b/src/pam.c | ||
| 30 | index 43bd687..16a36f0 100644 | ||
| 31 | --- a/src/pam.c | ||
| 32 | +++ b/src/pam.c | ||
| 33 | @@ -257,6 +257,10 @@ int lxdm_auth_user_authenticate(LXDM_AUTH *a,const char *user,const char *pass,i | ||
| 34 | return AUTH_FAIL; | ||
| 35 | } | ||
| 36 | ret=pam_acct_mgmt(a->handle,PAM_SILENT); | ||
| 37 | + if (ret == PAM_NEW_AUTHTOK_REQD) { | ||
| 38 | + g_debug("user %s account has expired\n", user); | ||
| 39 | + return AUTH_PASSWD_EXPIRE; | ||
| 40 | + } | ||
| 41 | if(ret!=PAM_SUCCESS) | ||
| 42 | { | ||
| 43 | g_debug("user %s acct mgmt fail with %d\n",user,ret); | ||
| 44 | -- | ||
| 45 | 2.25.1 | ||
| 46 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0004-lxdm.c-add-function-to-change-password-with-pam.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0004-lxdm.c-add-function-to-change-password-with-pam.patch new file mode 100644 index 0000000000..29c1000d18 --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0004-lxdm.c-add-function-to-change-password-with-pam.patch | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | From d4de5497bd89c408377194b9fa9026ba8e68b634 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Mon, 11 Jan 2021 14:11:05 +0800 | ||
| 4 | Subject: [PATCH 4/8] lxdm.c: add function to change password with pam | ||
| 5 | |||
| 6 | Add function to change user's password when pam is enabled. It is useful | ||
| 7 | to change user's password when the password is expired. | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 10 | |||
| 11 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 12 | --- | ||
| 13 | src/lxdm.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 14 | src/lxdm.h | 1 + | ||
| 15 | 2 files changed, 69 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/src/lxdm.c b/src/lxdm.c | ||
| 18 | index 638c30f..fe17a71 100644 | ||
| 19 | --- a/src/lxdm.c | ||
| 20 | +++ b/src/lxdm.c | ||
| 21 | @@ -104,6 +104,10 @@ static int old_tty=1,def_tty = 7,nr_tty=0; | ||
| 22 | static int def_display=0; | ||
| 23 | static GSList *session_list; | ||
| 24 | |||
| 25 | +#if HAVE_LIBPAM | ||
| 26 | +static const char *new_passwd = NULL; | ||
| 27 | +#endif | ||
| 28 | + | ||
| 29 | static void lxdm_startx(LXSession *s); | ||
| 30 | |||
| 31 | static int get_active_vt(void) | ||
| 32 | @@ -759,6 +763,69 @@ int lxdm_auth_user(int type,char *user, char *pass, struct passwd **ppw) | ||
| 33 | return ret; | ||
| 34 | } | ||
| 35 | |||
| 36 | + | ||
| 37 | +#if HAVE_LIBPAM | ||
| 38 | + | ||
| 39 | +static int do_conv(int num, const struct pam_message **msg,struct pam_response **resp, void *arg) | ||
| 40 | +{ | ||
| 41 | + int result = PAM_SUCCESS; | ||
| 42 | + int i; | ||
| 43 | + | ||
| 44 | + *resp = (struct pam_response *) calloc(num, sizeof(struct pam_response)); | ||
| 45 | + for(i = 0; i < num; i++) | ||
| 46 | + { | ||
| 47 | + switch (msg[i]->msg_style) { | ||
| 48 | + case PAM_PROMPT_ECHO_ON: | ||
| 49 | + break; | ||
| 50 | + case PAM_PROMPT_ECHO_OFF: | ||
| 51 | + resp[i]->resp = strdup(new_passwd); | ||
| 52 | + break; | ||
| 53 | + case PAM_ERROR_MSG: | ||
| 54 | + case PAM_TEXT_INFO: | ||
| 55 | + break; | ||
| 56 | + default: | ||
| 57 | + break; | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + return result; | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +static int lxdm_change_passwd_pam(const char *service, const char *user, const char *pass) | ||
| 64 | +{ | ||
| 65 | + pam_handle_t *pamh = NULL; | ||
| 66 | + static struct pam_conv conv = { | ||
| 67 | + do_conv, | ||
| 68 | + NULL | ||
| 69 | + }; | ||
| 70 | + | ||
| 71 | + int ret = pam_start("lxdm", user, &conv, &pamh); | ||
| 72 | + if (PAM_SUCCESS != ret) { | ||
| 73 | + g_warning("pam_start failed."); | ||
| 74 | + return 1; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + new_passwd = pass; | ||
| 78 | + ret = pam_chauthtok(pamh, 0); | ||
| 79 | + if (PAM_SUCCESS != ret) { | ||
| 80 | + g_warning("pam_chauthtok failed: %s", pam_strerror(pamh, ret)); | ||
| 81 | + return 1; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + (void)pam_end(pamh, PAM_SUCCESS); | ||
| 85 | + | ||
| 86 | + return 0; | ||
| 87 | +} | ||
| 88 | +#endif | ||
| 89 | + | ||
| 90 | +int lxdm_change_passwd(const char *user, const char *pass) | ||
| 91 | +{ | ||
| 92 | +#if HAVE_LIBPAM | ||
| 93 | + return lxdm_change_passwd_pam("lxdm", user, pass); | ||
| 94 | +#else | ||
| 95 | + return 0; | ||
| 96 | +#endif | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | static void close_left_fds(void) | ||
| 100 | { | ||
| 101 | struct dirent **list; | ||
| 102 | @@ -1446,6 +1513,7 @@ int lxdm_do_auto_login(void) | ||
| 103 | lxdm_do_login(pw,session,lang,option); | ||
| 104 | success=1; | ||
| 105 | } | ||
| 106 | + | ||
| 107 | g_free(user);g_free(session);g_free(lang); | ||
| 108 | } | ||
| 109 | g_free(last_lang); | ||
| 110 | diff --git a/src/lxdm.h b/src/lxdm.h | ||
| 111 | index 1c2f837..be3c81f 100644 | ||
| 112 | --- a/src/lxdm.h | ||
| 113 | +++ b/src/lxdm.h | ||
| 114 | @@ -30,6 +30,7 @@ G_BEGIN_DECLS | ||
| 115 | extern GKeyFile *config; | ||
| 116 | |||
| 117 | int lxdm_auth_user(int type,char *user,char *pass,struct passwd **ppw); | ||
| 118 | +int lxdm_change_passwd(const char *user, const char *pass); | ||
| 119 | void lxdm_do_login(struct passwd *pw,char *session,char *lang,char *option); | ||
| 120 | void lxdm_do_reboot(void); | ||
| 121 | void lxdm_do_shutdown(void); | ||
| 122 | -- | ||
| 123 | 2.25.1 | ||
| 124 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0005-ui.c-handle-password-expire-and-update-new-password.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0005-ui.c-handle-password-expire-and-update-new-password.patch new file mode 100644 index 0000000000..ecbe68d148 --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0005-ui.c-handle-password-expire-and-update-new-password.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | From 54b2ed18ca52fa682ade2fe84e1b0d19d1b78cc4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Mon, 11 Jan 2021 16:48:26 +0800 | ||
| 4 | Subject: [PATCH 5/8] ui.c: handle password-expire and update-new-password | ||
| 5 | |||
| 6 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 7 | |||
| 8 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 9 | --- | ||
| 10 | src/ui.c | 20 ++++++++++++++++++++ | ||
| 11 | 1 file changed, 20 insertions(+) | ||
| 12 | |||
| 13 | diff --git a/src/ui.c b/src/ui.c | ||
| 14 | index f233589..3ddb484 100644 | ||
| 15 | --- a/src/ui.c | ||
| 16 | +++ b/src/ui.c | ||
| 17 | @@ -161,6 +161,9 @@ static gboolean on_greeter_input(GIOChannel *source, GIOCondition condition, gpo | ||
| 18 | ui_drop(); | ||
| 19 | lxdm_do_login(pw, session, lang,NULL); | ||
| 20 | } | ||
| 21 | + else if (AUTH_PASSWD_EXPIRE == ret) { | ||
| 22 | + xwrite(greeter_pipe[0], "password-expire\n", 16); | ||
| 23 | + } | ||
| 24 | else | ||
| 25 | { | ||
| 26 | if(pass!=NULL) | ||
| 27 | @@ -205,6 +208,23 @@ static gboolean on_greeter_input(GIOChannel *source, GIOCondition condition, gpo | ||
| 28 | g_free(session); | ||
| 29 | g_free(lang); | ||
| 30 | } | ||
| 31 | + else if (!strncmp(str, "update-new-password", 19)) { | ||
| 32 | + xwrite(greeter_pipe[0], "update-new-password\n", 20); | ||
| 33 | + char *user = greeter_param(str, "user"); | ||
| 34 | + char *pass = greeter_param(str, "newpass"); | ||
| 35 | + char *session = greeter_param(str, "session"); | ||
| 36 | + char *lang = greeter_param(str, "lang"); | ||
| 37 | + | ||
| 38 | + int ret = lxdm_change_passwd(user, pass); | ||
| 39 | + if (ret) { | ||
| 40 | + xwrite(greeter_pipe[0], "invalid-new-password\n", 21); | ||
| 41 | + } else { | ||
| 42 | + struct passwd *pw; | ||
| 43 | + ret = lxdm_auth_user(AUTH_TYPE_NORMAL, user, pass, &pw); | ||
| 44 | + ui_drop(); | ||
| 45 | + lxdm_do_login(pw, session, lang, NULL); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | g_free(str); | ||
| 49 | return TRUE; | ||
| 50 | } | ||
| 51 | -- | ||
| 52 | 2.25.1 | ||
| 53 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0006-themes-Industrial-add-info-label-in-ui.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0006-themes-Industrial-add-info-label-in-ui.patch new file mode 100644 index 0000000000..4cadc3d9b2 --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0006-themes-Industrial-add-info-label-in-ui.patch | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | From 8414d63343cc7909bc7a972941c678509d5d5be6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Mon, 11 Jan 2021 10:15:45 +0800 | ||
| 4 | Subject: [PATCH 6/8] themes/Industrial: add info label in ui | ||
| 5 | |||
| 6 | Adjust the layout and add a new label "info" under the labe "prompt" in | ||
| 7 | themes/Industrial to tell user some useful information such as | ||
| 8 | "Authentication failed" or "Invalid password". | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 11 | |||
| 12 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 13 | --- | ||
| 14 | data/themes/Industrial/greeter-gtk3.ui | 27 +++++++++++++++++++++++++- | ||
| 15 | data/themes/Industrial/greeter.ui | 27 +++++++++++++++++++++++++- | ||
| 16 | data/themes/Industrial/gtk.css | 5 +++++ | ||
| 17 | 3 files changed, 57 insertions(+), 2 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/data/themes/Industrial/greeter-gtk3.ui b/data/themes/Industrial/greeter-gtk3.ui | ||
| 20 | index 2f4e631..e59eee3 100644 | ||
| 21 | --- a/data/themes/Industrial/greeter-gtk3.ui | ||
| 22 | +++ b/data/themes/Industrial/greeter-gtk3.ui | ||
| 23 | @@ -45,7 +45,12 @@ | ||
| 24 | <property name="xscale">0</property> | ||
| 25 | <property name="yscale">0</property> | ||
| 26 | <child> | ||
| 27 | - <object class="GtkHBox" id="hbox3"> | ||
| 28 | + <object class="GtkVBox" id="vbox3"> | ||
| 29 | + <property name="visible">True</property> | ||
| 30 | + <property name="orientation">vertical</property> | ||
| 31 | + <property name="spacing">12</property> | ||
| 32 | + <child> | ||
| 33 | + <object class="GtkHBox" id="hbox3"> | ||
| 34 | <property name="visible">True</property> | ||
| 35 | <property name="spacing">12</property> | ||
| 36 | <child> | ||
| 37 | @@ -91,6 +96,26 @@ | ||
| 38 | </packing> | ||
| 39 | </child> | ||
| 40 | </object> | ||
| 41 | + </child> | ||
| 42 | + <child> | ||
| 43 | + <object class="GtkHBox" id="hbox4"> | ||
| 44 | + <property name="visible">True</property> | ||
| 45 | + <property name="spacing">12</property> | ||
| 46 | + <child> | ||
| 47 | + <object class="GtkLabel" id="info"> | ||
| 48 | + <property name="visible">True</property> | ||
| 49 | + <property name="label" translatable="yes"></property> | ||
| 50 | + <property name="yalign">0.2</property> | ||
| 51 | + </object> | ||
| 52 | + <packing> | ||
| 53 | + <property name="expand">False</property> | ||
| 54 | + <property name="fill">False</property> | ||
| 55 | + <property name="position">0</property> | ||
| 56 | + </packing> | ||
| 57 | + </child> | ||
| 58 | + </object> | ||
| 59 | + </child> | ||
| 60 | + </object> | ||
| 61 | </child> | ||
| 62 | </object> | ||
| 63 | <packing> | ||
| 64 | diff --git a/data/themes/Industrial/greeter.ui b/data/themes/Industrial/greeter.ui | ||
| 65 | index 3413922..6a02d8d 100644 | ||
| 66 | --- a/data/themes/Industrial/greeter.ui | ||
| 67 | +++ b/data/themes/Industrial/greeter.ui | ||
| 68 | @@ -47,7 +47,12 @@ | ||
| 69 | <property name="xscale">0</property> | ||
| 70 | <property name="yscale">0</property> | ||
| 71 | <child> | ||
| 72 | - <object class="GtkHBox" id="hbox3"> | ||
| 73 | + <object class="GtkVBox" id="vbox3"> | ||
| 74 | + <property name="visible">True</property> | ||
| 75 | + <property name="orientation">vertical</property> | ||
| 76 | + <property name="spacing">12</property> | ||
| 77 | + <child> | ||
| 78 | + <object class="GtkHBox" id="hbox3"> | ||
| 79 | <property name="visible">True</property> | ||
| 80 | <property name="spacing">12</property> | ||
| 81 | <child> | ||
| 82 | @@ -93,6 +98,26 @@ | ||
| 83 | </packing> | ||
| 84 | </child> | ||
| 85 | </object> | ||
| 86 | + </child> | ||
| 87 | + <child> | ||
| 88 | + <object class="GtkHBox" id="hbox4"> | ||
| 89 | + <property name="visible">True</property> | ||
| 90 | + <property name="spacing">12</property> | ||
| 91 | + <child> | ||
| 92 | + <object class="GtkLabel" id="info"> | ||
| 93 | + <property name="visible">True</property> | ||
| 94 | + <property name="label" translatable="yes"></property> | ||
| 95 | + <property name="yalign">0.2</property> | ||
| 96 | + </object> | ||
| 97 | + <packing> | ||
| 98 | + <property name="expand">False</property> | ||
| 99 | + <property name="fill">False</property> | ||
| 100 | + <property name="position">0</property> | ||
| 101 | + </packing> | ||
| 102 | + </child> | ||
| 103 | + </object> | ||
| 104 | + </child> | ||
| 105 | + </object> | ||
| 106 | </child> | ||
| 107 | </object> | ||
| 108 | <packing> | ||
| 109 | diff --git a/data/themes/Industrial/gtk.css b/data/themes/Industrial/gtk.css | ||
| 110 | index 7621345..be15f43 100644 | ||
| 111 | --- a/data/themes/Industrial/gtk.css | ||
| 112 | +++ b/data/themes/Industrial/gtk.css | ||
| 113 | @@ -22,3 +22,8 @@ | ||
| 114 | font: Sans 12; | ||
| 115 | color: #9E9D9B; | ||
| 116 | } | ||
| 117 | + | ||
| 118 | +#info { | ||
| 119 | + font: Sans 14; | ||
| 120 | + font-style: italic; | ||
| 121 | +} | ||
| 122 | -- | ||
| 123 | 2.25.1 | ||
| 124 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0007-greeter.c-support-to-update-expired-password.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0007-greeter.c-support-to-update-expired-password.patch new file mode 100644 index 0000000000..84a9faebb8 --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0007-greeter.c-support-to-update-expired-password.patch | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | From bae6a2b3a2232abd16a8d8558dda542d4970f1bb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Tue, 12 Jan 2021 09:23:05 +0800 | ||
| 4 | Subject: [PATCH 7/8] greeter.c: support to update expired password | ||
| 5 | |||
| 6 | Update greeter to work with ui to handle expired password. It checks | ||
| 7 | whether password is expired after input user and password. If expired, | ||
| 8 | force user to update password immediately. It allows 3 times to try. If | ||
| 9 | exceeds, reset to input user. | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 12 | |||
| 13 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 14 | --- | ||
| 15 | src/greeter.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++-- | ||
| 16 | 1 file changed, 81 insertions(+), 2 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/src/greeter.c b/src/greeter.c | ||
| 19 | index f100c72..804fca0 100644 | ||
| 20 | --- a/src/greeter.c | ||
| 21 | +++ b/src/greeter.c | ||
| 22 | @@ -77,6 +77,8 @@ static GtkWidget *lang_menu; | ||
| 23 | |||
| 24 | static char* user = NULL; | ||
| 25 | static char* pass = NULL; | ||
| 26 | +static char* new_pass = NULL; | ||
| 27 | +static gboolean pass_expired = FALSE; | ||
| 28 | |||
| 29 | static char* ui_file = NULL; | ||
| 30 | static char *ui_nobody = NULL; | ||
| 31 | @@ -167,10 +169,19 @@ static void switch_to_input_passwd(void) | ||
| 32 | else | ||
| 33 | gtk_widget_hide(user_list); | ||
| 34 | } | ||
| 35 | - gtk_label_set_text( GTK_LABEL(prompt), _("Password:") ); | ||
| 36 | + if (pass_expired) { | ||
| 37 | + if (!new_pass) { | ||
| 38 | + gtk_label_set_text(GTK_LABEL(prompt), _("New password:")); | ||
| 39 | + } else { | ||
| 40 | + gtk_label_set_text(GTK_LABEL(prompt), _("Retype new password:")); | ||
| 41 | + } | ||
| 42 | + } else { | ||
| 43 | + gtk_label_set_text( GTK_LABEL(prompt), _("Password:") ); | ||
| 44 | + } | ||
| 45 | gtk_entry_set_text(GTK_ENTRY(login_entry), ""); | ||
| 46 | gtk_entry_set_visibility(GTK_ENTRY(login_entry), FALSE); | ||
| 47 | gtk_widget_show(login_entry); | ||
| 48 | + gtk_widget_show(prompt); | ||
| 49 | gtk_widget_grab_focus(login_entry); | ||
| 50 | } | ||
| 51 | |||
| 52 | @@ -189,6 +200,8 @@ static void try_login_user(const char *user) | ||
| 53 | |||
| 54 | static void on_entry_activate(GtkEntry* entry) | ||
| 55 | { | ||
| 56 | + static int count = 0; | ||
| 57 | + | ||
| 58 | char* tmp; | ||
| 59 | if( !user ) | ||
| 60 | { | ||
| 61 | @@ -217,6 +230,46 @@ static void on_entry_activate(GtkEntry* entry) | ||
| 62 | } | ||
| 63 | else | ||
| 64 | { | ||
| 65 | + if (pass_expired) { | ||
| 66 | + if (!new_pass) { | ||
| 67 | + new_pass = g_strdup(gtk_entry_get_text(entry)); | ||
| 68 | + switch_to_input_passwd(); | ||
| 69 | + } else { | ||
| 70 | + tmp = g_strdup(gtk_entry_get_text(entry)); | ||
| 71 | + if (strcmp(new_pass, tmp)) { | ||
| 72 | + g_free(new_pass); | ||
| 73 | + new_pass = NULL; | ||
| 74 | + // if new passwords not match, retry for 3 times at most | ||
| 75 | + if (++count < 3) { | ||
| 76 | + switch_to_input_passwd(); | ||
| 77 | + } else { | ||
| 78 | + count = 0; | ||
| 79 | + pass_expired = FALSE; | ||
| 80 | + switch_to_input_user(); | ||
| 81 | + } | ||
| 82 | + } else if (!strcmp(pass, g_base64_encode((guchar*)new_pass, strlen(new_pass) + 1))) { | ||
| 83 | + // if new password is same as old one | ||
| 84 | + g_free(new_pass); | ||
| 85 | + new_pass = NULL; | ||
| 86 | + if (++count < 3) { | ||
| 87 | + switch_to_input_passwd(); | ||
| 88 | + } else { | ||
| 89 | + count = 0; | ||
| 90 | + pass_expired = FALSE; | ||
| 91 | + switch_to_input_user(); | ||
| 92 | + } | ||
| 93 | + } else { | ||
| 94 | + char *session_exec=get_session_exec(); | ||
| 95 | + char *session_lang=get_session_lang(); | ||
| 96 | + | ||
| 97 | + printf("update-new-password user=%s newpass=%s session=%s lang=%s\n", | ||
| 98 | + user, new_pass, session_exec, session_lang); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + return ; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | char *session_exec=get_session_exec(); | ||
| 106 | char *session_lang=get_session_lang(); | ||
| 107 | |||
| 108 | @@ -227,6 +280,7 @@ static void on_entry_activate(GtkEntry* entry) | ||
| 109 | printf("login user=%s pass=%s session=%s lang=%s\n", | ||
| 110 | user, pass, session_exec, session_lang); | ||
| 111 | |||
| 112 | +#if 0 | ||
| 113 | /* password check failed */ | ||
| 114 | g_free(user); | ||
| 115 | user = NULL; | ||
| 116 | @@ -241,6 +295,7 @@ static void on_entry_activate(GtkEntry* entry) | ||
| 117 | gtk_label_set_text( GTK_LABEL(prompt), _("User:") ); | ||
| 118 | gtk_entry_set_text(GTK_ENTRY(entry), ""); | ||
| 119 | gtk_entry_set_visibility(GTK_ENTRY(entry), TRUE); | ||
| 120 | +#endif | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | @@ -1091,8 +1146,12 @@ static void on_screen_size_changed(GdkScreen *screen,GtkWidget *win) | ||
| 125 | |||
| 126 | static gint login_entry_on_key_press (GtkWidget *widget,GdkEventKey *event) | ||
| 127 | { | ||
| 128 | - if(event->keyval == GDK_Escape) | ||
| 129 | + if(event->keyval == GDK_Escape) { | ||
| 130 | + g_free(new_pass); | ||
| 131 | + new_pass = NULL; | ||
| 132 | + pass_expired = FALSE; | ||
| 133 | switch_to_input_user(); | ||
| 134 | + } | ||
| 135 | return FALSE; | ||
| 136 | } | ||
| 137 | |||
| 138 | @@ -1285,8 +1344,10 @@ static void create_win() | ||
| 139 | |||
| 140 | static gboolean on_lxdm_command(GIOChannel *source, GIOCondition condition, gpointer data) | ||
| 141 | { | ||
| 142 | + | ||
| 143 | GIOStatus ret; | ||
| 144 | char *str; | ||
| 145 | + static int count = 0; | ||
| 146 | |||
| 147 | if( !(G_IO_IN & condition) ) | ||
| 148 | return FALSE; | ||
| 149 | @@ -1300,10 +1361,28 @@ static gboolean on_lxdm_command(GIOChannel *source, GIOCondition condition, gpoi | ||
| 150 | { | ||
| 151 | switch_to_input_user(); | ||
| 152 | } | ||
| 153 | + else if (!strncmp(str, "password-expire", 15)) | ||
| 154 | + { | ||
| 155 | + pass_expired = TRUE; | ||
| 156 | + switch_to_input_passwd(); | ||
| 157 | + } | ||
| 158 | else if( !strncmp(str, "password", 8)) | ||
| 159 | { | ||
| 160 | switch_to_input_passwd(); | ||
| 161 | } | ||
| 162 | + else if (!strncmp(str, "invalid-new-password", 20)) | ||
| 163 | + { | ||
| 164 | + g_free(new_pass); | ||
| 165 | + new_pass = NULL; | ||
| 166 | + | ||
| 167 | + if (count++ < 3) { | ||
| 168 | + switch_to_input_passwd(); | ||
| 169 | + } else { | ||
| 170 | + count = 0; | ||
| 171 | + pass_expired = FALSE; | ||
| 172 | + switch_to_input_user(); | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | g_free(str); | ||
| 176 | return TRUE; | ||
| 177 | } | ||
| 178 | -- | ||
| 179 | 2.25.1 | ||
| 180 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0008-greeter.c-show-information-on-gtk-label-info.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0008-greeter.c-show-information-on-gtk-label-info.patch new file mode 100644 index 0000000000..eab9fd5e2e --- /dev/null +++ b/meta-oe/recipes-graphics/lxdm/lxdm/0008-greeter.c-show-information-on-gtk-label-info.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | From bb4ff4b134383bfdadf7cb5353d3553a8a72d47e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kai Kang <kai.kang@windriver.com> | ||
| 3 | Date: Wed, 13 Jan 2021 10:45:48 +0800 | ||
| 4 | Subject: [PATCH 8/8] greeter.c: show information on gtk label 'info' | ||
| 5 | |||
| 6 | Show information on a gtk label 'info' which is added under label | ||
| 7 | 'prompt' in the .glade or .ui files. | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/1/] | ||
| 10 | |||
| 11 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 12 | --- | ||
| 13 | src/greeter.c | 15 ++++++++++++++- | ||
| 14 | 1 file changed, 14 insertions(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/src/greeter.c b/src/greeter.c | ||
| 17 | index 804fca0..a4a2336 100644 | ||
| 18 | --- a/src/greeter.c | ||
| 19 | +++ b/src/greeter.c | ||
| 20 | @@ -64,6 +64,7 @@ static GtkWidget* win; | ||
| 21 | static GtkWidget* alignment2; | ||
| 22 | static GtkWidget* prompt; | ||
| 23 | static GtkWidget* login_entry; | ||
| 24 | +static GtkWidget* info; | ||
| 25 | static GtkWidget* user_list_scrolled; | ||
| 26 | static GtkWidget* user_list; | ||
| 27 | |||
| 28 | @@ -241,10 +242,12 @@ static void on_entry_activate(GtkEntry* entry) | ||
| 29 | new_pass = NULL; | ||
| 30 | // if new passwords not match, retry for 3 times at most | ||
| 31 | if (++count < 3) { | ||
| 32 | + gtk_label_set_text((GtkLabel *)info, _("Passwords do not match, please retry.")); | ||
| 33 | switch_to_input_passwd(); | ||
| 34 | } else { | ||
| 35 | count = 0; | ||
| 36 | pass_expired = FALSE; | ||
| 37 | + gtk_label_set_text((GtkLabel *)info, _("Maximum number of failed update password attempts exceeded.")); | ||
| 38 | switch_to_input_user(); | ||
| 39 | } | ||
| 40 | } else if (!strcmp(pass, g_base64_encode((guchar*)new_pass, strlen(new_pass) + 1))) { | ||
| 41 | @@ -252,6 +255,7 @@ static void on_entry_activate(GtkEntry* entry) | ||
| 42 | g_free(new_pass); | ||
| 43 | new_pass = NULL; | ||
| 44 | if (++count < 3) { | ||
| 45 | + gtk_label_set_text((GtkLabel *)info, _("New password is same as old one, password unchanged.")); | ||
| 46 | switch_to_input_passwd(); | ||
| 47 | } else { | ||
| 48 | count = 0; | ||
| 49 | @@ -1146,6 +1150,9 @@ static void on_screen_size_changed(GdkScreen *screen,GtkWidget *win) | ||
| 50 | |||
| 51 | static gint login_entry_on_key_press (GtkWidget *widget,GdkEventKey *event) | ||
| 52 | { | ||
| 53 | + | ||
| 54 | + gtk_label_set_text(GTK_LABEL(info), ""); | ||
| 55 | + | ||
| 56 | if(event->keyval == GDK_Escape) { | ||
| 57 | g_free(new_pass); | ||
| 58 | new_pass = NULL; | ||
| 59 | @@ -1211,11 +1218,14 @@ static void create_win() | ||
| 60 | login_entry = (GtkWidget*)gtk_builder_get_object(builder, "login_entry"); | ||
| 61 | if(login_entry!=NULL) | ||
| 62 | { | ||
| 63 | - g_signal_connect_after(login_entry,"key-press-event",G_CALLBACK(login_entry_on_key_press),NULL); | ||
| 64 | + g_signal_connect(login_entry,"key-press-event",G_CALLBACK(login_entry_on_key_press),NULL); | ||
| 65 | } | ||
| 66 | |||
| 67 | g_signal_connect(login_entry, "activate", G_CALLBACK(on_entry_activate), NULL); | ||
| 68 | |||
| 69 | + info = (GtkWidget *)gtk_builder_get_object(builder, "info"); | ||
| 70 | + gtk_label_set_text(GTK_LABEL(info), ""); | ||
| 71 | + | ||
| 72 | if( g_key_file_get_integer(config, "display", "bottom_pane", 0)==1) | ||
| 73 | { | ||
| 74 | /* hacks to let GtkEventBox paintable with gtk pixmap engine. */ | ||
| 75 | @@ -1359,11 +1369,13 @@ static gboolean on_lxdm_command(GIOChannel *source, GIOCondition condition, gpoi | ||
| 76 | gtk_main_quit(); | ||
| 77 | else if( !strncmp(str, "reset", 5) ) | ||
| 78 | { | ||
| 79 | + gtk_label_set_text(GTK_LABEL(info), _("Authentication failed.")); | ||
| 80 | switch_to_input_user(); | ||
| 81 | } | ||
| 82 | else if (!strncmp(str, "password-expire", 15)) | ||
| 83 | { | ||
| 84 | pass_expired = TRUE; | ||
| 85 | + gtk_label_set_text(GTK_LABEL(info), _("You are required to change your password immediately.")); | ||
| 86 | switch_to_input_passwd(); | ||
| 87 | } | ||
| 88 | else if( !strncmp(str, "password", 8)) | ||
| 89 | @@ -1376,6 +1388,7 @@ static gboolean on_lxdm_command(GIOChannel *source, GIOCondition condition, gpoi | ||
| 90 | new_pass = NULL; | ||
| 91 | |||
| 92 | if (count++ < 3) { | ||
| 93 | + gtk_label_set_text(GTK_LABEL(info), _("Invalid new password. Please input new password again.")); | ||
| 94 | switch_to_input_passwd(); | ||
| 95 | } else { | ||
| 96 | count = 0; | ||
| 97 | -- | ||
| 98 | 2.25.1 | ||
| 99 | |||
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb b/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb index db4767bb30..dcfd9e169d 100644 --- a/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb +++ b/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb | |||
| @@ -9,6 +9,14 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}%20${PV}/${BPN}-${PV}.tar. | |||
| 9 | file://0002-let-autotools-create-lxdm.conf.patch \ | 9 | file://0002-let-autotools-create-lxdm.conf.patch \ |
| 10 | file://0003-check-for-libexecinfo-providing-backtrace-APIs.patch \ | 10 | file://0003-check-for-libexecinfo-providing-backtrace-APIs.patch \ |
| 11 | file://0004-fix-css-under-gtk-3.20.patch \ | 11 | file://0004-fix-css-under-gtk-3.20.patch \ |
| 12 | file://0001-greeter-set-visible-when-switch-to-input-user.patch \ | ||
| 13 | file://0002-greeter-gdk.c-fix-typo.patch \ | ||
| 14 | file://0003-check-whether-password-expired-with-pam.patch \ | ||
| 15 | file://0004-lxdm.c-add-function-to-change-password-with-pam.patch \ | ||
| 16 | file://0005-ui.c-handle-password-expire-and-update-new-password.patch \ | ||
| 17 | file://0006-themes-Industrial-add-info-label-in-ui.patch \ | ||
| 18 | file://0007-greeter.c-support-to-update-expired-password.patch \ | ||
| 19 | file://0008-greeter.c-show-information-on-gtk-label-info.patch \ | ||
| 12 | " | 20 | " |
| 13 | SRC_URI[md5sum] = "061caae432634e6db38bbdc84bc6ffa0" | 21 | SRC_URI[md5sum] = "061caae432634e6db38bbdc84bc6ffa0" |
| 14 | SRC_URI[sha256sum] = "4891efee81c72a400cc6703e40aa76f3f3853833d048b72ec805da0f93567f2f" | 22 | SRC_URI[sha256sum] = "4891efee81c72a400cc6703e40aa76f3f3853833d048b72ec805da0f93567f2f" |
