--On Samstag, 30. August 2003 16:37 -0400 Sam Varshavchik
<[EMAIL PROTECTED]> wrote:

>> +// PATCH: check/fix Maildir
>> +int _MaildirCheckFix(const char *dir, int autocreate)
>> +{
>> +struct      stat stat_buf;
>> +
>> +    // check if directory exists
>> +    if (! stat(dir, &stat_buf) )    return( S_ISDIR(stat_buf.st_mode) );
>> +    if (! autocreate)               return(0);      // legacy fallback
>> +    fprintf(stderr, "DEBUG maildrop: mkdir %s\n", dir);
>> +    if (! mkdir(dir, 0700) )        return(1);      // success
>> +    merr << "maildrop: mkdir " << dir << ": " << strerror(errno) << "\n";
> 
> This is not going to create a maildir.

Works for me ;)

The snipped above only creates one of the four directories which
make up a maildir, if it does not exist already.

> Even if it did, it is not going to create a proper maildir folder (quota
> support would be broken).

Quota support just continues to work as it always worked.
Maildrop will create the file maildirsize if MAILDIRQUOTA is available
in the environment, which is usually set by the auth backend.
No need to mess around with this file.

Both works here in a jailed FreeBSD 5.1 like a charm, also tested
with non-existent folders which was the main reason for the patch
because people delete them via IMAP while they are still referenced
in the .mailfilter created with SQWebmail.
And I am also planning to implement delivery of suspected junk to
a Spamfolder which may not exist initially, another useful application
are monthly folders for archival of mailinglists.

Just drop this script into $HOME and run it for proof of concept:

#!/bin/sh -x

export MAILDROPDEFAULT=./Maildir_autocreated_with_proper_quota/
export MAILDIRQUOTA=1234567S,890C

test -d $MAILDROPDEFAULT && rm -rf $MAILDROPDEFAULT
# mkdir -m 0700 $MAILDROPDEFAULT $MAILDROPDEFAULT/tmp $MAILDROPDEFAULT/new
$MAILDROPDEFAULT/cur

env [EMAIL PROTECTED] [EMAIL PROTECTED] \
        cat $0 | maildrop -V 9

# EOF

The output:

# ./maildirmake.sh
+ export MAILDROPDEFAULT=./Maildir_autocreated_with_proper_quota/
+ export MAILDIRQUOTA=1234567S,890C
+ test -d ./Maildir_autocreated_with_proper_quota/
+ env [EMAIL PROTECTED] [EMAIL PROTECTED] cat
./maildirmake.sh
+ maildrop -V 9
maildrop: Changing to /root
Message start at 0 bytes, envelope sender=root
maildrop: Attempting .mailfilter
DEBUG maildrop: mkdir ./Maildir_autocreated_with_proper_quota
DEBUG maildrop: mkdir ./Maildir_autocreated_with_proper_quota/tmp
DEBUG maildrop: mkdir ./Maildir_autocreated_with_proper_quota/new
DEBUG maildrop: mkdir ./Maildir_autocreated_with_proper_quota/cur
maildrop: Delivery complete.

the resulting Maildir:

# ls -la Maildir_autocreated_with_proper_quota 
total 12
drwx------  5 root  wheel  512 Aug 31 03:18 .
drwxr-xr-x  6 root  wheel  512 Aug 31 03:19 ..
drwx------  2 root  wheel  512 Aug 31 03:18 cur
-rw-r-----  1 root  wheel   42 Aug 31 03:18 maildirsize
drwx------  2 root  wheel  512 Aug 31 03:18 new
drwx------  2 root  wheel  512 Aug 31 03:18 tmp

# cat Maildir_autocreated_with_proper_quota/maildirsize
1234567S,890C
       0    0
     349    1

And this is 100% identical with one created by those commands:

maildirmake ./Maildir_autocreated_with_proper_quota
maildirmake -q 1234567S,890C ./Maildir_autocreated_with_proper_quota

btw: maildirmake with -q on a non-existent maildir hangs forever.

Roland



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to