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

s3:rpc user idl define dcerpc_ctx_list instead of custom RPC_CONTEXT

This commit is contained in:
Simo Sorce 2010-07-07 17:14:27 -04:00
parent d57ecf920c
commit ae526514a9
4 changed files with 24 additions and 24 deletions

View File

@ -5078,7 +5078,7 @@ const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
void init_rpc_hdr(RPC_HDR *hdr, enum dcerpc_pkt_type pkt_type, uint8 flags,
uint32 call_id, int data_len, int auth_len);
bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth);
bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth);
bool smb_io_rpc_context(const char *desc, struct dcerpc_ctx_list *rpc_ctx, prs_struct *ps, int depth);
bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth);
void init_rpc_hdr_ba(RPC_HDR_BA *rpc,
uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,

View File

@ -107,18 +107,11 @@ typedef struct rpc_hdr_auth_info {
#define RPC_HDR_AUTH_LEN 8
typedef struct rpc_context {
uint16 context_id; /* presentation context identifier. */
uint8 num_transfer_syntaxes; /* the number of syntaxes */
struct ndr_syntax_id abstract; /* num and vers. of interface client is using */
struct ndr_syntax_id *transfer; /* Array of transfer interfaces. */
} RPC_CONTEXT;
/* RPC_BIND_REQ - ms req bind */
typedef struct rpc_bind_req_info {
RPC_HDR_BBA bba;
uint8 num_contexts; /* the number of contexts */
RPC_CONTEXT *rpc_context;
struct dcerpc_ctx_list *rpc_context;
} RPC_HDR_RB;
/*

View File

@ -188,10 +188,10 @@ static bool smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *
}
/*******************************************************************
Reads or writes an RPC_CONTEXT structure.
Reads or writes a struct dcerpc_ctx_list structure.
********************************************************************/
bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth)
bool smb_io_rpc_context(const char *desc, struct dcerpc_ctx_list *rpc_ctx, prs_struct *ps, int depth)
{
int i;
@ -209,17 +209,20 @@ bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps,
if (rpc_ctx->num_transfer_syntaxes == 0)
return False;
if(!smb_io_rpc_iface("", &rpc_ctx->abstract, ps, depth))
if(!smb_io_rpc_iface("", &rpc_ctx->abstract_syntax, ps, depth))
return False;
if (UNMARSHALLING(ps)) {
if (!(rpc_ctx->transfer = PRS_ALLOC_MEM(ps, struct ndr_syntax_id, rpc_ctx->num_transfer_syntaxes))) {
rpc_ctx->transfer_syntaxes =
PRS_ALLOC_MEM(ps, struct ndr_syntax_id,
rpc_ctx->num_transfer_syntaxes);
if (!rpc_ctx->transfer_syntaxes) {
return False;
}
}
for (i = 0; i < rpc_ctx->num_transfer_syntaxes; i++ ) {
if (!smb_io_rpc_iface("", &rpc_ctx->transfer[i], ps, depth))
if (!smb_io_rpc_iface("", &rpc_ctx->transfer_syntaxes[i], ps, depth))
return False;
}
return True;
@ -252,7 +255,7 @@ bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int de
return False;
if (UNMARSHALLING(ps)) {
if (!(rpc->rpc_context = PRS_ALLOC_MEM(ps, RPC_CONTEXT, rpc->num_contexts))) {
if (!(rpc->rpc_context = PRS_ALLOC_MEM(ps, struct dcerpc_ctx_list, rpc->num_contexts))) {
return False;
}
}

View File

@ -1605,7 +1605,7 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
* Try and find the correct pipe name to ensure
* that this is a pipe name we support.
*/
id = hdr_rb.rpc_context[0].abstract;
id = hdr_rb.rpc_context[0].abstract_syntax;
if (rpc_srv_pipe_exists_by_id(&id)) {
DEBUG(3, ("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n",
rpc_srv_get_pipe_cli_name(&id),
@ -1614,13 +1614,13 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
status = smb_probe_module(
"rpc", get_pipe_name_from_syntax(
talloc_tos(),
&hdr_rb.rpc_context[0].abstract));
&hdr_rb.rpc_context[0].abstract_syntax));
if (NT_STATUS_IS_ERR(status)) {
DEBUG(3,("api_pipe_bind_req: Unknown pipe name %s in bind request.\n",
get_pipe_name_from_syntax(
talloc_tos(),
&hdr_rb.rpc_context[0].abstract)));
&hdr_rb.rpc_context[0].abstract_syntax)));
prs_mem_free(&p->out_data.frag);
prs_mem_free(&out_hdr_ba);
prs_mem_free(&out_auth);
@ -1664,15 +1664,17 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
unknown to NT4)
Needed when adding entries to a DACL from NT5 - SK */
if(check_bind_req(p, &hdr_rb.rpc_context[0].abstract, &hdr_rb.rpc_context[0].transfer[0],
hdr_rb.rpc_context[0].context_id )) {
if (check_bind_req(p,
&hdr_rb.rpc_context[0].abstract_syntax,
&hdr_rb.rpc_context[0].transfer_syntaxes[0],
hdr_rb.rpc_context[0].context_id)) {
init_rpc_hdr_ba(&hdr_ba,
RPC_MAX_PDU_FRAG_LEN,
RPC_MAX_PDU_FRAG_LEN,
assoc_gid,
ack_pipe_name,
0x1, 0x0, 0x0,
&hdr_rb.rpc_context[0].transfer[0]);
&hdr_rb.rpc_context[0].transfer_syntaxes[0]);
} else {
/* Rejection reason: abstract syntax not supported */
init_rpc_hdr_ba(&hdr_ba, RPC_MAX_PDU_FRAG_LEN,
@ -1941,15 +1943,17 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p)
unknown to NT4)
Needed when adding entries to a DACL from NT5 - SK */
if(check_bind_req(p, &hdr_rb.rpc_context[0].abstract, &hdr_rb.rpc_context[0].transfer[0],
hdr_rb.rpc_context[0].context_id )) {
if (check_bind_req(p,
&hdr_rb.rpc_context[0].abstract_syntax,
&hdr_rb.rpc_context[0].transfer_syntaxes[0],
hdr_rb.rpc_context[0].context_id)) {
init_rpc_hdr_ba(&hdr_ba,
RPC_MAX_PDU_FRAG_LEN,
RPC_MAX_PDU_FRAG_LEN,
assoc_gid,
ack_pipe_name,
0x1, 0x0, 0x0,
&hdr_rb.rpc_context[0].transfer[0]);
&hdr_rb.rpc_context[0].transfer_syntaxes[0]);
} else {
/* Rejection reason: abstract syntax not supported */
init_rpc_hdr_ba(&hdr_ba, RPC_MAX_PDU_FRAG_LEN,