Skip to content

Commit

Permalink
Improve password policy error code and message
Browse files Browse the repository at this point in the history
Instead of returning PAM_SYSTEM_ERR if they necessary attributes for the
requested password policy cannot be found we return PAM_PERM_DENIED.
Additionally the log message says that the access is denied.
  • Loading branch information
sumit-bose authored and sgallagher committed Aug 25, 2011
1 parent 690ae38 commit 24a5dc6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/providers/ldap/ldap_auth.c
Expand Up @@ -278,8 +278,9 @@ static errno_t find_password_expiration_attributes(TALLOC_CTX *mem_ctx,
}
} else {
DEBUG(1, ("No Kerberos password expiration attributes found, "
"but MIT Kerberos password policy was requested.\n"));
return EINVAL;
"but MIT Kerberos password policy was requested. "
"Access will be denied.\n"));
return EACCES;
}
} else if (strcasecmp(pwd_policy, PWD_POL_OPT_SHADOW) == 0) {
mark = ldb_msg_find_attr_as_string(msg, SYSDB_SHADOWPW_LASTCHANGE, NULL);
Expand Down Expand Up @@ -321,8 +322,9 @@ static errno_t find_password_expiration_attributes(TALLOC_CTX *mem_ctx,
return EOK;
} else {
DEBUG(1, ("No shadow password attributes found, "
"but shadow password policy was requested.\n"));
return EINVAL;
"but shadow password policy was requested. "
"Access will be denied.\n"));
return EACCES;
}
}

Expand Down Expand Up @@ -661,6 +663,9 @@ int auth_recv(struct tevent_req *req,
if (err == ETIMEDOUT) {
*result = SDAP_UNAVAIL;
return EOK;
} else if (err == EACCES) {
*result = SDAP_AUTH_FAILED;
return EOK;
} else {
*result = SDAP_ERROR;
return err;
Expand Down

0 comments on commit 24a5dc6

Please sign in to comment.