Revert previous bad commit r11512
[openwrt/svn-archive/archive.git] / target / linux / ps3 / base-files / bin / login
1 #!/bin/sh
2 # Copyright (C) 2008 OpenWrt.org
3
4 ps3_db_bin=/usr/sbin/ps3-flash-util
5 ps3_db_owner_petitboot=3
6 ps3_db_key_telnet=3
7
8 if [ ! -f $ps3_db_bin ] ||
9 [ ! `$ps3_db_bin -P $ps3_db_owner_petitboot $ps3_db_key_telnet` ] ||
10 [ `$ps3_db_bin -P $ps3_db_owner_petitboot $ps3_db_key_telnet` = 0 ]; then
11 echo \
12 "
13 === IMPORTANT ==========================
14 Telnet login is disabled for security
15 reasons. Enabling telnet login on the
16 host will allow any user connected to
17 the same network to login to the host.
18
19 You can enable telnet login with the
20 following command in the host console:
21
22 # $ps3_db_bin -H $ps3_db_owner_petitboot $ps3_db_key_telnet 1
23
24 You can disable telnet login with the
25 following command in the host console:
26
27 # $ps3_db_bin -H $ps3_db_owner_petitboot $ps3_db_key_telnet 0
28 ----------------------------------------
29 "
30 exit 0
31 fi
32
33 grep '^root:[^!]' /etc/passwd >&- 2>&-
34 [ "$?" = "0" -a -z "$FAILSAFE" ] &&
35 {
36 echo "Login failed."
37 exit 0
38 } || {
39 cat << EOF
40 === IMPORTANT ============================
41 Use 'passwd' to set your login password
42 this will disable telnet and enable SSH
43 ------------------------------------------
44 EOF
45 }
46
47 exec /bin/ash --login