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"
15 SQCPCONF="$SQCONFDIR/config_change_pass.php"
16 CPCONF="/usr/share/squirrelmail/plugins/change_pass/config.php"
21 # Configure poppassd to refuse connection from all hosts
22 # but localhost (127.0.0.1).
24 if [ ! -f /etc/hosts.deny ]; then
27 if ! egrep -q '^poppassd:' /etc/hosts.deny; then
28 echo "poppassd: ALL" | cp-update "$PKG" /etc/hosts.deny
30 if [ ! -f /etc/hosts.allow ]; then
31 touch /etc/hosts.allow
33 if ! egrep -q '^poppassd:' /etc/hosts.allow; then
34 echo "poppassd: 127.0.0.1" | cp-update "$PKG" /etc/hosts.allow
38 # First of all, do the backup.
41 for cpconf_file in $SQCPCONF $CPCONF; do
42 if [ -f "$cpconf_file" ] && [ ! -L "$cpconf_file" ]; then
43 cp_echo "CN: Doing backup for $cpconf_file"
44 cp_backup_conffile -d "/var/backups/$PKG" -p $cpconf_file
48 if [ $done_backup -eq 1 ]; then
49 cp_echo "CN: Backup is located in directory: /var/backups/$PKG/"
53 # Enable change_pass plugin in SquirrelMail config.php.
55 if ! egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
56 /usr/sbin/squirrelmail-configure --install-plugin change_pass
60 # Convert poppassd service from inetd.conf to xinetd.conf type.
61 # Service configuration is saved in /etc/xinetd.d/ directory.
63 if [ -x /etc/init.d/xinetd -a -d /etc/xinetd.d -a -x /usr/sbin/itox ]; then
65 if egrep -q '^poppassd' /etc/inetd.conf && \
66 [ ! -f /etc/xinetd.d/poppassd ]; then
68 cp_echo "CN: Enabling poppassd in /etc/xinetd.d/poppassd"
70 touch /etc/xinetd.d/poppassd.$$
71 grep "^poppassd" /etc/inetd.conf | \
72 itox -daemon_dir /usr/sbin | cp-update "$PKG" /etc/xinetd.d/poppassd.$$
73 cp_mv /etc/xinetd.d/poppassd.$$ /etc/xinetd.d/poppassd
80 # Restart xinetd if needed.
82 if [ $need_restart -eq 1 ]; then
84 if [ -x "/etc/init.d/xinetd" ]; then
85 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
86 invoke-rc.d xinetd restart || exit $?
88 /etc/init.d/xinetd restart || exit $?