#!/bin/sh

. /etc/control.d/functions

BINARY=/usr/bin/passwd
CONFIG=/etc/pam.d/passwd

new_summary "passwd utility for updating passwords using PAM"

new_fmode tcb 2711 root shadow
new_fmode traditional 4711 root root
new_fmode restricted 700 root root

new_help tcb "Any user can change his own password using $BINARY when tcb scheme is enabled"
new_help traditional "Any user can change his own password using $BINARY when tcb scheme is disabled"
new_help restricted "Only root may change users passwords using $BINARY"

# Backwards compatibility
test "$*" = public && set - tcb

control_fmode "$BINARY" "$*" || exit 1
is_builtin_mode "$*" && exit 0

new_fmode tcb_config 640 root shadow
new_fmode traditional_config 600 root root
new_fmode restricted_config 600 root root

control_fmode "$CONFIG" "$*_config" || exit 1
