summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-02-27 11:35:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:55 -0500
commitb1b14817eaa6e6579596d54166e17bc8d5605c01 (patch)
treeb1af59838a0337dd52b510374b048255397dfe24 /source4/rpc_server
parentd2dc86994e7075490f95faa1cc85008feb38f04a (diff)
downloadsamba-b1b14817eaa6e6579596d54166e17bc8d5605c01.tar.gz
samba-b1b14817eaa6e6579596d54166e17bc8d5605c01.tar.bz2
samba-b1b14817eaa6e6579596d54166e17bc8d5605c01.zip
r5585: LDB interfaces change:
changes: - ldb_wrap disappears from code and become a private structure of db_wrap.c thanks to our move to talloc in ldb code, we do not need to expose it anymore - removal of ldb_close() function form the code thanks to our move to talloc in ldb code, we do not need it anymore use talloc_free() to close and free an ldb database - some minor updates to ldb modules code to cope with the change and fix some bugs I found out during the process (This used to be commit d58be9e74b786a11a57e89df36081d55730dfe0a)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c118
-rw-r--r--source4/rpc_server/netlogon/schannel_state.c30
2 files changed, 74 insertions, 74 deletions
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index a8f2af12ed..2e1a621eee 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -46,7 +46,7 @@ enum lsa_handle {
*/
struct lsa_policy_state {
struct dcesrv_handle *handle;
- struct ldb_wrap *sam_ctx;
+ struct ldb_context *sam_ldb;
struct sidmap_context *sidmap;
uint32_t access_mask;
const char *domain_dn;
@@ -77,7 +77,7 @@ struct lsa_secret_state {
struct lsa_policy_state *policy;
uint32_t access_mask;
const char *secret_dn;
- struct ldb_wrap *sam_ctx;
+ struct ldb_context *sam_ldb;
BOOL global;
};
@@ -122,7 +122,7 @@ static NTSTATUS lsa_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
DCESRV_PULL_HANDLE(h, r->in.handle, DCESRV_HANDLE_ANY);
if (h->wire_handle.handle_type == LSA_HANDLE_SECRET) {
struct lsa_secret_state *secret_state = h->data;
- ret = samdb_delete(secret_state->sam_ctx, mem_ctx, secret_state->secret_dn);
+ ret = samdb_delete(secret_state->sam_ldb, mem_ctx, secret_state->secret_dn);
talloc_free(h);
if (ret != 0) {
return NT_STATUS_INVALID_HANDLE;
@@ -131,7 +131,7 @@ static NTSTATUS lsa_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
return NT_STATUS_OK;
} else if (h->wire_handle.handle_type == LSA_HANDLE_TRUSTED_DOMAIN) {
struct lsa_trusted_domain_state *trusted_domain_state = h->data;
- ret = samdb_delete(trusted_domain_state->policy->sam_ctx, mem_ctx,
+ ret = samdb_delete(trusted_domain_state->policy->sam_ldb, mem_ctx,
trusted_domain_state->trusted_domain_dn);
talloc_free(h);
if (ret != 0) {
@@ -229,8 +229,8 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
}
/* make sure the sam database is accessible */
- state->sam_ctx = samdb_connect(state);
- if (state->sam_ctx == NULL) {
+ state->sam_ldb = samdb_connect(state);
+ if (state->sam_ldb == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -242,7 +242,7 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
/* work out the domain_dn - useful for so many calls its worth
fetching here */
state->domain_dn = talloc_reference(state,
- samdb_search_string(state->sam_ctx, mem_ctx, NULL,
+ samdb_search_string(state->sam_ldb, mem_ctx, NULL,
"dn", "(&(objectClass=domain)(!(objectclass=builtinDomain)))"));
if (!state->domain_dn) {
return NT_STATUS_NO_SUCH_DOMAIN;
@@ -251,7 +251,7 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
/* work out the builtin_dn - useful for so many calls its worth
fetching here */
state->builtin_dn = talloc_reference(state,
- samdb_search_string(state->sam_ctx, mem_ctx, NULL,
+ samdb_search_string(state->sam_ldb, mem_ctx, NULL,
"dn", "objectClass=builtinDomain"));
if (!state->builtin_dn) {
return NT_STATUS_NO_SUCH_DOMAIN;
@@ -260,13 +260,13 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
/* work out the system_dn - useful for so many calls its worth
fetching here */
state->system_dn = talloc_reference(state,
- samdb_search_string(state->sam_ctx, mem_ctx, state->domain_dn,
+ samdb_search_string(state->sam_ldb, mem_ctx, state->domain_dn,
"dn", "(&(objectClass=container)(cn=System))"));
if (!state->system_dn) {
return NT_STATUS_NO_SUCH_DOMAIN;
}
- sid_str = samdb_search_string(state->sam_ctx, mem_ctx, NULL,
+ sid_str = samdb_search_string(state->sam_ldb, mem_ctx, NULL,
"objectSid", "dn=%s", state->domain_dn);
if (!sid_str) {
return NT_STATUS_NO_SUCH_DOMAIN;
@@ -283,7 +283,7 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
}
state->domain_name = talloc_reference(state,
- samdb_search_string(state->sam_ctx, mem_ctx, NULL,
+ samdb_search_string(state->sam_ldb, mem_ctx, NULL,
"name", "dn=%s", state->domain_dn));
if (!state->domain_name) {
return NT_STATUS_NO_SUCH_DOMAIN;
@@ -359,7 +359,7 @@ static NTSTATUS lsa_info_AccountDomain(struct lsa_policy_state *state, TALLOC_CT
int ret;
struct ldb_message **res;
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs,
"dn=%s", state->domain_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -381,7 +381,7 @@ static NTSTATUS lsa_info_DNS(struct lsa_policy_state *state, TALLOC_CTX *mem_ctx
int ret;
struct ldb_message **res;
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs,
"dn=%s", state->domain_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -496,7 +496,7 @@ static NTSTATUS lsa_EnumAccounts(struct dcesrv_call_state *dce_call, TALLOC_CTX
state = h->data;
- ret = samdb_search(state->sam_ctx, mem_ctx, state->builtin_dn, &res, attrs,
+ ret = samdb_search(state->sam_ldb, mem_ctx, state->builtin_dn, &res, attrs,
"privilege=*");
if (ret <= 0) {
return NT_STATUS_NO_SUCH_USER;
@@ -600,7 +600,7 @@ static NTSTATUS lsa_CreateTrustedDomain(struct dcesrv_call_state *dce_call, TALL
}
/* search for the trusted_domain record */
- ret = samdb_search(trusted_domain_state->policy->sam_ctx,
+ ret = samdb_search(trusted_domain_state->policy->sam_ldb,
mem_ctx, policy_state->system_dn, &msgs, attrs,
"(&(cn=%s)(objectclass=trustedDomain))",
r->in.info->name.string);
@@ -619,8 +619,8 @@ static NTSTATUS lsa_CreateTrustedDomain(struct dcesrv_call_state *dce_call, TALL
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(trusted_domain_state->policy->sam_ctx, mem_ctx, msg, "cn", name);
- samdb_msg_add_string(trusted_domain_state->policy->sam_ctx, mem_ctx, msg, "flatname", name);
+ samdb_msg_add_string(trusted_domain_state->policy->sam_ldb, mem_ctx, msg, "cn", name);
+ samdb_msg_add_string(trusted_domain_state->policy->sam_ldb, mem_ctx, msg, "flatname", name);
if (r->in.info->sid) {
const char *sid_string = dom_sid_string(mem_ctx, r->in.info->sid);
@@ -628,23 +628,23 @@ static NTSTATUS lsa_CreateTrustedDomain(struct dcesrv_call_state *dce_call, TALL
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(trusted_domain_state->policy->sam_ctx, mem_ctx, msg, "securityIdentifier", sid_string);
+ samdb_msg_add_string(trusted_domain_state->policy->sam_ldb, mem_ctx, msg, "securityIdentifier", sid_string);
}
/* pull in all the template attributes. Note this is always from the global samdb */
- ret = samdb_copy_template(trusted_domain_state->policy->sam_ctx, mem_ctx, msg,
+ ret = samdb_copy_template(trusted_domain_state->policy->sam_ldb, mem_ctx, msg,
"(&(name=TemplateTrustedDomain)(objectclass=trustedDomainTemplate))");
if (ret != 0) {
DEBUG(0,("Failed to load TemplateTrustedDomain from samdb\n"));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- samdb_msg_add_string(trusted_domain_state->policy->sam_ctx, mem_ctx, msg, "objectClass", "trustedDomain");
+ samdb_msg_add_string(trusted_domain_state->policy->sam_ldb, mem_ctx, msg, "objectClass", "trustedDomain");
trusted_domain_state->trusted_domain_dn = talloc_reference(trusted_domain_state, msg->dn);
/* create the trusted_domain */
- ret = samdb_add(trusted_domain_state->policy->sam_ctx, mem_ctx, msg);
+ ret = samdb_add(trusted_domain_state->policy->sam_ldb, mem_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to create trusted_domain record %s\n", msg->dn));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -700,7 +700,7 @@ static NTSTATUS lsa_OpenTrustedDomain(struct dcesrv_call_state *dce_call, TALLOC
}
/* search for the trusted_domain record */
- ret = samdb_search(trusted_domain_state->policy->sam_ctx,
+ ret = samdb_search(trusted_domain_state->policy->sam_ldb,
mem_ctx, policy_state->system_dn, &msgs, attrs,
"(&(securityIdentifier=%s)(objectclass=trustedDomain))",
sid_string);
@@ -765,7 +765,7 @@ static NTSTATUS lsa_OpenTrustedDomainByName(struct dcesrv_call_state *dce_call,
trusted_domain_state->policy = policy_state;
/* search for the trusted_domain record */
- ret = samdb_search(trusted_domain_state->policy->sam_ctx,
+ ret = samdb_search(trusted_domain_state->policy->sam_ldb,
mem_ctx, policy_state->system_dn, &msgs, attrs,
"(&(flatname=%s)(objectclass=trustedDomain))",
r->in.name.string);
@@ -850,7 +850,7 @@ static NTSTATUS lsa_QueryTrustedDomainInfo(struct dcesrv_call_state *dce_call, T
trusted_domain_state = h->data;
/* pull all the user attributes */
- ret = samdb_search(trusted_domain_state->policy->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(trusted_domain_state->policy->sam_ldb, mem_ctx, NULL, &res, attrs,
"dn=%s", trusted_domain_state->trusted_domain_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -970,7 +970,7 @@ static NTSTATUS lsa_EnumTrustDom(struct dcesrv_call_state *dce_call, TALLOC_CTX
/* search for all users in this domain. This could possibly be cached and
resumed based on resume_key */
- count = samdb_search(policy_state->sam_ctx, mem_ctx, policy_state->system_dn, &domains, attrs,
+ count = samdb_search(policy_state->sam_ldb, mem_ctx, policy_state->system_dn, &domains, attrs,
"objectclass=trustedDomain");
if (count == -1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -1105,7 +1105,7 @@ static NTSTATUS lsa_lookup_sid(struct lsa_policy_state *state, TALLOC_CTX *mem_c
const char * const attrs[] = { "sAMAccountName", "sAMAccountType", "name", NULL};
NTSTATUS status;
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs,
"objectSid=%s", sid_str);
if (ret == 1) {
*name = ldb_msg_find_string(res[0], "sAMAccountName", NULL);
@@ -1324,7 +1324,7 @@ static NTSTATUS lsa_OpenAccount(struct dcesrv_call_state *dce_call, TALLOC_CTX *
}
/* check it really exists */
- astate->account_dn = samdb_search_string(state->sam_ctx, astate,
+ astate->account_dn = samdb_search_string(state->sam_ldb, astate,
NULL, "dn",
"(&(objectSid=%s)(objectClass=group))",
astate->account_sid_str);
@@ -1373,7 +1373,7 @@ static NTSTATUS lsa_EnumPrivsAccount(struct dcesrv_call_state *dce_call,
r->out.privs->unknown = 0;
r->out.privs->set = NULL;
- ret = samdb_search(astate->policy->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(astate->policy->sam_ldb, mem_ctx, NULL, &res, attrs,
"dn=%s", astate->account_dn);
if (ret != 1) {
return NT_STATUS_OK;
@@ -1429,7 +1429,7 @@ static NTSTATUS lsa_EnumAccountRights(struct dcesrv_call_state *dce_call,
return NT_STATUS_NO_MEMORY;
}
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs,
"objectSid=%s", sidstr);
if (ret != 1) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
@@ -1483,7 +1483,7 @@ static NTSTATUS lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_call,
return NT_STATUS_NO_MEMORY;
}
- dn = samdb_search_string(state->sam_ctx, mem_ctx, NULL, "dn",
+ dn = samdb_search_string(state->sam_ldb, mem_ctx, NULL, "dn",
"objectSid=%s", sidstr);
if (dn == NULL) {
return NT_STATUS_NO_SUCH_USER;
@@ -1494,7 +1494,7 @@ static NTSTATUS lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_call,
return NT_STATUS_NO_MEMORY;
}
- if (ldb_msg_add_empty(state->sam_ctx->ldb, msg, "privilege", ldb_flag)) {
+ if (ldb_msg_add_empty(state->sam_ldb, msg, "privilege", ldb_flag)) {
return NT_STATUS_NO_MEMORY;
}
@@ -1545,7 +1545,7 @@ static NTSTATUS lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_call,
return NT_STATUS_OK;
}
- ret = samdb_modify(state->sam_ctx, mem_ctx, msg);
+ ret = samdb_modify(state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
if (ldb_flag == LDB_FLAG_MOD_DELETE) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
@@ -1737,7 +1737,7 @@ static NTSTATUS lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX
if (strncmp("G$", r->in.name.string, 2) == 0) {
const char *name2;
name = &r->in.name.string[2];
- secret_state->sam_ctx = talloc_reference(secret_state, policy_state->sam_ctx);
+ secret_state->sam_ldb = talloc_reference(secret_state, policy_state->sam_ldb);
secret_state->global = True;
if (strlen(name) < 1) {
@@ -1746,7 +1746,7 @@ static NTSTATUS lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX
name2 = talloc_asprintf(mem_ctx, "%s Secret", name);
/* search for the secret record */
- ret = samdb_search(secret_state->sam_ctx,
+ ret = samdb_search(secret_state->sam_ldb,
mem_ctx, policy_state->system_dn, &msgs, attrs,
"(&(cn=%s)(objectclass=secret))",
name2);
@@ -1764,7 +1764,7 @@ static NTSTATUS lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(secret_state->sam_ctx, mem_ctx, msg, "cn", name2);
+ samdb_msg_add_string(secret_state->sam_ldb, mem_ctx, msg, "cn", name2);
} else {
secret_state->global = False;
@@ -1774,9 +1774,9 @@ static NTSTATUS lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX
return NT_STATUS_INVALID_PARAMETER;
}
- secret_state->sam_ctx = talloc_reference(secret_state, secrets_db_connect(mem_ctx));
+ secret_state->sam_ldb = talloc_reference(secret_state, secrets_db_connect(mem_ctx));
/* search for the secret record */
- ret = samdb_search(secret_state->sam_ctx,
+ ret = samdb_search(secret_state->sam_ldb,
mem_ctx, "cn=LSA Secrets", &msgs, attrs,
"(&(cn=%s)(objectclass=secret))",
name);
@@ -1790,23 +1790,23 @@ static NTSTATUS lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX
}
msg->dn = talloc_asprintf(mem_ctx, "cn=%s,cn=LSA Secrets", name);
- samdb_msg_add_string(secret_state->sam_ctx, mem_ctx, msg, "cn", name);
+ samdb_msg_add_string(secret_state->sam_ldb, mem_ctx, msg, "cn", name);
}
/* pull in all the template attributes. Note this is always from the global samdb */
- ret = samdb_copy_template(secret_state->policy->sam_ctx, mem_ctx, msg,
+ ret = samdb_copy_template(secret_state->policy->sam_ldb, mem_ctx, msg,
"(&(name=TemplateSecret)(objectclass=secretTemplate))");
if (ret != 0) {
DEBUG(0,("Failed to load TemplateSecret from samdb\n"));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- samdb_msg_add_string(secret_state->sam_ctx, mem_ctx, msg, "objectClass", "secret");
+ samdb_msg_add_string(secret_state->sam_ldb, mem_ctx, msg, "objectClass", "secret");
secret_state->secret_dn = talloc_reference(secret_state, msg->dn);
/* create the secret */
- ret = samdb_add(secret_state->sam_ctx, mem_ctx, msg);
+ ret = samdb_add(secret_state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to create secret record %s\n", msg->dn));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -1864,7 +1864,7 @@ static NTSTATUS lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
if (strncmp("G$", r->in.name.string, 2) == 0) {
name = &r->in.name.string[2];
- secret_state->sam_ctx = talloc_reference(secret_state, policy_state->sam_ctx);
+ secret_state->sam_ldb = talloc_reference(secret_state, policy_state->sam_ldb);
secret_state->global = True;
if (strlen(name) < 1) {
@@ -1872,7 +1872,7 @@ static NTSTATUS lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
}
/* search for the secret record */
- ret = samdb_search(secret_state->sam_ctx,
+ ret = samdb_search(secret_state->sam_ldb,
mem_ctx, policy_state->system_dn, &msgs, attrs,
"(&(cn=%s Secret)(objectclass=secret))",
name);
@@ -1886,7 +1886,7 @@ static NTSTATUS lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
}
} else {
- secret_state->sam_ctx = talloc_reference(secret_state, secrets_db_connect(mem_ctx));
+ secret_state->sam_ldb = talloc_reference(secret_state, secrets_db_connect(mem_ctx));
secret_state->global = False;
name = r->in.name.string;
@@ -1895,7 +1895,7 @@ static NTSTATUS lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
}
/* search for the secret record */
- ret = samdb_search(secret_state->sam_ctx,
+ ret = samdb_search(secret_state->sam_ldb,
mem_ctx, "cn=LSA Secrets", &msgs, attrs,
"(&(cn=%s)(objectclass=secret))",
name);
@@ -1978,13 +1978,13 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
val.length = secret.length;
/* set value */
- if (samdb_msg_add_value(secret_state->sam_ctx,
+ if (samdb_msg_add_value(secret_state->sam_ldb,
mem_ctx, msg, "priorSecret", &val) != 0) {
return NT_STATUS_NO_MEMORY;
}
/* set old value mtime */
- if (samdb_msg_add_uint64(secret_state->sam_ctx,
+ if (samdb_msg_add_uint64(secret_state->sam_ldb,
mem_ctx, msg, "priorSetTime", nt_now) != 0) {
return NT_STATUS_NO_MEMORY;
}
@@ -1993,16 +1993,16 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
/* This behaviour varies depending of if this is a local, or a global secret... */
if (secret_state->global) {
/* set old value mtime */
- if (samdb_msg_add_uint64(secret_state->sam_ctx,
+ if (samdb_msg_add_uint64(secret_state->sam_ldb,
mem_ctx, msg, "lastSetTime", nt_now) != 0) {
return NT_STATUS_NO_MEMORY;
}
} else {
- if (samdb_msg_add_delete(secret_state->sam_ctx,
+ if (samdb_msg_add_delete(secret_state->sam_ldb,
mem_ctx, msg, "secret")) {
return NT_STATUS_NO_MEMORY;
}
- if (samdb_msg_add_delete(secret_state->sam_ctx,
+ if (samdb_msg_add_delete(secret_state->sam_ldb,
mem_ctx, msg, "lastSetTime")) {
return NT_STATUS_NO_MEMORY;
}
@@ -2024,13 +2024,13 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
val.length = secret.length;
/* set value */
- if (samdb_msg_add_value(secret_state->sam_ctx,
+ if (samdb_msg_add_value(secret_state->sam_ldb,
mem_ctx, msg, "secret", &val) != 0) {
return NT_STATUS_NO_MEMORY;
}
/* set new value mtime */
- if (samdb_msg_add_uint64(secret_state->sam_ctx,
+ if (samdb_msg_add_uint64(secret_state->sam_ldb,
mem_ctx, msg, "lastSetTime", nt_now) != 0) {
return NT_STATUS_NO_MEMORY;
}
@@ -2048,7 +2048,7 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
};
/* search for the secret record */
- ret = samdb_search(secret_state->sam_ctx,
+ ret = samdb_search(secret_state->sam_ldb,
mem_ctx, NULL, &res, attrs,
"(dn=%s)", secret_state->secret_dn);
if (ret == 0) {
@@ -2065,7 +2065,7 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
if (new_val) {
/* set value */
- if (samdb_msg_add_value(secret_state->sam_ctx,
+ if (samdb_msg_add_value(secret_state->sam_ldb,
mem_ctx, msg, "priorSecret",
new_val) != 0) {
return NT_STATUS_NO_MEMORY;
@@ -2074,7 +2074,7 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
/* set new value mtime */
if (ldb_msg_find_ldb_val(res[0], "lastSetTime")) {
- if (samdb_msg_add_uint64(secret_state->sam_ctx,
+ if (samdb_msg_add_uint64(secret_state->sam_ldb,
mem_ctx, msg, "priorSetTime", last_set_time) != 0) {
return NT_STATUS_NO_MEMORY;
}
@@ -2083,7 +2083,7 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
}
/* modify the samdb record */
- ret = samdb_replace(secret_state->sam_ctx, mem_ctx, msg);
+ ret = samdb_replace(secret_state->sam_ldb, mem_ctx, msg);
if (ret != 0) {
/* we really need samdb.c to return NTSTATUS */
return NT_STATUS_UNSUCCESSFUL;
@@ -2121,7 +2121,7 @@ static NTSTATUS lsa_QuerySecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *
secret_state = h->data;
/* pull all the user attributes */
- ret = samdb_search(secret_state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(secret_state->sam_ldb, mem_ctx, NULL, &res, attrs,
"dn=%s", secret_state->secret_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -2340,7 +2340,7 @@ static NTSTATUS lsa_EnumAccountsWithUserRight(struct dcesrv_call_state *dce_call
return NT_STATUS_NO_SUCH_PRIVILEGE;
}
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = samdb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs,
"privilege=%s", privname);
if (ret <= 0) {
return NT_STATUS_NO_SUCH_USER;
@@ -2541,7 +2541,7 @@ static NTSTATUS lsa_lookup_name(struct lsa_policy_state *state, TALLOC_CTX *mem_
name = p + 1;
}
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs, "sAMAccountName=%s", name);
+ ret = samdb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs, "sAMAccountName=%s", name);
if (ret == 1) {
const char *sid_str = ldb_msg_find_string(res[0], "objectSid", NULL);
if (sid_str == NULL) {
diff --git a/source4/rpc_server/netlogon/schannel_state.c b/source4/rpc_server/netlogon/schannel_state.c
index 8f5f80e256..e7c9c13314 100644
--- a/source4/rpc_server/netlogon/schannel_state.c
+++ b/source4/rpc_server/netlogon/schannel_state.c
@@ -32,10 +32,10 @@
/*
connect to the schannel ldb
*/
-static struct ldb_wrap *schannel_db_connect(TALLOC_CTX *mem_ctx)
+static struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx)
{
char *path;
- struct ldb_wrap *ldb;
+ struct ldb_context *ldb;
path = smbd_tmp_path(mem_ctx, "schannel.ldb");
if (!path) {
@@ -58,7 +58,7 @@ static struct ldb_wrap *schannel_db_connect(TALLOC_CTX *mem_ctx)
NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
struct creds_CredentialState *creds)
{
- struct ldb_wrap *ldb;
+ struct ldb_context *ldb;
struct ldb_message *msg;
struct ldb_val val, seed;
char *s;
@@ -112,23 +112,23 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
seed.data = creds->seed.data;
seed.length = sizeof(creds->seed.data);
- ldb_msg_add_value(ldb->ldb, msg, "sessionKey", &val);
- ldb_msg_add_value(ldb->ldb, msg, "seed", &seed);
- ldb_msg_add_string(ldb->ldb, msg, "expiry", s);
- ldb_msg_add_string(ldb->ldb, msg, "negotiateFlags", f);
- ldb_msg_add_string(ldb->ldb, msg, "secureChannelType", sct);
- ldb_msg_add_string(ldb->ldb, msg, "accountName", creds->account_name);
- ldb_msg_add_string(ldb->ldb, msg, "computerName", creds->computer_name);
+ ldb_msg_add_value(ldb, msg, "sessionKey", &val);
+ ldb_msg_add_value(ldb, msg, "seed", &seed);
+ ldb_msg_add_string(ldb, msg, "expiry", s);
+ ldb_msg_add_string(ldb, msg, "negotiateFlags", f);
+ ldb_msg_add_string(ldb, msg, "secureChannelType", sct);
+ ldb_msg_add_string(ldb, msg, "accountName", creds->account_name);
+ ldb_msg_add_string(ldb, msg, "computerName", creds->computer_name);
- ldb_delete(ldb->ldb, msg->dn);
+ ldb_delete(ldb, msg->dn);
- ret = ldb_add(ldb->ldb, msg);
+ ret = ldb_add(ldb, msg);
talloc_free(s);
if (ret != 0) {
DEBUG(0,("Unable to add %s to session key db - %s\n",
- msg->dn, ldb_errstring(ldb->ldb)));
+ msg->dn, ldb_errstring(ldb)));
talloc_free(ldb);
talloc_free(msg);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -148,7 +148,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
const char *computer_name,
struct creds_CredentialState **creds)
{
- struct ldb_wrap *ldb;
+ struct ldb_context *ldb;
time_t expiry;
struct ldb_message **res;
int ret;
@@ -171,7 +171,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- ret = ldb_search(ldb->ldb, NULL, LDB_SCOPE_SUBTREE, expr, NULL, &res);
+ ret = ldb_search(ldb, NULL, LDB_SCOPE_SUBTREE, expr, NULL, &res);
if (ret != 1) {
talloc_free(ldb);
return NT_STATUS_INVALID_HANDLE;