P Bielecki writes:
On 8/11/07, Sam Varshavchik <[EMAIL PROTECTED]> wrote:> So what is th best way to create homedirs for virtual users and use > Maildrop too?Change whatever script you use to add LDAP records for new mail accounts to also create all the necessary directories, as part of the account creation process. This is the correct way to implement it. You're creating a mail account. You do that by adding the appropriate account metadata into the LDAP directory, and creating the account's home directory and maildir. That makes sense. It doesn't make any sense, whatsoever, to do only half the job, instead, and expect the other half to be done by your mail software. No sense, whatsoever.Sam, thanks for your message. Certainly, I will try to implement it as you advice me to. On some occasions, though, it's not always possible to do everything in the right way and as long as it works and is flexible enough to work with it's ok. On the top of you head, do you think of any other issues that I may have when I change authldaplib.c applying my small "patch"? I did tested today on few user accounts and it seams to do the job what I wanted. (FreeBSD 6.2,courier authlib ldap 0.59.3,courier imap 4.1.1,1) /* start code /* --- authldaplib.c.orig Sat Jan 20 17:03:22 2007 +++ authldaplib.c Mon Aug 13 12:02:41 2007 @@ -1467,6 +1467,24 @@ homeDir=new_mailroot; } } + else + { + if (my_ldap.mailroot != 0 && *my_ldap.mailroot) + { + char *new_mailroot=malloc(strlen(my_ldap.mailroot)); + + if (!new_mailroot) + { + perror("CRIT: authldap: malloc failed"); + rc= -1; + } + else + { + strcpy(new_mailroot, my_ldap.mailroot); + homeDir=new_mailroot; + } + } + } j=1; /* end code */
You need to profile this code to make sure that it's not going to leak memory, either from the newly-allocated buffer, or from the buffer that it replaced. Remember, that authdaemon is a persistent process. I do not recall offhand if the callback function deallocated the memory, probably does not. Which means that each authentication request is going to allocate memory that will never be freed, so after a while you're going to blow out your memory.
pgpCJKROQWdpV.pgp
Description: PGP signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ courier-users mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
