summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-05-22 07:55:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:52 -0500
commit93076cb9bc56a515bbefb6d88470d6776169779a (patch)
tree388d016f9552a244ddae086cee518bb0d48f8dbd /source4/rpc_server
parent8222c13ce98b0beef0ca34621c93c2b4878eb902 (diff)
downloadsamba-93076cb9bc56a515bbefb6d88470d6776169779a.tar.gz
samba-93076cb9bc56a515bbefb6d88470d6776169779a.tar.bz2
samba-93076cb9bc56a515bbefb6d88470d6776169779a.zip
r816: - Make use of tridge's new samdb_result_sid_prefix() helper function.
- Remove legacy sid_to_string (which contained a memleak) - Remove some unused parts of lib/util_sid.c Andrew Bartlett (This used to be commit 7c69a85984e47c004ddfd9bb5eadcb3191b56f9d)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 853a8b39e9..1dab39ebc1 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -332,14 +332,13 @@ static NTSTATUS netr_ServerPasswordSet(struct dcesrv_call_state *dce_call, TALLO
int num_records;
int num_records_domain;
int ret;
- int i;
struct ldb_message **msgs;
struct ldb_message **msgs_domain;
NTSTATUS nt_status;
struct samr_Hash newNtHash;
struct ldb_message mod, *msg_set_pw = &mod;
const char *domain_dn;
- struct dom_sid *domain_sid;
+ const char *domain_sid;
const char *attrs[] = {"objectSid", NULL
};
@@ -379,32 +378,28 @@ static NTSTATUS netr_ServerPasswordSet(struct dcesrv_call_state *dce_call, TALLO
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- domain_sid = dom_sid_parse_talloc(mem_ctx,
- samdb_result_string(msgs[0],
- "objectSid",
- NULL));
+ domain_sid = samdb_result_sid_prefix(mem_ctx, msgs[0], "objectSid");
if (!domain_sid) {
samdb_close(sam_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- sid_split_rid(domain_sid, NULL);
-
/* find the domain's DN */
num_records_domain = samdb_search(sam_ctx, mem_ctx, NULL,
&msgs_domain, domain_attrs,
"(&(objectSid=%s)(objectclass=domain))",
- dom_sid_string(mem_ctx, domain_sid));
+ domain_sid);
if (num_records_domain == 0) {
DEBUG(3,("check_sam_security: Couldn't find domain [%s] in passdb file.\n",
- dom_sid_string(mem_ctx, domain_sid)));
+ domain_sid));
samdb_close(sam_ctx);
return NT_STATUS_NO_SUCH_USER;
}
if (num_records_domain > 1) {
- DEBUG(1,("Found %d records matching domain [%s]\n", num_records_domain, dom_sid_string(mem_ctx, domain_sid)));
+ DEBUG(1,("Found %d records matching domain [%s]\n",
+ num_records_domain, domain_sid));
samdb_close(sam_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -435,15 +430,7 @@ static NTSTATUS netr_ServerPasswordSet(struct dcesrv_call_state *dce_call, TALLO
return nt_status;
}
- /* mark all the message elements as LDB_FLAG_MOD_REPLACE,
- unless they are already marked with some other flag */
- for (i=0;i<mod.num_elements;i++) {
- if (mod.elements[i].flags == 0) {
- mod.elements[i].flags = LDB_FLAG_MOD_REPLACE;
- }
- }
-
- ret = samdb_modify(sam_ctx, mem_ctx, msg_set_pw);
+ ret = samdb_replace(sam_ctx, mem_ctx, msg_set_pw);
if (ret != 0) {
/* we really need samdb.c to return NTSTATUS */