smgl/simpleinit-msb: initial commit
[grimoire-witchcraft.git] / smgl / simpleinit-msb / patches / sulogin.c.diff
blobd660dba4e1453ae69f48de22672385e677b74a64
1 --- ../../simpleinit-msb-1.2/sysvtools/sulogin.c 2001-09-26 12:59:46.000000000 +0200
2 +++ sulogin.c 2004-07-30 13:40:28.000000000 +0200
3 @@ -8,7 +8,7 @@
4 * encrypted root password is "x" the shadow
5 * password will be used.
7 - * Version: @(#)sulogin 2.81 31-Jul-2001 miquels@cistron.nl
8 + * Version: @(#)sulogin 2.85-3 23-Apr-2003 miquels@cistron.nl
12 @@ -35,11 +35,15 @@
13 #define F_SHADOW "/etc/shadow"
14 #define BINSH "/bin/sh"
16 -char *Version = "@(#)sulogin 2.81 31-Jul-2001 miquels@cistron.nl";
17 +char *Version = "@(#)sulogin 2.85-3 23-Apr-2003 miquels@cistron.nl";
19 int timeout = 0;
20 int profile = 0;
22 +#ifndef IUCLC
23 +# define IUCLC 0
24 +#endif
26 #if 0
28 * Fix the tty modes and set reasonable defaults.
29 @@ -240,7 +244,7 @@
30 * Ask for the password. Note that there is no
31 * default timeout as we normally skip this during boot.
33 -char *getpasswd(void)
34 +char *getpasswd(char *crypted)
36 struct sigaction sa;
37 struct termios old, tty;
38 @@ -248,8 +252,11 @@
39 char *ret = pass;
40 int i;
42 - printf("Give root password for maintenance\n");
43 - printf("(or type Control-D for normal startup): ");
44 + if (crypted[0])
45 + printf("Give root password for maintenance\n");
46 + else
47 + printf("Press enter for maintenance\n");
48 + printf("(or type Control-D to continue): ");
49 fflush(stdout);
51 tcgetattr(0, &old);
52 @@ -387,6 +394,7 @@
53 perror(tty);
54 } else if (!isatty(fd)) {
55 fprintf(stderr, "%s: not a tty\n", tty);
56 + close(fd);
57 } else {
60 @@ -433,7 +441,7 @@
61 * Ask for the password.
63 while(pwd) {
64 - if (pwd->pw_passwd[0] && (p = getpasswd()) == NULL) break;
65 + if ((p = getpasswd(pwd->pw_passwd)) == NULL) break;
66 if (pwd->pw_passwd[0] == 0 ||
67 strcmp(crypt(p, pwd->pw_passwd), pwd->pw_passwd) == 0)
68 sushell(pwd);