From 3a6f761eb061d93837038f0aa75c2ffcb0ba3639 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 12 Jul 2004 16:35:48 +0000 Subject: r1470: Get the smb_trans2 structure out of the rap_cli_call struct. Initial attempt at RAP server infrastructure. Look at rap_server.c for the dummy functions that are supposed to implement the core functionality. ipc_rap.c contains all the data shuffling. _rap_shareenum and _rap_serverenum2 in ipc_rap.c are (I think) regular enough to be auto-generated. I did not test all the corner cases yet, but nevertheless I would like some comments on the general style. Volker P.S: samba-3 smbclient now doesn't freak out anymore, although the results are not entirely correct :-) (This used to be commit 08140cc1a838b4eaa23c897b280a46c95b7ef3e0) --- source4/ntvfs/ipc/ipc_rap.c | 463 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 source4/ntvfs/ipc/ipc_rap.c (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c new file mode 100644 index 0000000000..d2cd0b38d5 --- /dev/null +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -0,0 +1,463 @@ +/* + Unix SMB/CIFS implementation. + RAP handlers + + Copyright (C) Volker Lendecke 2004 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +#define NERR_Success 0 +#define NERR_badpass 86 +#define NERR_notsupported 50 + +struct rap_string_heap { + TALLOC_CTX *mem_ctx; + int offset; + int num_strings; + const char **strings; +}; + +struct rap_heap_save { + int offset, num_strings; +}; + +static void rap_heap_save(struct rap_string_heap *heap, + struct rap_heap_save *save) +{ + save->offset = heap->offset; + save->num_strings = heap->num_strings; +} + +static void rap_heap_restore(struct rap_string_heap *heap, + struct rap_heap_save *save) +{ + heap->offset = save->offset; + heap->num_strings = save->num_strings; +} + +struct rap_call { + TALLOC_CTX *mem_ctx; + uint16 callno; + const char *paramdesc; + const char *datadesc; + + uint16 status; + uint16 convert; + + uint16 rcv_paramlen, rcv_datalen; + + struct ndr_push *ndr_push_param; + struct ndr_push *ndr_push_data; + struct rap_string_heap *heap; + + struct ndr_pull *ndr_pull_param; + struct ndr_pull *ndr_pull_data; +}; + +#define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + +static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, + struct smb_trans2 *trans) +{ + struct rap_call *call; + + call = talloc_p(mem_ctx, struct rap_call); + + if (call == NULL) + return NULL; + + ZERO_STRUCTP(call); + + call->mem_ctx = mem_ctx; + + call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx); + call->ndr_pull_param->flags = RAPNDR_FLAGS; + + call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx); + call->ndr_pull_data->flags = RAPNDR_FLAGS; + + call->heap = talloc_p(mem_ctx, struct rap_string_heap); + + if (call->heap == NULL) + return NULL; + + ZERO_STRUCTP(call->heap); + + call->heap->mem_ctx = mem_ctx; + + return call; +} + +static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16 *result) +{ + if (*call->paramdesc++ != 'W') + return NT_STATUS_INVALID_PARAMETER; + + return ndr_pull_uint16(call->ndr_pull_param, result); +} + +static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32 *result) +{ + if (*call->paramdesc++ != 'D') + return NT_STATUS_INVALID_PARAMETER; + + return ndr_pull_uint32(call->ndr_pull_param, result); +} + +static NTSTATUS rap_srv_pull_string(struct rap_call *call, const char **result) +{ + char paramdesc = *call->paramdesc++; + + if (paramdesc == 'O') { + *result = NULL; + return NT_STATUS_OK; + } + + if (paramdesc != 'z') + return NT_STATUS_INVALID_PARAMETER; + + return ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, result); +} + +static NTSTATUS rap_srv_pull_bufsize(struct rap_call *call, uint16 *bufsize) +{ + NTSTATUS result; + + if ( (*call->paramdesc++ != 'r') || (*call->paramdesc++ != 'L') ) + return NT_STATUS_INVALID_PARAMETER; + + result = ndr_pull_uint16(call->ndr_pull_param, bufsize); + + if (!NT_STATUS_IS_OK(result)) + return result; + + call->heap->offset = *bufsize; + + return NT_STATUS_OK; +} + +static NTSTATUS rap_srv_pull_expect_multiple(struct rap_call *call) +{ + if ( (*call->paramdesc++ != 'e') || (*call->paramdesc++ != 'h') ) + return NT_STATUS_INVALID_PARAMETER; + + return NT_STATUS_OK; +} + +static NTSTATUS rap_push_string(struct ndr_push *data_push, + struct rap_string_heap *heap, + const char *str) +{ + size_t space; + + if (str == NULL) + str = ""; + + space = strlen(str)+1; + + if (heap->offset < space) + return NT_STATUS_BUFFER_TOO_SMALL; + + heap->offset -= space; + + NDR_CHECK(ndr_push_uint16(data_push, heap->offset)); + NDR_CHECK(ndr_push_uint16(data_push, 0)); + + heap->strings = talloc_realloc(heap->mem_ctx, heap->strings, + sizeof(*heap->strings) * + (heap->num_strings + 1)); + + if (heap->strings == NULL) + return NT_STATUS_NO_MEMORY; + + heap->strings[heap->num_strings] = str; + heap->num_strings += 1; + + return NT_STATUS_OK; +} + +#define NDR_OK(call) do { result = call; \ + if (NT_STATUS_EQUAL(result, NT_STATUS_BUFFER_TOO_SMALL)) \ + goto buffer_overflow; \ + if (!NT_STATUS_IS_OK(result)) \ + goto done; \ + } while (0) + +static NTSTATUS _rap_netshareenum(struct smbsrv_request *req, + struct rap_call *call) +{ + struct rap_NetShareEnum r; + NTSTATUS result; + + NDR_OK(rap_srv_pull_word(call, &r.in.level)); + NDR_OK(rap_srv_pull_bufsize(call, &r.in.bufsize)); + NDR_OK(rap_srv_pull_expect_multiple(call)); + + switch(r.in.level) { + case 0: + if (strcmp(call->datadesc, "B13") != 0) + return NT_STATUS_INVALID_PARAMETER; + break; + case 1: + if (strcmp(call->datadesc, "B13BWz") != 0) + return NT_STATUS_INVALID_PARAMETER; + break; + default: + return NT_STATUS_INVALID_PARAMETER; + break; + } + + result = rap_netshareenum(req, &r); + + if (!NT_STATUS_IS_OK(result)) + return result; + + for (r.out.count = 0; r.out.count < r.out.available; r.out.count++) { + + int i = r.out.count; + struct ndr_push_save data_save; + struct rap_heap_save heap_save; + + ndr_push_save(call->ndr_push_data, &data_save); + rap_heap_save(call->heap, &heap_save); + + switch(r.in.level) { + case 0: + NDR_OK(ndr_push_bytes(call->ndr_push_data, + r.out.info[i].info0.name, + sizeof(r.out.info[i].info0.name))); + break; + case 1: + NDR_OK(ndr_push_bytes(call->ndr_push_data, + r.out.info[i].info1.name, + sizeof(r.out.info[i].info1.name))); + NDR_OK(ndr_push_uint8(call->ndr_push_data, + r.out.info[i].info1.pad)); + NDR_OK(ndr_push_uint16(call->ndr_push_data, + r.out.info[i].info1.type)); + + NDR_OK(rap_push_string(call->ndr_push_data, + call->heap, + r.out.info[i].info1.comment)); + + break; + } + + if (call->ndr_push_data->offset > call->heap->offset) { + + buffer_overflow: + + ndr_push_restore(call->ndr_push_data, &data_save); + rap_heap_restore(call->heap, &heap_save); + break; + } + } + + call->status = r.out.status; + + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.count)); + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.available)); + + result = NT_STATUS_OK; + + done: + return result; +} + +static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req, + struct rap_call *call) +{ + struct rap_NetServerEnum2 r; + NTSTATUS result; + + NDR_OK(rap_srv_pull_word(call, &r.in.level)); + NDR_OK(rap_srv_pull_bufsize(call, &r.in.bufsize)); + NDR_OK(rap_srv_pull_expect_multiple(call)); + NDR_OK(rap_srv_pull_dword(call, &r.in.servertype)); + NDR_OK(rap_srv_pull_string(call, &r.in.domain)); + + switch(r.in.level) { + case 0: + if (strcmp(call->datadesc, "B16") != 0) + return NT_STATUS_INVALID_PARAMETER; + break; + case 1: + if (strcmp(call->datadesc, "B16BBDz") != 0) + return NT_STATUS_INVALID_PARAMETER; + break; + default: + return NT_STATUS_INVALID_PARAMETER; + break; + } + + result = rap_netserverenum2(req, &r); + + if (!NT_STATUS_IS_OK(result)) + return result; + + for (r.out.count = 0; r.out.count < r.out.available; r.out.count++) { + + int i = r.out.count; + struct ndr_push_save data_save; + struct rap_heap_save heap_save; + + ndr_push_save(call->ndr_push_data, &data_save); + rap_heap_save(call->heap, &heap_save); + + switch(r.in.level) { + case 0: + NDR_OK(ndr_push_bytes(call->ndr_push_data, + r.out.info[i].info0.name, + sizeof(r.out.info[i].info0.name))); + break; + case 1: + NDR_OK(ndr_push_bytes(call->ndr_push_data, + r.out.info[i].info1.name, + sizeof(r.out.info[i].info1.name))); + NDR_OK(ndr_push_uint8(call->ndr_push_data, + r.out.info[i].info1.version_major)); + NDR_OK(ndr_push_uint8(call->ndr_push_data, + r.out.info[i].info1.version_minor)); + NDR_OK(ndr_push_uint32(call->ndr_push_data, + r.out.info[i].info1.servertype)); + + NDR_OK(rap_push_string(call->ndr_push_data, + call->heap, + r.out.info[i].info1.comment)); + + break; + } + + if (call->ndr_push_data->offset > call->heap->offset) { + + buffer_overflow: + + ndr_push_restore(call->ndr_push_data, &data_save); + rap_heap_restore(call->heap, &heap_save); + break; + } + } + + call->status = r.out.status; + + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.count)); + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.available)); + + result = NT_STATUS_OK; + + done: + return result; +} + +static NTSTATUS api_Unsupported(struct smbsrv_request *req, + struct rap_call *call) +{ + call->status = NERR_notsupported; + call->convert = 0; + return NT_STATUS_OK; +} + +#define RAP_NetShareEnum 0 +#define RAP_NetServerEnum2 104 + +static const struct +{ + const char *name; + int id; + NTSTATUS (*fn)(struct smbsrv_request *req, struct rap_call *call); +} api_commands[] = { + {"NetShareEnum", RAP_NetShareEnum, _rap_netshareenum }, + {"NetServerEnum2", RAP_NetServerEnum2, _rap_netserverenum2 }, + {NULL, -1, api_Unsupported} +}; + +NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) +{ + int i; + NTSTATUS result; + struct rap_call *call; + DATA_BLOB result_param, result_data; + struct ndr_push *final_param; + struct ndr_push *final_data; + + call = new_rap_srv_call(req->mem_ctx, trans); + + if (call == NULL) + return NT_STATUS_NO_MEMORY; + + NDR_CHECK(ndr_pull_uint16(call->ndr_pull_param, &call->callno)); + NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, + &call->paramdesc)); + NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, + &call->datadesc)); + + call->ndr_push_param = ndr_push_init_ctx(req->mem_ctx); + call->ndr_push_data = ndr_push_init_ctx(req->mem_ctx); + + if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL)) + return NT_STATUS_NO_MEMORY; + + call->ndr_push_param->flags = RAPNDR_FLAGS; + call->ndr_push_data->flags = RAPNDR_FLAGS; + + result = NT_STATUS_NOT_IMPLEMENTED; + + for (i=0; api_commands[i].name != NULL; i++) { + if (api_commands[i].id == call->callno) { + DEBUG(5, ("Running RAP call %s\n", + api_commands[i].name)); + result = api_commands[i].fn(req, call); + break; + } + } + + if (!NT_STATUS_IS_OK(result)) + return result; + + result_param = ndr_push_blob(call->ndr_push_param); + result_data = ndr_push_blob(call->ndr_push_data); + + final_param = ndr_push_init_ctx(req->mem_ctx); + final_data = ndr_push_init_ctx(req->mem_ctx); + + if ((final_param == NULL) || (final_data == NULL)) + return NT_STATUS_NO_MEMORY; + + final_param->flags = RAPNDR_FLAGS; + final_data->flags = RAPNDR_FLAGS; + + NDR_CHECK(ndr_push_uint16(final_param, call->status)); + NDR_CHECK(ndr_push_uint16(final_param, + call->heap->offset - result_data.length)); + NDR_CHECK(ndr_push_bytes(final_param, result_param.data, + result_param.length)); + + NDR_CHECK(ndr_push_bytes(final_data, result_data.data, + result_data.length)); + + for (i=call->heap->num_strings-1; i>=0; i--) + NDR_CHECK(ndr_push_string(final_data, NDR_SCALARS, + call->heap->strings[i])); + + trans->out.setup_count = 0; + trans->out.setup = NULL; + trans->out.params = ndr_push_blob(final_param); + trans->out.data = ndr_push_blob(final_data); + + return result; +} -- cgit From b83ba93eaeb2dcb0bf11615591d886fda84e4162 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 21 Aug 2004 01:54:46 +0000 Subject: r1983: a completely new implementation of talloc This version does the following: 1) talloc_free(), talloc_realloc() and talloc_steal() lose their (redundent) first arguments 2) you can use _any_ talloc pointer as a talloc context to allocate more memory. This allows you to create complex data structures where the top level structure is the logical parent of the next level down, and those are the parents of the level below that. Then destroy either the lot with a single talloc_free() or destroy any sub-part with a talloc_free() of that part 3) you can name any pointer. Use talloc_named() which is just like talloc() but takes the printf style name argument as well as the parent context and the size. The whole thing ends up being a very simple piece of code, although some of the pointer walking gets hairy. So far, I'm just using the new talloc() like the old one. The next step is to actually take advantage of the new interface properly. Expect some new commits soon that simplify some common coding styles in samba4 by using the new talloc(). (This used to be commit e35bb094c52e550b3105dd1638d8d90de71d854f) --- source4/ntvfs/ipc/ipc_rap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index d2cd0b38d5..347ff39d97 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -178,7 +178,7 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push, NDR_CHECK(ndr_push_uint16(data_push, heap->offset)); NDR_CHECK(ndr_push_uint16(data_push, 0)); - heap->strings = talloc_realloc(heap->mem_ctx, heap->strings, + heap->strings = talloc_realloc(heap->strings, sizeof(*heap->strings) * (heap->num_strings + 1)); -- cgit From 893c62d38388b20c52cf3c45069d836c46f42bd3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 8 Sep 2004 05:39:06 +0000 Subject: r2249: got rid of some more mem_ctx elements in structures (This used to be commit 21ef338cbbe96acc8594ffc550ef60c6a40fb951) --- source4/ntvfs/ipc/ipc_rap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 347ff39d97..32b2fa2181 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -395,7 +395,7 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) struct ndr_push *final_param; struct ndr_push *final_data; - call = new_rap_srv_call(req->mem_ctx, trans); + call = new_rap_srv_call(req, trans); if (call == NULL) return NT_STATUS_NO_MEMORY; @@ -406,8 +406,8 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, &call->datadesc)); - call->ndr_push_param = ndr_push_init_ctx(req->mem_ctx); - call->ndr_push_data = ndr_push_init_ctx(req->mem_ctx); + call->ndr_push_param = ndr_push_init_ctx(req); + call->ndr_push_data = ndr_push_init_ctx(req); if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL)) return NT_STATUS_NO_MEMORY; @@ -432,8 +432,8 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) result_param = ndr_push_blob(call->ndr_push_param); result_data = ndr_push_blob(call->ndr_push_data); - final_param = ndr_push_init_ctx(req->mem_ctx); - final_data = ndr_push_init_ctx(req->mem_ctx); + final_param = ndr_push_init_ctx(req); + final_data = ndr_push_init_ctx(req); if ((final_param == NULL) || (final_data == NULL)) return NT_STATUS_NO_MEMORY; -- cgit From 5b44130afad1bb1764d986de3ef0e8e04b0e7357 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Sep 2004 01:36:19 +0000 Subject: r2671: we're getting too many errors caused by the talloc_realloc() API not taking a context (so when you pass a NULL pointer you end up with memory in a top level context). Fixed it by changing the API to take a context. The context is only used if the pointer you are reallocing is NULL. (This used to be commit 8dc23821c9f54b2f13049b5e608a0cafb81aa540) --- source4/ntvfs/ipc/ipc_rap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 32b2fa2181..840c389d6c 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -178,9 +178,10 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push, NDR_CHECK(ndr_push_uint16(data_push, heap->offset)); NDR_CHECK(ndr_push_uint16(data_push, 0)); - heap->strings = talloc_realloc(heap->strings, - sizeof(*heap->strings) * - (heap->num_strings + 1)); + heap->strings = talloc_realloc_p(heap->mem_ctx, + heap->strings, + const char *, + heap->num_strings + 1); if (heap->strings == NULL) return NT_STATUS_NO_MEMORY; -- cgit From a42142439aee9e75796e25cdf05e042174926abf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Nov 2004 06:52:59 +0000 Subject: r3464: split out registry.h, rap.h and ldap_server.h (This used to be commit 70d2090f6bf2c7e0caf1e9c020f330de88871f8e) --- source4/ntvfs/ipc/ipc_rap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 840c389d6c..4fc5e182ca 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "rap.h" #define NERR_Success 0 #define NERR_badpass 86 -- cgit From 1814aad5617c5fcafb75cc4566618e98f5323554 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 25 Nov 2004 18:25:22 +0000 Subject: r3962: fix compiler warnings metze (This used to be commit 3bfb732187211d450db842a7533e4c7e915b6ce4) --- source4/ntvfs/ipc/ipc_rap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 4fc5e182ca..eeea7e24f7 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -241,12 +241,12 @@ static NTSTATUS _rap_netshareenum(struct smbsrv_request *req, switch(r.in.level) { case 0: NDR_OK(ndr_push_bytes(call->ndr_push_data, - r.out.info[i].info0.name, + (const uint8_t *)r.out.info[i].info0.name, sizeof(r.out.info[i].info0.name))); break; case 1: NDR_OK(ndr_push_bytes(call->ndr_push_data, - r.out.info[i].info1.name, + (const uint8_t *)r.out.info[i].info1.name, sizeof(r.out.info[i].info1.name))); NDR_OK(ndr_push_uint8(call->ndr_push_data, r.out.info[i].info1.pad)); @@ -324,12 +324,12 @@ static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req, switch(r.in.level) { case 0: NDR_OK(ndr_push_bytes(call->ndr_push_data, - r.out.info[i].info0.name, + (const uint8_t *)r.out.info[i].info0.name, sizeof(r.out.info[i].info0.name))); break; case 1: NDR_OK(ndr_push_bytes(call->ndr_push_data, - r.out.info[i].info1.name, + (const uint8_t *)r.out.info[i].info1.name, sizeof(r.out.info[i].info1.name))); NDR_OK(ndr_push_uint8(call->ndr_push_data, r.out.info[i].info1.version_major)); -- cgit From 6cec461c8c8e6faad93e6d2a24d8da705c4ae8a0 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 25 Jan 2005 09:46:00 +0000 Subject: r4979: Return NT_STATUS_INVALID_SYSTEM_SERVICE for unimplemented RAP calls as this is what win2k3 does. (This used to be commit 145d7c03df477eca08cb81d221e3a1b60ccf8c7f) --- source4/ntvfs/ipc/ipc_rap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index eeea7e24f7..e985d81baa 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -417,7 +417,7 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) call->ndr_push_param->flags = RAPNDR_FLAGS; call->ndr_push_data->flags = RAPNDR_FLAGS; - result = NT_STATUS_NOT_IMPLEMENTED; + result = NT_STATUS_INVALID_SYSTEM_SERVICE; for (i=0; api_commands[i].name != NULL; i++) { if (api_commands[i].id == call->callno) { -- cgit From 051c7b5e0c5db64e3da783471663996d6568e13f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 25 Jan 2005 10:03:57 +0000 Subject: r4980: Copy RAP callno constants from Samba 3 and start to use them. (This used to be commit e32ade44858b869001d2990c788a7e34fb70b121) --- source4/ntvfs/ipc/ipc_rap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index e985d81baa..aedb7acaef 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -374,16 +374,13 @@ static NTSTATUS api_Unsupported(struct smbsrv_request *req, return NT_STATUS_OK; } -#define RAP_NetShareEnum 0 -#define RAP_NetServerEnum2 104 - static const struct { const char *name; int id; NTSTATUS (*fn)(struct smbsrv_request *req, struct rap_call *call); } api_commands[] = { - {"NetShareEnum", RAP_NetShareEnum, _rap_netshareenum }, + {"NetShareEnum", RAP_WshareEnum, _rap_netshareenum }, {"NetServerEnum2", RAP_NetServerEnum2, _rap_netserverenum2 }, {NULL, -1, api_Unsupported} }; -- cgit From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/ntvfs/ipc/ipc_rap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index aedb7acaef..a61dbcb852 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -77,7 +77,7 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, { struct rap_call *call; - call = talloc_p(mem_ctx, struct rap_call); + call = talloc(mem_ctx, struct rap_call); if (call == NULL) return NULL; @@ -92,7 +92,7 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx); call->ndr_pull_data->flags = RAPNDR_FLAGS; - call->heap = talloc_p(mem_ctx, struct rap_string_heap); + call->heap = talloc(mem_ctx, struct rap_string_heap); if (call->heap == NULL) return NULL; @@ -179,7 +179,7 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push, NDR_CHECK(ndr_push_uint16(data_push, heap->offset)); NDR_CHECK(ndr_push_uint16(data_push, 0)); - heap->strings = talloc_realloc_p(heap->mem_ctx, + heap->strings = talloc_realloc(heap->mem_ctx, heap->strings, const char *, heap->num_strings + 1); -- cgit From 632acd9bc7704ac3d326354808c3d12f4f0a9f8f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 9 Feb 2005 21:10:23 +0000 Subject: r5286: Some first steps in making the pidl code somewhat more generic for the various data types: Add ndr_flags argument to all ndr push/pull scalar functions (This used to be commit ab490c0c882bb13de190546c50a0631ecb8255ad) --- source4/ntvfs/ipc/ipc_rap.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index a61dbcb852..7ee7d26e35 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -109,7 +109,7 @@ static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16 *result) if (*call->paramdesc++ != 'W') return NT_STATUS_INVALID_PARAMETER; - return ndr_pull_uint16(call->ndr_pull_param, result); + return ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, result); } static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32 *result) @@ -117,7 +117,7 @@ static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32 *result) if (*call->paramdesc++ != 'D') return NT_STATUS_INVALID_PARAMETER; - return ndr_pull_uint32(call->ndr_pull_param, result); + return ndr_pull_uint32(call->ndr_pull_param, NDR_SCALARS, result); } static NTSTATUS rap_srv_pull_string(struct rap_call *call, const char **result) @@ -142,7 +142,7 @@ static NTSTATUS rap_srv_pull_bufsize(struct rap_call *call, uint16 *bufsize) if ( (*call->paramdesc++ != 'r') || (*call->paramdesc++ != 'L') ) return NT_STATUS_INVALID_PARAMETER; - result = ndr_pull_uint16(call->ndr_pull_param, bufsize); + result = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, bufsize); if (!NT_STATUS_IS_OK(result)) return result; @@ -176,8 +176,8 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push, heap->offset -= space; - NDR_CHECK(ndr_push_uint16(data_push, heap->offset)); - NDR_CHECK(ndr_push_uint16(data_push, 0)); + NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, heap->offset)); + NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, 0)); heap->strings = talloc_realloc(heap->mem_ctx, heap->strings, @@ -249,9 +249,9 @@ static NTSTATUS _rap_netshareenum(struct smbsrv_request *req, (const uint8_t *)r.out.info[i].info1.name, sizeof(r.out.info[i].info1.name))); NDR_OK(ndr_push_uint8(call->ndr_push_data, - r.out.info[i].info1.pad)); + NDR_SCALARS, r.out.info[i].info1.pad)); NDR_OK(ndr_push_uint16(call->ndr_push_data, - r.out.info[i].info1.type)); + NDR_SCALARS, r.out.info[i].info1.type)); NDR_OK(rap_push_string(call->ndr_push_data, call->heap, @@ -272,8 +272,8 @@ static NTSTATUS _rap_netshareenum(struct smbsrv_request *req, call->status = r.out.status; - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.count)); - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.available)); + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count)); + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available)); result = NT_STATUS_OK; @@ -332,11 +332,11 @@ static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req, (const uint8_t *)r.out.info[i].info1.name, sizeof(r.out.info[i].info1.name))); NDR_OK(ndr_push_uint8(call->ndr_push_data, - r.out.info[i].info1.version_major)); + NDR_SCALARS, r.out.info[i].info1.version_major)); NDR_OK(ndr_push_uint8(call->ndr_push_data, - r.out.info[i].info1.version_minor)); + NDR_SCALARS, r.out.info[i].info1.version_minor)); NDR_OK(ndr_push_uint32(call->ndr_push_data, - r.out.info[i].info1.servertype)); + NDR_SCALARS, r.out.info[i].info1.servertype)); NDR_OK(rap_push_string(call->ndr_push_data, call->heap, @@ -357,8 +357,8 @@ static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req, call->status = r.out.status; - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.count)); - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.available)); + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count)); + NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available)); result = NT_STATUS_OK; @@ -399,7 +399,7 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) if (call == NULL) return NT_STATUS_NO_MEMORY; - NDR_CHECK(ndr_pull_uint16(call->ndr_pull_param, &call->callno)); + NDR_CHECK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &call->callno)); NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, &call->paramdesc)); NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, @@ -440,9 +440,9 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) final_param->flags = RAPNDR_FLAGS; final_data->flags = RAPNDR_FLAGS; - NDR_CHECK(ndr_push_uint16(final_param, call->status)); + NDR_CHECK(ndr_push_uint16(final_param, NDR_SCALARS, call->status)); NDR_CHECK(ndr_push_uint16(final_param, - call->heap->offset - result_data.length)); + NDR_SCALARS, call->heap->offset - result_data.length)); NDR_CHECK(ndr_push_bytes(final_param, result_param.data, result_param.length)); -- cgit From e82aad1ce39a6b7a2e51b9e2cb494d74ec70e158 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Feb 2005 05:09:35 +0000 Subject: r5298: - got rid of pstring.h from includes.h. This at least makes it a bit less likely that anyone will use pstring for new code - got rid of winbind_client.h from includes.h. This one triggered a huge change, as winbind_client.h was including system/filesys.h and defining the old uint32 and uint16 types, as well as its own pstring and fstring. (This used to be commit 9db6c79e902ec538108d6b7d3324039aabe1704f) --- source4/ntvfs/ipc/ipc_rap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 7ee7d26e35..d93b67b715 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -53,14 +53,14 @@ static void rap_heap_restore(struct rap_string_heap *heap, struct rap_call { TALLOC_CTX *mem_ctx; - uint16 callno; + uint16_t callno; const char *paramdesc; const char *datadesc; - uint16 status; - uint16 convert; + uint16_t status; + uint16_t convert; - uint16 rcv_paramlen, rcv_datalen; + uint16_t rcv_paramlen, rcv_datalen; struct ndr_push *ndr_push_param; struct ndr_push *ndr_push_data; @@ -104,7 +104,7 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, return call; } -static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16 *result) +static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16_t *result) { if (*call->paramdesc++ != 'W') return NT_STATUS_INVALID_PARAMETER; @@ -112,7 +112,7 @@ static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16 *result) return ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, result); } -static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32 *result) +static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32_t *result) { if (*call->paramdesc++ != 'D') return NT_STATUS_INVALID_PARAMETER; @@ -135,7 +135,7 @@ static NTSTATUS rap_srv_pull_string(struct rap_call *call, const char **result) return ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, result); } -static NTSTATUS rap_srv_pull_bufsize(struct rap_call *call, uint16 *bufsize) +static NTSTATUS rap_srv_pull_bufsize(struct rap_call *call, uint16_t *bufsize) { NTSTATUS result; -- cgit From 10d88a02d727ae16336eec8f696a94b76c1132cd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 23 Feb 2006 11:29:01 +0000 Subject: r13652: Move some more stuff out off include/ (This used to be commit 26bf2a393b90acc098be0b30886dbba34d348a01) --- source4/ntvfs/ipc/ipc_rap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index d93b67b715..f97ae4cd89 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "rap.h" +#include "libcli/rap/rap.h" #define NERR_Success 0 #define NERR_badpass 86 -- cgit From ba564a901e519b0f2cf2b7651bd260f618506b5c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 6 Mar 2006 23:28:18 +0000 Subject: r13903: Don't generate prototypes for modules and binaries in include/proto.h by default. (This used to be commit c80a8f1102caf744b66c13bebde38fba74983dc4) --- source4/ntvfs/ipc/ipc_rap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index f97ae4cd89..5656a96621 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -21,6 +21,7 @@ #include "includes.h" #include "libcli/rap/rap.h" +#include "ntvfs/ipc/proto.h" #define NERR_Success 0 #define NERR_badpass 86 -- cgit From 86497db6113c4ec3210d671c3fcf957d1026098c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 10 Mar 2006 14:31:17 +0000 Subject: r14157: - pass a struct ntvfs_request to the ntvfs layer (for now we just do #define ntvfs_request smbsrv_request, but it's the first step...) - rename ntvfs_openfile() -> ntvfs_open() - fix the talloc hierachie in some places in the ntvfs_map_*() code metze (This used to be commit ed9ed1f48f602354810937c0b0de850b44322191) --- source4/ntvfs/ipc/ipc_rap.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 5656a96621..bc9bc6f31e 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -201,8 +201,7 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push, goto done; \ } while (0) -static NTSTATUS _rap_netshareenum(struct smbsrv_request *req, - struct rap_call *call) +static NTSTATUS _rap_netshareenum(struct rap_call *call) { struct rap_NetShareEnum r; NTSTATUS result; @@ -225,7 +224,7 @@ static NTSTATUS _rap_netshareenum(struct smbsrv_request *req, break; } - result = rap_netshareenum(req, &r); + result = rap_netshareenum(call, &r); if (!NT_STATUS_IS_OK(result)) return result; @@ -282,8 +281,7 @@ static NTSTATUS _rap_netshareenum(struct smbsrv_request *req, return result; } -static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req, - struct rap_call *call) +static NTSTATUS _rap_netserverenum2(struct rap_call *call) { struct rap_NetServerEnum2 r; NTSTATUS result; @@ -308,7 +306,7 @@ static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req, break; } - result = rap_netserverenum2(req, &r); + result = rap_netserverenum2(call, &r); if (!NT_STATUS_IS_OK(result)) return result; @@ -367,8 +365,7 @@ static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req, return result; } -static NTSTATUS api_Unsupported(struct smbsrv_request *req, - struct rap_call *call) +static NTSTATUS api_Unsupported(struct rap_call *call) { call->status = NERR_notsupported; call->convert = 0; @@ -379,14 +376,14 @@ static const struct { const char *name; int id; - NTSTATUS (*fn)(struct smbsrv_request *req, struct rap_call *call); + NTSTATUS (*fn)(struct rap_call *call); } api_commands[] = { {"NetShareEnum", RAP_WshareEnum, _rap_netshareenum }, {"NetServerEnum2", RAP_NetServerEnum2, _rap_netserverenum2 }, {NULL, -1, api_Unsupported} }; -NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) +NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) { int i; NTSTATUS result; @@ -395,7 +392,7 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) struct ndr_push *final_param; struct ndr_push *final_data; - call = new_rap_srv_call(req, trans); + call = new_rap_srv_call(mem_ctx, trans); if (call == NULL) return NT_STATUS_NO_MEMORY; @@ -406,8 +403,8 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, &call->datadesc)); - call->ndr_push_param = ndr_push_init_ctx(req); - call->ndr_push_data = ndr_push_init_ctx(req); + call->ndr_push_param = ndr_push_init_ctx(call); + call->ndr_push_data = ndr_push_init_ctx(call); if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL)) return NT_STATUS_NO_MEMORY; @@ -421,7 +418,7 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) if (api_commands[i].id == call->callno) { DEBUG(5, ("Running RAP call %s\n", api_commands[i].name)); - result = api_commands[i].fn(req, call); + result = api_commands[i].fn(call); break; } } @@ -432,8 +429,8 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans) result_param = ndr_push_blob(call->ndr_push_param); result_data = ndr_push_blob(call->ndr_push_data); - final_param = ndr_push_init_ctx(req); - final_data = ndr_push_init_ctx(req); + final_param = ndr_push_init_ctx(call); + final_data = ndr_push_init_ctx(call); if ((final_param == NULL) || (final_data == NULL)) return NT_STATUS_NO_MEMORY; -- cgit From 32b0bb64bcb91a3f08fcaea72b89bf6409d0e67c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 11 Mar 2006 10:25:59 +0000 Subject: r14205: move smb specific stuff out of includes.h (finally!!!:-) all this changes really help ccache to speed up the samba4 build:-) metze (This used to be commit 180a79d1036e54fc0c50572b820818e9aafa28e9) --- source4/ntvfs/ipc/ipc_rap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index bc9bc6f31e..f683082d58 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "smb.h" #include "libcli/rap/rap.h" #include "ntvfs/ipc/proto.h" -- cgit From 35349a58df5b69446607fbd742a05f57f3515319 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 18 Mar 2006 15:42:57 +0000 Subject: r14542: Remove librpc, libndr and libnbt from includes.h (This used to be commit 51b4270513752d2eafbe77f9de598de16ef84a1f) --- source4/ntvfs/ipc/ipc_rap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index f683082d58..3f415c9293 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -23,6 +23,7 @@ #include "smb.h" #include "libcli/rap/rap.h" #include "ntvfs/ipc/proto.h" +#include "librpc/ndr/libndr.h" #define NERR_Success 0 #define NERR_badpass 86 -- cgit From 0329d755a7611ba3897fc1ee9bdce410cc33d7f8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 30 Aug 2006 11:29:34 +0000 Subject: r17930: Merge noinclude branch: * Move dlinklist.h, smb.h to subsystem-specific directories * Clean up ads.h and move what is left of it to dsdb/ (only place where it's used) (This used to be commit f7afa1cb77f3cfa7020b57de12e6003db7cfcc42) --- source4/ntvfs/ipc/ipc_rap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 3f415c9293..48a7822446 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "smb.h" +#include "libcli/raw/interfaces.h" #include "libcli/rap/rap.h" #include "ntvfs/ipc/proto.h" #include "librpc/ndr/libndr.h" -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/ntvfs/ipc/ipc_rap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 48a7822446..605a172a70 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 529763a9aa192a6785ba878aceeb1683c2510913 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Nov 2007 19:24:51 +0100 Subject: r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers) lib/messaging/ lib/registry/ lib/ldb-samba/ librpc/rpc/ auth/auth_winbind.c auth/gensec/ auth/kerberos/ dsdb/repl/ dsdb/samdb/ dsdb/schema/ torture/ cluster/ctdb/ kdc/ ntvfs/ipc/ torture/rap/ ntvfs/ utils/getntacl.c ntptr/ smb_server/ libcli/wrepl/ wrepl_server/ libcli/cldap/ libcli/dgram/ libcli/ldap/ libcli/raw/ libcli/nbt/ libnet/ winbind/ rpc_server/ metze (This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435) --- source4/ntvfs/ipc/ipc_rap.c | 136 ++++++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 48 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 605a172a70..2a9d66cae8 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -24,6 +24,33 @@ #include "ntvfs/ipc/proto.h" #include "librpc/ndr/libndr.h" +#define NDR_RETURN(call) do { \ + enum ndr_err_code _ndr_err; \ + _ndr_err = call; \ + if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \ + return ndr_map_error2ntstatus(_ndr_err); \ + } \ +} while (0) + +#define RAP_GOTO(call) do { \ + result = call; \ + if (NT_STATUS_EQUAL(result, NT_STATUS_BUFFER_TOO_SMALL)) {\ + goto buffer_overflow; \ + } \ + if (!NT_STATUS_IS_OK(result)) { \ + goto done; \ + } \ +} while (0) + +#define NDR_GOTO(call) do { \ + enum ndr_err_code _ndr_err; \ + _ndr_err = call; \ + if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \ + RAP_GOTO(ndr_map_error2ntstatus(_ndr_err)); \ + } \ +} while (0) + + #define NERR_Success 0 #define NERR_badpass 86 #define NERR_notsupported 50 @@ -108,22 +135,37 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16_t *result) { + enum ndr_err_code ndr_err; + if (*call->paramdesc++ != 'W') return NT_STATUS_INVALID_PARAMETER; - return ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, result); + ndr_err = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, result); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } + + return NT_STATUS_OK; } static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32_t *result) { + enum ndr_err_code ndr_err; + if (*call->paramdesc++ != 'D') return NT_STATUS_INVALID_PARAMETER; - return ndr_pull_uint32(call->ndr_pull_param, NDR_SCALARS, result); + ndr_err = ndr_pull_uint32(call->ndr_pull_param, NDR_SCALARS, result); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } + + return NT_STATUS_OK; } static NTSTATUS rap_srv_pull_string(struct rap_call *call, const char **result) { + enum ndr_err_code ndr_err; char paramdesc = *call->paramdesc++; if (paramdesc == 'O') { @@ -134,20 +176,25 @@ static NTSTATUS rap_srv_pull_string(struct rap_call *call, const char **result) if (paramdesc != 'z') return NT_STATUS_INVALID_PARAMETER; - return ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, result); + ndr_err = ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, result); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } + + return NT_STATUS_OK; } static NTSTATUS rap_srv_pull_bufsize(struct rap_call *call, uint16_t *bufsize) { - NTSTATUS result; + enum ndr_err_code ndr_err; if ( (*call->paramdesc++ != 'r') || (*call->paramdesc++ != 'L') ) return NT_STATUS_INVALID_PARAMETER; - result = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, bufsize); - - if (!NT_STATUS_IS_OK(result)) - return result; + ndr_err = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, bufsize); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } call->heap->offset = *bufsize; @@ -178,8 +225,8 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push, heap->offset -= space; - NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, heap->offset)); - NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, 0)); + NDR_RETURN(ndr_push_uint16(data_push, NDR_SCALARS, heap->offset)); + NDR_RETURN(ndr_push_uint16(data_push, NDR_SCALARS, 0)); heap->strings = talloc_realloc(heap->mem_ctx, heap->strings, @@ -195,21 +242,14 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push, return NT_STATUS_OK; } -#define NDR_OK(call) do { result = call; \ - if (NT_STATUS_EQUAL(result, NT_STATUS_BUFFER_TOO_SMALL)) \ - goto buffer_overflow; \ - if (!NT_STATUS_IS_OK(result)) \ - goto done; \ - } while (0) - static NTSTATUS _rap_netshareenum(struct rap_call *call) { struct rap_NetShareEnum r; NTSTATUS result; - NDR_OK(rap_srv_pull_word(call, &r.in.level)); - NDR_OK(rap_srv_pull_bufsize(call, &r.in.bufsize)); - NDR_OK(rap_srv_pull_expect_multiple(call)); + RAP_GOTO(rap_srv_pull_word(call, &r.in.level)); + RAP_GOTO(rap_srv_pull_bufsize(call, &r.in.bufsize)); + RAP_GOTO(rap_srv_pull_expect_multiple(call)); switch(r.in.level) { case 0: @@ -241,20 +281,20 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call) switch(r.in.level) { case 0: - NDR_OK(ndr_push_bytes(call->ndr_push_data, + NDR_GOTO(ndr_push_bytes(call->ndr_push_data, (const uint8_t *)r.out.info[i].info0.name, sizeof(r.out.info[i].info0.name))); break; case 1: - NDR_OK(ndr_push_bytes(call->ndr_push_data, + NDR_GOTO(ndr_push_bytes(call->ndr_push_data, (const uint8_t *)r.out.info[i].info1.name, sizeof(r.out.info[i].info1.name))); - NDR_OK(ndr_push_uint8(call->ndr_push_data, + NDR_GOTO(ndr_push_uint8(call->ndr_push_data, NDR_SCALARS, r.out.info[i].info1.pad)); - NDR_OK(ndr_push_uint16(call->ndr_push_data, + NDR_GOTO(ndr_push_uint16(call->ndr_push_data, NDR_SCALARS, r.out.info[i].info1.type)); - NDR_OK(rap_push_string(call->ndr_push_data, + RAP_GOTO(rap_push_string(call->ndr_push_data, call->heap, r.out.info[i].info1.comment)); @@ -273,8 +313,8 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call) call->status = r.out.status; - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count)); - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available)); + NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count)); + NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available)); result = NT_STATUS_OK; @@ -287,11 +327,11 @@ static NTSTATUS _rap_netserverenum2(struct rap_call *call) struct rap_NetServerEnum2 r; NTSTATUS result; - NDR_OK(rap_srv_pull_word(call, &r.in.level)); - NDR_OK(rap_srv_pull_bufsize(call, &r.in.bufsize)); - NDR_OK(rap_srv_pull_expect_multiple(call)); - NDR_OK(rap_srv_pull_dword(call, &r.in.servertype)); - NDR_OK(rap_srv_pull_string(call, &r.in.domain)); + RAP_GOTO(rap_srv_pull_word(call, &r.in.level)); + RAP_GOTO(rap_srv_pull_bufsize(call, &r.in.bufsize)); + RAP_GOTO(rap_srv_pull_expect_multiple(call)); + RAP_GOTO(rap_srv_pull_dword(call, &r.in.servertype)); + RAP_GOTO(rap_srv_pull_string(call, &r.in.domain)); switch(r.in.level) { case 0: @@ -323,22 +363,22 @@ static NTSTATUS _rap_netserverenum2(struct rap_call *call) switch(r.in.level) { case 0: - NDR_OK(ndr_push_bytes(call->ndr_push_data, + NDR_GOTO(ndr_push_bytes(call->ndr_push_data, (const uint8_t *)r.out.info[i].info0.name, sizeof(r.out.info[i].info0.name))); break; case 1: - NDR_OK(ndr_push_bytes(call->ndr_push_data, + NDR_GOTO(ndr_push_bytes(call->ndr_push_data, (const uint8_t *)r.out.info[i].info1.name, sizeof(r.out.info[i].info1.name))); - NDR_OK(ndr_push_uint8(call->ndr_push_data, + NDR_GOTO(ndr_push_uint8(call->ndr_push_data, NDR_SCALARS, r.out.info[i].info1.version_major)); - NDR_OK(ndr_push_uint8(call->ndr_push_data, + NDR_GOTO(ndr_push_uint8(call->ndr_push_data, NDR_SCALARS, r.out.info[i].info1.version_minor)); - NDR_OK(ndr_push_uint32(call->ndr_push_data, + NDR_GOTO(ndr_push_uint32(call->ndr_push_data, NDR_SCALARS, r.out.info[i].info1.servertype)); - NDR_OK(rap_push_string(call->ndr_push_data, + RAP_GOTO(rap_push_string(call->ndr_push_data, call->heap, r.out.info[i].info1.comment)); @@ -357,8 +397,8 @@ static NTSTATUS _rap_netserverenum2(struct rap_call *call) call->status = r.out.status; - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count)); - NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available)); + NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count)); + NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available)); result = NT_STATUS_OK; @@ -398,10 +438,10 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) if (call == NULL) return NT_STATUS_NO_MEMORY; - NDR_CHECK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &call->callno)); - NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, + NDR_RETURN(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &call->callno)); + NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, &call->paramdesc)); - NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, + NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, &call->datadesc)); call->ndr_push_param = ndr_push_init_ctx(call); @@ -439,17 +479,17 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) final_param->flags = RAPNDR_FLAGS; final_data->flags = RAPNDR_FLAGS; - NDR_CHECK(ndr_push_uint16(final_param, NDR_SCALARS, call->status)); - NDR_CHECK(ndr_push_uint16(final_param, + NDR_RETURN(ndr_push_uint16(final_param, NDR_SCALARS, call->status)); + NDR_RETURN(ndr_push_uint16(final_param, NDR_SCALARS, call->heap->offset - result_data.length)); - NDR_CHECK(ndr_push_bytes(final_param, result_param.data, + NDR_RETURN(ndr_push_bytes(final_param, result_param.data, result_param.length)); - NDR_CHECK(ndr_push_bytes(final_data, result_data.data, + NDR_RETURN(ndr_push_bytes(final_data, result_data.data, result_data.length)); for (i=call->heap->num_strings-1; i>=0; i--) - NDR_CHECK(ndr_push_string(final_data, NDR_SCALARS, + NDR_RETURN(ndr_push_string(final_data, NDR_SCALARS, call->heap->strings[i])); trans->out.setup_count = 0; -- cgit From 981437efbc966c4bb0880fc0b02715d297ae6644 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 20 Nov 2007 11:08:24 +0100 Subject: r26053: IPC_RAP: don't use ndr_pull_save anymore metze (This used to be commit 590dd7f8a1ccba762dfcdfb036cf44306da2354a) --- source4/ntvfs/ipc/ipc_rap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 2a9d66cae8..d8e9812dd8 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -273,10 +273,10 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call) for (r.out.count = 0; r.out.count < r.out.available; r.out.count++) { int i = r.out.count; - struct ndr_push_save data_save; + uint32_t offset_save; struct rap_heap_save heap_save; - ndr_push_save(call->ndr_push_data, &data_save); + offset_save = call->ndr_push_data->offset; rap_heap_save(call->heap, &heap_save); switch(r.in.level) { @@ -305,7 +305,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call) buffer_overflow: - ndr_push_restore(call->ndr_push_data, &data_save); + call->ndr_push_data->offset = offset_save; rap_heap_restore(call->heap, &heap_save); break; } @@ -355,10 +355,10 @@ static NTSTATUS _rap_netserverenum2(struct rap_call *call) for (r.out.count = 0; r.out.count < r.out.available; r.out.count++) { int i = r.out.count; - struct ndr_push_save data_save; + uint32_t offset_save; struct rap_heap_save heap_save; - ndr_push_save(call->ndr_push_data, &data_save); + offset_save = call->ndr_push_data->offset; rap_heap_save(call->heap, &heap_save); switch(r.in.level) { @@ -389,7 +389,7 @@ static NTSTATUS _rap_netserverenum2(struct rap_call *call) buffer_overflow: - ndr_push_restore(call->ndr_push_data, &data_save); + call->ndr_push_data->offset = offset_save; rap_heap_restore(call->heap, &heap_save); break; } -- cgit From 61873ce94c172c801a4831de5550a8e0fe54c5f5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:23 +0100 Subject: r26431: Require ndr_push creators to specify a iconv_convenience context. (This used to be commit 7352206f4450fdf881b95bda064cedd9d2477e4c) --- source4/ntvfs/ipc/ipc_rap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index d8e9812dd8..0636e42e16 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -23,6 +23,7 @@ #include "libcli/rap/rap.h" #include "ntvfs/ipc/proto.h" #include "librpc/ndr/libndr.h" +#include "param/param.h" #define NDR_RETURN(call) do { \ enum ndr_err_code _ndr_err; \ @@ -444,8 +445,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, &call->datadesc)); - call->ndr_push_param = ndr_push_init_ctx(call); - call->ndr_push_data = ndr_push_init_ctx(call); + call->ndr_push_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); + call->ndr_push_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL)) return NT_STATUS_NO_MEMORY; @@ -470,8 +471,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) result_param = ndr_push_blob(call->ndr_push_param); result_data = ndr_push_blob(call->ndr_push_data); - final_param = ndr_push_init_ctx(call); - final_data = ndr_push_init_ctx(call); + final_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); + final_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); if ((final_param == NULL) || (final_data == NULL)) return NT_STATUS_NO_MEMORY; -- cgit From d1e716cf4331bf09cfe15a6634bc5887aff81d20 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:27 +0100 Subject: r26432: Require ndr_pull users to specify iconv_convenience. (This used to be commit 28b1d36551b75241c1cf9fca5d74f45a6dc884ab) --- source4/ntvfs/ipc/ipc_rap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 0636e42e16..85bc5c212f 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -116,10 +116,10 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, call->mem_ctx = mem_ctx; - call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx); + call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx, lp_iconv_convenience(global_loadparm)); call->ndr_pull_param->flags = RAPNDR_FLAGS; - call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx); + call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx, lp_iconv_convenience(global_loadparm)); call->ndr_pull_data->flags = RAPNDR_FLAGS; call->heap = talloc(mem_ctx, struct rap_string_heap); -- cgit From df408d056ec03f2abe08ce0ea487e1875b90e7bf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 5 Jan 2008 19:03:43 -0600 Subject: r26672: Janitorial: Remove uses of global_loadparm. (This used to be commit 18cd08623eaad7d2cd63b82ea5275d4dfd21cf00) --- source4/ntvfs/ipc/ipc_rap.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index 85bc5c212f..faf48705c4 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -82,6 +82,8 @@ static void rap_heap_restore(struct rap_string_heap *heap, } struct rap_call { + struct loadparm_context *lp_ctx; + TALLOC_CTX *mem_ctx; uint16_t callno; const char *paramdesc; @@ -103,6 +105,7 @@ struct rap_call { #define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, + struct loadparm_context *lp_ctx, struct smb_trans2 *trans) { struct rap_call *call; @@ -114,12 +117,14 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, ZERO_STRUCTP(call); + call->lp_ctx = talloc_reference(call, lp_ctx); + call->mem_ctx = mem_ctx; - call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx, lp_iconv_convenience(global_loadparm)); + call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx, lp_iconv_convenience(lp_ctx)); call->ndr_pull_param->flags = RAPNDR_FLAGS; - call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx, lp_iconv_convenience(global_loadparm)); + call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx, lp_iconv_convenience(lp_ctx)); call->ndr_pull_data->flags = RAPNDR_FLAGS; call->heap = talloc(mem_ctx, struct rap_string_heap); @@ -266,7 +271,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call) break; } - result = rap_netshareenum(call, &r); + result = rap_netshareenum(call, call->lp_ctx, &r); if (!NT_STATUS_IS_OK(result)) return result; @@ -348,7 +353,7 @@ static NTSTATUS _rap_netserverenum2(struct rap_call *call) break; } - result = rap_netserverenum2(call, &r); + result = rap_netserverenum2(call, call->lp_ctx, &r); if (!NT_STATUS_IS_OK(result)) return result; @@ -425,7 +430,8 @@ static const struct {NULL, -1, api_Unsupported} }; -NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) +NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, + struct smb_trans2 *trans) { int i; NTSTATUS result; @@ -434,7 +440,7 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) struct ndr_push *final_param; struct ndr_push *final_data; - call = new_rap_srv_call(mem_ctx, trans); + call = new_rap_srv_call(mem_ctx, lp_ctx, trans); if (call == NULL) return NT_STATUS_NO_MEMORY; @@ -445,8 +451,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, &call->datadesc)); - call->ndr_push_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); - call->ndr_push_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); + call->ndr_push_param = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx)); + call->ndr_push_data = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx)); if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL)) return NT_STATUS_NO_MEMORY; @@ -471,8 +477,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans) result_param = ndr_push_blob(call->ndr_push_param); result_data = ndr_push_blob(call->ndr_push_data); - final_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); - final_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm)); + final_param = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx)); + final_data = ndr_push_init_ctx(call, lp_iconv_convenience(lp_ctx)); if ((final_param == NULL) || (final_data == NULL)) return NT_STATUS_NO_MEMORY; -- cgit From 21fc7673780aa1d7c0caab7b17ff9171238913ba Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 12:23:44 +0200 Subject: Specify event_context to ldb_wrap_connect explicitly. (This used to be commit b4e1ae07a284c044704322446c94351c2decff91) --- source4/ntvfs/ipc/ipc_rap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source4/ntvfs/ipc/ipc_rap.c') diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index faf48705c4..4969f1a791 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -21,6 +21,7 @@ #include "includes.h" #include "libcli/raw/interfaces.h" #include "libcli/rap/rap.h" +#include "events/events.h" #include "ntvfs/ipc/proto.h" #include "librpc/ndr/libndr.h" #include "param/param.h" @@ -100,11 +101,14 @@ struct rap_call { struct ndr_pull *ndr_pull_param; struct ndr_pull *ndr_pull_data; + + struct event_context *event_ctx; }; #define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct smb_trans2 *trans) { @@ -118,6 +122,7 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, ZERO_STRUCTP(call); call->lp_ctx = talloc_reference(call, lp_ctx); + call->event_ctx = ev_ctx; call->mem_ctx = mem_ctx; @@ -271,7 +276,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call) break; } - result = rap_netshareenum(call, call->lp_ctx, &r); + result = rap_netshareenum(call, call->event_ctx, call->lp_ctx, &r); if (!NT_STATUS_IS_OK(result)) return result; @@ -430,7 +435,7 @@ static const struct {NULL, -1, api_Unsupported} }; -NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, +NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct smb_trans2 *trans) { int i; @@ -440,7 +445,7 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct ndr_push *final_param; struct ndr_push *final_data; - call = new_rap_srv_call(mem_ctx, lp_ctx, trans); + call = new_rap_srv_call(mem_ctx, event_ctx, lp_ctx, trans); if (call == NULL) return NT_STATUS_NO_MEMORY; -- cgit