summaryrefslogtreecommitdiff
path: root/package/base-files/files/bin/login.sh
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-11-14 19:02:01 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-11-14 19:02:01 +0000
commit8b20bfafdf804598199364d05ab83a6f27882a42 (patch)
tree26f30fd65f04f268f5cdcf15b614846ac7bce6ae /package/base-files/files/bin/login.sh
parent79a4642b40e41af5c8c9c057aa494312d61f6cae (diff)
downloadmtk-20170518-8b20bfafdf804598199364d05ab83a6f27882a42.zip
mtk-20170518-8b20bfafdf804598199364d05ab83a6f27882a42.tar.gz
mtk-20170518-8b20bfafdf804598199364d05ab83a6f27882a42.tar.bz2
base-files: prime root password with "x" to notify programs that there is a shadow record, fix /bin/login.sh password detection accordingly. Solves broken key based dropbear login with empty password after r28935.
SVN-Revision: 29130
Diffstat (limited to 'package/base-files/files/bin/login.sh')
-rwxr-xr-xpackage/base-files/files/bin/login.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/package/base-files/files/bin/login.sh b/package/base-files/files/bin/login.sh
index b46769a..6682b02 100755
--- a/package/base-files/files/bin/login.sh
+++ b/package/base-files/files/bin/login.sh
@@ -1,7 +1,10 @@
#!/bin/sh
# Copyright (C) 2006-2011 OpenWrt.org
-if grep -qs '^root:[^!:]' /etc/passwd /etc/shadow && [ -z "$FAILSAFE" ]; then
+if ( ! grep -qs '^root::' /etc/shadow || \
+ ! grep -qs '^root:[!x]\?:' /etc/passwd ) && \
+ [ -z "$FAILSAFE" ]
+then
echo "Login failed."
exit 0
else