s4:ldap_backend.c/"map_ldb_error" - handle errors similar to "PyErr_SetLdbError"
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Wed, 21 Sep 2011 09:59:06 +0000 (11:59 +0200)
committerAndrew Tridgell <tridge@samba.org>
Tue, 11 Oct 2011 06:42:07 +0000 (08:42 +0200)
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 <tridge@samba.org>
source4/ldap_server/ldap_backend.c

index 57f81eaaaf04c8020e2a4b896815fe29cfe35dc6..afeb3500d0fe7e378f93556367f3cc385957f506 100644 (file)
@@ -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;
 }