diff options
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 17 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_modules.c | 20 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_msg.c | 3 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_parse.c | 47 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb.h | 34 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb_parse.h | 61 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb_private.h | 7 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 40 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 20 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_index.c | 1 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_match.c | 1 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_search.c | 42 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 19 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.h | 4 | ||||
-rw-r--r-- | source4/lib/ldb/modules/schema.c | 26 | ||||
-rw-r--r-- | source4/lib/ldb/modules/skel.c | 1 | ||||
-rw-r--r-- | source4/lib/ldb/modules/timestamps.c | 27 |
17 files changed, 216 insertions, 154 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 649b0a0f24..f5c6d551ea 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -101,6 +101,23 @@ int ldb_search(struct ldb_context *ldb, } /* + search the database given a LDAP-like search expression + + return the number of records found, or -1 on error + + Use talloc_free to free the ldb_message returned in 'res' + +*/ +int ldb_search_bytree(struct ldb_context *ldb, + const char *base, + enum ldb_scope scope, + struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res) +{ + return ldb->modules->ops->search_bytree(ldb->modules, base, scope, tree, attrs, res); +} + +/* add a record to the database. Will fail if a record with the given class and key already exists */ diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 644154d645..7df9901ae9 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -213,10 +213,10 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) */ int ldb_next_search(struct ldb_module *module, - const char *base, - enum ldb_scope scope, - const char *expression, - const char * const *attrs, struct ldb_message ***res) + const char *base, + enum ldb_scope scope, + const char *expression, + const char * const *attrs, struct ldb_message ***res) { if (!module->next) { return -1; @@ -224,6 +224,18 @@ int ldb_next_search(struct ldb_module *module, return module->next->ops->search(module->next, base, scope, expression, attrs, res); } +int ldb_next_search_bytree(struct ldb_module *module, + const char *base, + enum ldb_scope scope, + struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res) +{ + if (!module->next) { + return -1; + } + return module->next->ops->search_bytree(module->next, base, scope, tree, attrs, res); +} + int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message) { if (!module->next) { diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 7a6dea049a..8d921b989b 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -95,8 +95,7 @@ struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, /* duplicate a ldb_val structure */ -struct ldb_val ldb_val_dup(TALLOC_CTX *mem_ctx, - const struct ldb_val *v) +struct ldb_val ldb_val_dup(void *mem_ctx, const struct ldb_val *v) { struct ldb_val v2; v2.length = v->length; diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index e2eb0f8c78..afcda60e8e 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/lib/ldb/common/ldb_parse.c @@ -43,7 +43,6 @@ #include "includes.h" #include "ldb/include/ldb.h" -#include "ldb/include/ldb_parse.h" #include <ctype.h> @@ -64,7 +63,7 @@ a filter is defined by: /* return next token element. Caller frees */ -static char *ldb_parse_lex(TALLOC_CTX *ctx, const char **s, const char *sep) +static char *ldb_parse_lex(void *ctx, const char **s, const char *sep) { const char *p = *s; char *ret; @@ -130,13 +129,13 @@ static const char *match_brace(const char *s) decode a RFC2254 binary string representation of a buffer. Used in LDAP filters. */ -struct ldb_val ldb_binary_decode(TALLOC_CTX *ctx, const char *str) +struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str) { int i, j; struct ldb_val ret; int slen = str?strlen(str):0; - ret.data = talloc_size(ctx, slen+1); + ret.data = talloc_size(mem_ctx, slen+1); ret.length = 0; if (ret.data == NULL) return ret; @@ -165,7 +164,7 @@ struct ldb_val ldb_binary_decode(TALLOC_CTX *ctx, const char *str) encode a blob as a RFC2254 binary string, escaping any non-printable or '\' characters */ -char *ldb_binary_encode(TALLOC_CTX *ctx, struct ldb_val val) +char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) { int i; char *ret; @@ -177,7 +176,7 @@ char *ldb_binary_encode(TALLOC_CTX *ctx, struct ldb_val val) len += 2; } } - ret = talloc_array(ctx, char, len+1); + ret = talloc_array(mem_ctx, char, len+1); if (ret == NULL) return NULL; len = 0; @@ -195,17 +194,17 @@ char *ldb_binary_encode(TALLOC_CTX *ctx, struct ldb_val val) return ret; } -static struct ldb_parse_tree *ldb_parse_filter(TALLOC_CTX *ctx, const char **s); +static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s); /* <simple> ::= <attributetype> <filtertype> <attributevalue> */ -static struct ldb_parse_tree *ldb_parse_simple(TALLOC_CTX *ctx, const char *s) +static struct ldb_parse_tree *ldb_parse_simple(void *mem_ctx, const char *s) { char *eq, *val, *l; struct ldb_parse_tree *ret; - ret = talloc(ctx, struct ldb_parse_tree); + ret = talloc(mem_ctx, struct ldb_parse_tree); if (!ret) { errno = ENOMEM; return NULL; @@ -249,12 +248,12 @@ static struct ldb_parse_tree *ldb_parse_simple(TALLOC_CTX *ctx, const char *s) <or> ::= '|' <filterlist> <filterlist> ::= <filter> | <filter> <filterlist> */ -static struct ldb_parse_tree *ldb_parse_filterlist(TALLOC_CTX *ctx, +static struct ldb_parse_tree *ldb_parse_filterlist(void *mem_ctx, enum ldb_parse_op op, const char *s) { struct ldb_parse_tree *ret, *next; - ret = talloc(ctx, struct ldb_parse_tree); + ret = talloc(mem_ctx, struct ldb_parse_tree); if (!ret) { errno = ENOMEM; return NULL; @@ -300,11 +299,11 @@ static struct ldb_parse_tree *ldb_parse_filterlist(TALLOC_CTX *ctx, /* <not> ::= '!' <filter> */ -static struct ldb_parse_tree *ldb_parse_not(TALLOC_CTX *ctx, const char *s) +static struct ldb_parse_tree *ldb_parse_not(void *mem_ctx, const char *s) { struct ldb_parse_tree *ret; - ret = talloc(ctx, struct ldb_parse_tree); + ret = talloc(mem_ctx, struct ldb_parse_tree); if (!ret) { errno = ENOMEM; return NULL; @@ -324,39 +323,39 @@ static struct ldb_parse_tree *ldb_parse_not(TALLOC_CTX *ctx, const char *s) parse a filtercomp <filtercomp> ::= <and> | <or> | <not> | <simple> */ -static struct ldb_parse_tree *ldb_parse_filtercomp(TALLOC_CTX *ctx, const char *s) +static struct ldb_parse_tree *ldb_parse_filtercomp(void *mem_ctx, const char *s) { while (isspace(*s)) s++; switch (*s) { case '&': - return ldb_parse_filterlist(ctx, LDB_OP_AND, s+1); + return ldb_parse_filterlist(mem_ctx, LDB_OP_AND, s+1); case '|': - return ldb_parse_filterlist(ctx, LDB_OP_OR, s+1); + return ldb_parse_filterlist(mem_ctx, LDB_OP_OR, s+1); case '!': - return ldb_parse_not(ctx, s+1); + return ldb_parse_not(mem_ctx, s+1); case '(': case ')': return NULL; } - return ldb_parse_simple(ctx, s); + return ldb_parse_simple(mem_ctx, s); } /* <filter> ::= '(' <filtercomp> ')' */ -static struct ldb_parse_tree *ldb_parse_filter(TALLOC_CTX *ctx, const char **s) +static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s) { char *l, *s2; const char *p, *p2; struct ldb_parse_tree *ret; - l = ldb_parse_lex(ctx, s, LDB_ALL_SEP); + l = ldb_parse_lex(mem_ctx, s, LDB_ALL_SEP); if (!l) { return NULL; } @@ -373,13 +372,13 @@ static struct ldb_parse_tree *ldb_parse_filter(TALLOC_CTX *ctx, const char **s) } p2 = p + 1; - s2 = talloc_strndup(ctx, *s, p - *s); + s2 = talloc_strndup(mem_ctx, *s, p - *s); if (!s2) { errno = ENOMEM; return NULL; } - ret = ldb_parse_filtercomp(ctx, s2); + ret = ldb_parse_filtercomp(mem_ctx, s2); talloc_free(s2); *s = p2; @@ -393,7 +392,7 @@ static struct ldb_parse_tree *ldb_parse_filter(TALLOC_CTX *ctx, const char **s) expression ::= <simple> | <filter> */ -struct ldb_parse_tree *ldb_parse_tree(TALLOC_CTX *mem_ctx, const char *s) +struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s) { while (isspace(*s)) s++; @@ -408,7 +407,7 @@ struct ldb_parse_tree *ldb_parse_tree(TALLOC_CTX *mem_ctx, const char *s) /* construct a ldap parse filter given a parse tree */ -char *ldb_filter_from_tree(TALLOC_CTX *mem_ctx, struct ldb_parse_tree *tree) +char *ldb_filter_from_tree(void *mem_ctx, struct ldb_parse_tree *tree) { char *s, *s2, *ret; int i; diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 91a826447a..02df0ae810 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -145,6 +145,31 @@ struct ldb_debug_ops { #endif +/* structues for ldb_parse_tree handling code */ +enum ldb_parse_op {LDB_OP_SIMPLE=1, LDB_OP_AND='&', LDB_OP_OR='|', LDB_OP_NOT='!'}; + +struct ldb_parse_tree { + enum ldb_parse_op operation; + union { + struct { + char *attr; + struct ldb_val value; + } simple; + struct { + unsigned int num_elements; + struct ldb_parse_tree **elements; + } list; + struct { + struct ldb_parse_tree *child; + } not; + } u; +}; + +struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s); +char *ldb_filter_from_tree(void *mem_ctx, struct ldb_parse_tree *tree); +char *ldb_binary_encode(void *ctx, struct ldb_val val); + + /* connect to a database. The URL can either be one of the following forms ldb://path @@ -172,6 +197,15 @@ int ldb_search(struct ldb_context *ldb, const char * const *attrs, struct ldb_message ***res); /* + like ldb_search() but takes a parse tree +*/ +int ldb_search_bytree(struct ldb_context *ldb, + const char *base, + enum ldb_scope scope, + struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res); + +/* add a record to the database. Will fail if a record with the given class and key already exists */ diff --git a/source4/lib/ldb/include/ldb_parse.h b/source4/lib/ldb/include/ldb_parse.h deleted file mode 100644 index c8d89d2165..0000000000 --- a/source4/lib/ldb/include/ldb_parse.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - ldb database library - - Copyright (C) Andrew Tridgell 2004 - - ** NOTE! The following LGPL license applies to the ldb - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* - * Name: ldb - * - * Component: ldb expression parse header - * - * Description: structure for expression parsing - * - * Author: Andrew Tridgell - */ - -#ifndef _LDB_PARSE_H -#define _LDB_PARSE_H 1 - -enum ldb_parse_op {LDB_OP_SIMPLE=1, LDB_OP_AND='&', LDB_OP_OR='|', LDB_OP_NOT='!'}; - -struct ldb_parse_tree { - enum ldb_parse_op operation; - union { - struct { - char *attr; - struct ldb_val value; - } simple; - struct { - unsigned int num_elements; - struct ldb_parse_tree **elements; - } list; - struct { - struct ldb_parse_tree *child; - } not; - } u; -}; - -struct ldb_parse_tree *ldb_parse_tree(TALLOC_CTX *mem_ctx, const char *s); -char *ldb_filter_from_tree(TALLOC_CTX *mem_ctx, struct ldb_parse_tree *tree); -char *ldb_binary_encode(TALLOC_CTX *ctx, struct ldb_val val); - -#endif diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 69bf4a6dc6..414d8c14a1 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -57,6 +57,8 @@ struct ldb_module_ops { const char *name; int (*search)(struct ldb_module *, const char *, enum ldb_scope, const char *, const char * const [], struct ldb_message ***); + int (*search_bytree)(struct ldb_module *, const char *, enum ldb_scope, + struct ldb_parse_tree *, const char * const [], struct ldb_message ***); int (*add_record)(struct ldb_module *, const struct ldb_message *); int (*modify_record)(struct ldb_module *, const struct ldb_message *); int (*delete_record)(struct ldb_module *, const char *); @@ -88,6 +90,11 @@ int ldb_next_search(struct ldb_module *module, enum ldb_scope scope, const char *expression, const char * const *attrs, struct ldb_message ***res); +int ldb_next_search_bytree(struct ldb_module *module, + const char *base, + enum ldb_scope scope, + struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res); int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message); int ldb_next_modify_record(struct ldb_module *module, const struct ldb_message *message); int ldb_next_delete_record(struct ldb_module *module, const char *dn); diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 95b620f571..fceaf02196 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -286,6 +286,27 @@ failed: /* + search for matching records using a ldb_parse_tree +*/ +static int lldb_search_bytree(struct ldb_module *module, const char *base, + enum ldb_scope scope, struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res) +{ + struct lldb_private *lldb = module->private_data; + char *expression; + int ret; + + expression = ldb_filter_from_tree(lldb, tree); + if (expression == NULL) { + return -1; + } + ret = lldb_search(module, base, scope, expression, attrs, res); + talloc_free(expression); + return ret; +} + + +/* convert a ldb_message structure to a list of LDAPMod structures ready for ldap_add() or ldap_modify() */ @@ -447,15 +468,16 @@ static const char *lldb_errstring(struct ldb_module *module) static const struct ldb_module_ops lldb_ops = { - "ldap", - lldb_search, - lldb_add, - lldb_modify, - lldb_delete, - lldb_rename, - lldb_lock, - lldb_unlock, - lldb_errstring + .name = "ldap", + .search = lldb_search, + .search_bytree = lldb_search_bytree, + .add_record = lldb_add, + .modify_record = lldb_modify, + .delete_record = lldb_delete, + .rename_record = lldb_rename, + .named_lock = lldb_lock, + .named_unlock = lldb_unlock, + .errstring = lldb_errstring }; diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index d9e72c8089..747938116a 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -36,7 +36,6 @@ #include "includes.h" #include "ldb/include/ldb.h" #include "ldb/include/ldb_private.h" -#include "ldb/include/ldb_parse.h" #include "ldb/include/ldb_explode_dn.h" #include "ldb/ldb_sqlite3/ldb_sqlite3.h" @@ -162,15 +161,16 @@ new_attr(struct ldb_module * module, * Table of operations for the sqlite3 backend */ static const struct ldb_module_ops lsqlite3_ops = { - "sqlite", - lsqlite3_search, - lsqlite3_add, - lsqlite3_modify, - lsqlite3_delete, - lsqlite3_rename, - lsqlite3_lock, - lsqlite3_unlock, - lsqlite3_errstring + .name = "sqlite", + .search = lsqlite3_search, + .search_bytree = lsqlite3_search_bytree, + .add_record = lsqlite3_add, + .modify_record = lsqlite3_modify, + .delete_record = lsqlite3_delete, + .rename_record = lsqlite3_rename, + .named_lock = lsqlite3_lock, + .named_unlock = lsqlite3_unlock, + .errstring = lsqlite3_errstring }; diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index 1cf1b5c531..b6ba413ba5 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -36,7 +36,6 @@ #include "ldb/include/ldb.h" #include "ldb/include/ldb_private.h" #include "ldb/ldb_tdb/ldb_tdb.h" -#include "ldb/include/ldb_parse.h" /* find an element in a list, using the given comparison function and diff --git a/source4/lib/ldb/ldb_tdb/ldb_match.c b/source4/lib/ldb/ldb_tdb/ldb_match.c index 3bb63e2b5b..abaa5e98c6 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_match.c +++ b/source4/lib/ldb/ldb_tdb/ldb_match.c @@ -36,7 +36,6 @@ #include "ldb/include/ldb.h" #include "ldb/include/ldb_private.h" #include "ldb/ldb_tdb/ldb_tdb.h" -#include "ldb/include/ldb_parse.h" #include <fnmatch.h> /* diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index e036ae0966..17eff6f0a6 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -36,7 +36,6 @@ #include "ldb/include/ldb.h" #include "ldb/include/ldb_private.h" #include "ldb/ldb_tdb/ldb_tdb.h" -#include "ldb/include/ldb_parse.h" /* add one element to a message @@ -463,13 +462,11 @@ static int ltdb_search_full(struct ldb_module *module, search the database with a LDAP-like expression. choses a search method */ -int ltdb_search(struct ldb_module *module, const char *base, - enum ldb_scope scope, const char *expression, - const char * const attrs[], struct ldb_message ***res) +int ltdb_search_bytree(struct ldb_module *module, const char *base, + enum ldb_scope scope, struct ldb_parse_tree *tree, + const char * const attrs[], struct ldb_message ***res) { - struct ldb_context *ldb = module->ldb; struct ltdb_private *ltdb = module->private_data; - struct ldb_parse_tree *tree; int ret; if (ltdb_lock_read(module) != 0) { @@ -485,14 +482,6 @@ int ltdb_search(struct ldb_module *module, const char *base, *res = NULL; - /* form a parse tree for the expression */ - tree = ldb_parse_tree(ldb, expression); - if (!tree) { - ltdb->last_err_string = "expression parse failed"; - ltdb_unlock_read(module); - return -1; - } - if (tree->operation == LDB_OP_SIMPLE && (ldb_attr_cmp(tree->u.simple.attr, "dn") == 0 || ldb_attr_cmp(tree->u.simple.attr, "distinguishedName") == 0) && @@ -506,9 +495,32 @@ int ltdb_search(struct ldb_module *module, const char *base, } } - talloc_free(tree); ltdb_unlock_read(module); return ret; } + +/* + search the database with a LDAP-like expression. + choses a search method +*/ +int ltdb_search(struct ldb_module *module, const char *base, + enum ldb_scope scope, const char *expression, + const char * const attrs[], struct ldb_message ***res) +{ + struct ltdb_private *ltdb = module->private_data; + struct ldb_parse_tree *tree; + int ret; + + tree = ldb_parse_tree(ltdb, expression); + if (tree == NULL) { + ltdb->last_err_string = "expression parse failed"; + return -1; + } + + ret = ltdb_search_bytree(module, base, scope, tree, attrs, res); + talloc_free(tree); + return ret; +} + diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 9c126c1dfd..0366809c33 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -800,15 +800,16 @@ static const char *ltdb_errstring(struct ldb_module *module) static const struct ldb_module_ops ltdb_ops = { - "tdb", - ltdb_search, - ltdb_add, - ltdb_modify, - ltdb_delete, - ltdb_rename, - ltdb_lock, - ltdb_unlock, - ltdb_errstring + .name = "tdb", + .search = ltdb_search, + .search_bytree = ltdb_search_bytree, + .add_record = ltdb_add, + .modify_record = ltdb_modify, + .delete_record = ltdb_delete, + .rename_record = ltdb_rename, + .named_lock = ltdb_lock, + .named_unlock = ltdb_unlock, + .errstring = ltdb_errstring }; diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h index eb6c7825d2..891522f300 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h @@ -100,6 +100,10 @@ int ltdb_add_attr_results(struct ldb_module *module, struct ldb_message *msg, int ltdb_search(struct ldb_module *module, const char *base, enum ldb_scope scope, const char *expression, const char * const attrs[], struct ldb_message ***res); +int ltdb_search_bytree(struct ldb_module *module, const char *base, + enum ldb_scope scope, struct ldb_parse_tree *tree, + const char * const attrs[], struct ldb_message ***res); + /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */ struct TDB_DATA ltdb_key(struct ldb_module *module, const char *dn); diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c index 29e5194416..e11c8b4e4e 100644 --- a/source4/lib/ldb/modules/schema.c +++ b/source4/lib/ldb/modules/schema.c @@ -306,6 +306,13 @@ static int schema_search(struct ldb_module *module, const char *base, return ldb_next_search(module, base, scope, expression, attrs, res); } +static int schema_search_bytree(struct ldb_module *module, const char *base, + enum ldb_scope scope, struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res) +{ + return ldb_next_search_bytree(module, base, scope, tree, attrs, res); +} + /* add_record */ static int schema_add_record(struct ldb_module *module, const struct ldb_message *msg) { @@ -541,15 +548,16 @@ static int schema_destructor(void *module_ctx) } static const struct ldb_module_ops schema_ops = { - "schema", - schema_search, - schema_add_record, - schema_modify_record, - schema_delete_record, - schema_rename_record, - schema_named_lock, - schema_named_unlock, - schema_errstring, + .name = "schema", + .search = schema_search, + .search_bytree = schema_search_bytree, + .add_record = schema_add_record, + .modify_record = schema_modify_record, + .delete_record = schema_delete_record, + .rename_record = schema_rename_record, + .named_lock = schema_named_lock, + .named_unlock = schema_named_unlock, + .errstring = schema_errstring, }; #ifdef HAVE_DLOPEN_DISABLED diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c index 505b19a288..1221ac70f1 100644 --- a/source4/lib/ldb/modules/skel.c +++ b/source4/lib/ldb/modules/skel.c @@ -103,6 +103,7 @@ static int skel_destructor(void *module_ctx) static const struct ldb_module_ops skel_ops = { .name = "skel", .search = skel_search, + .search_bytree = skel_search_bytree, .add_record = skel_add_record, .modify_record = skel_modify_record, .delete_record = skel_delete_record, diff --git a/source4/lib/ldb/modules/timestamps.c b/source4/lib/ldb/modules/timestamps.c index 1c01bd14fd..c1db85a284 100644 --- a/source4/lib/ldb/modules/timestamps.c +++ b/source4/lib/ldb/modules/timestamps.c @@ -49,6 +49,14 @@ static int timestamps_search(struct ldb_module *module, const char *base, return ldb_next_search(module, base, scope, expression, attrs, res); } +static int timestamps_search_bytree(struct ldb_module *module, const char *base, + enum ldb_scope scope, struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_search\n"); + return ldb_next_search_bytree(module, base, scope, tree, attrs, res); +} + static int add_time_element(struct ldb_module *module, struct ldb_message *msg, const char *attr_name, const char *time_string, unsigned int flags) { @@ -247,15 +255,16 @@ static int timestamps_destructor(void *module_ctx) } static const struct ldb_module_ops timestamps_ops = { - "timestamps", - timestamps_search, - timestamps_add_record, - timestamps_modify_record, - timestamps_delete_record, - timestamps_rename_record, - timestamps_lock, - timestamps_unlock, - timestamps_errstring + .name = "timestamps", + .search = timestamps_search, + .search_bytree = timestamps_search_bytree, + .add_record = timestamps_add_record, + .modify_record = timestamps_modify_record, + .delete_record = timestamps_delete_record, + .rename_record = timestamps_rename_record, + .named_lock = timestamps_lock, + .named_unlock = timestamps_unlock, + .errstring = timestamps_errstring }; |