From 430dc36c1a456607826cedb9610d2a39cb923bd5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 5 Jun 2005 23:05:37 +0000 Subject: r7312: Add IDL for ncadg packets. (This used to be commit 2009a430b03c685dd65bd573e70d3618f2e0dd0f) --- source4/librpc/idl/dcerpc.idl | 89 ++++++++++++++++++++++++++++++++++++-- source4/librpc/rpc/dcerpc.c | 27 ++++++------ source4/librpc/rpc/dcerpc_util.c | 6 +-- source4/rpc_server/dcerpc_server.c | 14 +++--- source4/rpc_server/dcerpc_server.h | 2 +- source4/rpc_server/dcesrv_auth.c | 16 +++---- 6 files changed, 118 insertions(+), 36 deletions(-) (limited to 'source4') diff --git a/source4/librpc/idl/dcerpc.idl b/source4/librpc/idl/dcerpc.idl index 584bec0b10..a3949b737f 100644 --- a/source4/librpc/idl/dcerpc.idl +++ b/source4/librpc/idl/dcerpc.idl @@ -148,6 +148,50 @@ interface dcerpc [flag(NDR_REMAINING)] DATA_BLOB auth_info; } dcerpc_auth3; + typedef [public] struct { + uint32 _pad; + [flag(NDR_REMAINING)] DATA_BLOB auth_info; + } dcerpc_orphaned; + + typedef [public] struct { + uint32 _pad; + [flag(NDR_REMAINING)] DATA_BLOB auth_info; + } dcerpc_co_cancel; + + typedef [public] struct { + uint32 version; + uint32 id; + } dcerpc_cl_cancel; + + typedef [public] struct { + uint32 version; + uint32 id; + boolean32 server_is_accepting; + } dcerpc_cancel_ack; + + typedef [public] struct { + uint32 version; + uint8 _pad1; + uint16 window_size; + uint32 max_tdsu; + uint32 max_frag_size; + uint16 serial_no; + uint16 selack_size; + uint32 selack[selack_size]; + } dcerpc_fack; + + typedef [public] struct { + } dcerpc_ack; + + typedef [public] struct { + } dcerpc_ping; + + typedef [public] struct { + } dcerpc_shutdown; + + typedef [public] struct { + } dcerpc_working; + typedef [enum8bit] enum { DCERPC_PKT_REQUEST = 0, DCERPC_PKT_PING = 1, @@ -181,8 +225,24 @@ interface dcerpc [case(DCERPC_PKT_FAULT)] dcerpc_fault fault; [case(DCERPC_PKT_AUTH3)] dcerpc_auth3 auth3; [case(DCERPC_PKT_BIND_NAK)] dcerpc_bind_nak bind_nak; - } dcerpc_payload; + [case(DCERPC_PKT_CO_CANCEL)] dcerpc_co_cancel cancel; + [case(DCERPC_PKT_ORPHANED)] dcerpc_orphaned orphaned; + [case(DCERPC_PKT_SHUTDOWN)] dcerpc_shutdown shutdown; + } ncacn_payload; + typedef [nodiscriminant] union { + [case(DCERPC_PKT_REQUEST)] dcerpc_request request; + [case(DCERPC_PKT_PING)] dcerpc_ping ping; + [case(DCERPC_PKT_RESPONSE)] dcerpc_response response; + [case(DCERPC_PKT_FAULT)] dcerpc_fault fault; + [case(DCERPC_PKT_WORKING)] dcerpc_working working; + [case(DCERPC_PKT_NOCALL)] dcerpc_fack nocall; + [case(DCERPC_PKT_REJECT)] dcerpc_fault reject; + [case(DCERPC_PKT_ACK)] dcerpc_ack ack; + [case(DCERPC_PKT_CANCEL_ACK)] dcerpc_cancel_ack cancel_ack; + [case(DCERPC_PKT_FACK)] dcerpc_fack fack; + [case(DCERPC_PKT_CL_CANCEL)] dcerpc_cl_cancel cancel; + } ncadg_payload; /* pfc_flags values */ const uint8 DCERPC_PFC_FLAG_FIRST = 0x01; @@ -207,6 +267,29 @@ interface dcerpc uint16 frag_length; /* Total length of fragment */ uint16 auth_length; /* authenticator length */ uint32 call_id; /* Call identifier */ - [switch_is(ptype)] dcerpc_payload u; - } dcerpc_packet; + [switch_is(ptype)] ncacn_payload u; + } ncacn_packet; + + typedef [public] struct { + uint8 rpc_vers; /* RPC version (4) */ + uint8 ptype; + uint8 pfc_flags; + uint8 ncadg_flags; + uint8 drep[3]; + uint8 serial_high; + GUID object; + GUID iface; + GUID activity; + uint32 server_boot; /* Server boot time */ + uint32 iface_version; + uint32 seq_num; + uint16 opnum; + uint16 ihint; + uint16 ahint; + uint16 len; + uint16 fragnum; + uint8 auth_proto; + uint8 serial_low; + [switch_is(ptype)] ncadg_payload u; + } ncadg_packet; } diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 0194decb4a..e3dbd86ca4 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -182,11 +182,11 @@ static struct ndr_pull *ndr_pull_init_flags(struct dcerpc_connection *c, } /* - parse a data blob into a dcerpc_packet structure. This handles both + parse a data blob into a ncacn_packet structure. This handles both input and output packets */ static NTSTATUS dcerpc_pull(struct dcerpc_connection *c, DATA_BLOB *blob, TALLOC_CTX *mem_ctx, - struct dcerpc_packet *pkt) + struct ncacn_packet *pkt) { struct ndr_pull *ndr; @@ -199,7 +199,7 @@ static NTSTATUS dcerpc_pull(struct dcerpc_connection *c, DATA_BLOB *blob, TALLOC ndr->flags |= LIBNDR_FLAG_BIGENDIAN; } - return ndr_pull_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); + return ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); } /* @@ -233,7 +233,7 @@ static NTSTATUS dcerpc_check_connect_verifier(DATA_BLOB *blob) */ static NTSTATUS dcerpc_pull_request_sign(struct dcerpc_connection *c, DATA_BLOB *blob, TALLOC_CTX *mem_ctx, - struct dcerpc_packet *pkt) + struct ncacn_packet *pkt) { struct ndr_pull *ndr; NTSTATUS status; @@ -256,7 +256,7 @@ static NTSTATUS dcerpc_pull_request_sign(struct dcerpc_connection *c, } /* pull the basic packet */ - status = ndr_pull_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); + status = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -350,7 +350,7 @@ static NTSTATUS dcerpc_pull_request_sign(struct dcerpc_connection *c, */ static NTSTATUS dcerpc_push_request_sign(struct dcerpc_connection *c, DATA_BLOB *blob, TALLOC_CTX *mem_ctx, - struct dcerpc_packet *pkt) + struct ncacn_packet *pkt) { NTSTATUS status; struct ndr_push *ndr; @@ -375,7 +375,7 @@ static NTSTATUS dcerpc_push_request_sign(struct dcerpc_connection *c, ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT; } - status = ndr_push_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); + status = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -482,7 +482,7 @@ static NTSTATUS dcerpc_push_request_sign(struct dcerpc_connection *c, /* fill in the fixed values in a dcerpc header */ -static void init_dcerpc_hdr(struct dcerpc_connection *c, struct dcerpc_packet *pkt) +static void init_dcerpc_hdr(struct dcerpc_connection *c, struct ncacn_packet *pkt) { pkt->rpc_vers = 5; pkt->rpc_vers_minor = 0; @@ -581,7 +581,7 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p, const struct dcerpc_syntax_id *syntax, const struct dcerpc_syntax_id *transfer_syntax) { - struct dcerpc_packet pkt; + struct ncacn_packet pkt; NTSTATUS status; DATA_BLOB blob; @@ -652,14 +652,13 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p, return status; } - /* perform a continued bind (and auth3) */ NTSTATUS dcerpc_auth3(struct dcerpc_connection *c, TALLOC_CTX *mem_ctx) { - struct dcerpc_packet pkt; + struct ncacn_packet pkt; NTSTATUS status; DATA_BLOB blob; @@ -721,7 +720,7 @@ static void dcerpc_request_recv_data(struct dcerpc_connection *c, DATA_BLOB *data, NTSTATUS status) { - struct dcerpc_packet pkt; + struct ncacn_packet pkt; struct rpc_request *req; uint_t length; @@ -851,7 +850,7 @@ struct rpc_request *dcerpc_request_send(struct dcerpc_pipe *p, DATA_BLOB *stub_data) { struct rpc_request *req; - struct dcerpc_packet pkt; + struct ncacn_packet pkt; DATA_BLOB blob; uint32_t remaining, chunk_size; BOOL first_packet = True; @@ -1355,7 +1354,7 @@ NTSTATUS dcerpc_alter_context(struct dcerpc_pipe *p, const struct dcerpc_syntax_id *syntax, const struct dcerpc_syntax_id *transfer_syntax) { - struct dcerpc_packet pkt; + struct ncacn_packet pkt; NTSTATUS status; DATA_BLOB blob; diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 1a0518888d..0265d37f0f 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -87,10 +87,10 @@ const struct dcerpc_interface_table *idl_iface_by_uuid(const char *uuid) /* - push a dcerpc_packet into a blob, potentially with auth info + push a ncacn_packet into a blob, potentially with auth info */ NTSTATUS dcerpc_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, - struct dcerpc_packet *pkt, + struct ncacn_packet *pkt, struct dcerpc_auth *auth_info) { NTSTATUS status; @@ -115,7 +115,7 @@ NTSTATUS dcerpc_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, pkt->auth_length = 0; } - status = ndr_push_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); + status = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 241986a4b1..3882da08d8 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -363,7 +363,7 @@ NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx, } -static void dcesrv_init_hdr(struct dcerpc_packet *pkt) +static void dcesrv_init_hdr(struct ncacn_packet *pkt) { pkt->rpc_vers = 5; pkt->rpc_vers_minor = 0; @@ -382,7 +382,7 @@ static void dcesrv_init_hdr(struct dcerpc_packet *pkt) */ static NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32_t fault_code) { - struct dcerpc_packet pkt; + struct ncacn_packet pkt; struct dcesrv_call_reply *rep; NTSTATUS status; @@ -421,7 +421,7 @@ static NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32_t fault_code */ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason) { - struct dcerpc_packet pkt; + struct ncacn_packet pkt; struct dcesrv_call_reply *rep; NTSTATUS status; @@ -460,7 +460,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) { const char *uuid, *transfer_syntax; uint32_t if_version, transfer_syntax_version; - struct dcerpc_packet pkt; + struct ncacn_packet pkt; struct dcesrv_call_reply *rep; NTSTATUS status; uint32_t result=0, reason=0; @@ -660,7 +660,7 @@ static NTSTATUS dcesrv_alter_new_context(struct dcesrv_call_state *call, uint32_ */ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call) { - struct dcerpc_packet pkt; + struct ncacn_packet pkt; struct dcesrv_call_reply *rep; NTSTATUS status; uint32_t result=0, reason=0; @@ -837,7 +837,7 @@ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call) do { uint32_t length; struct dcesrv_call_reply *rep; - struct dcerpc_packet pkt; + struct ncacn_packet pkt; rep = talloc(call, struct dcesrv_call_reply); NT_STATUS_HAVE_NO_MEMORY(rep); @@ -959,7 +959,7 @@ NTSTATUS dcesrv_input_process(struct dcesrv_connection *dce_conn) ndr->flags |= LIBNDR_FLAG_BIGENDIAN; } - status = ndr_pull_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, &call->pkt); + status = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, &call->pkt); if (!NT_STATUS_IS_OK(status)) { talloc_free(dce_conn->partial_input.data); talloc_free(call); diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 85b51545a1..efcb7f9127 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -71,7 +71,7 @@ struct dcesrv_call_state { struct dcesrv_call_state *next, *prev; struct dcesrv_connection *conn; struct dcesrv_connection_context *context; - struct dcerpc_packet pkt; + struct ncacn_packet pkt; /* the backend can mark the call * with DCESRV_CALL_STATE_FLAG_ASYNC diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c index 5c098a0b60..e12cccd770 100644 --- a/source4/rpc_server/dcesrv_auth.c +++ b/source4/rpc_server/dcesrv_auth.c @@ -31,7 +31,7 @@ */ BOOL dcesrv_auth_bind(struct dcesrv_call_state *call) { - struct dcerpc_packet *pkt = &call->pkt; + struct ncacn_packet *pkt = &call->pkt; struct dcesrv_connection *dce_conn = call->conn; struct dcesrv_auth *auth = &dce_conn->auth_state; NTSTATUS status; @@ -77,7 +77,7 @@ BOOL dcesrv_auth_bind(struct dcesrv_call_state *call) add any auth information needed in a bind ack, and process the authentication information found in the bind. */ -BOOL dcesrv_auth_bind_ack(struct dcesrv_call_state *call, struct dcerpc_packet *pkt) +BOOL dcesrv_auth_bind_ack(struct dcesrv_call_state *call, struct ncacn_packet *pkt) { struct dcesrv_connection *dce_conn = call->conn; NTSTATUS status; @@ -118,7 +118,7 @@ BOOL dcesrv_auth_bind_ack(struct dcesrv_call_state *call, struct dcerpc_packet * */ BOOL dcesrv_auth_auth3(struct dcesrv_call_state *call) { - struct dcerpc_packet *pkt = &call->pkt; + struct ncacn_packet *pkt = &call->pkt; struct dcesrv_connection *dce_conn = call->conn; NTSTATUS status; @@ -168,7 +168,7 @@ BOOL dcesrv_auth_auth3(struct dcesrv_call_state *call) */ BOOL dcesrv_auth_alter(struct dcesrv_call_state *call) { - struct dcerpc_packet *pkt = &call->pkt; + struct ncacn_packet *pkt = &call->pkt; struct dcesrv_connection *dce_conn = call->conn; NTSTATUS status; @@ -202,7 +202,7 @@ BOOL dcesrv_auth_alter(struct dcesrv_call_state *call) add any auth information needed in a alter ack, and process the authentication information found in the alter. */ -BOOL dcesrv_auth_alter_ack(struct dcesrv_call_state *call, struct dcerpc_packet *pkt) +BOOL dcesrv_auth_alter_ack(struct dcesrv_call_state *call, struct ncacn_packet *pkt) { struct dcesrv_connection *dce_conn = call->conn; NTSTATUS status; @@ -275,7 +275,7 @@ static NTSTATUS dcesrv_check_connect_verifier(DATA_BLOB *blob) */ BOOL dcesrv_auth_request(struct dcesrv_call_state *call, DATA_BLOB *full_packet) { - struct dcerpc_packet *pkt = &call->pkt; + struct ncacn_packet *pkt = &call->pkt; struct dcesrv_connection *dce_conn = call->conn; DATA_BLOB auth_blob; struct dcerpc_auth auth; @@ -365,7 +365,7 @@ BOOL dcesrv_auth_request(struct dcesrv_call_state *call, DATA_BLOB *full_packet) push a signed or sealed dcerpc request packet into a blob */ BOOL dcesrv_auth_response(struct dcesrv_call_state *call, - DATA_BLOB *blob, struct dcerpc_packet *pkt) + DATA_BLOB *blob, struct ncacn_packet *pkt) { struct dcesrv_connection *dce_conn = call->conn; NTSTATUS status; @@ -387,7 +387,7 @@ BOOL dcesrv_auth_response(struct dcesrv_call_state *call, ndr->flags |= LIBNDR_FLAG_BIGENDIAN; } - status = ndr_push_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); + status = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); if (!NT_STATUS_IS_OK(status)) { return False; } -- cgit