Sorry Nate,

Stephen was concerned about multiple users and or processes attempting to
manage the global lists simultaneously, generally through TMDA-CGI, or the
tmda-pending and tmda-deliver processes. My point was that if you change the
global lists from flat files to CDB or DBM files or a database, the
atomicity of any updates is ensured (I'm not positive about deleting from
the CDB and DBM files when using the optional auto flag).  That is any
updates to the lists occur as all-or-nothing updates which prevent data
corruption from a partial update.  The simplest way to make this change is
in the global incoming and outgoing filters change the from-file statements
to from-file -[auto]CDB|DBM.  To be even more robust, I'd add the -optional
flag as well e.g.

/home/tmda/filters/incoming
from-file -autodbm -optional /home/tmda/confirmed ok
from-file -autodbm -optional /home/tmda/whitelist ok
from-file -autodbm -optional /home/tmda/blacklist drop
include -optional $(USER_FILTER_INCOMING)
<optional post user global actions>

Now if you happen to have a database installed on your server, you could
instead of using the DBM or CDB files as above use the database to store
your address list info by defining the appropriate settings in your global
tmdarc file.  For example to use MySQL for global address lists you could
use the following config with appropriate edits, and the attached sql script
to create the needed database table:

/etc/tmdarc
import MySQLdb
DB_CONNECTION =
MySQLdb.connect(db='databasename',host='localhost',user='databaseuser',passw
d='password')
DB_BARE_APPEND = """INSERT IGNORE INTO TMDALists (ListName, Address, Source)
VALUES ('WhiteList', %(recipient)s, 'BARE APPEND')"""
DB_CONFIRM_APPEND = """INSERT IGNORE INTO TMDALists (ListName, Address,
Source) VALUES ('Confirmed', %(sender)s, 'CONFIRM')"""
SQL_WHITELIST = """SELECT Address, Action, OutAction FROM TMDALists WHERE
ListName in ('WhiteList','Confirmed') AND %(criteria)s ORDER BY Action
DESC"""
SQL_BLACKLIST = """SELECT Address, Action, OutAction FROM TMDALists WHERE
ListName = 'BlackList' AND %(criteria)s ORDER BY Action DESC"""

/home/tmda/filters/incoming
from-sql -addr_column=Address -action_column=Action "${SQL_WHITELIST}" ok
from-sql -addr_column=Address -action_column=Action "${SQL_BLACKLIST}" drop
include -optional $(USER_FILTER_INCOMING)
<optional post user global actions>

/home/tmda/filters/outgoing
to-sql -addr_column=Address -action_column=OutAction "${SQL_WHITELIST}" tag
envelope dated=10d from bare
include -optional $(USER_FILTER_OUTGOING)
<optional post user global actions>

One [dis]advantage of using the database list as above is that TMDA-CGI and
tmda-pending users won't have access to the list for editing, so any
whitelisting, blacklisting, releasing or deleting will only affect their
personal lists or any global flat, CDB or DBM lists.

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Nate Sanders
> Sent: Thursday, October 21, 2004 8:20 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Global lists
> 
> I must say, I think you lost me :-]
> 
> I understand the concern of having multiple users append the 
> same file 
> with no locking. But I'm not sure I follow either of your guys 
> solutions to get around that..
> 
> 
> On Oct 21, 2004, at 10:09 AM, David Grimberg wrote:
> 
> >>>>> On Oct 20, 2004, at 5:51 PM, Nate Sanders wrote:
> >>>>>> .tmda/conf:
> >>>>>> CONFIRM_APPEND = "/home/tmda/confirmed"
> >>>>>> PENDING_BLACKLIST_APPEND = "/home/tmda/blacklist"
> >>>>>> PENDING_WHITELIST_APPEND = "/home/tmda/whitelist"
> >>
> >> I'm not sure this will be reliable - you'll end up with each
> >> user's TMDA
> >> process potentially running in parallel and wishing to update
> >> the lists
> >> at the same time. I don't believe TMDA has the locking
> >> required to make
> >> this work, without the potential for losing data.
> >
> > I'm not sure if t would be reliable using data files either, but I 
> > seem to
> > recall some discussion in the past about the atomicity of the append
> > processes.  If however, your lists are maintained in a database you 
> > could
> > safely use the DB_BARE_APPEND and DB_CONFIRM_APPEND config vars to 
> > maintain
> > the global lists ([auto] CDB and DBM lists may also work 
> for this).  
> > In fact
> > since these would be global lists appended to by all the 
> potential for
> > having a large number of entries is quite good, so a DB based list 
> > would be
> > of benefit.
> >
> > _____________________________________________
> > tmda-users mailing list ([EMAIL PROTECTED])
> > http://tmda.net/lists/listinfo/tmda-users
> >
> ------
> Nate Sanders                   Customer Support Manager
> Sonic Studio, LLC           (763) 577-1535 ext. 2
> 
> RMA Requests - [EMAIL PROTECTED]
> Keyfile Requests - [EMAIL PROTECTED]
> Support Requests - [EMAIL PROTECTED]
> 
> _____________________________________________
> tmda-users mailing list ([EMAIL PROTECTED])
> http://tmda.net/lists/listinfo/tmda-users
> 

Attachment: TMDALists.sql
Description: Binary data

Attachment: tmdarc
Description: Binary data

Attachment: incoming
Description: Binary data

Attachment: outgoing
Description: Binary data

_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to