dsdb: Add dsdb_request_has_control() helper function
authorTim Beale <timbeale@catalyst.net.nz>
Thu, 11 Oct 2018 04:50:52 +0000 (17:50 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Fri, 12 Oct 2018 05:23:26 +0000 (07:23 +0200)
Most of the DSDB modules only want to check the existence of a control,
rather than access the control itself. Adding a helper function allows
the code to ask more natural-sounding yes/no questions, and tidies up
an ugly-looking long-line in extended_dn_out.c.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Oct 12 07:23:26 CEST 2018 on sn-devel-144

source4/dsdb/common/util.c
source4/dsdb/samdb/ldb_modules/extended_dn_out.c

index 193fa2ae653fec86a3ad0e3fcd937e8111a85386..e7b860df1bc58f4d8d113173ceba46ff9cea7c90 100644 (file)
@@ -4438,6 +4438,14 @@ int dsdb_request_add_controls(struct ldb_request *req, uint32_t dsdb_flags)
        return LDB_SUCCESS;
 }
 
+/*
+   returns true if a control with the specified "oid" exists
+*/
+bool dsdb_request_has_control(struct ldb_request *req, const char *oid)
+{
+       return (ldb_request_get_control(req, oid) != NULL);
+}
+
 /*
   an add with a set of controls
 */
index feb0bf4058f9a3dc90a097a5ba7e87b110778d50..014ae0a8f536a20e64fbf03daae772c374ba1a06 100644 (file)
@@ -474,8 +474,7 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares,
        }
 
        have_reveal_control =
-               ldb_request_get_control(req,
-                                       LDB_CONTROL_REVEAL_INTERNALS) != NULL;
+               dsdb_request_has_control(req, LDB_CONTROL_REVEAL_INTERNALS);
 
        /* 
         * Shortcut for repl_meta_data.  We asked for the data