CVS: tmda/bin tmda-rfilter,1.100,1.101 tmda-inject,1.90,1.91 ChangeLog,1.281,1.282
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-serv4926/bin
Modified Files:
tmda-rfilter tmda-inject ChangeLog
Log Message:
Defaults.py: New variables DB_BARE_APPEND and DB_CONFIRM_APPEND.
FilterParser.py: Removed {from,to}-mysql code. Moved
__create_sql_params method to module-level function create_sql_params.
Removed -domains argument and always add the domains into the keys.
Made the domains list contain only unique domains.
Util.py: New function 'db_insert' used by the DB_BARE_APPEND and
DB_CONFIRM_APPEND code.
tmda-inject: Added code to insert recipient into database using the
SQL code in DB_BARE_APPEND if both DB_BARE_APPEND and DB_CONNECTION
are set. Mimics BARE_APPEND functionality.
tmda-rfilter: Added code to insert sender into database using the SQL
code in DB_CONFIRM_APPEND if both DB_CONFIRM_APPEND and DB_CONNECTION
are set. Mimics CONFIRM_APPEND functionality. Made 'sender_list' in
main() contain only unique senders.
filter-sources.ht: Removed {from,to}-mysql documentation, moved
-domains documentation to top, since now it is default behavior.
Index: tmda-rfilter
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-rfilter,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- tmda-rfilter 1 Jul 2003 06:29:51 -0000 1.100
+++ tmda-rfilter 11 Jul 2003 23:02:59 -0000 1.101
@@ -509,16 +509,28 @@
if os.path.exists(confirmed_filepath):
msg = Util.msg_from_file(open(confirmed_filepath, 'r'))
# Optionally append the sender's address to a file.
- if Defaults.CONFIRM_APPEND:
+ if Defaults.CONFIRM_APPEND or Defaults.DB_CONFIRM_APPEND:
confirm_append_addr = Util.confirm_append_address(
parseaddr(msg.get('x-primary-address'))[1],
parseaddr(msg.get('return-path'))[1])
if not confirm_append_addr:
raise IOError, \
confirmed_filepath + ' has no Return-Path header!'
+ if Defaults.CONFIRM_APPEND:
if Util.append_to_file(confirm_append_addr,
Defaults.CONFIRM_APPEND) != 0:
logit('CONFIRM_APPEND ' + Defaults.CONFIRM_APPEND)
+ if Defaults.DB_CONFIRM_APPEND and Defaults.DB_CONNECTION:
+ _username = Defaults.USERNAME.lower()
+ _hostname = Defaults.HOSTNAME.lower()
+ _recipient = _username + '@' + _hostname
+ params = FilterParser.create_sql_params(
+ recipient=_recipient, username=_username,
+ hostname=_hostname, sender=confirm_append_addr)
+ Util.db_insert(Defaults.DB_CONNECTION,
+ Defaults.DB_CONFIRM_APPEND,
+ params)
+ logit('DB_CONFIRM_APPEND ')
# Optionally generate a confirmation acceptance notice.
if Defaults.CONFIRM_ACCEPT_NOTIFY:
if (delivery_status == 'c' and
@@ -762,17 +774,18 @@
# The list of sender e-mail addresses comes from the envelope
# sender, the "From:" header, the "Reply-To:" header, and possibly
# the "X-Primary-Address" header.
- sender_list = [envelope_sender]
+ sender_dict = { envelope_sender: None }
confirm_append_address = Util.confirm_append_address(x_primary_address,
envelope_sender)
if confirm_append_address and confirm_append_address != envelope_sender:
- sender_list.append(confirm_append_address)
+ sender_dict[confirm_append_address] = None
from_list = getaddresses(msgin.get_all('from', []))
replyto_list = getaddresses(msgin.get_all('reply-to', []))
for list in from_list, replyto_list:
for a in list:
emaddy = a[1]
- sender_list.append(emaddy)
+ sender_dict[emaddy] = None
+ sender_list = [ addr.lower() for addr in sender_dict.keys() ]
# Process confirmation messages first.
confirm_done_hdr = msgin.get('x-tmda-confirm-done')
if confirm_done_hdr:
Index: tmda-inject
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-inject,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- tmda-inject 1 Jul 2003 06:29:51 -0000 1.90
+++ tmda-inject 11 Jul 2003 23:02:59 -0000 1.91
@@ -161,9 +161,20 @@
# Use an untagged address.
field = from_address
# Optionally append the recipient address to a file.
- if (cookie_option and string.lower(cookie_option) == 'append'
- and Defaults.BARE_APPEND):
- Util.append_to_file(to_address, Defaults.BARE_APPEND)
+ if cookie_option and cookie_option.lower() == 'append':
+ if Defaults.BARE_APPEND:
+ Util.append_to_file(to_address, Defaults.BARE_APPEND)
+ if Defaults.DB_BARE_APPEND and Defaults.DB_CONNECTION:
+ _username = Defaults.USERNAME.lower()
+ _hostname = Defaults.HOSTNAME.lower()
+ _sender = _username + '@' + _hostname
+ params = FilterParser.create_sql_params(
+ recipient=to_address.lower(),
+ fromheader=from_address.lower(),
+ username=_username, hostname=_hostname, sender=_sender)
+ Util.db_insert(Defaults.DB_CONNECTION,
+ Defaults.DB_BARE_APPEND,
+ params)
elif cookie_type == 'dated':
# Send a message with a tagged (dated) address.
if cookie_option: # check for timeout override
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v
retrieving revision 1.281
retrieving revision 1.282
diff -u -r1.281 -r1.282
--- ChangeLog 5 Jul 2003 00:25:19 -0000 1.281
+++ ChangeLog 11 Jul 2003 23:02:59 -0000 1.282
@@ -1,3 +1,15 @@
+2003-07-11 Tim Legant <[email protected]>
+
+ * tmda-inject (make_field): Added code to insert recipient into
+ database using the SQL code in DB_BARE_APPEND if both
+ DB_BARE_APPEND and DB_CONNECTION are set. Mimics BARE_APPEND
+ functionality.
+
+ * tmda-rfilter (verify_confirm_cookie): Added code to insert
+ sender into database using the SQL code in DB_CONFIRM_APPEND if
+ both DB_CONFIRM_APPEND and DB_CONNECTION are set. Mimics
+ CONFIRM_APPEND functionality.
+
2003-07-01 Tim Legant <[email protected]>
* tmda-rfilter (main): Create FilterParser with DB_CONNECTION.
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs