s4:ldb_register_samba_handlers - fix up and convert result codes to LDB/LDAP results
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 11 Sep 2010 15:41:38 +0000 (17:41 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 11 Sep 2010 15:41:38 +0000 (17:41 +0200)
source4/dsdb/common/tests/dsdb_dn.c
source4/lib/ldb-samba/ldb_wrap.c
source4/lib/ldb-samba/ldif_handlers.c
source4/lib/ldb/tools/cmdline.c
source4/torture/drs/rpc/dssync.c
source4/torture/ldb/ldb.c

index 183bce28d02b51b8fece2c0a1914d8f2c98c3da4..d01e858a0ddd4ec8d31ffff9bfa0489028cd4623 100644 (file)
@@ -44,7 +44,7 @@ static bool torture_dsdb_dn_attrs(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
@@ -127,7 +127,7 @@ static bool torture_dsdb_dn_valid(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
@@ -249,7 +249,7 @@ static bool torture_dsdb_dn_invalid(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
index 13ab3edefe8f3deb23fea2cfbe9a8b515856b60c..ebc1818c76013820c4435341de1f30c5ddbd5da5 100644 (file)
@@ -192,7 +192,7 @@ static int ldb_wrap_destructor(struct ldb_wrap *w)
         * precedence over the 'binary attribute' declaration in the
         * schema */
        ret = ldb_register_samba_handlers(ldb);
-       if (ret == -1) {
+       if (ret != LDB_SUCCESS) {
                talloc_free(ldb);
                return NULL;
        }
index 0ff6d32deecc837e99447f2bc419fd3617bee4c9..1c366104c05286e8e2ba356b78e0b7b20baf25ce 100644 (file)
@@ -1278,7 +1278,7 @@ int ldb_register_samba_handlers(struct ldb_context *ldb)
                }
 
                if (!s) {
-                       return -1;
+                       return LDB_ERR_OPERATIONS_ERROR;
                }
 
                ret = ldb_schema_attribute_add_with_syntax(ldb, samba_attributes[i].name, LDB_ATTR_FLAG_FIXED, s);
index c2b595f329d746d5c6991bac1127591803c30554..99847662785238f87f0d8d068dee634ae24bcf3b 100644 (file)
@@ -122,7 +122,7 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb,
 
 #if (_SAMBA_BUILD_ >= 4)
        r = ldb_register_samba_handlers(ldb);
-       if (r != 0) {
+       if (r != LDB_SUCCESS) {
                goto failed;
        }
 
index c7b67081cb1476ba771d2b8851bc56c47606fa5b..aaae85be3d8d50ad50bd704d477b079613489bd6 100644 (file)
@@ -265,7 +265,7 @@ static bool test_LDAPBind(struct torture_context *tctx, struct DsSyncTest *ctx,
        /* Despite us loading the schema from the AD server, we need
         * the samba handlers to get the extended DN syntax stuff */
        ret = ldb_register_samba_handlers(ldb);
-       if (ret == -1) {
+       if (ret != LDB_SUCCESS) {
                talloc_free(ldb);
                return NULL;
        }
index 8bc6357e3dc1fe1495fcbadc82cd63994a15b52e..8a5a3f309edc916c50d425e7c15bbf2836897f34 100644 (file)
@@ -57,7 +57,7 @@ static bool torture_ldb_attrs(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
@@ -216,7 +216,7 @@ static bool torture_ldb_dn_attrs(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
@@ -334,7 +334,7 @@ static bool torture_ldb_dn_extended(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
@@ -595,7 +595,7 @@ static bool torture_ldb_dn(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
@@ -707,7 +707,7 @@ static bool torture_ldb_dn_invalid_extended(struct torture_context *torture)
                       "Failed to init ldb");
 
        torture_assert_int_equal(torture, 
-                                ldb_register_samba_handlers(ldb), 0, 
+                                ldb_register_samba_handlers(ldb), LDB_SUCCESS,
                                 "Failed to register Samba handlers");
 
        ldb_set_utf8_fns(ldb, NULL, wrap_casefold);