From 3547872a76741c1aa455c0cd52e0513efb2d5003 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 30 Jan 2014 22:06:53 +0100 Subject: s3:rpcclient: make use of dcerpc_binding_[g|s]et_*() in rpcclient.c Signed-off-by: Stefan Metzmacher Reviewed-by: Guenther Deschner --- source3/rpcclient/rpcclient.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index bcc0b07383..0e6c6c3f4f 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -939,6 +939,8 @@ out_free: TALLOC_CTX *frame = talloc_stackframe(); uint32_t flags = 0; struct dcerpc_binding *binding = NULL; + enum dcerpc_transport_t transport; + uint32_t bflags = 0; const char *binding_string = NULL; char *user, *domain, *q; @@ -1063,34 +1065,41 @@ out_free: } } - if (binding->transport == NCA_UNKNOWN) { - binding->transport = NCACN_NP; + transport = dcerpc_binding_get_transport(binding); + + if (transport == NCA_UNKNOWN) { + nt_status = dcerpc_binding_set_transport(binding, NCACN_NP); + if (!NT_STATUS_IS_OK(nt_status)) { + result = -1; + goto done; + } } - if (binding->flags & DCERPC_CONNECT) { + bflags = dcerpc_binding_get_flags(binding); + if (bflags & DCERPC_CONNECT) { pipe_default_auth_level = DCERPC_AUTH_LEVEL_CONNECT; pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP; } - if (binding->flags & DCERPC_SIGN) { + if (bflags & DCERPC_SIGN) { pipe_default_auth_level = DCERPC_AUTH_LEVEL_INTEGRITY; pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP; } - if (binding->flags & DCERPC_SEAL) { + if (bflags & DCERPC_SEAL) { pipe_default_auth_level = DCERPC_AUTH_LEVEL_PRIVACY; pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP; } - if (binding->flags & DCERPC_AUTH_SPNEGO) { + if (bflags & DCERPC_AUTH_SPNEGO) { pipe_default_auth_type = DCERPC_AUTH_TYPE_SPNEGO; pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_NTLMSSP; } - if (binding->flags & DCERPC_AUTH_NTLM) { + if (bflags & DCERPC_AUTH_NTLM) { if (pipe_default_auth_type == DCERPC_AUTH_TYPE_SPNEGO) { pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_NTLMSSP; } else { pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP; } } - if (binding->flags & DCERPC_AUTH_KRB5) { + if (bflags & DCERPC_AUTH_KRB5) { if (pipe_default_auth_type == DCERPC_AUTH_TYPE_SPNEGO) { pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_KRB5; } else { @@ -1169,7 +1178,7 @@ out_free: cmd_set++; } - default_transport = binding->transport; + default_transport = dcerpc_binding_get_transport(binding); fetch_machine_sid(cli); -- cgit