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"
20 # Check if configuration file has CARNet package info lines.
21 # return: $RET => 0 - tagged
22 # 1 - file does not exists
23 # 2 - file exists, but it is not tagged
30 if [ -f "$conf_file" ]; then
31 if egrep -q "^## Begin - Generated by CARNet package ${PKG}$" "$conf_file"; then
39 # Configure poppassd to refuse connection from all hosts
40 # but localhost (127.0.0.1).
42 if [ ! -f /etc/hosts.deny ]; then
45 if ! egrep -q '^poppassd:' /etc/hosts.deny; then
46 echo "poppassd: ALL" | cp-update "$PKG" /etc/hosts.deny
48 if [ ! -f /etc/hosts.allow ]; then
49 touch /etc/hosts.allow
51 if ! egrep -q '^poppassd:' /etc/hosts.allow; then
52 echo "poppassd: 127.0.0.1" | cp-update "$PKG" /etc/hosts.allow
56 # Enable change_pass plugin in SquirrelMail config.php.
58 if ! egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
59 squirrelmail-configure --install-plugin change_pass
63 # Convert poppassd service from inetd.conf to xinetd.conf type.
64 # Service configuration is saved in /etc/xinetd.d/ directory.
66 chk_conf_tag /etc/xinetd.d/poppassd
67 if [ $RET -lt 2 ]; then
68 cp_echo "CN: Enabling poppassd in /etc/xinetd.d/poppassd"
70 if [ ! -d /etc/xinetd.d ]; then
71 mkdir -p /etc/xinetd.d/
73 touch /etc/xinetd.d/poppassd.$$
74 cp-update "$PKG" /etc/xinetd.d/poppassd.$$ <<EOF
81 server = /usr/sbin/poppassd
84 cp_mv /etc/xinetd.d/poppassd.$$ /etc/xinetd.d/poppassd
90 # Restart xinetd if needed.
92 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 $?