Home | Scripts | How To's | About


Patching Maildrop To Create Directories

View Comments

When using maildrop in a virtual mail server setup, by default it will not create new directories, which makes the task up to the administrator when adding new accounts. However, there is a very simple way to modify Maildrop so that in the event it does not find a user's mailbox directory, will automatically create Maildir style folders.

The Source

The source file seems to not have changed throughout subsequent version updates, therefore this howto should apply to any new version.

Go to the maildrop source directory and then go one more level down to "maildrop." Once you are there, look for "maildir.C."

Patching

Look through the source for the "Maildir:IsMaildir" function.

After:
int     c;


Insert:
int     chkfail = 0;


In that same function you will find four if statements that check for the directory name, they will then return false. We need to change that.

Change:
return (0);

To:
chkfail == 1


Finally, add the if statement that will create the Maildirs. It goes at the very bottom of the function, right before it returns true.

Before:
return (1);


Add:
if (chkfail == 1)
{
    /* Get a valid directory string */
    newdir=dirname;
    newdir += '';

    /* Default permissions, maildrop will use this for the Maildir */
    dirperm=0700;

    mkdir(newdir, dirperm);
    chdir(newdir);
    mkdir("tmp", dirperm);
    mkdir("new", dirperm);
    mkdir("cur", dirperm);
}


Compile and you're done!
 


Comments (Last 10): [Show All]


No comments yet... be the first to make one, use the form below!
 
Post Comment:

Use the following verification number: ui65ajz6q5g

Name 
Comment 
Verification 



eBay Sniper