summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb.i
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-11 03:25:22 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-11 03:26:45 +0100
commit1d8cdddcd0901c5886099b7596f6d9629bdfad69 (patch)
tree6f357e48f82c79a5f966d73b7c732440ada14087 /source4/lib/ldb/ldb.i
parent6a875cc8529d971cd41d2ba53952481545989d53 (diff)
downloadsamba-1d8cdddcd0901c5886099b7596f6d9629bdfad69.tar.gz
samba-1d8cdddcd0901c5886099b7596f6d9629bdfad69.tar.bz2
samba-1d8cdddcd0901c5886099b7596f6d9629bdfad69.zip
python/ldap: Support controls argument to ldb.search().
(This used to be commit 9eddc27f13fa2feb56d6b015e66d8c54081487da)
Diffstat (limited to 'source4/lib/ldb/ldb.i')
-rw-r--r--source4/lib/ldb/ldb.i52
1 files changed, 49 insertions, 3 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index cf4a335954..2604393e8f 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -514,11 +514,49 @@ typedef struct ldb_context {
const char *options[] = NULL);
~ldb() { talloc_free($self); }
- ldb_error search(ldb_dn *base = NULL,
+ ldb_error search_ex(TALLOC_CTX *mem_ctx,
+ ldb_dn *base = NULL,
enum ldb_scope scope = LDB_SCOPE_DEFAULT,
const char *expression = NULL,
- const char * const *attrs = NULL,
- struct ldb_result **OUT);
+ const char *const *attrs = NULL,
+ struct ldb_control **controls = NULL,
+ struct ldb_result **OUT) {
+ int ret;
+ struct ldb_result *res;
+ struct ldb_request *req;
+ res = talloc_zero(mem_ctx, struct ldb_result);
+ if (!res) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ ret = ldb_build_search_req(&req, $self, mem_ctx,
+ base?base:ldb_get_default_basedn($self),
+ scope,
+ expression,
+ attrs,
+ controls,
+ res,
+ ldb_search_default_callback);
+
+ if (ret != LDB_SUCCESS) {
+ talloc_free(res);
+ return ret;
+ }
+
+ ldb_set_timeout($self, req, 0); /* use default timeout */
+
+ ret = ldb_request($self, req);
+
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+
+ talloc_free(req);
+
+ *OUT = res;
+ return ret;
+ }
+
ldb_error delete(ldb_dn *dn);
ldb_error rename(ldb_dn *olddn, ldb_dn *newdn);
struct ldb_control **parse_control_strings(TALLOC_CTX *mem_ctx,
@@ -615,6 +653,14 @@ typedef struct ldb_context {
_ldb.Ldb_swiginit(self,_ldb.new_Ldb())
if url is not None:
self.connect(url, flags, options)
+
+ def search(self, base=None, scope=SCOPE_DEFAULT, expression=None,
+ attrs=None, controls=None):
+ parsed_controls = None
+ if controls is not None:
+ parsed_controls = self.parse_control_strings(controls)
+ return self.search_ex(base, scope, expression, attrs,
+ parsed_controls)
}
} ldb;