From 93076cb9bc56a515bbefb6d88470d6776169779a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 22 May 2004 07:55:48 +0000 Subject: 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) --- source4/rpc_server/netlogon/dcerpc_netlogon.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'source4/rpc_server') 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