diff options
author | Volker Lendecke <vl@samba.org> | 2008-04-20 11:45:41 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-04-20 11:47:33 +0200 |
commit | f56eedb95c64593ceff0ef91b99729c5071aa7ac (patch) | |
tree | 2a44ac5504213b9480fad4ca7e5e5b5716090cba /source3 | |
parent | ff8aa642f34f95cb85d4b9a65e01b4fe0efe5384 (diff) | |
download | samba-f56eedb95c64593ceff0ef91b99729c5071aa7ac.tar.gz samba-f56eedb95c64593ceff0ef91b99729c5071aa7ac.tar.bz2 samba-f56eedb95c64593ceff0ef91b99729c5071aa7ac.zip |
Remove the pipe_idx variable from rpc_pipe_client
(This used to be commit 4840febcd481563c3d9b2fabc1fe1b2ae5a76cf6)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/client.h | 4 | ||||
-rw-r--r-- | source3/include/rpc_client.h | 2 | ||||
-rw-r--r-- | source3/lib/netapi/cm.c | 2 | ||||
-rw-r--r-- | source3/libsmb/libsmb_xattr.c | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_netlogon.c | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 73 | ||||
-rw-r--r-- | source3/rpc_client/ndr.c | 2 | ||||
-rw-r--r-- | source3/rpc_parse/parse_rpc.c | 3 |
8 files changed, 38 insertions, 52 deletions
diff --git a/source3/include/client.h b/source3/include/client.h index af03e2bb60..d9f4727203 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -62,10 +62,12 @@ struct rpc_pipe_client { struct cli_state *cli; - int pipe_idx; const char *pipe_name; uint16 fnum; + const struct ndr_syntax_id *abstract_syntax; + const struct ndr_syntax_id *transfer_syntax; + const char *desthost; const char *srv_name_slash; diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index c552271ee7..ce0c932981 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -91,7 +91,7 @@ #define CLI_DO_RPC_WERR( pcli, ctx, p_idx, opnum, q_in, r_out, \ q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ {\ - SMB_ASSERT(pcli->pipe_idx == p_idx); \ + SMB_ASSERT(rpccli_is_pipe_idx(pcli, p_idx)); \ if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ return WERR_NOMEM;\ }\ diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c index 5464237247..2e16b98ffb 100644 --- a/source3/lib/netapi/cm.c +++ b/source3/lib/netapi/cm.c @@ -105,7 +105,7 @@ static struct rpc_pipe_client *pipe_cm_find(struct cli_state *cli, } if (strequal(cli->desthost, p->pipe->desthost) && - pipe_idx == p->pipe->pipe_idx) { + rpccli_is_pipe_idx(p->pipe, pipe_idx)) { *status = NT_STATUS_OK; return p->pipe; } diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c index e17146e611..8763205d1f 100644 --- a/source3/libsmb/libsmb_xattr.c +++ b/source3/libsmb/libsmb_xattr.c @@ -39,7 +39,7 @@ find_lsa_pipe_hnd(struct cli_state *ipc_cli) pipe_hnd; pipe_hnd = pipe_hnd->next) { - if (pipe_hnd->pipe_idx == PI_LSARPC) { + if (rpccli_is_pipe_idx(pipe_hnd, PI_LSARPC)) { return pipe_hnd; } } diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index bf1e161957..cb1d93e9c1 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -134,7 +134,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli, struct dcinfo *dc; bool retried = false; - SMB_ASSERT(cli->pipe_idx == PI_NETLOGON); + SMB_ASSERT(rpccli_is_pipe_idx(cli, PI_NETLOGON)); dc = cli->dc; if (!dc) { diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index b9d184f023..2979d168c5 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -1092,8 +1092,8 @@ static NTSTATUS create_schannel_auth_rpc_bind_req( struct rpc_pipe_client *cli, static NTSTATUS create_bind_or_alt_ctx_internal(enum RPC_PKT_TYPE pkt_type, prs_struct *rpc_out, uint32 rpc_call_id, - RPC_IFACE *abstract, - RPC_IFACE *transfer, + const RPC_IFACE *abstract, + const RPC_IFACE *transfer, RPC_HDR_AUTH *phdr_auth, prs_struct *pauth_info) { @@ -1174,7 +1174,8 @@ static NTSTATUS create_bind_or_alt_ctx_internal(enum RPC_PKT_TYPE pkt_type, static NTSTATUS create_rpc_bind_req(struct rpc_pipe_client *cli, prs_struct *rpc_out, uint32 rpc_call_id, - RPC_IFACE *abstract, RPC_IFACE *transfer, + const RPC_IFACE *abstract, + const RPC_IFACE *transfer, enum pipe_auth_type auth_type, enum pipe_auth_level auth_level) { @@ -1639,34 +1640,7 @@ static bool rpc_pipe_set_hnd_state(struct rpc_pipe_client *cli, Check the rpc bind acknowledge response. ****************************************************************************/ -static bool valid_pipe_name(const int pipe_idx, RPC_IFACE *abstract, RPC_IFACE *transfer) -{ - if ( pipe_idx >= PI_MAX_PIPES ) { - DEBUG(0,("valid_pipe_name: Programmer error! Invalid pipe index [%d]\n", - pipe_idx)); - return False; - } - - DEBUG(5,("Bind Abstract Syntax: ")); - dump_data(5, (uint8 *)&pipe_names[pipe_idx].abstr_syntax, - sizeof(pipe_names[pipe_idx].abstr_syntax)); - DEBUG(5,("Bind Transfer Syntax: ")); - dump_data(5, (uint8 *)&pipe_names[pipe_idx].trans_syntax, - sizeof(pipe_names[pipe_idx].trans_syntax)); - - /* copy the required syntaxes out so we can do the right bind */ - - *transfer = *pipe_names[pipe_idx].trans_syntax; - *abstract = *pipe_names[pipe_idx].abstr_syntax; - - return True; -} - -/**************************************************************************** - Check the rpc bind acknowledge response. -****************************************************************************/ - -static bool check_bind_response(RPC_HDR_BA *hdr_ba, const int pipe_idx, RPC_IFACE *transfer) +static bool check_bind_response(RPC_HDR_BA *hdr_ba, const RPC_IFACE *transfer) { if ( hdr_ba->addr.len == 0) { DEBUG(4,("Ignoring length check -- ASU bug (server didn't fill in the pipe name correctly)")); @@ -1839,8 +1813,8 @@ static NTSTATUS rpc_finish_auth3_bind(struct rpc_pipe_client *cli, ********************************************************************/ static NTSTATUS create_rpc_alter_context(uint32 rpc_call_id, - RPC_IFACE *abstract, - RPC_IFACE *transfer, + const RPC_IFACE *abstract, + const RPC_IFACE *transfer, enum pipe_auth_level auth_level, const DATA_BLOB *pauth_blob, /* spnego auth blob already created. */ prs_struct *rpc_out) @@ -1883,8 +1857,8 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli, RPC_HDR *phdr, prs_struct *rbuf, uint32 rpc_call_id, - RPC_IFACE *abstract, - RPC_IFACE *transfer, + const RPC_IFACE *abstract, + const RPC_IFACE *transfer, enum pipe_auth_type auth_type, enum pipe_auth_level auth_level) { @@ -2018,8 +1992,6 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, { RPC_HDR hdr; RPC_HDR_BA hdr_ba; - RPC_IFACE abstract; - RPC_IFACE transfer; prs_struct rpc_out; prs_struct rbuf; uint32 rpc_call_id; @@ -2031,17 +2003,14 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, (unsigned int)auth_type, (unsigned int)auth_level )); - if (!valid_pipe_name(cli->pipe_idx, &abstract, &transfer)) { - return NT_STATUS_INVALID_PARAMETER; - } - prs_init_empty(&rpc_out, talloc_tos(), MARSHALL); rpc_call_id = get_rpc_call_id(); /* Marshall the outgoing data. */ status = create_rpc_bind_req(cli, &rpc_out, rpc_call_id, - &abstract, &transfer, + cli->abstract_syntax, + cli->transfer_syntax, auth_type, auth_level); @@ -2081,7 +2050,7 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, return NT_STATUS_BUFFER_TOO_SMALL; } - if(!check_bind_response(&hdr_ba, cli->pipe_idx, &transfer)) { + if(!check_bind_response(&hdr_ba, cli->transfer_syntax)) { DEBUG(2,("rpc_pipe_bind: check_bind_response failed.\n")); prs_mem_free(&rbuf); return NT_STATUS_BUFFER_TOO_SMALL; @@ -2111,7 +2080,8 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, case PIPE_AUTH_TYPE_SPNEGO_NTLMSSP: /* Need to send alter context request and reply. */ status = rpc_finish_spnego_ntlmssp_bind(cli, &hdr, &rbuf, rpc_call_id, - &abstract, &transfer, + cli->abstract_syntax, + cli->transfer_syntax, auth_type, auth_level); if (!NT_STATUS_IS_OK(status)) { prs_mem_free(&rbuf); @@ -2162,6 +2132,11 @@ unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli, return cli_set_timeout(cli->cli, timeout); } +bool rpccli_is_pipe_idx(struct rpc_pipe_client *cli, int pipe_idx) +{ + return (cli->abstract_syntax == pipe_names[pipe_idx].abstr_syntax); +} + /**************************************************************************** Open a named pipe over SMB to a remote server. * @@ -2189,6 +2164,13 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe return NULL; } + if ( pipe_idx >= PI_MAX_PIPES ) { + DEBUG(0, ("cli_rpc_pipe_open: Programmer error! Invalid pipe " + "index [%d]\n", pipe_idx)); + *perr = NT_STATUS_INVALID_PARAMETER; + return NULL; + } + /* The pipe name index must fall within our array */ SMB_ASSERT((pipe_idx >= 0) && (pipe_idx < PI_MAX_PIPES)); @@ -2213,7 +2195,8 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe result->fnum = fnum; result->cli = cli; - result->pipe_idx = pipe_idx; + result->abstract_syntax = pipe_names[pipe_idx].abstr_syntax; + result->transfer_syntax = pipe_names[pipe_idx].trans_syntax; result->auth.auth_type = PIPE_AUTH_TYPE_NONE; result->auth.auth_level = PIPE_AUTH_LEVEL_NONE; diff --git a/source3/rpc_client/ndr.c b/source3/rpc_client/ndr.c index ae705b313b..91751a2d71 100644 --- a/source3/rpc_client/ndr.c +++ b/source3/rpc_client/ndr.c @@ -35,7 +35,7 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, NTSTATUS status; enum ndr_err_code ndr_err; - SMB_ASSERT(cli->pipe_idx == p_idx); + SMB_ASSERT(rpccli_is_pipe_idx(cli, p_idx)); SMB_ASSERT(table->num_calls > opnum); call = &table->calls[opnum]; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b6e1424e0..893eb57808 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -252,7 +252,8 @@ static bool smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct * Note the transfer pointer must remain valid until this is marshalled. ********************************************************************/ -void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, RPC_IFACE *abstract, RPC_IFACE *transfer) +void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, + const RPC_IFACE *abstract, const RPC_IFACE *transfer) { rpc_ctx->context_id = context_id ; /* presentation context identifier (0x0) */ rpc_ctx->num_transfer_syntaxes = 1 ; /* the number of syntaxes (has always been 1?)(0x1) */ |