Hi,
I have made some modifications to the authldaplib.c source in order to have
the option to set a constant prefix to the LDAP_MAILDIR returned value. In
this way I can set a fixed path prefix in the authldaprc file that will be
added to the user specific maildir attribute returned from the LDAP query.
This new authldaprc configuration parameter is LDAP_HOMEDIR_PREFIX.
I made this modification for a better integration with QMail-(with the ldap
patch) using the Maildir format in clustered environment and with large
storage subsystems where Maildirs are located on multiple RAID5 array
filesystems.
Please if you know a better approach let me know.

The patch, applied to the sqwebmail 1.0.2 release, follow:

authldaplib.c
135,137d126
< /* FF 27/10/00 begin */
<         const char *pHomeDirPrefix;
< /* FF 27/10/00 end */
330,333d318
< /* FF 27/10/00 begin */
<   if (!read_env ("LDAP_HOMEDIR_PREFIX",&ldap->pHomeDirPrefix, "", 0,""))
<         return 0;
< /* FF 27/10/00 end */
336d320
<
601,630c585,588
<
< /* @FF-27-10-2000: handle MAILDIR/HOMEDIR relative path */
< /* Copy the directory and the password into struct */
< //  copy_value(my_ldap_fp,entry,attributes[0],&homeDir);
<   {
<     char *pLdapHomeDir;
<     copy_value(my_ldap_fp,entry, attributes[0], &pLdapHomeDir);
<     /* check if a relative path was used */
<     if (pLdapHomeDir) {
<       if (my_ldap.pHomeDirPrefix && *pLdapHomeDir != '/') {
<         homeDir = malloc(strlen(my_ldap.pHomeDirPrefix) +
strlen(pLdapHomeDir) + 1);
<         if (homeDir) {
<           strcpy(homeDir, my_ldap.pHomeDirPrefix);
<           strcat(homeDir, pLdapHomeDir);
<         }
<       }
<       else {
<         homeDir = strdup(pLdapHomeDir);
<       }
<       free(pLdapHomeDir);
<     }
<   }
<   if (attributes[1]) {
<     copy_value(my_ldap_fp,entry,attributes[1],&mailDir);
<   }
<   else {
<     mailDir = strdup(".");
<   }
< /* FF */
<
---
>   /* Copy the directory and the password into struct */
>   copy_value(my_ldap_fp,entry,attributes[0],&homeDir);
>   if (attributes[1])
>           copy_value(my_ldap_fp,entry,attributes[1],&mailDir);



Franco Fiorese
EDS Pubblica Istruzione
Program Office - Technology Policy
+3906-51038272
email: [EMAIL PROTECTED]

Reply via email to