Hi!

The attached change was requested by:
https://bugzilla.redhat.com/show_bug.cgi?id=1254723

Thanks,

Michal
>From bc41a3748754881ad495bed1b654cc8d90d0c69a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzi...@redhat.com>
Date: Tue, 18 Aug 2015 20:39:03 +0200
Subject: [PATCH] sdap_async: Use specific errmsg when available

Use specific errmsg when ldap returns
LDAP_CONSTRAINT_VIOLATION code if that specific
message is available.
---
 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 c5be856..97c9ea5 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;
-- 
2.1.0

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to