From 06987186fb528271d6c208d2abf326049c0e168b Mon Sep 17 00:00:00 2001 From: Michal Židek Date: Tue, 18 Aug 2015 20:39:03 +0200 Subject: sdap_async: Use specific errmsg when available Ticket: https://fedorahosted.org/sssd/ticket/2762 Use specific errmsg when ldap returns LDAP_CONSTRAINT_VIOLATION code if that specific message is available. Reviewed-by: Pavel Reichl --- src/providers/ldap/sdap_async.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c index c5be8561a..97c9ea5df 100644 --- a/src/providers/ldap/sdap_async.c +++ b/src/providers/ldap/sdap_async.c @@ -648,8 +648,14 @@ static void sdap_exop_modify_passwd_done(struct sdap_op *op, ret = EOK; break; case LDAP_CONSTRAINT_VIOLATION: - state->user_error_message = talloc_strdup(state, - "Please make sure the password meets the complexity constraints."); + if (errmsg && strlen(errmsg) != 0) { + state->user_error_message = talloc_strdup(state, errmsg); + } else { + state->user_error_message = talloc_strdup(state, + "Please make sure the password meets the " + "complexity constraints."); + } + if (state->user_error_message == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup failed\n"); ret = ENOMEM; -- cgit