confixx with individual imap-mailboxes

i had to deal with a confixx-version which uses the home-directory /XnirvanaX for all mail users. i wanted to install imap-uw, so that the users can access their mailboxes through imap.

  • problem: all created mailboxes by or through imap and files like .mailboxlist would go to /XnirvanaX. mailbox “Trash” for user1 would be /XnirvanaX/Trash, just like “Trash” for user2 and so on.
  • solution: make imapd use individual and seperate directories for the storage of these files and mailboxes.

my solution for imap-2006a:

find and replace in src/osdep/unix/env_unix.h: (finds a nice place for
.mailboxlist and .mblxlsttmp, individual for each user)

/* Subscription definitions for UNIX */
#define SUBSCRIPTIONFILE(t) sprintf (t,”%s/%s/.mailboxlist”,myhomedir
(), myusername())
#define SUBSCRIPTIONTEMP(t) sprintf (t,”%s/%s/.mlbxlsttmp”,myhomedir (),
myusername())

find and replace in srx/osdep/unix/env_unix.c: (returns an individual
home mailbox directory for each user, creates needed directories if they
don’t exist)

/* Return my home mailbox name
* Returns: my home directory name
*/
static char *mymailboxdir ()
{
char *home = myhomedir ();
if (!myMailboxDir && myHomeDir) {
char tmp[MAILTMPLEN];
sprintf (tmp,”%s/%s”,myhomedir(), myusername());
struct stat stat_p;
if ( -1 == stat (tmp, &stat_p))
mkdir(tmp, 0711);sprintf (tmp,”%s/mail”,tmp); if ( -1 == stat (tmp,
&stat_p))
mkdir(tmp, 0711);
myMailboxDir = cpystr (tmp);
}
return myMailboxDir ? myMailboxDir : “”;
}

then compile and install..

with these changes, .mailboxlist and .mlbxlsttmp will go to
/home-of-users/individual-username and the mailboxes will be stored into
/home-of-users/individual-username/mail .
the home directoy of the users MUST exist, the other directories will be
created automatically.

Leave a Reply


linkboost