summaryrefslogtreecommitdiff
path: root/source4/ldap_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-02 07:51:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:55 -0500
commit500d5523d2a83234d6bfbf264d78293426488bfc (patch)
tree2a90456d248fb4c27184771ac2ede645356e6025 /source4/ldap_server
parent1a988ec9af7960616fb4661b20d86ff05146d836 (diff)
downloadsamba-500d5523d2a83234d6bfbf264d78293426488bfc.tar.gz
samba-500d5523d2a83234d6bfbf264d78293426488bfc.tar.bz2
samba-500d5523d2a83234d6bfbf264d78293426488bfc.zip
r4475: fixed smbd to work with the small changes in the ldb API (the most important
change was in the ldb_msg_add_*() routines, which now use the msg as a context, and thus it needs to be a talloc ptr) (This used to be commit 1a4713bfd0e519f3eb7b3241121ff914a6eeef18)
Diffstat (limited to 'source4/ldap_server')
-rw-r--r--source4/ldap_server/ldap_rootdse.c4
-rw-r--r--source4/ldap_server/ldap_simple_ldb.c12
2 files changed, 6 insertions, 10 deletions
diff --git a/source4/ldap_server/ldap_rootdse.c b/source4/ldap_server/ldap_rootdse.c
index fecb82ec4a..71c81ac822 100644
--- a/source4/ldap_server/ldap_rootdse.c
+++ b/source4/ldap_server/ldap_rootdse.c
@@ -309,7 +309,7 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps
void *local_ctx;
struct ldap_SearchResEntry *ent;
struct ldap_Result *done;
- struct ldb_message **res;
+ struct ldb_message **res = NULL;
int result = LDAP_SUCCESS;
struct ldapsrv_reply *ent_r, *done_r;
struct rootdse_db_context *rootdsedb;
@@ -338,8 +338,8 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps
attrs[j] = NULL;
}
- ldb_set_alloc(rootdsedb->ldb, talloc_realloc_fn, rootdsedb);
count = ldb_search(rootdsedb->ldb, "", 0, "dn=cn=rootDSE", attrs, &res);
+ talloc_steal(rootdsedb, res);
if (count == 1) {
ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry);
diff --git a/source4/ldap_server/ldap_simple_ldb.c b/source4/ldap_server/ldap_simple_ldb.c
index c33f04cafb..cdf16c99ea 100644
--- a/source4/ldap_server/ldap_simple_ldb.c
+++ b/source4/ldap_server/ldap_simple_ldb.c
@@ -58,7 +58,7 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
struct ldapsrv_reply *ent_r, *done_r;
int result = LDAP_SUCCESS;
struct samdb_context *samdb;
- struct ldb_message **res;
+ struct ldb_message **res = NULL;
int i, j, y, count = 0;
enum ldb_scope scope = LDB_SCOPE_DEFAULT;
const char **attrs = NULL;
@@ -102,8 +102,8 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
attrs[i] = NULL;
}
- ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
count = ldb_search(samdb->ldb, basedn->dn, scope, r->filter, attrs, &res);
+ talloc_steal(samdb, res);
for (i=0; i < count; i++) {
ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry);
@@ -249,7 +249,6 @@ reply:
ALLOC_CHECK(add_reply);
if (result == LDAP_SUCCESS) {
- ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
ldb_ret = ldb_add(samdb->ldb, msg);
if (ldb_ret == 0) {
result = LDAP_SUCCESS;
@@ -302,7 +301,6 @@ reply:
ALLOC_CHECK(del_reply);
if (result == LDAP_SUCCESS) {
- ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
ldb_ret = ldb_delete(samdb->ldb, dn->dn);
if (ldb_ret == 0) {
result = LDAP_SUCCESS;
@@ -413,7 +411,6 @@ reply:
ALLOC_CHECK(modify_reply);
if (result == LDAP_SUCCESS) {
- ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
ldb_ret = ldb_modify(samdb->ldb, msg);
if (ldb_ret == 0) {
result = LDAP_SUCCESS;
@@ -447,7 +444,7 @@ static NTSTATUS sldb_Compare(struct ldapsrv_partition *partition, struct ldapsrv
struct ldapsrv_reply *compare_r;
int result = LDAP_SUCCESS;
struct samdb_context *samdb;
- struct ldb_message **res;
+ struct ldb_message **res = NULL;
const char *attrs[1];
const char *errstr = NULL;
const char *filter = NULL;
@@ -475,8 +472,8 @@ reply:
ALLOC_CHECK(compare_r);
if (result == LDAP_SUCCESS) {
- ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
count = ldb_search(samdb->ldb, dn->dn, LDB_SCOPE_BASE, filter, attrs, &res);
+ talloc_steal(samdb, res);
if (count == 1) {
DEBUG(10,("sldb_Compare: matched\n"));
result = LDAP_COMPARE_TRUE;
@@ -580,7 +577,6 @@ reply:
ALLOC_CHECK(modifydn_r);
if (result == LDAP_SUCCESS) {
- ldb_set_alloc(samdb->ldb, talloc_realloc_fn, samdb);
ldb_ret = ldb_rename(samdb->ldb, olddn->dn, newdn);
if (ldb_ret == 0) {
result = LDAP_SUCCESS;