2 ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "courier_auth_config.h"
19 #include "authmysql.h"
22 static const char rcsid
[]="$Id: preauthmysql.c,v 1.10 2004/10/21 00:10:49 mrsam Exp $";
25 int auth_mysql_pre(const char *user
, const char *service
,
26 int (*callback
)(struct authinfo
*, void *), void *arg
)
28 struct authmysqluserinfo
*authinfo
;
31 authinfo
=auth_mysql_getuserinfo(user
, service
);
33 if (!authinfo
) /* Fatal error - such as MySQL being down */
36 if (!authinfo
->home
) /* User not found */
39 memset(&aa
, 0, sizeof(aa
));
41 /*aa.sysusername=user;*/
42 aa
.sysuserid
= &authinfo
->uid
;
43 aa
.sysgroupid
= authinfo
->gid
;
44 aa
.homedir
=authinfo
->home
;
45 aa
.maildir
=authinfo
->maildir
&& authinfo
->maildir
[0] ?
47 aa
.address
=authinfo
->username
;
48 aa
.passwd
=authinfo
->cryptpw
;
49 aa
.clearpasswd
=authinfo
->clearpw
;
50 aa
.fullname
=authinfo
->fullname
;
51 aa
.quota
=authinfo
->quota
&& authinfo
->quota
[0] ?
53 aa
.options
=authinfo
->options
;
54 return ((*callback
)(&aa
, arg
));