summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-04-23 14:27:59 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-04-23 18:27:31 +0200
commit9b64073cf733588b75c3780f2c18728ff3009500 (patch)
tree9e0a2a4b0489d3322be1a1c06ec68f594d844143
parent90cc5e72ba0cf4b5261be2f2aa9db87bd011fbb0 (diff)
downloadsamba-9b64073cf733588b75c3780f2c18728ff3009500.tar.gz
samba-9b64073cf733588b75c3780f2c18728ff3009500.tar.bz2
samba-9b64073cf733588b75c3780f2c18728ff3009500.zip
ldb/samba3: Support event context argument to ldb_init().
This argument is ignored (Samba3's LDB is synchronous) but having it there is useful for API compatibility with the LDB used by Samba 4 and available on some systems.
-rw-r--r--source3/groupdb/mapping_ldb.c2
-rw-r--r--source3/lib/ldb/common/ldb.c2
-rw-r--r--source3/lib/ldb/include/ldb.h9
-rw-r--r--source3/lib/ldb/tools/ldbadd.c2
-rw-r--r--source3/lib/ldb/tools/ldbdel.c2
-rw-r--r--source3/lib/ldb/tools/ldbedit.c2
-rw-r--r--source3/lib/ldb/tools/ldbmodify.c2
-rw-r--r--source3/lib/ldb/tools/ldbrename.c2
-rw-r--r--source3/lib/ldb/tools/ldbsearch.c2
-rw-r--r--source3/libads/ldap.c3
10 files changed, 18 insertions, 10 deletions
diff --git a/source3/groupdb/mapping_ldb.c b/source3/groupdb/mapping_ldb.c
index a162c194d6..143f4ed6cf 100644
--- a/source3/groupdb/mapping_ldb.c
+++ b/source3/groupdb/mapping_ldb.c
@@ -57,7 +57,7 @@ static bool init_group_mapping(void)
db_path = state_path("group_mapping.ldb");
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
if (ldb == NULL) goto failed;
/* Ensure this db is created read/write for root only. */
diff --git a/source3/lib/ldb/common/ldb.c b/source3/lib/ldb/common/ldb.c
index cef7373c26..0ea80fecfc 100644
--- a/source3/lib/ldb/common/ldb.c
+++ b/source3/lib/ldb/common/ldb.c
@@ -39,7 +39,7 @@
initialise a ldb context
The mem_ctx is optional
*/
-struct ldb_context *ldb_init(void *mem_ctx)
+struct ldb_context *ldb_init(void *mem_ctx, struct tevent_context *tev_ctx)
{
struct ldb_context *ldb = talloc_zero(mem_ctx, struct ldb_context);
int ret;
diff --git a/source3/lib/ldb/include/ldb.h b/source3/lib/ldb/include/ldb.h
index 113652a1a7..466e4a21ee 100644
--- a/source3/lib/ldb/include/ldb.h
+++ b/source3/lib/ldb/include/ldb.h
@@ -795,10 +795,13 @@ int ldb_global_init(void);
\param mem_ctx pointer to a talloc memory context. Pass NULL if there is
no suitable context available.
+ \param ev_ctx Event context. This is here for API compatibility
+ with the Samba 4 version of LDB and ignored in this version of LDB.
+
\return pointer to ldb_context that should be free'd (using talloc_free())
at the end of the program.
*/
-struct ldb_context *ldb_init(void *mem_ctx);
+struct ldb_context *ldb_init(void *mem_ctx, struct tevent_context *ev_ctx);
/**
Connect to a database.
@@ -1275,7 +1278,9 @@ int ldb_attrib_add_handlers(struct ldb_context *ldb,
int ldb_dn_is_special(const struct ldb_dn *dn);
int ldb_dn_check_special(const struct ldb_dn *dn, const char *check);
char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value);
-struct ldb_dn *ldb_dn_new(void *mem_ctx);
+struct ldb_dn *ldb_dn_new(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const char *dn);
+bool ldb_dn_validate(struct ldb_dn *dn);
+struct ldb_dn *ldb_dn_new_fmt(void *mem_ctx, struct ldb_context *ldb, const char *new_fmt, ...);
struct ldb_dn *ldb_dn_explode(void *mem_ctx, const char *dn);
struct ldb_dn *ldb_dn_explode_or_special(void *mem_ctx, const char *dn);
char *ldb_dn_linearize(void *mem_ctx, const struct ldb_dn *edn);
diff --git a/source3/lib/ldb/tools/ldbadd.c b/source3/lib/ldb/tools/ldbadd.c
index 155395e065..c23a13ab3c 100644
--- a/source3/lib/ldb/tools/ldbadd.c
+++ b/source3/lib/ldb/tools/ldbadd.c
@@ -90,7 +90,7 @@ int main(int argc, const char **argv)
ldb_global_init();
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source3/lib/ldb/tools/ldbdel.c b/source3/lib/ldb/tools/ldbdel.c
index c58a82a523..bdd1b60014 100644
--- a/source3/lib/ldb/tools/ldbdel.c
+++ b/source3/lib/ldb/tools/ldbdel.c
@@ -80,7 +80,7 @@ int main(int argc, const char **argv)
ldb_global_init();
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source3/lib/ldb/tools/ldbedit.c b/source3/lib/ldb/tools/ldbedit.c
index a33e6ae704..6b9eaec111 100644
--- a/source3/lib/ldb/tools/ldbedit.c
+++ b/source3/lib/ldb/tools/ldbedit.c
@@ -282,7 +282,7 @@ int main(int argc, const char **argv)
ldb_global_init();
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source3/lib/ldb/tools/ldbmodify.c b/source3/lib/ldb/tools/ldbmodify.c
index f12387a8f6..e3552b4ea3 100644
--- a/source3/lib/ldb/tools/ldbmodify.c
+++ b/source3/lib/ldb/tools/ldbmodify.c
@@ -92,7 +92,7 @@ int main(int argc, const char **argv)
ldb_global_init();
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source3/lib/ldb/tools/ldbrename.c b/source3/lib/ldb/tools/ldbrename.c
index d6c3a4ab62..d66d4b93c3 100644
--- a/source3/lib/ldb/tools/ldbrename.c
+++ b/source3/lib/ldb/tools/ldbrename.c
@@ -59,7 +59,7 @@ int main(int argc, const char **argv)
ldb_global_init();
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source3/lib/ldb/tools/ldbsearch.c b/source3/lib/ldb/tools/ldbsearch.c
index e5cec0fa66..f1c88d580b 100644
--- a/source3/lib/ldb/tools/ldbsearch.c
+++ b/source3/lib/ldb/tools/ldbsearch.c
@@ -279,7 +279,7 @@ int main(int argc, const char **argv)
ldb_global_init();
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index cc72d81b86..44a73cbfdb 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -3858,6 +3858,7 @@ ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
struct ldb_dn *name_dn = NULL;
const char *name = NULL;
char *ou_string = NULL;
+ struct ldb_context *ldb = ldb_init(mem_ctx, NULL);
name_dn = ldb_dn_explode(mem_ctx, *account_ou);
if (name_dn) {
@@ -3883,9 +3884,11 @@ ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
*account_ou = talloc_strdup(mem_ctx, name);
if (!*account_ou) {
+ talloc_free(ldb);
return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
}
+ talloc_free(ldb);
return ADS_SUCCESS;
}