diff options
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 184 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.h | 15 |
2 files changed, 0 insertions, 199 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index f2402605d9..e055d1671b 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -339,44 +339,6 @@ _PUBLIC_ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx, return NT_STATUS_OK; } -/* - search and connect to a dcerpc endpoint -*/ -_PUBLIC_ NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx, - TALLOC_CTX *mem_ctx, - const struct dcerpc_binding *ep_description, - struct auth_session_info *session_info, - struct tevent_context *event_ctx, - struct messaging_context *msg_ctx, - struct server_id server_id, - uint32_t state_flags, - struct dcesrv_connection **dce_conn_p) -{ - NTSTATUS status; - const struct dcesrv_endpoint *ep; - - /* make sure this endpoint exists */ - ep = find_endpoint(dce_ctx, ep_description); - if (!ep) { - return NT_STATUS_OBJECT_NAME_NOT_FOUND; - } - - status = dcesrv_endpoint_connect(dce_ctx, mem_ctx, ep, session_info, - event_ctx, msg_ctx, server_id, - state_flags, dce_conn_p); - NT_STATUS_NOT_OK_RETURN(status); - - (*dce_conn_p)->auth_state.session_key = dcesrv_inherited_session_key; - - /* TODO: check security descriptor of the endpoint here - * if it's a smb named pipe - * if it's failed free dce_conn_p - */ - - return NT_STATUS_OK; -} - - static void dcesrv_init_hdr(struct ncacn_packet *pkt, bool bigendian) { pkt->rpc_vers = 5; @@ -1255,133 +1217,6 @@ NTSTATUS dcesrv_process_ncacn_packet(struct dcesrv_connection *dce_conn, return status; } - -/* - provide some input to a dcerpc endpoint server. This passes data - from a dcerpc client into the server -*/ -_PUBLIC_ NTSTATUS dcesrv_input(struct dcesrv_connection *dce_conn, const DATA_BLOB *data) -{ - dce_conn->partial_input.data = talloc_realloc(dce_conn, - dce_conn->partial_input.data, - uint8_t, - dce_conn->partial_input.length + data->length); - if (!dce_conn->partial_input.data) { - return NT_STATUS_NO_MEMORY; - } - memcpy(dce_conn->partial_input.data + dce_conn->partial_input.length, - data->data, data->length); - dce_conn->partial_input.length += data->length; - - while (dce_full_packet(&dce_conn->partial_input)) { - NTSTATUS status; - struct ndr_pull *ndr; - enum ndr_err_code ndr_err; - DATA_BLOB blob; - struct ncacn_packet *pkt; - - blob = dce_conn->partial_input; - blob.length = dcerpc_get_frag_length(&blob); - blob = data_blob_talloc(dce_conn, blob.data, blob.length); - if (!blob.data) { - data_blob_free(&dce_conn->partial_input); - return NT_STATUS_NO_MEMORY; - } - - dce_partial_advance(dce_conn, blob.length); - - pkt = talloc(dce_conn, struct ncacn_packet); - if (!pkt) { - data_blob_free(&blob); - return NT_STATUS_NO_MEMORY; - } - - ndr = ndr_pull_init_blob(&blob, pkt, lp_iconv_convenience(dce_conn->dce_ctx->lp_ctx)); - if (!ndr) { - data_blob_free(&blob); - talloc_free(pkt); - return NT_STATUS_NO_MEMORY; - } - - if (!(CVAL(blob.data, DCERPC_DREP_OFFSET) & DCERPC_DREP_LE)) { - ndr->flags |= LIBNDR_FLAG_BIGENDIAN; - } - - if (CVAL(blob.data, DCERPC_PFC_OFFSET) & DCERPC_PFC_FLAG_OBJECT_UUID) { - ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT; - } - - ndr_err = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt); - TALLOC_FREE(ndr); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - data_blob_free(&blob); - talloc_free(pkt); - return ndr_map_error2ntstatus(ndr_err); - } - - status = dcesrv_process_ncacn_packet(dce_conn, pkt, blob); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - } - - return NT_STATUS_OK; -} - -/* - retrieve some output from a dcerpc server - The caller supplies a function that will be called to do the - actual output. - - The first argument to write_fn() will be 'private', the second will - be a pointer to a buffer containing the data to be sent and the 3rd - will be a pointer to a size_t variable that will be set to the - number of bytes that are consumed from the output. - - from the current fragment -*/ -_PUBLIC_ NTSTATUS dcesrv_output(struct dcesrv_connection *dce_conn, - void *private_data, - NTSTATUS (*write_fn)(void *private_data, DATA_BLOB *output, size_t *nwritten)) -{ - NTSTATUS status; - struct dcesrv_call_state *call; - struct data_blob_list_item *rep; - size_t nwritten; - - call = dce_conn->call_list; - if (!call || !call->replies) { - if (dce_conn->pending_call_list) { - /* TODO: we need to say act async here - * as we know we have pending requests - * which will be finished at a time - */ - return NT_STATUS_FOOBAR; - } - return NT_STATUS_FOOBAR; - } - rep = call->replies; - - status = write_fn(private_data, &rep->blob, &nwritten); - NT_STATUS_IS_ERR_RETURN(status); - - rep->blob.length -= nwritten; - rep->blob.data += nwritten; - - if (rep->blob.length == 0) { - /* we're done with this section of the call */ - DLIST_REMOVE(call->replies, rep); - } - - if (call->replies == NULL) { - /* we're done with the whole call */ - dcesrv_call_set_list(call, DCESRV_LIST_NONE); - talloc_free(call); - } - - return status; -} - _PUBLIC_ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char **endpoint_servers, struct dcesrv_context **_dce_ctx) @@ -1534,22 +1369,3 @@ const struct dcesrv_critical_sizes *dcerpc_module_version(void) return &critical_sizes; } -/* - initialise the dcerpc server context for ncacn_np based services -*/ -_PUBLIC_ NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct dcesrv_context **_dce_ctx) -{ - NTSTATUS status; - struct dcesrv_context *dce_ctx; - - dcerpc_server_init(lp_ctx); - - status = dcesrv_init_context(mem_ctx, lp_ctx, lp_dcerpc_endpoint_servers(lp_ctx), &dce_ctx); - NT_STATUS_NOT_OK_RETURN(status); - - *_dce_ctx = dce_ctx; - return NT_STATUS_OK; -} - - diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 23806630d2..0c4d4d413d 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -298,21 +298,6 @@ NTSTATUS dcerpc_register_ep_server(const void *_ep_server); NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char **endpoint_servers, struct dcesrv_context **_dce_ctx); -NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct dcesrv_context **_dce_ctx); -NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx, - TALLOC_CTX *mem_ctx, - const struct dcerpc_binding *ep_description, - struct auth_session_info *session_info, - struct tevent_context *event_ctx, - struct messaging_context *msg_ctx, - struct server_id server_id, - uint32_t state_flags, - struct dcesrv_connection **dce_conn_p); -NTSTATUS dcesrv_output(struct dcesrv_connection *dce_conn, - void *private_data, - NTSTATUS (*write_fn)(void *private_data, DATA_BLOB *output, size_t *nwritten)); -NTSTATUS dcesrv_input(struct dcesrv_connection *dce_conn, const DATA_BLOB *data); NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx, TALLOC_CTX *mem_ctx, const struct dcesrv_endpoint *ep, |