5 [ "$1" = "configure" ] || exit 0
6 [ $DEBIAN_SCRIPT_DEBUG ] && set -vx
9 PKG="squirrelmail-change-pass-cn"
11 SQCONFDIR="/etc/squirrelmail"
12 SQCONF="$SQCONFDIR/config.php"
13 SQCPCONF="$SQCONFDIR/config_change_pass.php"
14 CPCONF="/usr/share/squirrelmail/plugins/change_pass/config.php"
18 # Include CARNet functions
19 . /usr/share/carnet-tools/functions.sh
22 # Configure poppassd to refuse connection from all hosts
23 # but localhost (127.0.0.1).
25 if [ ! -f /etc/hosts.deny ]; then
28 if ! egrep -q '^poppassd:' /etc/hosts.deny; then
29 echo "poppassd: ALL" | cp-update "$PKG" /etc/hosts.deny
31 if [ ! -f /etc/hosts.allow ]; then
32 touch /etc/hosts.allow
34 if ! egrep -q '^poppassd:' /etc/hosts.allow; then
35 echo "poppassd: 127.0.0.1" | cp-update "$PKG" /etc/hosts.allow
39 # Configure SquirrelMail change_pass plugin - using defaults,
40 # no configuration files.
42 if [ "$2" ] && dpkg --compare-versions $2 lt $VERSION; then
43 cp_echo "CN: This version of change_pass plugin contains major changes."
44 cp_echo "CN: For detailed description, see documentation in /usr/share/doc/$PKG/."
46 if [ -f "$SQCPCONF" ]; then
47 mv -f "$SQCPCONF" "$SQCPCONF.cn-old"
48 cp_echo "CN: Old $SQCPCONF disabled and renamed to $SQCPCONF.cn-old."
50 if [ -f "$CPCONF" ]; then
51 mv -f "$CPCONF" "$CPCONF.cn-old"
52 cp_echo "CN: Old $CPCONF disabled and renamed to $CPCONF.cn-old."
56 # Enable change_pass plugin in SquirrelMail config.php.
58 if ! egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
60 if cp_check_and_backup "$SQCONF"; then
61 cp_echo "CN: Old $SQCONF saved as \"/var/backups/${SQCONF##*/}.bak\"."
64 cp_echo "CN: Enabling SquirrelMail change_pass plugin in $SQCONF"
65 /usr/sbin/squirrelmail-configure --install-plugin change_pass
69 # Convert poppassd service from inetd.conf to xinetd.conf type.
70 # Service configuration is saved in /etc/xinetd.d/ directory.
72 if [ -x /etc/init.d/xinetd -a -d /etc/xinetd.d -a -x /usr/sbin/itox ]; then
74 if egrep -q '^poppassd' /etc/inetd.conf && \
75 [ ! -f /etc/xinetd.d/poppassd ]; then
77 cp_echo "CN: Enabling poppassd in /etc/xinetd.d/poppassd"
79 touch /etc/xinetd.d/poppassd.$$
80 grep "^poppassd" /etc/inetd.conf | \
81 itox -daemon_dir /usr/sbin | cp-update "$PKG" /etc/xinetd.d/poppassd.$$
82 cp_mv /etc/xinetd.d/poppassd.$$ /etc/xinetd.d/poppassd
89 # Restart xinetd if needed.
91 if [ $need_restart -eq 1 ]; then
93 if [ -x "/etc/init.d/xinetd" ]; then
94 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
95 invoke-rc.d xinetd restart || exit $?
97 /etc/init.d/xinetd restart || exit $?