Sam Varshavchik <[email protected]> (Sun Mar 13 20:34:33 2011):
> Heiko Schlittermann writes:
> 
> >> Courier itself will use the quota, whether it comes from userdb or
> >> from somewhere else. If Courier runs an external mail delivery
> >> agent, it sets MAILDIRQUOTA and leaves it up to the external mail
> >> delivery agent to use it.
> >
> >It looks as if the imapd/popd never gets passed the quota setting from
> >the userdb. Seems to be the locical conclusion, if we suppose, that
> >Courier will find the current active quota settings in the first line of
> >the maildirsize file.
> 
> That does look like the issue here. There is code in imapd that
> reads and uses MAILDIRQUOTA from the environment, if it's set, but
> there's nothing that explicitly sets it; it predates the current
> authentication architecture where this was done differently.
> 
> But I do see that the quota data should be available to imaplogin.
> This should be fixable, I'll look into it.

I did it, but unfortunely restructred the source a bit…

diff --git a/imap/imaplogin.c b/imap/imaplogin.c
--- a/imap/imaplogin.c
+++ b/imap/imaplogin.c
@@ -211,36 +211,33 @@
        {
                p=malloc(sizeof("OPTIONS=") + strlen(ainfo->options ?
                                                     ainfo->options:""));
+               if (!p) return(rc);
+               strcat(strcpy(p, "OPTIONS="), ainfo->options ? 
ainfo->options:"");
+               putenv(p);
 
-               if (p)
-               {
-                       strcat(strcpy(p, "OPTIONS="),
-                              ainfo->options ? ainfo->options:"");
+               p=malloc(sizeof("IMAPLOGINTAG=") + strlen(tag));
+               if (!p) return(rc);
+               strcat(strcpy(p, "IMAPLOGINTAG="), tag);
+               putenv(p);
+
+               p=malloc(sizeof("AUTHENTICATED=") + strlen(ainfo->address));
+               if (!p) return(rc);
+               strcat(strcpy(p, "AUTHENTICATED="), ainfo->address);
+               putenv(p);
+
+               if (ainfo->quota) {
+                       p=malloc(sizeof("MAILDIRQUOTA=") + 
strlen(ainfo->quota));
+                       if (!p) return(rc);
+                       strcat(strcpy(p, "MAILDIRQUOTA="), ainfo->quota);
                        putenv(p);
+               }
 
-                       p=malloc(sizeof("IMAPLOGINTAG=")+strlen(tag));
-                       if (p)
-                       {
-                               strcat(strcpy(p, "IMAPLOGINTAG="), tag);
-                               putenv(p);
-
-                               p=malloc(sizeof("AUTHENTICATED=")+
-                                        strlen(ainfo->address));
-                               if (p)
-                               {
-                                       strcat(strcpy(p, "AUTHENTICATED="),
-                                              ainfo->address);
-                                       putenv(p);
-                                       alarm(0);
-                                       execl(imapd, imapd,
-                                             ainfo->maildir ?
-                                             ainfo->maildir:defaultmaildir,
-                                             NULL);
-                                       fprintf(stderr, "ERR: exec(%s) 
failed!!\n",
-                                                                imapd);
-                               }
-                       }
-               }
+               alarm(0);
+               execl(imapd, imapd,
+                                       ainfo->maildir ?
+                                       ainfo->maildir:defaultmaildir,
+                                       NULL);
+               fprintf(stderr, "ERR: exec(%s) failed!!\n", imapd);
        }
 
        return(rc);
diff --git a/imap/pop3login.c b/imap/pop3login.c
--- a/imap/pop3login.c
+++ b/imap/pop3login.c
@@ -192,32 +192,31 @@
 
        if (rc == 0)
        {
-               char *p=malloc(sizeof("OPTIONS=") + strlen(ainfo->options ?
-                                                          ainfo->options:""));
+               char *p;
 
-               if (p)
-               {
-                       strcat(strcpy(p, "OPTIONS="),
-                              ainfo->options ? ainfo->options:"");
+               p = malloc(sizeof("OPTIONS=") + strlen(ainfo->options ?  
ainfo->options:""));
+               if (!p) return(rc);
+               strcat(strcpy(p, "OPTIONS="), ainfo->options ? 
ainfo->options:"");
+               putenv(p);
+
+               p = malloc(sizeof("AUTHENTICATED=") + strlen(ainfo->address));
+               if (!p) return(rc);
+               strcat(strcpy(p, "AUTHENTICATED="), ainfo->address);
+               putenv(p);
+
+               if (ainfo->quota) {
+                       p = malloc(sizeof("MAILDIRQUOTA=") + 
strlen(ainfo->quota));
+                       if (!p) return(rc);
+                       strcat(strcpy(p, "MAILDIRQUOTA="), ainfo->quota);
                        putenv(p);
+               }
 
-                       p=malloc(sizeof("AUTHENTICATED=")+
-                                strlen(ainfo->address));
-                       if (p)
-                       {
-                               strcat(strcpy(p, "AUTHENTICATED="),
-                                      ainfo->address);
-                               putenv(p);
-
-                               alarm(0);
-                               execl(pop3d, pop3d,
-                                     ainfo->maildir ?
-                                     ainfo->maildir:defaultmaildir,
-                                     NULL);
-                               fprintf(stderr, "ERR: exec(%s) failed!!\n",
-                                                        pop3d);
-                       }
-               }
+               alarm(0);
+               execl(pop3d, pop3d,
+                                               ainfo->maildir ?
+                                               ainfo->maildir:defaultmaildir,
+                                               NULL);
+               fprintf(stderr, "ERR: exec(%s) failed!!\n", pop3d);
        }
 
        return (rc);

-- 
Heiko

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to