imapext-2007

annotate APOPtools/pop3-update @ 1:28a55bc1110c

[mq]: imapext
author yuuji@gentei.org
date Mon, 14 Sep 2009 19:23:11 +0900
parents
children d741b3ecc917
rev   line source
yuuji@1 1 #!/bin/sh -
yuuji@1 2 # A sample "POP before SMTP"-enabler script for tcp_wrappers
yuuji@1 3 # This script should be installed in /usr/local/etc
yuuji@1 4 # If you are thinking of using this script on heavily loaded host,
yuuji@1 5 # you had better to choose tcpserver instead of tcp_wrappers.
yuuji@1 6 #
yuuji@1 7 ALLOWTMP="/var/log/ATMP"
yuuji@1 8 if [ -f /usr/local/etc/hosts.allow ]; then
yuuji@1 9 ALLOW="/usr/local/etc/hosts.allow"
yuuji@1 10 else
yuuji@1 11 ALLOW=/etc/hosts.allow
yuuji@1 12 fi
yuuji@1 13 ALLOWSRC=${ALLOW}.src
yuuji@1 14 ALLOWNEW=${ALLOW}.new
yuuji@1 15
yuuji@1 16 # for debug
yuuji@1 17 # (env;echo "1=$1") | Mail -s pop3access yuuji
yuuji@1 18
yuuji@1 19 case $0 in
yuuji@1 20 *record)
yuuji@1 21 echo "tcp-env : $RELAYCLIENT : setenv = RELAYCLIENT" >> $ALLOWTMP.1
yuuji@1 22 ;;
yuuji@1 23 *age)
yuuji@1 24 rm -f $ALLOWTMP.2
yuuji@1 25 [ -f $ALLOWTMP.1 ] && mv -f $ALLOWTMP.1 $ALLOWTMP.2
yuuji@1 26 ;;
yuuji@1 27 *)
yuuji@1 28 # else generate master hosts.allow file
yuuji@1 29 ;;
yuuji@1 30 esac
yuuji@1 31 touch $ALLOWTMP.1 $ALLOWTMP.2
yuuji@1 32 echo "#
yuuji@1 33 # DO NOT EDIT THIS FILE!
yuuji@1 34 # This file is generated from $ALLOWSRC file.
yuuji@1 35 # Edit it!
yuuji@1 36 #" > $ALLOWNEW
yuuji@1 37 (cat $ALLOWTMP.[12] | sort -u; cat $ALLOWSRC) >> $ALLOWNEW
yuuji@1 38 /bin/mv -f $ALLOWNEW $ALLOW
yuuji@1 39
yuuji@1 40 # pop3-{age,update,record} for tcp_wrappers ends here
yuuji@1 41 # The following section is the sample routine for tcpserver(ucsp-tcp)
yuuji@1 42 # If you use tcpserver, replace the above section after "case $0...esac"
yuuji@1 43 # by the following section.
yuuji@1 44 # Sample code was contributed by pirozeau(pirozeau@banana-fish.com).
yuuji@1 45
yuuji@1 46 #TCPREMOTEIP=${TCPREMOTEIP:-undefined}
yuuji@1 47 #RELAYCLIENT=${RELAYCLIENT:-$TCPREMOTEIP}
yuuji@1 48 #ALLOW=/usr/local/etc/smtprule
yuuji@1 49 #case $0 in
yuuji@1 50 # *record)
yuuji@1 51 # echo "$RELAYCLIENT:allow,RELAYCLIENT=\"\"" >> $ALLOWTMP.1
yuuji@1 52 # ;;
yuuji@1 53 # *age)
yuuji@1 54 # rm -f $ALLOWTMP.2
yuuji@1 55 # [ -f $ALLOWTMP.1 ] && mv -f $ALLOWTMP.1 $ALLOWTMP.2
yuuji@1 56 # ;;
yuuji@1 57 # *)
yuuji@1 58 # # else generate master tcprule file
yuuji@1 59 # ;;
yuuji@1 60 #esac
yuuji@1 61 #touch $ALLOWTMP.1 $ALLOWTMP.2
yuuji@1 62 #(cat $ALLOWTMP.[12] | sort -u; cat ${ALLOW}) | /usr/local/bin/tcprules ${ALLOW}.cdb ${ALLOW}.tmp

UW-IMAP'd extensions by yuuji