summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-08-15 09:25:58 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-08-15 19:42:39 +0200
commitfb58c0f36575510ca6572e695afdd81469ced3dd (patch)
treeaafcef8f74edf39a873331c97a89cbfd912a9137
parent08b628efe40bd93993ed4b662d924436444bb242 (diff)
downloadsamba-fb58c0f36575510ca6572e695afdd81469ced3dd.tar.gz
samba-fb58c0f36575510ca6572e695afdd81469ced3dd.tar.bz2
samba-fb58c0f36575510ca6572e695afdd81469ced3dd.zip
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.
-rw-r--r--source4/ldap_server/ldap_backend.c13
1 files changed, 13 insertions, 0 deletions
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;