summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-09-06 10:55:15 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-09-06 14:51:45 -0400
commitcd5b718ebeab1c923af7a5c3c0a5c717c5659c7d (patch)
tree9371901027fc5eaa53fef2d86dd2336c0fb49083 /src/providers
parent4e3495b3b8927a282adc48cc80f0611ecf79821b (diff)
downloadsssd-cd5b718ebeab1c923af7a5c3c0a5c717c5659c7d.tar.gz
sssd-cd5b718ebeab1c923af7a5c3c0a5c717c5659c7d.tar.xz
sssd-cd5b718ebeab1c923af7a5c3c0a5c717c5659c7d.zip
Improve error message for LDAP password constraint violation
https://fedorahosted.org/sssd/ticket/985
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ldap/ldap_auth.c27
-rw-r--r--src/providers/ldap/sdap.h1
-rw-r--r--src/providers/ldap/sdap_async.c17
3 files changed, 29 insertions, 16 deletions
diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c
index ef4477cf0..390ea8bc3 100644
--- a/src/providers/ldap/ldap_auth.c
+++ b/src/providers/ldap/ldap_auth.c
@@ -904,7 +904,7 @@ static void sdap_pam_chpass_done(struct tevent_req *req)
ret = sdap_exop_modify_passwd_recv(req, state, &result, &user_error_message);
talloc_zfree(req);
- if (ret) {
+ if (ret && ret != EIO) {
state->pd->pam_status = PAM_SYSTEM_ERR;
goto done;
}
@@ -914,19 +914,24 @@ static void sdap_pam_chpass_done(struct tevent_req *req)
state->pd->pam_status = PAM_SUCCESS;
dp_err = DP_ERR_OK;
break;
+ case SDAP_AUTH_PW_CONSTRAINT_VIOLATION:
+ state->pd->pam_status = PAM_NEW_AUTHTOK_REQD;
+ break;
default:
state->pd->pam_status = PAM_AUTHTOK_ERR;
- if (user_error_message != NULL) {
- ret = pack_user_info_chpass_error(state->pd, user_error_message,
- &msg_len, &msg);
+ break;
+ }
+
+ if (state->pd->pam_status != PAM_SUCCESS && user_error_message != NULL) {
+ ret = pack_user_info_chpass_error(state->pd, user_error_message,
+ &msg_len, &msg);
+ if (ret != EOK) {
+ DEBUG(1, ("pack_user_info_chpass_error failed.\n"));
+ } else {
+ ret = pam_add_response(state->pd, SSS_PAM_USER_INFO, msg_len,
+ msg);
if (ret != EOK) {
- DEBUG(1, ("pack_user_info_chpass_error failed.\n"));
- } else {
- ret = pam_add_response(state->pd, SSS_PAM_USER_INFO, msg_len,
- msg);
- if (ret != EOK) {
- DEBUG(1, ("pam_add_response failed.\n"));
- }
+ DEBUG(1, ("pam_add_response failed.\n"));
}
}
}
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index 2e270f346..7d704b55f 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -144,6 +144,7 @@ enum sdap_result {
SDAP_AUTH_SUCCESS,
SDAP_AUTH_FAILED,
SDAP_AUTH_PW_EXPIRED,
+ SDAP_AUTH_PW_CONSTRAINT_VIOLATION,
SDAP_ACCT_EXPIRED
};
diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c
index 2edc7597c..2183ceb78 100644
--- a/src/providers/ldap/sdap_async.c
+++ b/src/providers/ldap/sdap_async.c
@@ -672,15 +672,22 @@ int sdap_exop_modify_passwd_recv(struct tevent_req *req,
struct sdap_exop_modify_passwd_state *state = tevent_req_data(req,
struct sdap_exop_modify_passwd_state);
- *result = SDAP_ERROR;
*user_error_message = talloc_steal(mem_ctx, state->user_error_message);
- TEVENT_REQ_RETURN_ON_ERROR(req);
-
- if (state->result == LDAP_SUCCESS) {
- *result = SDAP_SUCCESS;
+ switch (state->result) {
+ case LDAP_SUCCESS:
+ *result = SDAP_SUCCESS;
+ break;
+ case LDAP_CONSTRAINT_VIOLATION:
+ *result = SDAP_AUTH_PW_CONSTRAINT_VIOLATION;
+ break;
+ default:
+ *result = SDAP_ERROR;
+ break;
}
+ TEVENT_REQ_RETURN_ON_ERROR(req);
+
return EOK;
}