lxdm: disallow empty new password

Do not clear text of label 'promt' when skip_password is set. When user
is required to update password, it only shows input box without label
for about 1 second.

And disallow empty new password when user is required to update it.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Kai Kang
2021-02-09 16:29:15 +08:00
committed by Khem Raj
parent f7d22fb620
commit 592101d0f3
2 changed files with 54 additions and 0 deletions
@@ -0,0 +1,53 @@
From af1c347a31ae243d29c6087da8ffb423b23c74f2 Mon Sep 17 00:00:00 2001
From: Kai Kang <kai.kang@windriver.com>
Date: Mon, 1 Feb 2021 09:54:48 +0800
Subject: [PATCH] greeter.c: disallow empty new password
Do not clear text of label 'promt' when skip_password is set. When user
is required to update password, it only shows input box without label
for about 1 second.
And disallow empty new password when user is required to update it.
Upstream-Status: Submitted [https://sourceforge.net/p/lxdm/code/merge-requests/2/]
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
src/greeter.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/greeter.c b/src/greeter.c
index 7e4a168..c0e6b64 100644
--- a/src/greeter.c
+++ b/src/greeter.c
@@ -220,7 +220,6 @@ static void on_entry_activate(GtkEntry* entry)
}
if(g_key_file_get_integer(config,"base","skip_password",NULL)!=0)
{
- gtk_label_set_text( GTK_LABEL(prompt), "");
try_login_user(user);
}
else
@@ -235,6 +239,10 @@ static void on_entry_activate(GtkEntry* entry)
if (pass_expired) {
if (!new_pass) {
new_pass = g_strdup(gtk_entry_get_text(entry));
+ if (strlen(new_pass) == 0) {
+ new_pass = NULL;
+ gtk_label_set_text((GtkLabel *)info, _("Empty password is not allowed."));
+ }
switch_to_input_passwd();
} else {
tmp = g_strdup(gtk_entry_get_text(entry));
@@ -251,7 +259,7 @@ static void on_entry_activate(GtkEntry* entry)
gtk_label_set_text((GtkLabel *)info, _("Maximum number of failed update password attempts exceeded."));
switch_to_input_user();
}
- } else if (!strcmp(pass, g_base64_encode((guchar*)new_pass, strlen(new_pass) + 1))) {
+ } else if (pass && !strcmp(pass, g_base64_encode((guchar*)new_pass, strlen(new_pass) + 1))) {
// if new password is same as old one
g_free(new_pass);
new_pass = NULL;
--
2.25.1
@@ -17,6 +17,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}%20${PV}/${BPN}-${PV}.tar.
file://0006-themes-Industrial-add-info-label-in-ui.patch \
file://0007-greeter.c-support-to-update-expired-password.patch \
file://0008-greeter.c-show-information-on-gtk-label-info.patch \
file://0009-greeter.c-disallow-empty-new-password.patch \
"
SRC_URI[md5sum] = "061caae432634e6db38bbdc84bc6ffa0"
SRC_URI[sha256sum] = "4891efee81c72a400cc6703e40aa76f3f3853833d048b72ec805da0f93567f2f"