"Juergen Georgi" <georgi(_at_)belwue(_dot_)de> writes:
I wonder if someone has modified procmail to support
a hashed mail directory with filter mode. Let me explain:
Not that I know of.
I'm using procmail in a special sendmail mailer definition
for POP users without UNIX accounts. This POP mailer calls
"procmail -m rcfile $f $u" with the rcfile
# /etc/procmailrcs/rc.pop
MAILDIR=/var/pop # Mailspool
FROM=$1 # Sender (in case we do forwarding)
DEFAULT=$2 # Recipient
MAILDIR will be very populated so I'd like to have a hashed
MAILDIR similar to procmail's MAILSPOOLHASH. I can't use
MAILSPOOLHASH since it only works in delivery mode (procmail -d $u).
Of course I could use an external program to spit out the
desired file name for $DEFAULT, but I would rather avoid this.
I imagine something like
MAILDIR=/var/pop # Mailspool
MAILDIRHASH=2 # $MAILDIR/f/o/foobar
FROM=$1 # Sender (in case we do forwarding)
DEFAULT=$2 # Recipient
which a) automatically delivers to "f/o/foobar" when DEFAULT is set
to "foobar" and b) creates missing directories in MAILDIR on the fly.
Can you live with precreating all but one level of the heirarchy, and then
the cost of a fork/exec?
SPOOLDIR = /var/pop
FROM = $1
RCPT = $2
:0
* RCPT ?? ^^\/.
{ DIR = "$SPOOLDIR/$MATCH" }
:0
* RCPT ?? ^^.\/.
{ DIR = "$DIR/$MATCH" }
:E
{ # Username was only one character long. What's the name
# of their mailbox? We'll just give up.
EXITCODE = 73 # EX_CANTCREAT
HOST
}
:0
* ! ? test -d $DIR
* ! ? mkdir $DIR
{ # The directory didn't exist and we couldn't create it. Bail!
EXITCODE = 73 # EX_CANTCREAT
HOST
}
DEFAULT = "$DIR/$RCPT"
If you want it in C, then I would suggest hacking authenticate.c to
create a procmail binary that acts like everyone has the same uid, and
then just use deliverymode. This was discussed a week or two ago when
someone was asking about using an SQL database for virtualhost users.
Try looking for that thread in the archive:
http://www.xray.mpe.mpg.de/mailing-lists/procmail/
Philip Guenther