summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/dcerpc.c16
-rw-r--r--source4/librpc/rpc/dcerpc.h3
-rw-r--r--source4/librpc/rpc/dcerpc_auth.c1
-rw-r--r--source4/librpc/rpc/dcerpc_util.c6
4 files changed, 23 insertions, 3 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 3868bfdf45..e0b3a550a7 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -44,6 +44,8 @@ struct dcerpc_pipe *dcerpc_pipe_init(void)
p->auth_info = NULL;
p->ntlmssp_state = NULL;
p->flags = 0;
+ p->srv_max_xmit_frag = 0;
+ p->srv_max_recv_frag = 0;
return p;
}
@@ -360,14 +362,16 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p,
return status;
}
- if (pkt.ptype != DCERPC_PKT_BIND_ACK ||
+ if ((pkt.ptype != DCERPC_PKT_BIND_ACK && pkt.ptype != DCERPC_PKT_ALTER_ACK) ||
pkt.u.bind_ack.num_results == 0 ||
pkt.u.bind_ack.ctx_list[0].result != 0) {
status = NT_STATUS_UNSUCCESSFUL;
}
- p->srv_max_xmit_frag = pkt.u.bind_ack.max_xmit_frag;
- p->srv_max_recv_frag = pkt.u.bind_ack.max_recv_frag;
+ if (pkt.ptype != DCERPC_PKT_ALTER_ACK) {
+ p->srv_max_xmit_frag = pkt.u.bind_ack.max_xmit_frag;
+ p->srv_max_recv_frag = pkt.u.bind_ack.max_recv_frag;
+ }
/* the bind_ack might contain a reply set of credentials */
if (p->auth_info && pkt.u.bind_ack.auth_info.length) {
@@ -526,6 +530,7 @@ NTSTATUS dcerpc_request(struct dcerpc_pipe *p,
}
if (pkt.ptype == DCERPC_PKT_FAULT) {
+ p->last_fault_code = pkt.u.fault.status;
return NT_STATUS_NET_WRITE_FAULT;
}
@@ -559,6 +564,11 @@ NTSTATUS dcerpc_request(struct dcerpc_pipe *p,
return NT_STATUS_UNSUCCESSFUL;
}
+ if (pkt.ptype == DCERPC_PKT_FAULT) {
+ p->last_fault_code = pkt.u.fault.status;
+ return NT_STATUS_NET_WRITE_FAULT;
+ }
+
if (pkt.ptype != DCERPC_PKT_RESPONSE) {
return NT_STATUS_UNSUCCESSFUL;
}
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 906f613593..9a301db66b 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -48,6 +48,9 @@ struct dcerpc_pipe {
NTSTATUS (*shutdown_pipe)(struct dcerpc_pipe *);
const char *(*peer_name)(struct dcerpc_pipe *);
} transport;
+
+ /* the last fault code from a DCERPC fault */
+ uint32 last_fault_code;
};
/* dcerpc pipe flags */
diff --git a/source4/librpc/rpc/dcerpc_auth.c b/source4/librpc/rpc/dcerpc_auth.c
index 5850ec6979..99ea03c216 100644
--- a/source4/librpc/rpc/dcerpc_auth.c
+++ b/source4/librpc/rpc/dcerpc_auth.c
@@ -136,6 +136,7 @@ done:
if (!NT_STATUS_IS_OK(status)) {
p->ntlmssp_state = NULL;
+ p->auth_info = NULL;
}
return status;
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 32d940bc88..1f349e9a4b 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -62,6 +62,12 @@ NTSTATUS dcerpc_epm_map_tcp_port(const char *server,
GUID guid;
struct epm_twr_t twr, *twr_r;
+ if (strcmp(uuid, DCERPC_EPMAPPER_UUID) == 0) {
+ /* don't lookup epmapper via epmapper! */
+ *port = 135;
+ return NT_STATUS_OK;
+ }
+
status = dcerpc_pipe_open_tcp(&p, server, 135);
if (!NT_STATUS_IS_OK(status)) {
return status;