summaryrefslogtreecommitdiffstats
path: root/package/busybox/files/telnet
blob: b8823379b9a8e1c61546090c7527447fe9aa5275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2010 OpenWrt.org
START=50

has_root_pwd() {
	local pwd=$([ -f "$1" ] && cat "$1")
	      pwd="${pwd#*root:}"
	      pwd="${pwd%%:*}"

	test -n "${pwd#!}"
}

start() {
	if ( ! has_root_pwd /etc/passwd && ! has_root_pwd /etc/shadow ) || \
	   ( [ ! -x /usr/sbin/dropbear ] && [ ! -x /usr/sbin/sshd ] );
	then
		telnetd -l /bin/login.sh
	fi
}

stop() {
	killall telnetd 2>/dev/null
}