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