From: Joseph Sutton Date: Mon, 13 Feb 2023 23:03:10 +0000 (+1300) Subject: s4-dsdb: Remove is_attr_in_list() X-Git-Tag: talloc-2.4.1~952 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ec0a04dc103e9ffe402eb891d4a30f2736ee2f4;p=thirdparty%2Fsamba.git s4-dsdb: Remove is_attr_in_list() ldb_attr_in_list() already exists and does essentially the same thing. Signed-off-by: Joseph Sutton Reviewed-by: Andreas Schneider --- diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index ef42d71ae04..a24880f7d3f 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -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) diff --git a/source4/dsdb/common/util.h b/source4/dsdb/common/util.h index 5bb96d60b3c..63cfd79f809 100644 --- a/source4/dsdb/common/util.h +++ b/source4/dsdb/common/util.h @@ -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 \ diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c index a8b4437354c..5f6fb9ff8c2 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c @@ -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) {