1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4:librpc/rpc: make use of dcerpc_binding_get_flags()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-02-04 10:02:28 +01:00 committed by Günther Deschner
parent 57476e4e22
commit 26c2a27c2d
3 changed files with 31 additions and 16 deletions

View File

@ -1174,6 +1174,7 @@ struct tevent_req *dcerpc_bind_send(TALLOC_CTX *mem_ctx,
DATA_BLOB blob;
NTSTATUS status;
struct rpc_request *subreq;
uint32_t flags;
req = tevent_req_create(mem_ctx, &state,
struct dcerpc_bind_state);
@ -1187,6 +1188,8 @@ struct tevent_req *dcerpc_bind_send(TALLOC_CTX *mem_ctx,
p->syntax = *syntax;
p->transfer_syntax = *transfer_syntax;
flags = dcerpc_binding_get_flags(p->binding);
init_ncacn_hdr(p->conn, &pkt);
pkt.ptype = DCERPC_PKT_BIND;
@ -1194,7 +1197,7 @@ struct tevent_req *dcerpc_bind_send(TALLOC_CTX *mem_ctx,
pkt.call_id = p->conn->call_id;
pkt.auth_length = 0;
if (p->binding->flags & DCERPC_CONCURRENT_MULTIPLEX) {
if (flags & DCERPC_CONCURRENT_MULTIPLEX) {
pkt.pfc_flags |= DCERPC_PFC_FLAG_CONC_MPX;
}
@ -1292,6 +1295,7 @@ static void dcerpc_bind_recv_handler(struct rpc_request *subreq,
struct dcerpc_bind_state);
struct dcecli_connection *conn = state->p->conn;
NTSTATUS status;
uint32_t flags;
/*
* Note that pkt is allocated under raw_packet->data,
@ -1349,7 +1353,9 @@ static void dcerpc_bind_recv_handler(struct rpc_request *subreq,
conn->srv_max_recv_frag = MIN(conn->srv_max_recv_frag,
pkt->u.bind_ack.max_recv_frag);
if ((state->p->binding->flags & DCERPC_CONCURRENT_MULTIPLEX) &&
flags = dcerpc_binding_get_flags(state->p->binding);
if ((flags & DCERPC_CONCURRENT_MULTIPLEX) &&
(pkt->pfc_flags & DCERPC_PFC_FLAG_CONC_MPX)) {
conn->flags |= DCERPC_CONCURRENT_MULTIPLEX;
}
@ -1394,6 +1400,9 @@ NTSTATUS dcerpc_auth3(struct dcerpc_pipe *p,
struct ncacn_packet pkt;
NTSTATUS status;
DATA_BLOB blob;
uint32_t flags;
flags = dcerpc_binding_get_flags(p->binding);
init_ncacn_hdr(p->conn, &pkt);
@ -1403,7 +1412,7 @@ NTSTATUS dcerpc_auth3(struct dcerpc_pipe *p,
pkt.auth_length = 0;
pkt.u.auth3.auth_info = data_blob(NULL, 0);
if (p->binding->flags & DCERPC_CONCURRENT_MULTIPLEX) {
if (flags & DCERPC_CONCURRENT_MULTIPLEX) {
pkt.pfc_flags |= DCERPC_PFC_FLAG_CONC_MPX;
}
@ -2056,6 +2065,7 @@ struct tevent_req *dcerpc_alter_context_send(TALLOC_CTX *mem_ctx,
DATA_BLOB blob;
NTSTATUS status;
struct rpc_request *subreq;
uint32_t flags;
req = tevent_req_create(mem_ctx, &state,
struct dcerpc_alter_context_state);
@ -2069,6 +2079,8 @@ struct tevent_req *dcerpc_alter_context_send(TALLOC_CTX *mem_ctx,
p->syntax = *syntax;
p->transfer_syntax = *transfer_syntax;
flags = dcerpc_binding_get_flags(p->binding);
init_ncacn_hdr(p->conn, &pkt);
pkt.ptype = DCERPC_PKT_ALTER;
@ -2076,7 +2088,7 @@ struct tevent_req *dcerpc_alter_context_send(TALLOC_CTX *mem_ctx,
pkt.call_id = p->conn->call_id;
pkt.auth_length = 0;
if (p->binding->flags & DCERPC_CONCURRENT_MULTIPLEX) {
if (flags & DCERPC_CONCURRENT_MULTIPLEX) {
pkt.pfc_flags |= DCERPC_PFC_FLAG_CONC_MPX;
}

View File

@ -131,6 +131,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
struct pipe_np_smb_state *s;
struct composite_context *conn_req;
struct smb_composite_connect *conn;
uint32_t flags;
/* composite context allocation and setup */
c = composite_create(mem_ctx, io->pipe->conn->event_ctx);
@ -167,7 +168,8 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT
* setup) or if asked to do so by the caller (perhaps a SAMR password change?)
*/
s->conn.in.credentials = s->io.creds;
if (s->io.binding->flags & (DCERPC_SCHANNEL|DCERPC_ANON_FALLBACK)) {
flags = dcerpc_binding_get_flags(s->io.binding);
if (flags & (DCERPC_SCHANNEL|DCERPC_ANON_FALLBACK)) {
conn->in.fallback_to_anonymous = true;
} else {
conn->in.fallback_to_anonymous = false;
@ -284,6 +286,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
struct pipe_np_smb2_state *s;
struct tevent_req *subreq;
struct smbcli_options options;
uint32_t flags;
/* composite context allocation and setup */
c = composite_create(mem_ctx, io->pipe->conn->event_ctx);
@ -295,15 +298,15 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
s->io = *io;
flags = dcerpc_binding_get_flags(s->io.binding);
/*
* provide proper credentials - user supplied or anonymous in case this is
* schannel connection
*/
if (s->io.binding->flags & DCERPC_SCHANNEL) {
s->io.creds = cli_credentials_init(mem_ctx);
if (flags & DCERPC_SCHANNEL) {
s->io.creds = cli_credentials_init_anon(mem_ctx);
if (composite_nomem(s->io.creds, c)) return c;
cli_credentials_guess(s->io.creds, lp_ctx);
}
lpcfg_smbcli_options(lp_ctx, &options);

View File

@ -614,7 +614,7 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p,
s->lp_ctx = lp_ctx;
conn = s->pipe->conn;
conn->flags = binding->flags;
conn->flags = dcerpc_binding_get_flags(binding);
if (DEBUGLVL(100)) {
conn->flags |= DCERPC_DEBUG_PRINT_BOTH;
@ -629,7 +629,7 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p,
return c;
}
if ((binding->flags & DCERPC_SCHANNEL) &&
if ((conn->flags & DCERPC_SCHANNEL) &&
!cli_credentials_get_netlogon_creds(s->credentials)) {
/* If we don't already have netlogon credentials for
* the schannel bind, then we have to get these
@ -646,7 +646,7 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p,
* if not doing sign or seal
*/
if (conn->transport.transport == NCACN_NP &&
!(s->binding->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
!(conn->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe, s->table);
composite_continue(c, auth_none_req, continue_auth_none, c);
return c;
@ -666,16 +666,16 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p,
conn->flags |= DCERPC_CONNECT;
}
if (s->binding->flags & DCERPC_AUTH_SPNEGO) {
if (conn->flags & DCERPC_AUTH_SPNEGO) {
auth_type = DCERPC_AUTH_TYPE_SPNEGO;
} else if (s->binding->flags & DCERPC_AUTH_KRB5) {
} else if (conn->flags & DCERPC_AUTH_KRB5) {
auth_type = DCERPC_AUTH_TYPE_KRB5;
} else if (s->binding->flags & DCERPC_SCHANNEL) {
} else if (conn->flags & DCERPC_SCHANNEL) {
auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
} else if (s->binding->flags & DCERPC_AUTH_NTLM) {
} else if (conn->flags & DCERPC_AUTH_NTLM) {
auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
} else {