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