OFFTOPIC (Was: Re: mail filter in python?)

Gerrit Holl gerrit.holl at pobox.com
Mon Feb 7 14:36:45 EST 2000


Thomas Wouters wrote on 949942343:
> On Mon, Feb 07, 2000 at 05:01:56PM +0100, Gerrit Holl wrote:
> > File locking isn't hard to implement, what kind of security checks do you
> > mean? Python is portable so that's not a problem.
> 
> File locking _is_ hard to implement, in a portable, secure, race-proof
> manner. flock()/lockf()/O_EXCL are the easiest ways of locking, but are not
> very portable, and are likely not to work on some filesystems (like NFS).
> Also, some NFS servers and clients do their best to do NFS locking in a
> secure way, but most do not succeed, or succeed at the cost of stability and
> speed.

Oh, sorry. I thought you could just create a file called ".filename.lock"
and remove it when you're ready, in a try: ... finally: ... clause?

> There is a fairly portable way of locking, even over NFS, using hard links
> between lockfiles, but it is tricky to implement. See the mailman-developers
> archive on www.python.org/pipermail/mailman-developers, there should be a
> few recent postings by me about locking.

I don't see the point.

> > >    It would be hard to reimplement all that from scratch :(
> > 
> > I don't think so. Security is not an issue, the command runs under the
> > right uid.
> 
> That depends on how/where you install it. It usually has to run with
> mail-gid permissions, for instance. All in all, i think you're better off
> with a frontend to procmail, which creates a procmailrc to your liking. Or
> perhaps you can use the powers of procmail to make it start a python script
> to do the filtering, and accepts the action from it -- it would then take
> care of locking, security and the mailbox format itself.

Suse:
20:33:54:tty7:gerrit at stopcontact:~$ ls -l $(type -p procmail)
-rwxr-xr-x   1 root     root        68596 aug  7  1999 /usr/bin/procmail*
Redhat, Stampede:
20:36:17:0:gerrit at humbolt:~$ ls -l $(type -p procmail)
-rwsr-sr-x   1 root     mail        55088 Jan 25  1998 /usr/bin/procmail*

regards,
Gerrit.

-- 
homepage: http://www.nl.linux.org/~gerrit
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O
!M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth




More information about the Python-list mailing list