[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [oe-core][PATCH 1/1] shadow: Fix can not print full login timeout message
From:       "Soumya" <soumya.sambu () windriver ! com>
Date:       2023-03-31 16:26:51
Message-ID: 20230331162651.760229-1-soumya.sambu () windriver ! com
[Download RAW message or body]

When we do not enter password during login, it is expected to display message "Login \
timed out after 60 seconds". But it prints only first few bytes(like "Login t") when \
write is immediately followed by exit. Fix - Calling exit from new handler provides \
enough time to display full message.

Upstream-Status: Accepted \
[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f7464fa57790d911b63c]


Signed-off-by: Soumya <soumya.sambu@windriver.com>
---
 .../0001-Fix-can-not-print-full-login.patch   | 41 +++++++++++++++++++
 meta/recipes-extended/shadow/shadow.inc       |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch


diff --git a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch \
b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch new file \
mode 100644 index 0000000000..37ba5f3dc2
--- /dev/null
+++ b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch
@@ -0,0 +1,41 @@
+commit 670cae834827a8f794e6f7464fa57790d911b63c
+Author: SoumyaWind <121475834+SoumyaWind@users.noreply.github.com>
+Date:   Tue Dec 27 17:40:17 2022 +0530
+
+    shadow: Fix can not print full login timeout message
+    
+    Login timed out message prints only first few bytes when write is immediately \
followed by exit. +    Calling exit from new handler provides enough time to display \
full message. +
+Upstream-Status: Accepted \
[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f7464fa57790d911b63c]
 +
+diff --git a/src/login.c b/src/login.c
+index 116e2cb3..c55f4de0 100644
+--- a/src/login.c
++++ b/src/login.c
+@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);
+ 
+ static void init_env (void);
+ static void alarm_handler (int);
++static void exit_handler (int);
+ 
+ /*
+  * usage - print login command usage and exit
+@@ -391,11 +392,16 @@ static void init_env (void)
+ #endif				/* !USE_PAM */
+ }
+ 
++static void exit_handler (unused int sig)
++{
++	_exit (0);
++}
+ 
+ static void alarm_handler (unused int sig)
+ {
+ 	write (STDERR_FILENO, tmsg, strlen (tmsg));
+-	_exit (0);
++	signal(SIGALRM, exit_handler);
++	alarm(2);
+ }
+ 
+ #ifdef USE_PAM
diff --git a/meta/recipes-extended/shadow/shadow.inc \
b/meta/recipes-extended/shadow/shadow.inc index 2c70a2d00e..52b10000ee 100644
--- a/meta/recipes-extended/shadow/shadow.inc
+++ b/meta/recipes-extended/shadow/shadow.inc
@@ -14,6 +14,7 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
 SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
            ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
            file://useradd \
+	   file://0001-Fix-can-not-print-full-login.patch \
            "
 
 SRC_URI:append:class-target = " \
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#179453): https://lists.openembedded.org/g/openembedded-core/message/179453
Mute This Topic: https://lists.openembedded.org/mt/97977074/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic