svn commit: samba r20126 - in
branches/SAMBA_4_0/source/lib/ldb/ldb_ldap: .
metze at samba.org
metze at samba.org
Tue Dec 12 18:25:20 GMT 2006
Author: metze
Date: 2006-12-12 18:25:19 +0000 (Tue, 12 Dec 2006)
New Revision: 20126
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20126
Log:
fix talloc hierachy and make lldb a child of module
metze
Modified:
branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c 2006-12-12 18:14:31 UTC (rev 20125)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c 2006-12-12 18:25:19 UTC (rev 20126)
@@ -47,6 +47,7 @@
struct lldb_private {
LDAP *ldap;
+ struct ldb_module *module;
};
struct lldb_context {
@@ -786,20 +787,34 @@
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;
}
+ module->private_data = lldb;
+ lldb->module = module;
+ lldb->ldap = NULL;
- lldb->ldap = NULL;
-
ret = ldap_initialize(&lldb->ldap, url);
if (ret != LDAP_SUCCESS) {
ldb_debug(ldb, LDB_DEBUG_FATAL, "ldap_initialize failed for URL '%s' - %s\n",
@@ -816,22 +831,11 @@
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;
}
More information about the samba-cvs
mailing list