From fb58c0f36575510ca6572e695afdd81469ced3dd Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sun, 15 Aug 2010 09:25:58 +0200 Subject: s4:ldap_backend.c - map error codes - add a change which allows custom WERROR codes This is strictly needed by my recent passwords work, since I want to remove most of the password change stuff in "samr_password.c". Since AD gives us CONSTRAINT_VIOLATION on all change problems I cannot distinguish on the SAMR level which the real cause was about. Therefore I need the extended WERROR codes here. --- source4/ldap_server/ldap_backend.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index d5b1a39181..ffe637d7d4 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -45,6 +45,19 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err, { WERROR err; + /* Certain LDB modules need to return very special WERROR codes. Proof + * for them here and if they exist skip the rest of the mapping. */ + if (add_err_string != NULL) { + char *endptr; + strtol(add_err_string, &endptr, 16); + if (endptr != add_err_string) { + *errstring = add_err_string; + return ldb_err; + } + } + + /* Otherwise we calculate here a generic, but appropriate WERROR. */ + switch (ldb_err) { case LDB_SUCCESS: err = WERR_OK; -- cgit