Hi Gurus and everybody who is using qmail with VMAILMGR and Courier-IMAP!

After several tests we've found the problem and solved it!

No, it's not Outlook or anything else:

It's the authvmailmgr-module from vmailmgr.

So, if you want to log the user of a virtual domain who is using
courier-imap here's how to handle this:


The authentication-module of vmailmgr sends the "virtual name" of the domain
only! The solution:

Set an ENV with a name where no prog is using this ENV, except the
(modified) imapd from courier-imap:

look at "authvlib.cc" from the source of vmailmgr:

[...]
  if(!lookup_baseuser(fulluser, basepw, virtname))
    fail_login("Invalid or unknown base user or domain");
  presetenv("VUSER=", virtname);
/* 
  the following line must be added! The ENV-Name can be different, but
notice to change this in the imapd.c too!
*/
  presetenv("FULL_USER=", fulluser);
  
  if(!virtname) {
    if(virtual_only)
[...]

Notice: We add the ENV "FULL_USER" to the code so that the full
functionality of vmailmgr for qmail will be untouched!

Then make it with: make
and copy the program authvmailmgr to the auth-dir of courier-imap where your
original authvmailmgr resides.

Go to the source of courier-imap and look into the path imap for imapd.c.
Open the file and look for:
[...]
        writes("* BYE Courier-IMAP server shutting down\r\n");
        writes(tag);
        writes(" OK LOGOUT completed\r\n");
        writeflush();
        emptytrash();
/*
Original: getenv("AUTHENTICATED")
NOW: getenv("FULL_USER")
*/
        fprintf(stderr, "INFO: LOGOUT, USER=%s, ip=[%s],"
            " headers=%lu, body=%lu\n",
            getenv("FULL_USER"), getenv("TCPREMOTEIP"),
            header_count, body_count);
    exit(0);
    }

    if (strcmp(curtoken->tokenbuf, "LIST") == 0
[...]

Now we put the "FULL_USER"-ENV instead of "AUTHENTICATED"-ENV, because
according to vmailmgr the variable "fulluser" contains the domain and the
virtual user!

Next step:

STOP imap (& imap-ssl if your using)
make
make install (or copy the imapd to /usr/lib/courier-imap/bin or whereever
your imap-path is)

After you've overwritten the original imapd-prog: start it again and log
into your mailbox via imap and logout.
Look in the maillog (/var/log/maillog) and you should see something like:

INFO: LOGOUT, USER=domain.com-test, ip=[xxx.xxx.xxx.xxx], headers=0, body=0

Now you have the "alternative" Login from the user:

Login: [EMAIL PROTECTED] -> Becomes: domain.com-test

Login: domain.com-test -> Besomes: domain.com-test

I was surprised why NOBODY is interested to get the size of a virtual user
who is getting mails via imap over vmailmgr-auth!!!!

Any ideas?

milli



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to