diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-01-10 15:56:37 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:38 -0500 |
commit | 0457324cc8ee3eb1a8c4d2067db3c7e7934e8702 (patch) | |
tree | 86335b5c726cef014d79fff807ee281797d87808 /source4/rpc_server/netlogon/dcerpc_netlogon.c | |
parent | cab7e90ae523a2c0ef2bbd85dee2ea20d248f4f2 (diff) | |
download | samba-0457324cc8ee3eb1a8c4d2067db3c7e7934e8702.tar.gz samba-0457324cc8ee3eb1a8c4d2067db3c7e7934e8702.tar.bz2 samba-0457324cc8ee3eb1a8c4d2067db3c7e7934e8702.zip |
r4647: - use talloc_zero() instead of ZERO_STRUCTP()
- fix uninitialized memory bug found by valgrind
metze
(This used to be commit 1118a1b1bb09c9a369bb9600fbe8ad3523b7e36f)
Diffstat (limited to 'source4/rpc_server/netlogon/dcerpc_netlogon.c')
-rw-r--r-- | source4/rpc_server/netlogon/dcerpc_netlogon.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index ab67a2595e..c3ca59a041 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -581,29 +581,27 @@ static NTSTATUS netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call, TALLOC_ switch (r->in.validation_level) { case 2: - sam2 = talloc_p(mem_ctx, struct netr_SamInfo2); + sam2 = talloc_zero(mem_ctx, struct netr_SamInfo2); NT_STATUS_HAVE_NO_MEMORY(sam2); - ZERO_STRUCTP(sam2); sam2->base = *sam; r->out.validation.sam2 = sam2; break; case 3: - sam3 = talloc_p(mem_ctx, struct netr_SamInfo3); + sam3 = talloc_zero(mem_ctx, struct netr_SamInfo3); NT_STATUS_HAVE_NO_MEMORY(sam3); - ZERO_STRUCTP(sam3); sam3->base = *sam; r->out.validation.sam3 = sam3; break; case 6: - sam6 = talloc_p(mem_ctx, struct netr_SamInfo6); + sam6 = talloc_zero(mem_ctx, struct netr_SamInfo6); NT_STATUS_HAVE_NO_MEMORY(sam6); - ZERO_STRUCTP(sam6); sam6->base = *sam; sam6->forest.string = lp_realm(); sam6->principle.string = talloc_asprintf(mem_ctx, "%s@%s", sam->account_name.string, sam6->forest.string); + NT_STATUS_HAVE_NO_MEMORY(sam6->principle.string); r->out.validation.sam6 = sam6; break; @@ -626,34 +624,33 @@ static NTSTATUS netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call, TALLOC_ static NTSTATUS netr_LogonSamLogonWithFlags(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct netr_LogonSamLogonWithFlags *r) { + struct server_pipe_state *pipe_state = dce_call->context->private; NTSTATUS nt_status; struct netr_LogonSamLogonEx r2; - struct server_pipe_state *pipe_state = dce_call->context->private; + struct netr_Authenticator *return_authenticator; - r->out.return_authenticator = talloc_p(mem_ctx, struct netr_Authenticator); - if (!r->out.return_authenticator) { - return NT_STATUS_NO_MEMORY; - } + return_authenticator = talloc(mem_ctx, struct netr_Authenticator); + NT_STATUS_HAVE_NO_MEMORY(return_authenticator); - nt_status = netr_creds_server_step_check(pipe_state, r->in.credential, r->out.return_authenticator); - if (!NT_STATUS_IS_OK(nt_status)) { - return nt_status; - } + nt_status = netr_creds_server_step_check(pipe_state, r->in.credential, return_authenticator); + NT_STATUS_NOT_OK_RETURN(nt_status); ZERO_STRUCT(r2); - r2.in.server_name = r->in.server_name; - r2.in.workstation = r->in.workstation; - r2.in.logon_level = r->in.logon_level; - r2.in.logon = r->in.logon; - r2.in.validation_level = r->in.validation_level; - r2.in.flags = r->in.flags; + r2.in.server_name = r->in.server_name; + r2.in.workstation = r->in.workstation; + r2.in.logon_level = r->in.logon_level; + r2.in.logon = r->in.logon; + r2.in.validation_level = r->in.validation_level; + r2.in.flags = r->in.flags; nt_status = netr_LogonSamLogonEx(dce_call, mem_ctx, &r2); - r->out.validation = r2.out.validation; - r->out.authoritative = r2.out.authoritative; + r->out.return_authenticator = return_authenticator; + r->out.validation = r2.out.validation; + r->out.authoritative = r2.out.authoritative; + r->out.flags = r2.out.flags; r->out.flags = r2.out.flags; return nt_status; |