version 1.42, 2007/08/23 02:55:51 |
version 1.43, 2007/09/21 08:15:29 |
|
|
return (sys_auth_passwd(authctxt, password) && ok); |
return (sys_auth_passwd(authctxt, password) && ok); |
} |
} |
|
|
#ifdef BSD_AUTH |
|
static void |
static void |
warn_expiry(Authctxt *authctxt, auth_session_t *as) |
warn_expiry(Authctxt *authctxt, auth_session_t *as) |
{ |
{ |
|
|
return (auth_close(as)); |
return (auth_close(as)); |
} |
} |
} |
} |
#else |
|
int |
|
sys_auth_passwd(Authctxt *authctxt, const char *password) |
|
{ |
|
struct passwd *pw = authctxt->pw; |
|
char *encrypted_password; |
|
|
|
/* Check for users with no password. */ |
|
if (strcmp(password, "") == 0 && strcmp(pw->pw_passwd, "") == 0) |
|
return (1); |
|
|
|
/* Encrypt the candidate password using the proper salt. */ |
|
encrypted_password = crypt(password, |
|
(pw->pw_passwd[0] && pw->pw_passwd[1]) ? |
|
pw->pw_passwd : "xx"); |
|
|
|
/* |
|
* Authentication is accepted if the encrypted passwords |
|
* are identical. |
|
*/ |
|
return (strcmp(encrypted_password, pw->pw_passwd) == 0); |
|
} |
|
#endif |
|