From 96a9f823edd9c9387d6708fa8c3a4dc5de75127d Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 21 Sep 2011 11:59:06 +0200 Subject: s4:ldap_backend.c/"map_ldb_error" - handle errors similar to "PyErr_SetLdbError" If the call was done using an error string ("add_err_string"), then use that one without an additional "ldb_strerror()" for the definitive LDAP output. Otherwise generate one using "ldb_strerror()". This omits redundancies in the error string generation (twice the same information by "ldb_strerror()"). Signed-off-by: Andrew Tridgell --- source4/ldap_server/ldap_backend.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 57f81eaaaf..afeb3500d0 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -169,12 +169,8 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err, } *errstring = talloc_asprintf(mem_ctx, "%08X: %s", W_ERROR_V(err), - ldb_strerror(ldb_err)); - if (add_err_string != NULL) { - *errstring = talloc_asprintf(mem_ctx, "%s - %s", *errstring, - add_err_string); - } - + add_err_string != NULL ? add_err_string : ldb_strerror(ldb_err)); + /* result is 1:1 for now */ return ldb_err; } -- cgit