5 [ "$1" = "configure" ] || exit 0
6 [ $DEBIAN_SCRIPT_DEBUG ] && set -vx
8 # Include CARNet functions
9 . /usr/share/carnet-tools/functions.sh
11 PKG="squirrelmail-change-pass-cn"
13 SQCONFDIR="/etc/squirrelmail"
14 SQCONF="$SQCONFDIR/config.php"
18 # Configure poppassd to refuse connection from all hosts
19 # but localhost (127.0.0.1).
21 if [ ! -f /etc/hosts.deny ]; then
24 if ! egrep -q '^poppassd:' /etc/hosts.deny; then
25 echo "poppassd: ALL" | cp-update "$PKG" /etc/hosts.deny
27 if [ ! -f /etc/hosts.allow ]; then
28 touch /etc/hosts.allow
30 if ! egrep -q '^poppassd:' /etc/hosts.allow; then
31 echo "poppassd: 127.0.0.1" | cp-update "$PKG" /etc/hosts.allow
35 # Enable change_pass plugin in SquirrelMail config.php.
37 if ! egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
38 squirrelmail-configure --install-plugin change_pass
42 # Convert poppassd service from inetd.conf to xinetd.conf type.
43 # Service configuration is saved in /etc/xinetd.d/ directory.
45 if [ -x /etc/init.d/xinetd -a -d /etc/xinetd.d -a -x /usr/sbin/itox ]; then
46 if egrep -q '^poppassd' /etc/inetd.conf && \
47 [ ! -f /etc/xinetd.d/poppassd ]; then
49 cp_echo "CN: Enabling poppassd in /etc/xinetd.d/poppassd"
51 touch /etc/xinetd.d/poppassd.$$
52 grep "^poppassd" /etc/inetd.conf | \
53 itox -daemon_dir /usr/sbin | cp-update "$PKG" /etc/xinetd.d/poppassd.$$
54 cp_mv /etc/xinetd.d/poppassd.$$ /etc/xinetd.d/poppassd
61 # Restart xinetd if needed.
63 if [ $need_restart -eq 1 ]; then
64 if [ -x "/etc/init.d/xinetd" ]; then
65 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
66 invoke-rc.d xinetd restart || exit $?
68 /etc/init.d/xinetd restart || exit $?