2 ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "courier_auth_config.h"
15 #include "courierauthdebug.h"
22 int auth_pam_pre(const char *userid
, const char *service
,
23 int (*callback
)(struct authinfo
*, void *),
32 memset(&auth
, 0, sizeof(auth
));
34 if ((pw
=getpwnam(userid
)) == 0)
36 if (errno
== ENOMEM
) return (1);
37 DPRINTF("authpam: username '%s' not found in password file", userid
);
42 auth
.sysusername
=userid
;
43 auth
.sysgroupid
=pw
->pw_gid
;
44 auth
.homedir
=pw
->pw_dir
;
46 auth
.fullname
=pw
->pw_gecos
;
47 auth
.passwd
=pw
->pw_passwd
;
50 if ((spw
=getspnam(userid
)) != 0)
51 auth
.passwd
=spw
->sp_pwdp
;
53 courier_authdebug_authinfo("DEBUG: authpam: ", &auth
, 0, pw
->pw_passwd
);
55 return ((*callback
)(&auth
, arg
));