diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-03-12 10:18:56 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-03-13 11:19:59 +0100 |
commit | 4d4c6315fa65b9938d1b4222832d12055c46e681 (patch) | |
tree | 286b4bf20c23a5dc1fcec03ba2ba13e3164dd274 /source4/librpc | |
parent | 7888f0e7f779e4d3180978ed7bccdb15e036996a (diff) | |
download | samba-4d4c6315fa65b9938d1b4222832d12055c46e681.tar.gz samba-4d4c6315fa65b9938d1b4222832d12055c46e681.tar.bz2 samba-4d4c6315fa65b9938d1b4222832d12055c46e681.zip |
s4:librpc/rpc: remove unused dcerpc_ndr_request* code
metze
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sun Mar 13 11:19:59 CET 2011 on sn-devel-104
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 189 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 15 |
2 files changed, 0 insertions, 204 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index d467845472..3e1aa6f10c 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -1747,195 +1747,6 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcecli_connection *c, return NT_STATUS_OK; } - -/** - send a rpc request given a dcerpc_call structure - */ -struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, - const struct GUID *object, - const struct ndr_interface_table *table, - uint32_t opnum, - bool async, - TALLOC_CTX *mem_ctx, - void *r) -{ - const struct ndr_interface_call *call; - struct ndr_push *push; - NTSTATUS status; - DATA_BLOB request; - struct rpc_request *req; - enum ndr_err_code ndr_err; - - call = &table->calls[opnum]; - - /* setup for a ndr_push_* call */ - push = ndr_push_init_ctx(mem_ctx); - if (!push) { - return NULL; - } - - if (p->conn->flags & DCERPC_PUSH_BIGENDIAN) { - push->flags |= LIBNDR_FLAG_BIGENDIAN; - } - - if (p->conn->flags & DCERPC_NDR64) { - push->flags |= LIBNDR_FLAG_NDR64; - } - - /* push the structure into a blob */ - ndr_err = call->ndr_push(push, NDR_IN, r); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - status = ndr_map_error2ntstatus(ndr_err); - DEBUG(2,("Unable to ndr_push structure in dcerpc_ndr_request_send - %s\n", - nt_errstr(status))); - talloc_free(push); - return NULL; - } - - /* retrieve the blob */ - request = ndr_push_blob(push); - - if (p->conn->flags & DCERPC_DEBUG_VALIDATE_IN) { - status = dcerpc_ndr_validate_in(p->conn, push, request, call->struct_size, - call->ndr_push, call->ndr_pull); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(2,("Validation failed in dcerpc_ndr_request_send - %s\n", - nt_errstr(status))); - talloc_free(push); - return NULL; - } - } - - DEBUG(10,("rpc request data:\n")); - dump_data(10, request.data, request.length); - - /* make the actual dcerpc request */ - req = dcerpc_request_send(p, object, opnum, &request); - - if (req != NULL) { - req->ndr.table = table; - req->ndr.opnum = opnum; - req->ndr.struct_ptr = r; - req->ndr.mem_ctx = mem_ctx; - } - - talloc_free(push); - - return req; -} - -/* - receive the answer from a dcerpc_ndr_request_send() -*/ -_PUBLIC_ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req) -{ - struct dcerpc_pipe *p = req->p; - NTSTATUS status; - DATA_BLOB response; - struct ndr_pull *pull; - unsigned int flags; - TALLOC_CTX *mem_ctx = req->ndr.mem_ctx; - void *r = req->ndr.struct_ptr; - uint32_t opnum = req->ndr.opnum; - const struct ndr_interface_table *table = req->ndr.table; - const struct ndr_interface_call *call = &table->calls[opnum]; - enum ndr_err_code ndr_err; - - /* make sure the recv code doesn't free the request, as we - need to grab the flags element before it is freed */ - if (talloc_reference(p, req) == NULL) { - return NT_STATUS_NO_MEMORY; - } - - status = dcerpc_request_recv(req, mem_ctx, &response); - if (!NT_STATUS_IS_OK(status)) { - talloc_unlink(p, req); - return status; - } - - flags = req->flags; - - /* prepare for ndr_pull_* */ - pull = ndr_pull_init_flags(p->conn, &response, mem_ctx); - if (!pull) { - talloc_unlink(p, req); - return NT_STATUS_NO_MEMORY; - } - - if (pull->data) { - pull->data = talloc_steal(pull, pull->data); - } - talloc_unlink(p, req); - - if (flags & DCERPC_PULL_BIGENDIAN) { - pull->flags |= LIBNDR_FLAG_BIGENDIAN; - } - - DEBUG(10,("rpc reply data:\n")); - dump_data(10, pull->data, pull->data_size); - - /* pull the structure from the blob */ - ndr_err = call->ndr_pull(pull, NDR_OUT, r); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - status = ndr_map_error2ntstatus(ndr_err); - dcerpc_log_packet(p->conn->packet_log_dir, - table, opnum, NDR_OUT, - &response); - return status; - } - - if (p->conn->flags & DCERPC_DEBUG_VALIDATE_OUT) { - status = dcerpc_ndr_validate_out(p->conn, pull, r, call->struct_size, - call->ndr_push, call->ndr_pull, - call->ndr_print); - if (!NT_STATUS_IS_OK(status)) { - dcerpc_log_packet(p->conn->packet_log_dir, - table, opnum, NDR_OUT, - &response); - return status; - } - } - - if (pull->offset != pull->data_size) { - DEBUG(0,("Warning! ignoring %d unread bytes in rpc packet!\n", - pull->data_size - pull->offset)); - /* we used to return NT_STATUS_INFO_LENGTH_MISMATCH here, - but it turns out that early versions of NT - (specifically NT3.1) add junk onto the end of rpc - packets, so if we want to interoperate at all with - those versions then we need to ignore this error */ - } - - /* TODO: make pull context independent from the output mem_ctx and free the pull context */ - - return NT_STATUS_OK; -} - - -/* - a useful helper function for synchronous rpc requests - - this can be used when you have ndr push/pull functions in the - standard format -*/ -_PUBLIC_ NTSTATUS dcerpc_ndr_request(struct dcerpc_pipe *p, - const struct GUID *object, - const struct ndr_interface_table *table, - uint32_t opnum, - TALLOC_CTX *mem_ctx, - void *r) -{ - struct rpc_request *req; - - req = dcerpc_ndr_request_send(p, object, table, opnum, false, mem_ctx, r); - if (req == NULL) { - return NT_STATUS_NO_MEMORY; - } - - return dcerpc_ndr_request_recv(req); -} - - /* a useful function for retrieving the server name we connected to */ diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index bff7f6e1bb..fab1236eaf 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -266,14 +266,6 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct cli_credentials *credentials, struct tevent_context *ev, struct loadparm_context *lp_ctx); -NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req); -struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, - const struct GUID *object, - const struct ndr_interface_table *table, - uint32_t opnum, - bool async, - TALLOC_CTX *mem_ctx, - void *r); const char *dcerpc_server_name(struct dcerpc_pipe *p); struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev); NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe *p, @@ -376,13 +368,6 @@ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor, struct ndr enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower); const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t); -NTSTATUS dcerpc_ndr_request(struct dcerpc_pipe *p, - const struct GUID *object, - const struct ndr_interface_table *table, - uint32_t opnum, - TALLOC_CTX *mem_ctx, - void *r); - NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, struct dcerpc_binding **b_out); |