summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-06-14 11:24:17 -0400
committerSimo Sorce <idra@samba.org>2008-06-14 11:59:19 -0400
commit929adc9efa5cf985f0585214d30d18521aa1a821 (patch)
tree2a0f3e4dedc1336fb29aa4f36f302f29c5439f55 /source4/lib/ldb/common
parent2aba4107915611b223daa8c27c52352f57b25bbc (diff)
downloadsamba-929adc9efa5cf985f0585214d30d18521aa1a821.tar.gz
samba-929adc9efa5cf985f0585214d30d18521aa1a821.tar.bz2
samba-929adc9efa5cf985f0585214d30d18521aa1a821.zip
Make up the right dependencies now that ldb depends on libevents
(This used to be commit 3b8eec7ca334528cad3cdcd5e3fc5ee555d8d0e0)
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/ldb.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index b51c288993..bfce12bdd3 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -1,13 +1,13 @@
-/*
+/*
ldb database library
Copyright (C) Andrew Tridgell 2004
- Copyright (C) Simo Sorce 2005-2006
+ Copyright (C) Simo Sorce 2005-2008
** 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
@@ -34,15 +34,21 @@
#include "ldb_includes.h"
-/*
+/*
initialise a ldb context
- The mem_ctx is optional
+ The mem_ctx is required
+ The event_ctx is required
*/
-struct ldb_context *ldb_init(void *mem_ctx)
+struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx)
{
- struct ldb_context *ldb = talloc_zero(mem_ctx, struct ldb_context);
+ struct ldb_context *ldb;
int ret;
+ ldb = talloc_zero(mem_ctx, struct ldb_context);
+ if (ev_ctx == NULL) {
+ ev_ctx = event_context_init(ldb);
+ }
+
ret = ldb_setup_wellknown_attributes(ldb);
if (ret != 0) {
talloc_free(ldb);
@@ -52,6 +58,10 @@ struct ldb_context *ldb_init(void *mem_ctx)
ldb_set_utf8_default(ldb);
ldb_set_create_perms(ldb, 0666);
ldb_set_modules_dir(ldb, LDB_MODULESDIR);
+ ldb_set_event_context(ldb, ev_ctx);
+
+ /* TODO: get timeout from options if available there */
+ ldb->default_timeout = 300; /* set default to 5 minutes */
return ldb;
}
@@ -568,6 +578,16 @@ void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms)
ldb->create_perms = perms;
}
+void ldb_set_event_context(struct ldb_context *ldb, struct event_context *ev)
+{
+ ldb->ev_ctx = ev;
+}
+
+struct event_context * ldb_get_event_context(struct ldb_context *ldb)
+{
+ return ldb->ev_ctx;
+}
+
/*
start an ldb request
NOTE: the request must be a talloc context.