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

dcerpc.idl: make use of union dcerpc_bind_ack_reason and fix all callers.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Jan 16 18:21:40 CET 2014 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2014-01-09 16:00:23 +01:00 committed by Günther Deschner
parent 7a62a35577
commit dc561b7e2d
5 changed files with 20 additions and 10 deletions

View File

@ -94,7 +94,7 @@ interface dcerpc
typedef struct {
dcerpc_bind_ack_result result;
uint16 reason;
[switch_is(result)] dcerpc_bind_ack_reason reason;
ndr_syntax_id syntax;
} dcerpc_ack_ctx;

View File

@ -1620,7 +1620,7 @@ static bool check_bind_response(const struct dcerpc_bind_ack *r,
if (r->num_results != 0x1 || ctx.result != 0) {
DEBUG(2,("bind_rpc_pipe: bind denied results: %d reason: %x\n",
r->num_results, ctx.reason));
r->num_results, ctx.reason.value));
}
DEBUG(5,("check_bind_response: accepted!\n"));

View File

@ -651,13 +651,13 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
pkt->u.bind.ctx_list[0].context_id)) {
bind_ack_ctx.result = 0;
bind_ack_ctx.reason = 0;
bind_ack_ctx.reason.value = 0;
bind_ack_ctx.syntax = pkt->u.bind.ctx_list[0].transfer_syntaxes[0];
} else {
p->pipe_bound = False;
/* Rejection reason: abstract syntax not supported */
bind_ack_ctx.result = DCERPC_BIND_PROVIDER_REJECT;
bind_ack_ctx.reason = DCERPC_BIND_REASON_ASYNTAX;
bind_ack_ctx.reason.value = DCERPC_BIND_REASON_ASYNTAX;
bind_ack_ctx.syntax = ndr_syntax_id_null;
}
@ -1009,13 +1009,13 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
pkt->u.bind.ctx_list[0].context_id)) {
bind_ack_ctx.result = 0;
bind_ack_ctx.reason = 0;
bind_ack_ctx.reason.value = 0;
bind_ack_ctx.syntax = pkt->u.bind.ctx_list[0].transfer_syntaxes[0];
} else {
p->pipe_bound = False;
/* Rejection reason: abstract syntax not supported */
bind_ack_ctx.result = DCERPC_BIND_PROVIDER_REJECT;
bind_ack_ctx.reason = DCERPC_BIND_REASON_ASYNTAX;
bind_ack_ctx.reason.value = DCERPC_BIND_REASON_ASYNTAX;
bind_ack_ctx.syntax = ndr_syntax_id_null;
}

View File

@ -1006,7 +1006,17 @@ static NTSTATUS dcerpc_map_ack_reason(const struct dcerpc_ack_ctx *ack)
return NT_STATUS_RPC_PROTOCOL_ERROR;
}
switch (ack->reason) {
switch (ack->result) {
case DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK:
/*
* We have not asked for this...
*/
return NT_STATUS_RPC_PROTOCOL_ERROR;
default:
break;
}
switch (ack->reason.value) {
case DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED:
return NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX;
case DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED:
@ -2180,7 +2190,7 @@ static void dcerpc_alter_context_recv_handler(struct rpc_request *subreq,
pkt->u.alter_resp.ctx_list[0].result != 0) {
status = dcerpc_map_ack_reason(&pkt->u.alter_resp.ctx_list[0]);
DEBUG(2,("dcerpc: alter_resp failed - reason %d - %s\n",
pkt->u.alter_resp.ctx_list[0].reason,
pkt->u.alter_resp.ctx_list[0].reason.value,
nt_errstr(status)));
tevent_req_nterror(req, status);
return;

View File

@ -640,7 +640,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
return NT_STATUS_NO_MEMORY;
}
pkt.u.bind_ack.ctx_list[0].result = result;
pkt.u.bind_ack.ctx_list[0].reason = reason;
pkt.u.bind_ack.ctx_list[0].reason.value = reason;
pkt.u.bind_ack.ctx_list[0].syntax = ndr_transfer_syntax_ndr;
pkt.u.bind_ack.auth_info = data_blob(NULL, 0);
@ -829,7 +829,7 @@ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call)
return NT_STATUS_NO_MEMORY;
}
pkt.u.alter_resp.ctx_list[0].result = result;
pkt.u.alter_resp.ctx_list[0].reason = reason;
pkt.u.alter_resp.ctx_list[0].reason.value = reason;
pkt.u.alter_resp.ctx_list[0].syntax = ndr_transfer_syntax_ndr;
pkt.u.alter_resp.auth_info = data_blob(NULL, 0);
pkt.u.alter_resp.secondary_address = "";