From fd21f8d0122c4af5ec147639e66ec10629c42eb16a9a556553b027b33102d1af Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 30 Oct 2020 14:33:02 +0000 Subject: [PATCH] sulogin OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=435 --- util-linux-sulogin4bsc1175514.patch | 69 +++++++++++++++++++++++++++++ util-linux.changes | 7 +++ util-linux.spec | 2 + 3 files changed, 78 insertions(+) create mode 100644 util-linux-sulogin4bsc1175514.patch diff --git a/util-linux-sulogin4bsc1175514.patch b/util-linux-sulogin4bsc1175514.patch new file mode 100644 index 0000000..dd41740 --- /dev/null +++ b/util-linux-sulogin4bsc1175514.patch @@ -0,0 +1,69 @@ +From: Werner Fink +Date: Fri, 30 Oct 2020 14:54:59 +0100 +Subject: [PATCH] sulogin: ignore not existing console devices + +and also not functional console devices. Redirect the error +messages to the appropiate console device. + +--- + sulogin.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c +index 9091caf14..7ee8f2dc7 100644 +--- a/login-utils/sulogin.c ++++ b/login-utils/sulogin.c +@@ -608,7 +608,7 @@ static const char *getpasswd(struct console *con) + struct termios tty; + static char pass[128], *ptr; + struct chardata *cp; +- const char *ret = pass; ++ const char *ret = NULL; + unsigned char tc; + char c, ascval; + int eightbit; +@@ -618,6 +618,7 @@ static const char *getpasswd(struct console *con) + goto out; + cp = &con->cp; + tty = con->tio; ++ ret = pass; + + tty.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); + tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP|ISIG); +@@ -647,11 +648,12 @@ static const char *getpasswd(struct console *con) + } + ret = NULL; + switch (errno) { +- case 0: + case EIO: ++ con->flags |= CON_NOTTY; + case ESRCH: + case EINVAL: + case ENOENT: ++ case 0: + break; + default: + warn(_("cannot read %s"), con->tty); +@@ -968,10 +970,13 @@ int main(int argc, char **argv) + con = list_entry(ptr, struct console, entry); + if (con->id >= CONMAX) + break; ++ if (con->flags & CON_NOTTY) ++ goto next; + + switch ((con->pid = fork())) { + case 0: + mask_signal(SIGCHLD, SIG_DFL, NULL); ++ dup2(con->fd, STDERR_FILENO); + nofork: + setup(con); + while (1) { +@@ -1026,7 +1031,7 @@ int main(int argc, char **argv) + default: + break; + } +- ++ next: + ptr = ptr->next; + + } while (ptr != &consoles); diff --git a/util-linux.changes b/util-linux.changes index c419e96..94ef314 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 30 14:03:47 UTC 2020 - Dr. Werner Fink + +- Add patch util-linux-sulogin4bsc1175514.patch + Avoid sulogin failing on not existing or not functional console + devices (bsc#1175514) + ------------------------------------------------------------------- Wed Sep 16 00:10:11 UTC 2020 - Stanislav Brabec diff --git a/util-linux.spec b/util-linux.spec index 6d9fe2c..1baa329 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -127,6 +127,8 @@ Source51: blkid.conf Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff Patch1: libmount-print-a-blacklist-hint-for-unknown-filesyst.patch Patch2: Add-documentation-on-blacklisted-modules-to-mount-8-.patch +# PATCH-FIX-SUSE: Avoid sulogin failing on not existing or not functional console devices +Patch3: util-linux-sulogin4bsc1175514.patch # %if %{with base} %if 0%{?suse_version} >= 1330