8 messages in net.sourceforge.lists.courier-maildrop[maildropl] Problems with autocreatio...
FromSent OnAttachments
Saulo Calixto BonfimMar 5, 2004 2:24 pm 
Bernhard SchmidtMar 6, 2004 6:33 am 
cue...@saulo.eti.brMar 6, 2004 2:48 pm 
Bernhard SchmidtMar 7, 2004 2:29 am 
Saulo Calixto BonfimMar 8, 2004 12:48 pm 
Bernhard SchmidtMar 9, 2004 4:28 am 
Saulo Calixto BonfimMar 9, 2004 5:50 am 
Bernhard SchmidtMar 9, 2004 6:09 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[maildropl] Problems with autocreation of maildirActions...
From:Saulo Calixto Bonfim (cue@saulo.eti.br)
Date:Mar 5, 2004 2:24:42 pm
List:net.sourceforge.lists.courier-maildrop

Greets from Brazil,

I know it is a old known issue and already had been discuted here, but actually I see no way for solving my problem, so I joined your mailing list searching for some help.

My mail server have Postfix 2.0.18, Courier Imap 2.2.1, virtual domains with MySQL lookups, maildrop 1.6.3 with quota extension and Virtual user database via MySQL extension enabled. The user's mail are stored at /var/spool/mail/domain.tld/user/Maildir.

It was working smoothly without maildrop when I needed creating new users via mysql. The Postfix virtual delivery agent was creating maildirs perfectly. When I switched out the transport table for "maildrop:", mail was delivered normally and the quota feature was running without any problems. The only problem was the same as other people: Maildirs wasn't being created when new users were add in mysql db.

I've googled for few days and discovered that maildrop actually is unable to create maildir for virtual users. Some people said to patch courier imap's source so it would be capable to create nonexisting maildirs with the very first login from the user. Other people said to use maildroprc file to make the job.

Following the instructions written by Ajai Khattri in http://sourceforge.net/mailarchive/message.php?msg_id=2446278 I tried to use the default /etc/maildroprc script for creating maildirs 'on demand' for new users.

cat /etc/maildroprc ############################################### # make sure Maildir exists `test -d $HOME/Maildir/` if( $RETURNCODE == 1 ) { `mkdir -p $HOME` `maildirmake $HOME/Maildir/` } ###############################################

It didn't work. Seems like maildrop can't get the $HOME variable from SQL database when the directory isn't created in the machine. For testing purposals, I've replaced the mkdir and maildirmake commands with a simple command, like `echo $HOME > /tmp/output` to be sure that maildrop was getting the $HOME variable correctly. When I tried to mail a user that have the Maildir created, the file /tmp/output shows me the path for its maildir correctly (/var/spool/mail/domain.tld/userwithmaildir). But when I mail a user that don't have maildir created, the output is not generated; I was expecting /var/spool/mail/domain.tld/userwithoutmaildir but the /tmp/output file has null content.

So I tried to use another configuration and used the patch at http://www.commedia.it/ccontavalli/#courier I used the courier_0.44.2.diff patch against the source of Courier Imap. But that's the oputput of pop3d log when tried to login with a non-existing maildir account:

Mar 5 15:26:26 p4 pop3d: after running '/sbin/modcreator', chdir '/var/spool/mail/domain.tld/userwithoutmaildir': No such file or directory

Here's the output of /sbin/modcreator #################################################################### #!/bin/bash

maildir=$1 mkdir -p $maildir chown -R $UID:mail $maildir

logger -p auth.notice -t courier Automagically created homedir "$1"\ for uid "$UID" aka "$AUTHADDR". ####################################################################

At last I've tried Marcio Merlone's solution at http://sourceforge.net/mailarchive/message.php?msg_id=2446278

Content of /etc/maildroprc:

`/etc/script $HOME`

Content of /etc/script: ##################################################################################### #!/bin/sh # # Script for use with Carlo Contavalli's courier patch # for automgic maildir creation uppon pop/imap login # http://www.commedia.it/ccontavalli/#courier # # This script assumes a static uid:gid mapping for virtual mail users. # and can be run by hand on command prompt passing a maildir as # argument. # # Script grown by Marcio Merlone (mm@su...) based on suggested # script on Carlo's online docs.

# Customize these lines for your needs! staticuid="vmail" staticgid="mail" LOGGER=/usr/bin/logger MDIRMAKE=/usr/local/bin/maildirmake

# Hopefully you don't need to customize any further.

maildir=$1

# Check for arguments. [ -z "$1" ] && printf "Use: `basename $0` <dir>\n" && exit 0

child=`basename $1` parent=`echo $1|sed 's/'${child}'//g'`

# Check for parent dirs (useful for setups for virtual # mailboxes with domain as # /virtual/domain/id/Maildir or something like this... if [ ! -d "$1" ]; then echo "Directory "$parent" does not exists, creating..." mkdir -p $parent $LOGGER -p auth.notice -t courier "Directory "$parent" automagic created." fi

echo $parent" "$child

# Finally creates the maildir. $MDIRMAKE $maildir && $LOGGER -p auth.notice -t courier "Maildir "$parent"/"$child" for uid "$UID" aka "$AUTHADDR" automagiclly created." chown -R $staticuid:$staticgid $maildir chmod -R g+rx $maildir ####################################################################################

Sorry about the long mail, but I really can't figure out how the heck I can get rid of this problem. This thing is driving me nuts. Any help would be greatly appreciated.

TIA and sorry about the poor english,