base-files: fix check for empty password warning
authorMatthias Schiffer <mschiffer@universe-factory.net>
Mon, 26 Sep 2016 13:25:37 +0000 (15:25 +0200)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Mon, 26 Sep 2016 15:57:56 +0000 (17:57 +0200)
Now that we know that the password is in /etc/shadow and not in
/etc/passwd, we can properly fix the logic for the empty password check.
Only 'root::' is an empty password, 'root:x:' and 'root:!:' allow no
password login at all.

This fixes the empty password warning still showing after the root password
has been locked using 'passwd -l root' (e.g. to allow public-key auth
only).

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
package/base-files/files/etc/profile

index d70bafca49ed0991d903be3f1b63f75a9282aa1b..f241ab2ef38658cfbb2476a087a2a6eba403351a 100644 (file)
@@ -30,8 +30,7 @@ alias ll='ls -alF --color=auto'
        unset FILE
 }
 
        unset FILE
 }
 
-if ( grep -qsE '^root:[!x]?:' /etc/shadow && \
-     grep -qsE '^root:[!x]?:' /etc/passwd  && \
+if ( grep -qs '^root::' /etc/shadow && \
      [ -z "$FAILSAFE" ] )
 then
 cat << EOF
      [ -z "$FAILSAFE" ] )
 then
 cat << EOF