CVS: tmda/bin ChangeLog,1.276,1.277 tmda-ofmipd,1.37,1.38
Gre7g Luterman <[email protected]>
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tmda/tmda/bin In directory sc8-pr-cvs1:/tmp/cvs-serv711 Modified Files: ChangeLog tmda-ofmipd Log Message: tmda-ofmipd: Added a new -t parameter which lets you set a "throttle" script. The script is called whenever a user tries to send mail (it is passed the sender's authentication user name) and may return 0 to permit or non-0 to prevent tofmipd from sending mail. Index: ChangeLog =================================================================== RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v retrieving revision 1.276 retrieving revision 1.277 diff -u -r1.276 -r1.277 --- ChangeLog 9 Jun 2003 02:20:51 -0000 1.276 +++ ChangeLog 15 Jun 2003 17:27:24 -0000 1.277 @@ -1,3 +1,10 @@ +2003-06-15 Gre7g Luterman <[email protected]> + + * tmda-ofmipd: Added a new -t parameter which lets you set a "throttle" + script. The script is called whenever a user tries to send mail + (it is passed the sender's authentication user name) and may return + 0 to permit or non-0 to prevent tofmipd from sending mail. + 2003-06-08 Jason R. Mastaler <[email protected]> * tmda-rfilter (bouncegen): Add a 'template' function parameter, Index: tmda-ofmipd =================================================================== RCS file: /cvsroot/tmda/tmda/bin/tmda-ofmipd,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- tmda-ofmipd 9 Jun 2003 22:10:52 -0000 1.37 +++ tmda-ofmipd 15 Jun 2003 17:27:24 -0000 1.38 @@ -157,7 +157,14 @@ NOTE: This is only used when you have a qmail installation with virtual domains using the VMailMgr add-on. It implies that you will also set - the --vhome-script parameter above.""" + the --vhome-script parameter above. + + -t <script> + --throttle-script <script> + Full pathname of a script which can meter how much mail any user sends. + The script is passed a login name whenever a user tries to send mail. + If the script returns a 0, the message is allowed. For any other + value, the message is rejected.""" import getopt import os @@ -205,6 +212,7 @@ connections = 20 vhomescript = None vdomainspath = '/var/qmail/control/virtualdomains' +throttlescript = None if os.getuid() == 0: running_as_root = 1 @@ -253,7 +261,7 @@ try: opts, args = getopt.getopt(sys.argv[1:], - 'p:u:a:R:A:Fc:C:dVhfbS:v:', ['proxyport=', + 'p:u:a:R:A:Fc:C:dVhfbS:v:t:', ['proxyport=', 'username=', 'authfile=', 'remoteauth=', @@ -267,7 +275,8 @@ 'foreground', 'background', 'vhome-script=', - 'vdomains-path=']) + 'vdomains-path=', + 'throttle-script=']) except getopt.error, msg: usage(1, msg) @@ -334,6 +343,8 @@ vhomescript = arg elif opt in ('-v', '--vdomains-path'): vdomainspath = arg + elif opt in ('-t', '--throttle-script'): + throttlescript = arg if vhomescript and configdir: msg = "WARNING: --vhome-script and --config-dir are incompatible." + \ @@ -826,11 +837,17 @@ else: data.append(text) self.__data = NEWLINE.join(data) - status = self.__server.process_message(self.__peer, - self.__mailfrom, - self.__rcpttos, - self.__data, - self.__auth_username) + + if not throttlescript or not os.system("%s %s" % (throttlescript, + self.__auth_username)): + status = self.__server.process_message(self.__peer, + self.__mailfrom, + self.__rcpttos, + self.__data, + self.__auth_username) + else: + status = self.push('450 Outgoing mail quota exceeded') + self.__rcpttos = [] self.__mailfrom = None self.__state = self.COMMAND _______________________________________ tmda-cvs mailing list http://tmda.net/lists/listinfo/tmda-cvs