On Fri, 15 Dec 2006 01:59:28 +0200
Mehmet Tolga Avcioglu <[EMAIL PROTECTED]> wrote:

> 
> After recently upgrading from a 2.x version to the latest
> courier-imap-4.1.1 and courier-authlib-0.58 I realized that I had some
> problems as after login the server would just exit with the following
> in maillog.
> 
> imapd: getpwnam: Success
> 
> After some digging I realized the following code in authdaemon.c
> 
> if (ainfo->sysusername)
>         libmail_changeusername(ainfo->sysusername,
>                                &ainfo->sysgroupid);
> else if (ainfo->sysuserid)
>         libmail_changeuidgid(*ainfo->sysuserid,
>                              ainfo->sysgroupid);
> 
> Which checks to see if we received a username from the authentication
> code and if so tries to change to that username and if not checks to
> see if we received the userid. Works if I use a system user but fails
> with virtual users at the getpwnam call in changeusername function as
> no such user exists in the system.
> 
> Changing the order above to if(userid) ... else if(username) ... fixed
> my problem. I am using a custom authentication code. I imagine this
> would fail with any authentication method that use virtual users. Am I
> correct? Or am I missing something.
> 
> My problem seems to be fixed but please let me know if I am
> overlooking something.
> 
> Thanks
> 
Hi

I also use custom authentication which looks up a PostgreSQL database.
When a username/password lookup succeeds, my code fills in a struct
authinfo with the users name (i.e. foo if his mail address is
[EMAIL PROTECTED]), the path to his Maildir and homedir, the virtual user uid
and gid. This is then passed to the callback function provided as a
parameter to the auth_custom function i.e.

result = (* callback) (&authinfo, callback_arg) ;

The auth_custom function then returns the result to the caller. Works
fine for IMAP and POP3 users (in any one of many domains), so it looks
like your custom code may be missing some of these steps. Perhaps
posting your auth_custom function would help us.

-Adrian

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Courier-imap mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap

Reply via email to