Re: [Exim] Bug: Quota checking

Góra strony
Delete this message
Reply to this message
Autor: Heinz Ekker
Data:  
Dla: exim-users
CC: Heinz Ekker
Temat: Re: [Exim] Bug: Quota checking
Ok, it was a bit late yesterday, I hope, my English is more
comprehensible today ;)

When Exim checks quota in a maildir, it looks for a file 'maildirfolder'
in that directory. If one is present, this is a maildir++-folder, and
therefore the parent directory and its subdirectories should be included
in the quota calculation, too.

Therefore Exim tries to find the parent directory from the path.
Unfortunately, if path ends in a slash (which is perfectly valid for a
directory ;)), it yields a string with only the last slash stripped.

So, '/var/mail/user/.folder/' becomes '/var/mail/user/.folder', which is
not much of a gain ;).

Because my boss wants to see results, I hacked up a quick fix myself,
see attached:

he

<snip>
*** src/transports/appendfile.c.orig    Wed May  8 17:46:31 2002
--- src/transports/appendfile.c Wed May  8 17:51:56 2002
*************** else
*** 1958,1963 ****
--- 1958,1964 ----
      sub-directory of the real inbox. We should therefore do the quota check on
      the parent directory. */


+     DEBUG(D_transport) debug_printf("checking for maildirfolder in [%s]\n", check_path);
      #ifdef SUPPORT_MAILDIR
      if (mbformat == mbf_maildir)
        {
*************** else
*** 1965,1972 ****
--- 1966,1980 ----
        if (Ustat(string_sprintf("%s/maildirfolder", path), &statbuf) >= 0)
          {
          uschar *slash = Ustrrchr(path, '/');
+         DEBUG(D_transport) debug_printf("[%s] is a maildir++, checking parent directory.\n", path);
+         while (slash != NULL && ((slash - path) == (Ustrlen(path) - 1)))
+           {
+           *slash='\0';
+           slash = Ustrrchr(path,'/');
+           }
          if (slash != NULL)
            check_path = string_sprintf("%.*s", slash - path, path);
+         DEBUG(D_transport) debug_printf("check_path changed to [%s]\n", check_path);
          }
        }
      #endif
</snip>