#!/bin/sh

. /etc/control.d/functions

BINARY_RSHD=/usr/sbin/in.rshd
BINARY_REXECD=/usr/sbin/in.rexecd
BINARY_RLOGIND=/usr/sbin/in.rlogind
BINARIES="$BINARY_RSHD $BINARY_REXECD $BINARY_RLOGIND"

new_help enabled "Execution enabled for $BINARIES"
new_help disabled "Execution disabled for $BINARIES"

new_fmode enabled 711 root root
new_fmode disabled 600 root root

if is_builtin_mode "$*"; then
	case "$*" in
	status|'')	# if there's more than a line it's a question...
		for f in $BINARIES; do
			control_fmode "$f" status || exit 1
		done | sort -u | sed 'N; { s/.*\n.*/unknown/; }'
		;;
	*)
		control_fmode "$BINARY_RSHD" "$*"
		;;
	esac
else
	for f in $BINARIES; do
		control_fmode "$f" "$*" || exit 1
	done
fi
