Hello community,
here is the log from the commit of package sysvinit for openSUSE:Factory
checked in at Tue Jul 26 14:58:36 CEST 2011.
--------
--- sysvinit/sysvinit.changes 2011-06-28 10:37:50.000000000 +0200
+++ /mounts/work_src_done/STABLE/sysvinit/sysvinit.changes 2011-07-26 14:13:52.000000000 +0200
@@ -1,0 +2,7 @@
+Tue Jul 26 12:13:18 UTC 2011 - werner@suse.de
+
+- Sulogin: enforce reconnection of stdin/stdout/stderr if a device
+ was specified.
+- Sulogin: if zero is read at reading the passwd guess it's done.
+
+-------------------------------------------------------------------
@@ -119 +126 @@
- serial system console (bnc#677435)
+ serial system console (bnc#672450)
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sysvinit.spec ++++++
--- /var/tmp/diff_new_pack.FasUAq/_old 2011-07-26 14:56:50.000000000 +0200
+++ /var/tmp/diff_new_pack.FasUAq/_new 2011-07-26 14:56:50.000000000 +0200
@@ -29,7 +29,7 @@
Group: System/Base
AutoReqProv: on
Version: 2.88+
-Release: 52
+Release: 54
Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: audit-devel libselinux-devel libsepol-devel pam-devel
++++++ sysvinit-2.88dsf-multiple-sulogin.patch ++++++
--- /var/tmp/diff_new_pack.FasUAq/_old 2011-07-26 14:56:50.000000000 +0200
+++ /var/tmp/diff_new_pack.FasUAq/_new 2011-07-26 14:56:50.000000000 +0200
@@ -1,5 +1,5 @@
--- src/sulogin.c
-+++ src/sulogin.c 2011-05-19 10:47:11.783926103 +0000
++++ src/sulogin.c 2011-07-26 14:01:55.543926269 +0200
@@ -28,8 +28,10 @@
*
*/
@@ -350,7 +350,7 @@
*/
if (p == NULL) {
- fprintf(stderr, "%s: no entry for root\n", F_PASSWD);
-+ fprintf(stderr, "%s: no entry for root\n\r", F_PASSWD);
++ fprintf(stderr, "sulogin: %s: no entry for root\n\r", F_PASSWD);
return &pwd;
}
if (valid(pwd.pw_passwd)) return &pwd;
@@ -359,21 +359,21 @@
strcpy(pwd.pw_passwd, "");
if ((fp = fopen(F_SHADOW, "r")) == NULL) {
- fprintf(stderr, "%s: root password garbled\n", F_PASSWD);
-+ fprintf(stderr, "%s: root password garbled\n\r", F_PASSWD);
++ fprintf(stderr, "sulogin: %s: root password garbled\n\r", F_PASSWD);
return &pwd;
}
while((p = fgets(sline, 256, fp)) != NULL) {
-@@ -333,67 +499,212 @@ struct passwd *getrootpwent(int try_manu
+@@ -333,67 +499,215 @@ struct passwd *getrootpwent(int try_manu
* NULL it, and return.
*/
if (p == NULL) {
- fprintf(stderr, "%s: no entry for root\n", F_SHADOW);
-+ fprintf(stderr, "%s: no entry for root\n\r", F_SHADOW);
++ fprintf(stderr, "sulogin: %s: no entry for root\n\r", F_SHADOW);
strcpy(pwd.pw_passwd, "");
}
if (!valid(pwd.pw_passwd)) {
- fprintf(stderr, "%s: root password garbled\n", F_SHADOW);
-+ fprintf(stderr, "%s: root password garbled\n\r", F_SHADOW);
++ fprintf(stderr, "sulogin: %s: root password garbled\n\r", F_SHADOW);
strcpy(pwd.pw_passwd, ""); }
return &pwd;
}
@@ -532,7 +532,7 @@
+ cp->eol = *ptr = '\0';
+
+ eightbit = ((con->flags & CON_SERIAL) == 0 || (tty.c_cflag & (PARODD|PARENB)) == 0);
-+ while (cp->eol == 0) {
++ while (cp->eol == '\0') {
+ if (read(fd, &c, 1) < 1) {
+ if (errno == EINTR || errno == EAGAIN) {
+ usleep(1000);
@@ -565,6 +565,9 @@
+ }
+
+ switch (ascval) {
++ case 0:
++ *ptr = '\0';
++ goto quit;
+ case CR:
+ case NL:
+ *ptr = '\0';
@@ -607,19 +610,19 @@
return ret;
}
-@@ -411,7 +722,10 @@ void sushell(struct passwd *pwd)
+@@ -411,7 +725,10 @@ void sushell(struct passwd *pwd)
/*
* Set directory and shell.
*/
- (void)chdir(pwd->pw_dir);
+ if (chdir(pwd->pw_dir) < 0) {
+ if (chdir("/") < 0)
-+ fprintf(stderr, "Change of working directory failed: %m\n");
++ fprintf(stderr, "sulogin: change of working directory failed: %m\n\r");
+ }
if ((p = getenv("SUSHELL")) != NULL)
sushell = p;
else if ((p = getenv("sushell")) != NULL)
-@@ -431,7 +745,8 @@ void sushell(struct passwd *pwd)
+@@ -431,7 +748,8 @@ void sushell(struct passwd *pwd)
/*
* Set some important environment variables.
*/
@@ -629,7 +632,7 @@
setenv("HOME", home, 1);
setenv("LOGNAME", "root", 1);
setenv("USER", "root", 1);
-@@ -445,17 +760,18 @@ void sushell(struct passwd *pwd)
+@@ -445,17 +763,18 @@ void sushell(struct passwd *pwd)
signal(SIGINT, saved_sigint);
signal(SIGTSTP, saved_sigtstp);
signal(SIGQUIT, saved_sigquit);
@@ -651,13 +654,13 @@
+ if (getseuserbyname("root", &seuser, &level) == 0)
+ if (get_default_context_with_level(seuser, level, 0, &scon) == 0) {
+ if (setexeccon(scon) != 0)
-+ fprintf(stderr, "setexeccon failed\n\r");
++ fprintf(stderr, "sulogin: setexeccon failed\n\r");
+ freecon(scon);
+ }
free(seuser);
free(level);
}
-@@ -474,20 +790,68 @@ void sushell(struct passwd *pwd)
+@@ -474,23 +793,72 @@ void sushell(struct passwd *pwd)
perror(STATICSH);
}
@@ -715,6 +718,7 @@
struct passwd *pwd;
- int c, fd = -1;
+ int c, status = 0;
++ int reconnect = 0;
int opt_e = 0;
- pid_t pid, pgrp, ppgrp, ttypgrp;
+ struct console *con;
@@ -729,8 +733,12 @@
+ }
/*
- * See if we have a timeout flag.
-@@ -510,115 +874,138 @@ int main(int argc, char **argv)
+- * See if we have a timeout flag.
++ * See if we have a timeout flag.
+ */
+ opterr = 0;
+ while((c = getopt(argc, argv, "ept:")) != EOF) switch(c) {
+@@ -510,115 +878,151 @@ int main(int argc, char **argv)
}
if (geteuid() != 0) {
@@ -746,10 +754,10 @@
saved_sigquit = signal(SIGQUIT, SIG_IGN);
saved_sigtstp = signal(SIGTSTP, SIG_IGN);
- if (optind < argc) tty = argv[optind];
+-
+- if (tty || (tty = getenv("CONSOLE"))) {
+ saved_sighup = signal(SIGHUP, SIG_IGN);
-- if (tty || (tty = getenv("CONSOLE"))) {
--
- if ((fd = open(tty, O_RDWR)) < 0) {
- perror(tty);
- fd = dup(0);
@@ -760,7 +768,7 @@
- close(fd);
- } else {
+ /*
-+ * See if we need to open an other tty device.
++ * See if we need to open an other tty device.
+ */
+ if (optind < argc)
+ tty = argv[optind];
@@ -783,9 +791,10 @@
- setsid();
- }
+ /*
-+ * Detect possible consoles, use stdin as fallback.
++ * Detect possible consoles, use stdin as fallback.
++ * If an optional tty is given, reconnect it to stdin.
+ */
-+ detect_consoles(tty, 0);
++ reconnect = detect_consoles(tty, 0);
- signal(SIGHUP, SIG_IGN);
- if (ttypgrp > 0)
@@ -829,7 +838,17 @@
-#if defined(SANE_TIO) && (SANE_TIO == 1)
- fixtty();
-#endif
--
++ /*
++ * If previous stdin was not the speified tty and therefore reconnected
++ * to the specified tty also reconnect stdout and stderr.
++ */
++ if (reconnect) {
++ if (isatty(1) == 0)
++ dup2(0, 1);
++ if (isatty(2) == 0)
++ dup2(0, 2);
++ }
+
/*
* Get the root password.
*/
@@ -906,10 +925,11 @@
+ signal(SIGINT, SIG_IGN);
+
+ if (failed) {
-+ fprintf(stderr, "Can not execute su shell.\n\r");
++ fprintf(stderr, "sulogin: can not execute su shell.\n\r");
+ break;
+ }
+ fprintf(stderr, "Login incorrect.\n\r");
++ sleep(3);
+ }
+ if (alarm_rised) {
+ tcfinal(con);
@@ -956,7 +976,7 @@
return 0;
}
--- src/consoles.c
-+++ src/consoles.c 2011-04-01 10:37:59.827926346 +0000
++++ src/consoles.c 2011-07-26 12:17:30.139926327 +0200
@@ -27,9 +27,21 @@
#include