From 951bcba4cf7312c4fe5a488b980c846c36f9e3eefe1b4e4525239e82dcf2cfc4 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 3 Apr 2023 08:55:57 +0000 Subject: [PATCH] Accepting request 1076854 from home:Andreas_Schwab:Factory - getlogin-no-loginuid.patch: getlogin_r: fix missing fallback if loginuid is unset (bsc#1209229, BZ #30235) OBS-URL: https://build.opensuse.org/request/show/1076854 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=649 --- getlogin-no-loginuid.patch | 31 +++++++++++++++++++++++++++++++ glibc.changes | 6 ++++++ glibc.spec | 3 +++ 3 files changed, 40 insertions(+) create mode 100644 getlogin-no-loginuid.patch diff --git a/getlogin-no-loginuid.patch b/getlogin-no-loginuid.patch new file mode 100644 index 0000000..46dd0b0 --- /dev/null +++ b/getlogin-no-loginuid.patch @@ -0,0 +1,31 @@ +From 0d83b349fa7340475406b2fe933c7467e4584091 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Wed, 15 Mar 2023 11:44:24 +0100 +Subject: [PATCH] getlogin_r: fix missing fallback if loginuid is unset (bug + 30235) + +When /proc/self/loginuid is not set, we should still fall back to using +the traditional utmp lookup, instead of failing right away. +--- + sysdeps/unix/sysv/linux/getlogin_r.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c +index 879df85a16..4ae9a53503 100644 +--- a/sysdeps/unix/sysv/linux/getlogin_r.c ++++ b/sysdeps/unix/sysv/linux/getlogin_r.c +@@ -59,10 +59,7 @@ __getlogin_r_loginuid (char *name, size_t namesize) + value of, (uid_t) -1, so check if that value is set and return early to + avoid making unneeded nss lookups. */ + if (uid == (uid_t) -1) +- { +- __set_errno (ENXIO); +- return ENXIO; +- } ++ return -1; + + struct passwd pwd; + struct passwd *tpwd; +-- +2.40.0 + diff --git a/glibc.changes b/glibc.changes index 7a9a03f..2cb7771 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Mar 30 12:03:36 UTC 2023 - Andreas Schwab + +- getlogin-no-loginuid.patch: getlogin_r: fix missing fallback if loginuid + is unset (bsc#1209229, BZ #30235) + ------------------------------------------------------------------- Thu Mar 16 15:41:56 UTC 2023 - Andreas Schwab diff --git a/glibc.spec b/glibc.spec index ac944b9..a4f76a1 100644 --- a/glibc.spec +++ b/glibc.spec @@ -284,6 +284,8 @@ Patch306: glibc-fix-double-loopback.diff Patch1000: printf-grouping.patch # PATCH-FIX-UPSTREAM Use 64-bit time_t interfaces in strftime and strptime (BZ #30053) Patch1001: strftime-time64.patch +# PATCH-FIX-UPSTREAM getlogin_r: fix missing fallback if loginuid is unset (BZ #30235) +Patch1002: getlogin-no-loginuid.patch ### # Patches awaiting upstream approval @@ -510,6 +512,7 @@ library in a cross compilation setting. %if %{without snapshot} %patch1000 -p1 %patch1001 -p1 +%patch1002 -p1 %endif %patch2000 -p1