Tizen 2.1 base
[platform/upstream/sysvinit.git] / debian / patches / 91_sulogin_lockedpw.dpatch
1 debian/patches/91_sulogin_lockedpw.dpatch (Thom May):
2 Purpose: Make sure file systems can be fixed on machines with locked
3          root accounts too, by presenting a shell in these cases.
4 Authour: Thom May and Ubuntu.
5 Fixes:   #326678
6 Status:  unknown
7
8 Index: trunk/src/sulogin.c
9 ===================================================================
10 --- trunk.orig/src/sulogin.c    2009-09-30 10:59:13.000000000 +0200
11 +++ trunk/src/sulogin.c 2009-09-30 10:59:13.000000000 +0200
12 @@ -241,7 +241,11 @@
13                 fprintf(stderr, "%s: no entry for root\n", F_SHADOW);
14                 strcpy(pwd.pw_passwd, "");
15         }
16 -       if (!valid(pwd.pw_passwd)) {
17 +
18 +       /* disabled passwords are valid too */
19 +       if (!(strcmp(pwd.pw_passwd, "*") == 0) ||
20 +           !(strcmp(pwd.pw_passwd, "!") == 0) ||
21 +           !valid(pwd.pw_passwd)) {
22                 fprintf(stderr, "%s: root password garbled\n", F_SHADOW);
23                 strcpy(pwd.pw_passwd, ""); }
24         return &pwd;
25 @@ -469,6 +473,14 @@
26                 fprintf(stderr, "sulogin: cannot open password database!\n");
27                 sleep(2);
28         }
29 +       /*
30 +        *      If the root password is locked, fire up a shell
31 +        */
32 +       if ((strcmp(pwd->pw_passwd, "*") == 0) ||
33 +           (strcmp(pwd->pw_passwd, "!") == 0)) {
34 +               fprintf(stderr, "sulogin: root account is locked, starting shell\n");
35 +               sushell(pwd);
36 +       }
37  
38         /*
39          *      Ask for the password.
40 Index: trunk/man/sulogin.8
41 ===================================================================
42 --- trunk.orig/man/sulogin.8    2009-07-24 11:49:26.000000000 +0200
43 +++ trunk/man/sulogin.8 2009-09-30 10:59:49.000000000 +0200
44 @@ -22,6 +22,9 @@
45  .br
46  (or type Control\-D for normal startup):
47  .PP
48 +If the root account is locked, no password prompt is displayed and
49 +\fIsulogin\fR behaves as if the correct password were entered.
50 +.PP
51  \fIsulogin\fP will be connected to the current terminal, or to the
52  optional device that can be specified on the command line
53  (typically \fB/dev/console\fP).