5 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] Maildrop LDAP default...
FromSent OnAttachments
Jean-Rene CormierJul 22, 2004 5:32 am 
Tony EarnshawJul 22, 2004 8:29 am 
Jean-Rene CormierJul 22, 2004 10:46 am 
Joey O'DohertyJul 22, 2004 9:35 pm.gz
Jean-Rene CormierJul 23, 2004 5:54 am.patch
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:Re: [maildropl] Maildrop LDAP default maildir_attrActions...
From:Jean-Rene Cormier (jean@cipanb.ca)
Date:Jul 23, 2004 5:54:47 am
List:net.sourceforge.lists.courier-maildrop
Attachments:

On Fri, 2004-07-23 at 00:35 -0400, Joey O'Doherty wrote:

On Thu, 22 Jul 2004, Jean-Rene Cormier wrote:

[snip]

Yes I know that, I use the Courier schema with the mailbox but I'd like to not have to set it to Maildir/ for my virtual domain users in the OpenLDAP directory and instead use Maildir/ as a default

While this is not exactly what you are looking for, I wrote a small patch to define a default home directory attribute. I did this so I could have a home directory defined in LDAP for posix accounts (homeDirectory), and a default home directory defined for all virtual users.

(Strictly speaking I implemented a default_homedirectory_attr. This let me set the homedir for virtual users to equivalent to their maildir but let posix users use their real homedir. I did this so I could do fun things like deliver all virtual mail as a vmail user but deliver posix mail as the proper uid and still ensure that .mailfilter files would have the correct permissions for each type of delivery. The other solution would have been to write a custom LDAP schema.)

The patch, which I attach for posterity, is all of 43 lines, so a similar solution could be equally trivial in your case.

Thanks a lot! By studying your patch I've been able to create one that does what I want. Your patch told me almost exactly where to add code so it was pretty easy to do. This is my first patch and I've attached it in case it can help someone. All it does is add a "default_maildir" configuration directive so you don't need to specify it in your LDAP directory for every users.

-- Jean-Rene Cormier <jean@cipanb.ca>

diff -urN maildrop-1.6.3/maildrop/mdldap.c maildrop-1.6.3.new/maildrop/mdldap.c --- maildrop-1.6.3/maildrop/mdldap.c 2002-06-09 12:26:19.000000000 -0300 +++ maildrop-1.6.3.new/maildrop/mdldap.c 2004-07-23 09:33:25.322213306 -0300 @@ -97,8 +97,8 @@ rec->maildir = strdup(values[0]); ldap_value_free(values); } else - rec->maildir = NULL; - + rec->maildir = cfg->default_maildir; +

values=ldap_get_values(ldap,entry,cfg->mail_attr); if ( ldap_count_values(values) > 0 ) { diff -urN maildrop-1.6.3/maildrop/mdldapconfig.c
maildrop-1.6.3.new/maildrop/mdldapconfig.c --- maildrop-1.6.3/maildrop/mdldapconfig.c 2003-10-10 22:06:17.000000000 -0300 +++ maildrop-1.6.3.new/maildrop/mdldapconfig.c 2004-07-23 09:29:21.483549992
-0300 @@ -29,6 +29,7 @@ cfg->uidnumber_attr = NULL; cfg->gidnumber_attr = NULL; cfg->maildir_attr = NULL; + cfg->default_maildir = NULL; cfg->homedirectory_attr = NULL;

cfg->port = LDAP_DEFAULT_PORT; @@ -80,6 +81,8 @@ cfg->gidnumber_attr = (char*)strdup(val); if ( !strcasecmp(var,"maildir_attr") ) cfg->maildir_attr = (char*)strdup(val); + if ( !strcasecmp(var,"default_maildir") ) + cfg->default_maildir = (char*)strdup(val); if ( !strcasecmp(var,"homedirectory_attr") ) cfg->homedirectory_attr = (char*)strdup(val); if ( !strcasecmp(var,"quota_attr") ) diff -urN maildrop-1.6.3/maildrop/mdldapconfig.h
maildrop-1.6.3.new/maildrop/mdldapconfig.h --- maildrop-1.6.3/maildrop/mdldapconfig.h 2001-01-28 15:59:20.000000000 -0400 +++ maildrop-1.6.3.new/maildrop/mdldapconfig.h 2004-07-23 09:29:33.247086344
-0300 @@ -31,6 +31,7 @@ char *uidnumber_attr; char *gidnumber_attr; char *maildir_attr; + char *default_maildir; char *homedirectory_attr; char *quota_attr;