s4:dsdb:objectclass_attrs: return based on the validate_ldb() return value.
authorStefan Metzmacher <metze@samba.org>
Wed, 25 Sep 2013 08:09:41 +0000 (10:09 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 25 Sep 2013 08:09:41 +0000 (10:09 +0200)
WERR_DS_INVALID_ATTRIBUTE_SYNTAX and WERR_DS_CONSTRAINT_VIOLATION
are the important ones, which need to be mapped to
LDB_ERR_INVALID_ATTRIBUTE_SYNTAX and LDB_ERR_CONSTRAINT_VIOLATION.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source4/dsdb/samdb/ldb_modules/objectclass_attrs.c

index 4776680a9216e2b16a7a31220df8546db03bcab4..4460165d5b2a5bdee5d713f16b06b8cb980b1fe9 100644 (file)
@@ -220,10 +220,17 @@ static int attr_handler(struct oc_context *ac)
                                                          &msg->elements[i]);
                        if (!W_ERROR_IS_OK(werr) &&
                            !ldb_request_get_control(ac->req, DSDB_CONTROL_DBCHECK)) {
-                               ldb_asprintf_errstring(ldb, "objectclass_attrs: attribute '%s' on entry '%s' contains at least one invalid value!",
+                               ldb_asprintf_errstring(ldb, "objectclass_attrs: attribute '%s' on entry '%s' contains at least one invalid value! %s!",
                                                       msg->elements[i].name,
-                                                      ldb_dn_get_linearized(msg->dn));
-                               return LDB_ERR_CONSTRAINT_VIOLATION;
+                                                      ldb_dn_get_linearized(msg->dn),
+                                                      win_errstr(werr));
+                               if (W_ERROR_EQUAL(werr, WERR_DS_INVALID_ATTRIBUTE_SYNTAX)) {
+                                       return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
+                               }
+                               if (W_ERROR_EQUAL(werr, WERR_DS_CONSTRAINT_VIOLATION)) {
+                                       return LDB_ERR_CONSTRAINT_VIOLATION;
+                               }
+                               return LDB_ERR_OPERATIONS_ERROR;
                        }
                }