]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-dsdb: Remove is_attr_in_list()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 13 Feb 2023 23:03:10 +0000 (12:03 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 12 Apr 2023 13:52:31 +0000 (13:52 +0000)
ldb_attr_in_list() already exists and does essentially the same thing.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/dsdb/common/util.c
source4/dsdb/common/util.h
source4/dsdb/samdb/ldb_modules/extended_dn_out.c

index ef42d71ae04e6c463f7467608b1a8dc606e6f8f3..a24880f7d3fa094ffacabb660cd4d66ad4e46c76 100644 (file)
@@ -5396,7 +5396,7 @@ static const char * const secret_attributes[] = {
 bool dsdb_attr_in_rodc_fas(const struct dsdb_attribute *sa)
 {
        /* they never get secret attributes */
-       if (is_attr_in_list(secret_attributes, sa->lDAPDisplayName)) {
+       if (ldb_attr_in_list(secret_attributes, sa->lDAPDisplayName)) {
                return false;
        }
 
@@ -5551,18 +5551,6 @@ bool dsdb_attr_in_parse_tree(struct ldb_parse_tree *tree,
        return false;
 }
 
-bool is_attr_in_list(const char * const * attrs, const char *attr)
-{
-       unsigned int i;
-
-       for (i = 0; attrs[i]; i++) {
-               if (ldb_attr_cmp(attrs[i], attr) == 0)
-                       return true;
-       }
-
-       return false;
-}
-
 int dsdb_werror_at(struct ldb_context *ldb, int ldb_ecode, WERROR werr,
                   const char *location, const char *func,
                   const char *reason)
index 5bb96d60b3cca2208bdb3acdc125d08ea7bcf7a2..63cfd79f809a897dec00990df11c58fd5e9c908a 100644 (file)
@@ -45,8 +45,6 @@
 #define DSDB_REPLMD_VANISH_LINKS              0x10000
 #define DSDB_MARK_REQ_UNTRUSTED               0x20000
 
-bool is_attr_in_list(const char * const * attrs, const char *attr);
-
 #define DSDB_SECRET_ATTRIBUTES_EX(sep) \
        "pekList" sep \
        "msDS-ExecuteScriptPassword" sep \
index a8b4437354c63d7d08433e7d5e532483f2603a97..5f6fb9ff8c227968364fa5d281bb43ff9cb1d2dd 100644 (file)
@@ -346,7 +346,7 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares)
                        const char * const *attrs = ac->req->op.search.attrs;
 
                        if (attrs != NULL) {
-                               bl_requested = is_attr_in_list(attrs,
+                               bl_requested = ldb_attr_in_list(attrs,
                                                attribute->lDAPDisplayName);
                        } else {
                                bl_requested = false;
@@ -554,11 +554,11 @@ static int extended_dn_out_search(struct ldb_module *module, struct ldb_request
                }
 
                /* check if attrs only is specified, in that case check whether we need to modify them */
-               if (req->op.search.attrs && !is_attr_in_list(req->op.search.attrs, "*")) {
-                       if (! is_attr_in_list(req->op.search.attrs, "objectGUID")) {
+               if (req->op.search.attrs && !ldb_attr_in_list(req->op.search.attrs, "*")) {
+                       if (! ldb_attr_in_list(req->op.search.attrs, "objectGUID")) {
                                ac->remove_guid = true;
                        }
-                       if (! is_attr_in_list(req->op.search.attrs, "objectSid")) {
+                       if (! ldb_attr_in_list(req->op.search.attrs, "objectSid")) {
                                ac->remove_sid = true;
                        }
                        if (ac->remove_guid || ac->remove_sid) {