diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-12-12 18:25:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:29:11 -0500 |
commit | 43637dfb9dbf44403fc90d56cedbfbf7a5e54bc8 (patch) | |
tree | f3f2499bb5667f31ee179506ca9ae6793e765d9c /source4 | |
parent | 2986313a68355069ee26b2a2527459e737d3bc29 (diff) | |
download | samba-43637dfb9dbf44403fc90d56cedbfbf7a5e54bc8.tar.gz samba-43637dfb9dbf44403fc90d56cedbfbf7a5e54bc8.tar.bz2 samba-43637dfb9dbf44403fc90d56cedbfbf7a5e54bc8.zip |
r20126: fix talloc hierachy and make lldb a child of module
metze
(This used to be commit 1e3bb180261643900c7bdacef818add5349c7a30)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index bfae566e3e..a96a73d02b 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -47,6 +47,7 @@ struct lldb_private { LDAP *ldap; + struct ldb_module *module; }; struct lldb_context { @@ -786,19 +787,33 @@ static int lldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, const char *options[], - struct ldb_module **module) + struct ldb_module **_module) { - struct lldb_private *lldb = NULL; + struct ldb_module *module; + struct lldb_private *lldb; int version = 3; int ret; - lldb = talloc(ldb, struct lldb_private); + module = talloc(ldb, struct ldb_module); + if (module == NULL) { + ldb_oom(ldb); + talloc_free(lldb); + return -1; + } + talloc_set_name_const(module, "ldb_ldap backend"); + module->ldb = ldb; + module->prev = module->next = NULL; + module->private_data = NULL; + module->ops = &lldb_ops; + + lldb = talloc(module, struct lldb_private); if (!lldb) { ldb_oom(ldb); goto failed; } - - lldb->ldap = NULL; + module->private_data = lldb; + lldb->module = module; + lldb->ldap = NULL; ret = ldap_initialize(&lldb->ldap, url); if (ret != LDAP_SUCCESS) { @@ -816,22 +831,11 @@ static int lldb_connect(struct ldb_context *ldb, goto failed; } - *module = talloc(ldb, struct ldb_module); - if (*module == NULL) { - ldb_oom(ldb); - talloc_free(lldb); - return -1; - } - talloc_set_name_const(*module, "ldb_ldap backend"); - (*module)->ldb = ldb; - (*module)->prev = (*module)->next = NULL; - (*module)->private_data = lldb; - (*module)->ops = &lldb_ops; - + *_module = module; return 0; failed: - talloc_free(lldb); + talloc_free(module); return -1; } |