diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-09 11:32:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:34 -0500 |
commit | e74b3ed6f195e66cb5fa0f387cea0f59fb66711b (patch) | |
tree | 0e57da2f311045035ff0f6d63a4d016fecb3adc1 /source4/librpc/rpc/dcerpc.c | |
parent | ab9ca559269f9ef921eb3e6ec3007d2e249c6cfe (diff) | |
download | samba-e74b3ed6f195e66cb5fa0f387cea0f59fb66711b.tar.gz samba-e74b3ed6f195e66cb5fa0f387cea0f59fb66711b.tar.bz2 samba-e74b3ed6f195e66cb5fa0f387cea0f59fb66711b.zip |
r4618: - tidied up the alter_context client code a bit
- there is no alter_nak or alter_ack packet, its all done in an
alter_response
- auto-allocated the contex_ids
- tried to fix up the dcom code to work again with
alter_context. Jelmer, please take a look :)
(This used to be commit dd1c54add8884376601f2f8a56c01bfb8add030c)
Diffstat (limited to 'source4/librpc/rpc/dcerpc.c')
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index d75f6db935..e133c77d07 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -562,6 +562,18 @@ static NTSTATUS full_request(struct dcerpc_connection *c, return state->status; } +/* + map a bind nak reason to a NTSTATUS +*/ +static NTSTATUS dcerpc_map_reason(uint16_t reason) +{ + switch (reason) { + case DCERPC_BIND_REASON_ASYNTAX: + return NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX; + } + return NT_STATUS_UNSUCCESSFUL; +} + /* perform a bind using the given syntax @@ -622,7 +634,7 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p, if (pkt.ptype == DCERPC_PKT_BIND_NAK) { DEBUG(2,("dcerpc: bind_nak reason %d\n", pkt.u.bind_nak.reject_reason)); - return NT_STATUS_ACCESS_DENIED; + return dcerpc_map_reason(pkt.u.bind_nak.reject_reason); } if ((pkt.ptype != DCERPC_PKT_BIND_ACK) || @@ -1387,20 +1399,23 @@ NTSTATUS dcerpc_alter_context(struct dcerpc_pipe *p, return status; } - if (pkt.ptype == DCERPC_PKT_BIND_NAK) { - DEBUG(2,("dcerpc: alter_nak reason %d\n", pkt.u.bind_nak.reject_reason)); - return NT_STATUS_ACCESS_DENIED; + if (pkt.ptype == DCERPC_PKT_ALTER_RESP && + pkt.u.alter_resp.num_results == 1 && + pkt.u.alter_resp.ctx_list[0].result != 0) { + DEBUG(2,("dcerpc: alter_resp failed - reason %d\n", + pkt.u.alter_resp.ctx_list[0].reason)); + return dcerpc_map_reason(pkt.u.alter_resp.ctx_list[0].reason); } - if ((pkt.ptype != DCERPC_PKT_ALTER_ACK) || - pkt.u.alter_ack.num_results == 0 || - pkt.u.alter_ack.ctx_list[0].result != 0) { + if (pkt.ptype != DCERPC_PKT_ALTER_RESP || + pkt.u.alter_resp.num_results == 0 || + pkt.u.alter_resp.ctx_list[0].result != 0) { return NT_STATUS_UNSUCCESSFUL; } - /* the alter_ack might contain a reply set of credentials */ - if (p->conn->security_state.auth_info && pkt.u.alter_ack.auth_info.length) { - status = ndr_pull_struct_blob(&pkt.u.alter_ack.auth_info, + /* the alter_resp might contain a reply set of credentials */ + if (p->conn->security_state.auth_info && pkt.u.alter_resp.auth_info.length) { + status = ndr_pull_struct_blob(&pkt.u.alter_resp.auth_info, mem_ctx, p->conn->security_state.auth_info, (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth); |