CVS: tmda/bin ChangeLog,1.277,1.278 tmda-rfilter,1.96,1.97
Timothy Legant <[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-serv13428/bin Modified Files: ChangeLog tmda-rfilter Log Message: Call new function setvuserhomedir during argument processing if the -S (--vhome-script) flag is given to update $HOME with the virtual user's home directory. Also, a small fix to make wildcard domains in VIRTUALDOMAINS work properly. Index: ChangeLog =================================================================== RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v retrieving revision 1.277 retrieving revision 1.278 diff -u -r1.277 -r1.278 --- ChangeLog 15 Jun 2003 17:27:24 -0000 1.277 +++ ChangeLog 18 Jun 2003 03:39:52 -0000 1.278 @@ -1,3 +1,12 @@ +2003-06-17 Tim Legant <[email protected]> + + * tmda-rfilter (setvuserhomedir): New function. Called during + argument processing if the -S (--vhome-script) flag is given to + update $HOME with the virtual user's home directory. + + * tmda-rfilter (USEVIRTUALDOMAINS): Small fix to make wildcard + domains in VIRTUALDOMAINS work properly. + 2003-06-15 Gre7g Luterman <[email protected]> * tmda-ofmipd: Added a new -t parameter which lets you set a "throttle" Index: tmda-rfilter =================================================================== RCS file: /cvsroot/tmda/tmda/bin/tmda-rfilter,v retrieving revision 1.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- tmda-rfilter 9 Jun 2003 02:20:52 -0000 1.96 +++ tmda-rfilter 18 Jun 2003 03:39:52 -0000 1.97 @@ -81,14 +81,37 @@ if msg: print msg sys.exit(code) - + +# If -S / --vhome-script flag is given on command line, use it to determine the +# virtual user's home directory and set $HOME to that, so that '~' refers to +# the virtual user's home directory and not the domain directory. +def setvuserhomedir(vhomescript): + """Set $HOME to the recipient's (virtual user) home directory.""" + host = os.environ['HOST'] + parts = os.environ['EXT'].split('-confirm-', 1)[0].split('-') + cmd = vhomescript + ' "%s"' + ' "%s"' % (host,) + username = '' + for part in parts: + username += part + fpin = os.popen(cmd % (username,)) + vuserhomedir = fpin.read().strip() + if fpin.close() is None: + os.environ['HOME'] = vuserhomedir + os.chdir(vuserhomedir) + break + else: + username += '-' + else: # didn't find username + sys.exit(0) + try: opts, args = getopt.getopt(sys.argv[1:], - 'c:dt:I:M:Vh', ['config-file=', + 'c:dt:I:M:S:Vh', ['config-file=', 'discard', 'template-dir=', 'filter-incoming-file=', 'filter-match=', + 'vhome-script=', 'version', 'help']) except getopt.error, msg: @@ -113,6 +136,9 @@ discard = 1 elif opt in ('-c', '--config-file'): os.environ['TMDARC'] = arg + elif opt in ('-S', '--vhome-script'): + if os.environ.has_key('EXT') and os.environ.has_key('HOST'): + setvuserhomedir(arg) from TMDA import Defaults @@ -233,7 +259,7 @@ vdomain_match = 1 # .domain:prepend (wildcard) elif not vdomain.split('.', 1)[0]: - if odomain.lower().find(vdomain) != 1: + if odomain.lower().find(vdomain) != -1: vdomain_match = 1 # user@domain:prepend else: _______________________________________ tmda-cvs mailing list http://tmda.net/lists/listinfo/tmda-cvs