2 ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "courier_auth_config.h"
21 #include "authmysql.h"
23 int auth_mysql_pre(const char *user
, const char *service
,
24 int (*callback
)(struct authinfo
*, void *), void *arg
)
26 authmysqluserinfo authinfo
;
29 if (!auth_mysql_getuserinfo(user
, service
, authinfo
))
30 /* Fatal error - such as MySQL being down */
33 if (authinfo
.home
.size() == 0) /* User not found */
36 memset(&aa
, 0, sizeof(aa
));
38 /*aa.sysusername=user;*/
39 aa
.sysuserid
= &authinfo
.uid
;
40 aa
.sysgroupid
= authinfo
.gid
;
42 #define STR(z) (authinfo.z.size() ? authinfo.z.c_str():0)
45 aa
.maildir
=STR(maildir
);
46 aa
.address
=STR(username
);
47 aa
.passwd
=STR(cryptpw
);
48 aa
.clearpasswd
=STR(clearpw
);
49 aa
.fullname
=STR(fullname
);
51 aa
.options
=STR(options
);
52 return ((*callback
)(&aa
, arg
));