From 8709182fd3c740619fdb075b24023b1eaf192fcd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 Apr 2004 19:06:37 +0000 Subject: r126: - add first srvsvc and wkssvc server side stuff - we know can browse the server via the Windows Explorer - some little fixes to the winreg server pipe metze (This used to be commit 6f213a3494d3b5ab629944394b20a84075a04438) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 1210 +++++++++++++++++++++++++++++ 1 file changed, 1210 insertions(+) create mode 100644 source4/rpc_server/srvsvc/dcesrv_srvsvc.c (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c new file mode 100644 index 0000000000..2cf886c12b --- /dev/null +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -0,0 +1,1210 @@ +/* + Unix SMB/CIFS implementation. + + endpoint server for the srvsvc pipe + + Copyright (C) Stefan (metze) Metzmacher 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" +#include "rpc_server/common/common.h" + +/* + srvsvc_NetCharDevEnum +*/ +static NTSTATUS srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevEnum *r) +{ + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: + r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetCharDevCtr0); + WERR_TALLOC_CHECK(r->out.ctr.ctr0); + + r->out.ctr.ctr0->count = 0; + r->out.ctr.ctr0->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + case 1: + r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevCtr1); + WERR_TALLOC_CHECK(r->out.ctr.ctr1); + + r->out.ctr.ctr1->count = 0; + r->out.ctr.ctr1->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetCharDevGetInfo +*/ +static NTSTATUS srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevGetInfo *r) +{ + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: + r->out.info.info0 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + case 1: + r->out.info.info1 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetCharDevControl +*/ +static NTSTATUS srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevControl *r) +{ + r->out.result = WERR_NOT_SUPPORTED; + return NT_STATUS_OK; +} + + +/* + srvsvc_NetCharDevQEnum +*/ +static NTSTATUS srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQEnum *r) +{ + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: + r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr0); + WERR_TALLOC_CHECK(r->out.ctr.ctr0); + + r->out.ctr.ctr0->count = 0; + r->out.ctr.ctr0->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + case 1: + r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr1); + WERR_TALLOC_CHECK(r->out.ctr.ctr1); + + r->out.ctr.ctr1->count = 0; + r->out.ctr.ctr1->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetCharDevQGetInfo +*/ +static NTSTATUS srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQGetInfo *r) +{ + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: + r->out.info.info0 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + case 1: + r->out.info.info1 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetCharDevQSetInfo +*/ +static NTSTATUS srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQSetInfo *r) +{ + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + r->out.result = WERR_NOT_SUPPORTED; + break; + case 1: + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + r->out.result = WERR_NOT_SUPPORTED; + break; + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetCharDevQPurge +*/ +static NTSTATUS srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQPurge *r) +{ + r->out.result = WERR_NOT_SUPPORTED; + return NT_STATUS_OK; +} + + +/* + srvsvc_NetCharDevQPurgeSelf +*/ +static NTSTATUS srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQPurgeSelf *r) +{ + r->out.result = WERR_NOT_SUPPORTED; + return NT_STATUS_OK; +} + + +/* + srvsvc_NetConnEnum +*/ +static NTSTATUS srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetConnEnum *r) +{ + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: { + r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr0); + WERR_TALLOC_CHECK(r->out.ctr.ctr0); + + r->out.ctr.ctr0->count = 0; + r->out.ctr.ctr0->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 1: { + r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr1); + WERR_TALLOC_CHECK(r->out.ctr.ctr1); + + r->out.ctr.ctr1->count = 0; + r->out.ctr.ctr1->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetFileEnum +*/ +static NTSTATUS srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetFileEnum *r) +{ + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 2: { + r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr2); + WERR_TALLOC_CHECK(r->out.ctr.ctr2); + + r->out.ctr.ctr2->count = 0; + r->out.ctr.ctr2->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 3: { + r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr3); + WERR_TALLOC_CHECK(r->out.ctr.ctr3); + + r->out.ctr.ctr3->count = 0; + r->out.ctr.ctr3->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetFileGetInfo +*/ +static NTSTATUS srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetFileGetInfo *r) +{ + r->out.result = WERR_OK; + + switch (r->in.level) { + case 2: { + r->out.info.info2 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 3: { + r->out.info.info3 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetFileClose +*/ +static NTSTATUS srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetFileClose *r) +{ + r->out.result = WERR_NOT_SUPPORTED; + return NT_STATUS_OK; +} + + +/* + srvsvc_NetSessEnum +*/ +static NTSTATUS srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetSessEnum *r) +{ + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: { + r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr0); + WERR_TALLOC_CHECK(r->out.ctr.ctr0); + + r->out.ctr.ctr0->count = 0; + r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetSessInfo0)); + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 1: { + r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr1); + WERR_TALLOC_CHECK(r->out.ctr.ctr1); + + r->out.ctr.ctr1->count = 0; + r->out.ctr.ctr1->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 2: { + r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr2); + WERR_TALLOC_CHECK(r->out.ctr.ctr2); + + r->out.ctr.ctr2->count = 0; + r->out.ctr.ctr2->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 10:{ + r->out.ctr.ctr10 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr10); + WERR_TALLOC_CHECK(r->out.ctr.ctr10); + + r->out.ctr.ctr2->count = 0; + r->out.ctr.ctr2->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 502:{ + r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr502); + WERR_TALLOC_CHECK(r->out.ctr.ctr502); + + r->out.ctr.ctr2->count = 0; + r->out.ctr.ctr2->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetSessDel +*/ +static NTSTATUS srvsvc_NetSessDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetSessDel *r) +{ + r->out.result = WERR_NOT_SUPPORTED; + return NT_STATUS_OK; +} + + +/* + srvsvc_NetShareAdd +*/ +static NTSTATUS srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareAdd *r) +{ + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + r->out.result = WERR_NOT_SUPPORTED; + break; + case 1: + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + r->out.result = WERR_NOT_SUPPORTED; + break; + case 2: + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + r->out.result = WERR_NOT_SUPPORTED; + break; + case 501: + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + r->out.result = WERR_NOT_SUPPORTED; + break; + case 502: + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + r->out.result = WERR_NOT_SUPPORTED; + break; + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetShareEnumAll +*/ +static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareEnumAll *r) +{ + struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: { + int i; + + r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); + WERR_TALLOC_CHECK(r->out.ctr.ctr0); + + r->out.ctr.ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr0->array = NULL; + + if (r->out.ctr.ctr0->count == 0) break; + + r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetShareInfo0)); + WERR_TALLOC_CHECK(r->out.ctr.ctr0->array); + + for (i=0;iout.ctr.ctr0->count;i++) { + r->out.ctr.ctr0->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + WERR_TALLOC_CHECK(r->out.ctr.ctr0->array[i].name); + } + + r->out.totalentries = r->out.ctr.ctr0->count; + + break; + } + case 1: { + int i; + r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); + WERR_TALLOC_CHECK(r->out.ctr.ctr1); + + r->out.ctr.ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr1->array = NULL; + + if (r->out.ctr.ctr1->count == 0) break; + + r->out.ctr.ctr1->array = talloc(mem_ctx, r->out.ctr.ctr1->count*sizeof(struct srvsvc_NetShareInfo1)); + WERR_TALLOC_CHECK(r->out.ctr.ctr1->array); + + for (i=0;iout.ctr.ctr1->count;i++) { + r->out.ctr.ctr1->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr1->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr1->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr1->count; + + break; + } + case 2: { + int i; + r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); + WERR_TALLOC_CHECK(r->out.ctr.ctr2); + + r->out.ctr.ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr2->array = NULL; + + if (r->out.ctr.ctr2->count == 0) break; + + r->out.ctr.ctr2->array = talloc(mem_ctx, r->out.ctr.ctr2->count*sizeof(struct srvsvc_NetShareInfo2)); + WERR_TALLOC_CHECK(r->out.ctr.ctr2->array); + + for (i=0;iout.ctr.ctr2->count;i++) { + r->out.ctr.ctr2->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr2->count; + + break; + } + case 501:{ + int i; + r->out.ctr.ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); + WERR_TALLOC_CHECK(r->out.ctr.ctr501); + + r->out.ctr.ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr501->array = NULL; + + if (r->out.ctr.ctr501->count == 0) break; + + r->out.ctr.ctr501->array = talloc(mem_ctx, r->out.ctr.ctr501->count*sizeof(struct srvsvc_NetShareInfo501)); + WERR_TALLOC_CHECK(r->out.ctr.ctr501->array); + + for (i=0;iout.ctr.ctr501->count;i++) { + r->out.ctr.ctr501->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr501->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr501->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + r->out.ctr.ctr501->array[i].csc_policy = dcesrv_common_get_share_csc_policy(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr501->count; + + break; + } + case 502:{ + int i; + r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); + WERR_TALLOC_CHECK(r->out.ctr.ctr502); + + r->out.ctr.ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr502->array = NULL; + + if (r->out.ctr.ctr502->count == 0) break; + + r->out.ctr.ctr502->array = talloc(mem_ctx, r->out.ctr.ctr502->count*sizeof(struct srvsvc_NetShareInfo502)); + WERR_TALLOC_CHECK(r->out.ctr.ctr502->array); + + for (i=0;iout.ctr.ctr502->count;i++) { + r->out.ctr.ctr502->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr502->count; + + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetShareGetInfo +*/ +static NTSTATUS srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareGetInfo *r) +{ + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: { + r->out.info.info0 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 1: { + r->out.info.info0 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 2: { + r->out.info.info0 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 501:{ + r->out.info.info0 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 502:{ + r->out.info.info0 = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NetShareSetInfo +*/ +static NTSTATUS srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareSetInfo *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetShareDel +*/ +static NTSTATUS srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareDel *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetShareDelSticky +*/ +static NTSTATUS srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareDelSticky *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetShareCheck +*/ +static NTSTATUS srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareCheck *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetSrvGetInfo +*/ +static NTSTATUS srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetSrvGetInfo *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetSrvSetInfo +*/ +static NTSTATUS srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetSrvSetInfo *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetDiskEnum +*/ +static NTSTATUS srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetDiskEnum *r) +{ + r->out.count = 0; + r->out.ctr0 = NULL; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: { + r->out.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetDiskCtr0); + WERR_TALLOC_CHECK(r->out.ctr0); + + r->out.ctr0->unknown = 0x1; + r->out.ctr0->count = 0; + r->out.ctr0->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NETRSERVERSTATISTICSGET +*/ +static NTSTATUS srvsvc_NETRSERVERSTATISTICSGET(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERSTATISTICSGET *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRSERVERTRANSPORTADD +*/ +static NTSTATUS srvsvc_NETRSERVERTRANSPORTADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERTRANSPORTADD *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetTransportEnum +*/ +static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetTransportEnum *r) +{ + ZERO_STRUCT(r->out); + r->out.result = WERR_NOT_SUPPORTED; + return NT_STATUS_OK; +} + + +/* + srvsvc_NETRSERVERTRANSPORTDEL +*/ +static NTSTATUS srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERTRANSPORTDEL *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NET_REMOTE_TOD +*/ +static NTSTATUS srvsvc_NET_REMOTE_TOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NET_REMOTE_TOD *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRSERVERSETSERVICEBITS +*/ +static NTSTATUS srvsvc_NETRSERVERSETSERVICEBITS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERSETSERVICEBITS *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRPRPATHTYPE +*/ +static NTSTATUS srvsvc_NETRPRPATHTYPE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRPRPATHTYPE *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRPRPATHCANONICALIZE +*/ +static NTSTATUS srvsvc_NETRPRPATHCANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRPRPATHCANONICALIZE *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRPRPATHCOMPARE +*/ +static NTSTATUS srvsvc_NETRPRPATHCOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRPRPATHCOMPARE *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NET_NAME_VALIDATE +*/ +static NTSTATUS srvsvc_NET_NAME_VALIDATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NET_NAME_VALIDATE *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRPRNAMECANONICALIZE +*/ +static NTSTATUS srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRPRNAMECANONICALIZE *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRPRNAMECOMPARE +*/ +static NTSTATUS srvsvc_NETRPRNAMECOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRPRNAMECOMPARE *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NetShareEnum +*/ +static NTSTATUS srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareEnum *r) +{ + struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: { + int i; + + r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); + WERR_TALLOC_CHECK(r->out.ctr.ctr0); + + r->out.ctr.ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr0->array = NULL; + + if (r->out.ctr.ctr0->count == 0) break; + + r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetShareInfo0)); + WERR_TALLOC_CHECK(r->out.ctr.ctr0->array); + + for (i=0;iout.ctr.ctr0->count;i++) { + r->out.ctr.ctr0->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + WERR_TALLOC_CHECK(r->out.ctr.ctr0->array[i].name); + } + + r->out.totalentries = r->out.ctr.ctr0->count; + + break; + } + case 1: { + int i; + r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); + WERR_TALLOC_CHECK(r->out.ctr.ctr1); + + r->out.ctr.ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr1->array = NULL; + + if (r->out.ctr.ctr1->count == 0) break; + + r->out.ctr.ctr1->array = talloc(mem_ctx, r->out.ctr.ctr1->count*sizeof(struct srvsvc_NetShareInfo1)); + WERR_TALLOC_CHECK(r->out.ctr.ctr1->array); + + for (i=0;iout.ctr.ctr1->count;i++) { + r->out.ctr.ctr1->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr1->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr1->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr1->count; + + break; + } + case 2: { + int i; + r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); + WERR_TALLOC_CHECK(r->out.ctr.ctr2); + + r->out.ctr.ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr2->array = NULL; + + if (r->out.ctr.ctr2->count == 0) break; + + r->out.ctr.ctr2->array = talloc(mem_ctx, r->out.ctr.ctr2->count*sizeof(struct srvsvc_NetShareInfo2)); + WERR_TALLOC_CHECK(r->out.ctr.ctr2->array); + + for (i=0;iout.ctr.ctr2->count;i++) { + r->out.ctr.ctr2->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); + r->out.ctr.ctr2->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr2->count; + + break; + } + case 501:{ + int i; + r->out.ctr.ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); + WERR_TALLOC_CHECK(r->out.ctr.ctr501); + + r->out.ctr.ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr501->array = NULL; + + if (r->out.ctr.ctr501->count == 0) break; + + r->out.ctr.ctr501->array = talloc(mem_ctx, r->out.ctr.ctr501->count*sizeof(struct srvsvc_NetShareInfo501)); + WERR_TALLOC_CHECK(r->out.ctr.ctr501->array); + + for (i=0;iout.ctr.ctr501->count;i++) { + r->out.ctr.ctr501->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr501->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr501->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + r->out.ctr.ctr501->array[i].csc_policy = dcesrv_common_get_share_csc_policy(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr501->count; + + break; + } + case 502:{ + int i; + r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); + WERR_TALLOC_CHECK(r->out.ctr.ctr502); + + r->out.ctr.ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + r->out.ctr.ctr502->array = NULL; + + if (r->out.ctr.ctr502->count == 0) break; + + r->out.ctr.ctr502->array = talloc(mem_ctx, r->out.ctr.ctr502->count*sizeof(struct srvsvc_NetShareInfo502)); + WERR_TALLOC_CHECK(r->out.ctr.ctr502->array); + + for (i=0;iout.ctr.ctr502->count;i++) { + r->out.ctr.ctr502->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, i); + r->out.ctr.ctr502->array[i].sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, i); + } + + r->out.totalentries = r->out.ctr.ctr502->count; + + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + + return NT_STATUS_OK; +} + + +/* + srvsvc_NETRSHAREDELSTART +*/ +static NTSTATUS srvsvc_NETRSHAREDELSTART(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSHAREDELSTART *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRSHAREDELCOMMIT +*/ +static NTSTATUS srvsvc_NETRSHAREDELCOMMIT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSHAREDELCOMMIT *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NET_FILE_QUERY_SECDESC +*/ +static NTSTATUS srvsvc_NET_FILE_QUERY_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NET_FILE_QUERY_SECDESC *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NET_FILE_SET_SECDESC +*/ +static NTSTATUS srvsvc_NET_FILE_SET_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NET_FILE_SET_SECDESC *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRSERVERTRANSPORTADDEX +*/ +static NTSTATUS srvsvc_NETRSERVERTRANSPORTADDEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERTRANSPORTADDEX *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRSERVERSETSERVICEBITSEX +*/ +static NTSTATUS srvsvc_NETRSERVERSETSERVICEBITSEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERSETSERVICEBITSEX *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSGETVERSION +*/ +static NTSTATUS srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSGETVERSION *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSCREATELOCALPARTITION +*/ +static NTSTATUS srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSCREATELOCALPARTITION *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSDELETELOCALPARTITION +*/ +static NTSTATUS srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSDELETELOCALPARTITION *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSSETLOCALVOLUMESTATE +*/ +static NTSTATUS srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSSETSERVERINFO +*/ +static NTSTATUS srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSSETSERVERINFO *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSCREATEEXITPOINT +*/ +static NTSTATUS srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSCREATEEXITPOINT *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSDELETEEXITPOINT +*/ +static NTSTATUS srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSDELETEEXITPOINT *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSMODIFYPREFIX +*/ +static NTSTATUS srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSMODIFYPREFIX *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSFIXLOCALVOLUME +*/ +static NTSTATUS srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSFIXLOCALVOLUME *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRDFSMANAGERREPORTSITEINFO +*/ +static NTSTATUS srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* + srvsvc_NETRSERVERTRANSPORTDELEX +*/ +static NTSTATUS srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERTRANSPORTDELEX *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* include the generated boilerplate */ +#include "librpc/gen_ndr/ndr_srvsvc_s.c" -- cgit From 55da6e7f90d2a48a69ee37140f946131c6a03de6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 19 Apr 2004 18:21:53 +0000 Subject: r286: use talloc_array_p() instead of talloc() add some more WERR_NOT_SUPPORTED stubs to pass our torture tests (wkssvc and srvsvc) metze (This used to be commit f8605b39ab58f8db22358122eafccc8a1cc60004) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 65 +++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 8 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 2cf886c12b..1e5a2105d0 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -360,7 +360,7 @@ static NTSTATUS srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CT WERR_TALLOC_CHECK(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; - r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetSessInfo0)); + r->out.ctr.ctr0->array = NULL; r->out.result = WERR_NOT_SUPPORTED; break; @@ -497,7 +497,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO if (r->out.ctr.ctr0->count == 0) break; - r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetShareInfo0)); + r->out.ctr.ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, r->out.ctr.ctr0->count); WERR_TALLOC_CHECK(r->out.ctr.ctr0->array); for (i=0;iout.ctr.ctr0->count;i++) { @@ -519,7 +519,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO if (r->out.ctr.ctr1->count == 0) break; - r->out.ctr.ctr1->array = talloc(mem_ctx, r->out.ctr.ctr1->count*sizeof(struct srvsvc_NetShareInfo1)); + r->out.ctr.ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, r->out.ctr.ctr1->count); WERR_TALLOC_CHECK(r->out.ctr.ctr1->array); for (i=0;iout.ctr.ctr1->count;i++) { @@ -542,7 +542,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO if (r->out.ctr.ctr2->count == 0) break; - r->out.ctr.ctr2->array = talloc(mem_ctx, r->out.ctr.ctr2->count*sizeof(struct srvsvc_NetShareInfo2)); + r->out.ctr.ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, r->out.ctr.ctr2->count); WERR_TALLOC_CHECK(r->out.ctr.ctr2->array); for (i=0;iout.ctr.ctr2->count;i++) { @@ -570,7 +570,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO if (r->out.ctr.ctr501->count == 0) break; - r->out.ctr.ctr501->array = talloc(mem_ctx, r->out.ctr.ctr501->count*sizeof(struct srvsvc_NetShareInfo501)); + r->out.ctr.ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, r->out.ctr.ctr501->count); WERR_TALLOC_CHECK(r->out.ctr.ctr501->array); for (i=0;iout.ctr.ctr501->count;i++) { @@ -594,7 +594,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO if (r->out.ctr.ctr502->count == 0) break; - r->out.ctr.ctr502->array = talloc(mem_ctx, r->out.ctr.ctr502->count*sizeof(struct srvsvc_NetShareInfo502)); + r->out.ctr.ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, r->out.ctr.ctr502->count); WERR_TALLOC_CHECK(r->out.ctr.ctr502->array); for (i=0;iout.ctr.ctr502->count;i++) { @@ -790,8 +790,57 @@ static NTSTATUS srvsvc_NETRSERVERTRANSPORTADD(struct dcesrv_call_state *dce_call static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetTransportEnum *r) { - ZERO_STRUCT(r->out); - r->out.result = WERR_NOT_SUPPORTED; + r->out.level = r->in.level; + r->out.totalentries = 0; + r->out.resume_handle = NULL; + r->out.result = WERR_OK; + + switch (r->in.level) { + case 0: { + r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr0); + WERR_TALLOC_CHECK(r->out.ctr.ctr0); + + r->out.ctr.ctr0->count = 0; + r->out.ctr.ctr0->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 1: { + r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr1); + WERR_TALLOC_CHECK(r->out.ctr.ctr1); + + r->out.ctr.ctr1->count = 0; + r->out.ctr.ctr1->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 2: { + r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr2); + WERR_TALLOC_CHECK(r->out.ctr.ctr2); + + r->out.ctr.ctr2->count = 0; + r->out.ctr.ctr2->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + case 3: { + r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr3); + WERR_TALLOC_CHECK(r->out.ctr.ctr3); + + r->out.ctr.ctr3->count = 0; + r->out.ctr.ctr3->array = NULL; + + r->out.result = WERR_NOT_SUPPORTED; + break; + } + default: + r->out.result = WERR_UNKNOWN_LEVEL; + break; + } + return NT_STATUS_OK; } -- cgit From 21e6b1531b4e656af5962fdbeb671350f653fc26 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 May 2004 06:07:52 +0000 Subject: r464: a big improvement to the API for writing server-side RPC servers. Previously the server pipe code needed to return the RPC level status (nearly always "OK") and separately set the function call return using r->out.result. All the programmers writing servers (metze, jelmer and me) were often getting this wrong, by doing things like "return NT_STATUS_NO_MEMORY" which was really quite meaningless as there is no code like that at the dcerpc level. I have now modified pidl to generate the necessary boilerplate so that just returning the status you want from the function will work. So for a NTSTATUS function you return NT_STATUS_XXX and from a WERROR function you return WERR_XXX. If you really want to generate a DCERPC level fault rather than just a return value in your function then you should use the DCESRV_FAULT() macro which will correctly generate a fault for you. As a side effect, this also adds automatic type checking of all of our server side rpc functions, which was impossible with the old API. When I changed the API I found and fixed quite a few functions with the wrong type information, so this is definately useful. I have also changed the server side template generation to generate a DCERPC "operation range error" by default when you have not yet filled in a server side function. This allows us to correctly implement functions in any order in our rpc pipe servers and give the client the right information about the fault. (This used to be commit a4df5c7cf88891a78d82c8d6d7f058d8485e73f0) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 477 +++++++++++++----------------- 1 file changed, 211 insertions(+), 266 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 1e5a2105d0..96af3d84f4 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -26,13 +26,12 @@ /* srvsvc_NetCharDevEnum */ -static NTSTATUS srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetCharDevEnum *r) +static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevEnum *r) { r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { case 0: @@ -42,8 +41,8 @@ static NTSTATUS srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevCtr1); WERR_TALLOC_CHECK(r->out.ctr.ctr1); @@ -51,66 +50,60 @@ static NTSTATUS srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetCharDevGetInfo */ -static NTSTATUS srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevGetInfo *r) { - r->out.result = WERR_OK; - switch (r->in.level) { case 0: r->out.info.info0 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 1: r->out.info.info1 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetCharDevControl */ -static NTSTATUS srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevControl *r) { - r->out.result = WERR_NOT_SUPPORTED; - return NT_STATUS_OK; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetCharDevQEnum */ -static NTSTATUS srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetCharDevQEnum *r) +static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQEnum *r) { r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { case 0: @@ -120,8 +113,8 @@ static NTSTATUS srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLO r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr1); WERR_TALLOC_CHECK(r->out.ctr.ctr1); @@ -129,361 +122,324 @@ static NTSTATUS srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLO r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetCharDevQGetInfo */ -static NTSTATUS srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetCharDevQGetInfo *r) +static WERROR srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQGetInfo *r) { - r->out.result = WERR_OK; - switch (r->in.level) { case 0: r->out.info.info0 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 1: r->out.info.info1 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetCharDevQSetInfo */ -static NTSTATUS srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQSetInfo *r) { - r->out.result = WERR_OK; - switch (r->in.level) { case 0: if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; case 1: if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetCharDevQPurge */ -static NTSTATUS srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQPurge *r) { - r->out.result = WERR_NOT_SUPPORTED; - return NT_STATUS_OK; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetCharDevQPurgeSelf */ -static NTSTATUS srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetCharDevQPurgeSelf *r) +static WERROR srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetCharDevQPurgeSelf *r) { - r->out.result = WERR_NOT_SUPPORTED; - return NT_STATUS_OK; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetConnEnum */ -static NTSTATUS srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetConnEnum *r) { r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { - case 0: { + case 0: r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr0); WERR_TALLOC_CHECK(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 1: { + return WERR_NOT_SUPPORTED; + + case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr1); WERR_TALLOC_CHECK(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetFileEnum */ -static NTSTATUS srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetFileEnum *r) +static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetFileEnum *r) { r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { - case 2: { + case 2: r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr2); WERR_TALLOC_CHECK(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 3: { + return WERR_NOT_SUPPORTED; + + case 3: r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr3); WERR_TALLOC_CHECK(r->out.ctr.ctr3); r->out.ctr.ctr3->count = 0; r->out.ctr.ctr3->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetFileGetInfo */ -static NTSTATUS srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetFileGetInfo *r) +static WERROR srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetFileGetInfo *r) { - r->out.result = WERR_OK; - switch (r->in.level) { - case 2: { + case 2: r->out.info.info2 = NULL; + return WERR_NOT_SUPPORTED; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 3: { + case 3: r->out.info.info3 = NULL; + return WERR_NOT_SUPPORTED; - r->out.result = WERR_NOT_SUPPORTED; - break; - } default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetFileClose */ -static NTSTATUS srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileClose *r) { - r->out.result = WERR_NOT_SUPPORTED; - return NT_STATUS_OK; + return WERR_NOT_SUPPORTED; + return WERR_OK; } /* srvsvc_NetSessEnum */ -static NTSTATUS srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSessEnum *r) { r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { - case 0: { + case 0: r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr0); WERR_TALLOC_CHECK(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 1: { + return WERR_NOT_SUPPORTED; + + case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr1); WERR_TALLOC_CHECK(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 2: { + return WERR_NOT_SUPPORTED; + + case 2: r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr2); WERR_TALLOC_CHECK(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 10:{ + return WERR_NOT_SUPPORTED; + + case 10: r->out.ctr.ctr10 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr10); WERR_TALLOC_CHECK(r->out.ctr.ctr10); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 502:{ + return WERR_NOT_SUPPORTED; + + case 502: r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr502); WERR_TALLOC_CHECK(r->out.ctr.ctr502); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetSessDel */ -static NTSTATUS srvsvc_NetSessDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetSessDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSessDel *r) { - r->out.result = WERR_NOT_SUPPORTED; - return NT_STATUS_OK; + return WERR_NOT_SUPPORTED; + return WERR_OK; } /* srvsvc_NetShareAdd */ -static NTSTATUS srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareAdd *r) { - r->out.result = WERR_OK; - switch (r->in.level) { case 0: if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 1: if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 2: if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 501: if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + case 502: if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - r->out.result = WERR_NOT_SUPPORTED; - break; + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetShareEnumAll */ -static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareEnumAll *r) { struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { case 0: { @@ -615,133 +571,124 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO break; } default: - r->out.result = WERR_UNKNOWN_LEVEL; - break; + return WERR_UNKNOWN_LEVEL; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetShareGetInfo */ -static NTSTATUS srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareGetInfo *r) { - r->out.result = WERR_OK; - switch (r->in.level) { - case 0: { + case 0: r->out.info.info0 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 1: { + return WERR_NOT_SUPPORTED; + + case 1: r->out.info.info0 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 2: { + return WERR_NOT_SUPPORTED; + + case 2: r->out.info.info0 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 501:{ + return WERR_NOT_SUPPORTED; + + case 501: r->out.info.info0 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } - case 502:{ + return WERR_NOT_SUPPORTED; + + case 502: r->out.info.info0 = NULL; - r->out.result = WERR_NOT_SUPPORTED; - break; - } + return WERR_NOT_SUPPORTED; + default: - r->out.result = WERR_UNKNOWN_LEVEL; + return WERR_UNKNOWN_LEVEL; break; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NetShareSetInfo */ -static NTSTATUS srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareSetInfo *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetShareDel */ -static NTSTATUS srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDel *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetShareDelSticky */ -static NTSTATUS srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDelSticky *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetShareCheck */ -static NTSTATUS srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareCheck *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetSrvGetInfo */ -static NTSTATUS srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvGetInfo *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetSrvSetInfo */ -static NTSTATUS srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvSetInfo *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetDiskEnum */ -static NTSTATUS srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetDiskEnum *r) { r->out.count = 0; r->out.ctr0 = NULL; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { case 0: { @@ -752,48 +699,47 @@ static NTSTATUS srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CT r->out.ctr0->count = 0; r->out.ctr0->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; + return WERR_NOT_SUPPORTED; break; } default: - r->out.result = WERR_UNKNOWN_LEVEL; + return WERR_UNKNOWN_LEVEL; break; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NETRSERVERSTATISTICSGET */ -static NTSTATUS srvsvc_NETRSERVERSTATISTICSGET(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSERVERSTATISTICSGET *r) +static WERROR srvsvc_NETRSERVERSTATISTICSGET(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRSERVERSTATISTICSGET *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRSERVERTRANSPORTADD */ -static NTSTATUS srvsvc_NETRSERVERTRANSPORTADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSERVERTRANSPORTADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTADD *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetTransportEnum */ -static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetTransportEnum *r) { r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { case 0: { @@ -803,7 +749,7 @@ static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALL r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; + return WERR_NOT_SUPPORTED; break; } case 1: { @@ -813,7 +759,7 @@ static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALL r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; + return WERR_NOT_SUPPORTED; break; } case 2: { @@ -823,7 +769,7 @@ static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALL r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; + return WERR_NOT_SUPPORTED; break; } case 3: { @@ -833,119 +779,118 @@ static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALL r->out.ctr.ctr3->count = 0; r->out.ctr.ctr3->array = NULL; - r->out.result = WERR_NOT_SUPPORTED; + return WERR_NOT_SUPPORTED; break; } default: - r->out.result = WERR_UNKNOWN_LEVEL; + return WERR_UNKNOWN_LEVEL; break; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NETRSERVERTRANSPORTDEL */ -static NTSTATUS srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTDEL *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NET_REMOTE_TOD */ -static NTSTATUS srvsvc_NET_REMOTE_TOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NET_REMOTE_TOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_REMOTE_TOD *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRSERVERSETSERVICEBITS */ -static NTSTATUS srvsvc_NETRSERVERSETSERVICEBITS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSERVERSETSERVICEBITS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERSETSERVICEBITS *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRPRPATHTYPE */ -static NTSTATUS srvsvc_NETRPRPATHTYPE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRPRPATHTYPE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRPATHTYPE *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRPRPATHCANONICALIZE */ -static NTSTATUS srvsvc_NETRPRPATHCANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRPRPATHCANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRPATHCANONICALIZE *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRPRPATHCOMPARE */ -static NTSTATUS srvsvc_NETRPRPATHCOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRPRPATHCOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRPATHCOMPARE *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NET_NAME_VALIDATE */ -static NTSTATUS srvsvc_NET_NAME_VALIDATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NET_NAME_VALIDATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_NAME_VALIDATE *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRPRNAMECANONICALIZE */ -static NTSTATUS srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRNAMECANONICALIZE *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRPRNAMECOMPARE */ -static NTSTATUS srvsvc_NETRPRNAMECOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRPRNAMECOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRNAMECOMPARE *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NetShareEnum */ -static NTSTATUS srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareEnum *r) { struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; r->out.level = r->in.level; r->out.totalentries = 0; r->out.resume_handle = NULL; - r->out.result = WERR_OK; switch (r->in.level) { case 0: { @@ -1077,181 +1022,181 @@ static NTSTATUS srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_C break; } default: - r->out.result = WERR_UNKNOWN_LEVEL; + return WERR_UNKNOWN_LEVEL; break; } - return NT_STATUS_OK; + return WERR_OK; } /* srvsvc_NETRSHAREDELSTART */ -static NTSTATUS srvsvc_NETRSHAREDELSTART(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSHAREDELSTART(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSHAREDELSTART *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRSHAREDELCOMMIT */ -static NTSTATUS srvsvc_NETRSHAREDELCOMMIT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSHAREDELCOMMIT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSHAREDELCOMMIT *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NET_FILE_QUERY_SECDESC */ -static NTSTATUS srvsvc_NET_FILE_QUERY_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NET_FILE_QUERY_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_FILE_QUERY_SECDESC *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NET_FILE_SET_SECDESC */ -static NTSTATUS srvsvc_NET_FILE_SET_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NET_FILE_SET_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_FILE_SET_SECDESC *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRSERVERTRANSPORTADDEX */ -static NTSTATUS srvsvc_NETRSERVERTRANSPORTADDEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSERVERTRANSPORTADDEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTADDEX *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRSERVERSETSERVICEBITSEX */ -static NTSTATUS srvsvc_NETRSERVERSETSERVICEBITSEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSERVERSETSERVICEBITSEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERSETSERVICEBITSEX *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSGETVERSION */ -static NTSTATUS srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSGETVERSION *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSCREATELOCALPARTITION */ -static NTSTATUS srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSCREATELOCALPARTITION *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSDELETELOCALPARTITION */ -static NTSTATUS srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSDELETELOCALPARTITION *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSSETLOCALVOLUMESTATE */ -static NTSTATUS srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSSETSERVERINFO */ -static NTSTATUS srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSSETSERVERINFO *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSCREATEEXITPOINT */ -static NTSTATUS srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSCREATEEXITPOINT *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSDELETEEXITPOINT */ -static NTSTATUS srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSDELETEEXITPOINT *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSMODIFYPREFIX */ -static NTSTATUS srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSMODIFYPREFIX *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSFIXLOCALVOLUME */ -static NTSTATUS srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSFIXLOCALVOLUME *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRDFSMANAGERREPORTSITEINFO */ -static NTSTATUS srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } /* srvsvc_NETRSERVERTRANSPORTDELEX */ -static NTSTATUS srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTDELEX *r) { - return NT_STATUS_NOT_IMPLEMENTED; + return WERR_NOT_SUPPORTED; } -- cgit From c10c69ba9e9908490f0f020cb2610850d6b5bc5e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 25 May 2004 00:51:47 +0000 Subject: r868: we should issue a rpc fault OP_RANGE_ERROR not a WERR_NOT_SUPPORTED for functions we don't implement yet so that we don't put uninitialised result data on the wire (found with valgrind) (This used to be commit 2712e26a5d08afd9bf8c6957f75be522966b5062) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 80 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 41 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 96af3d84f4..452896fcbf 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -91,7 +91,7 @@ static WERROR srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevControl *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -188,7 +188,7 @@ static WERROR srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALL static WERROR srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQPurge *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -198,7 +198,7 @@ static WERROR srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC static WERROR srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQPurgeSelf *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -305,8 +305,7 @@ static WERROR srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_C static WERROR srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileClose *r) { - return WERR_NOT_SUPPORTED; - return WERR_OK; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -380,8 +379,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX static WERROR srvsvc_NetSessDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSessDel *r) { - return WERR_NOT_SUPPORTED; - return WERR_OK; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -625,7 +623,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareSetInfo *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -635,7 +633,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDel *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -645,7 +643,7 @@ static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX static WERROR srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDelSticky *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -655,7 +653,7 @@ static WERROR srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareCheck *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -665,7 +663,7 @@ static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CT static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvGetInfo *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -675,7 +673,7 @@ static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT static WERROR srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvSetInfo *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -717,7 +715,7 @@ static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX static WERROR srvsvc_NETRSERVERSTATISTICSGET(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERSTATISTICSGET *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -727,7 +725,7 @@ static WERROR srvsvc_NETRSERVERSTATISTICSGET(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NETRSERVERTRANSPORTADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTADD *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -797,7 +795,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC static WERROR srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTDEL *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -807,7 +805,7 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NET_REMOTE_TOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_REMOTE_TOD *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -817,7 +815,7 @@ static WERROR srvsvc_NET_REMOTE_TOD(struct dcesrv_call_state *dce_call, TALLOC_C static WERROR srvsvc_NETRSERVERSETSERVICEBITS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERSETSERVICEBITS *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -827,7 +825,7 @@ static WERROR srvsvc_NETRSERVERSETSERVICEBITS(struct dcesrv_call_state *dce_call static WERROR srvsvc_NETRPRPATHTYPE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRPATHTYPE *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -837,7 +835,7 @@ static WERROR srvsvc_NETRPRPATHTYPE(struct dcesrv_call_state *dce_call, TALLOC_C static WERROR srvsvc_NETRPRPATHCANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRPATHCANONICALIZE *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -847,7 +845,7 @@ static WERROR srvsvc_NETRPRPATHCANONICALIZE(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NETRPRPATHCOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRPATHCOMPARE *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -857,7 +855,7 @@ static WERROR srvsvc_NETRPRPATHCOMPARE(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NET_NAME_VALIDATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_NAME_VALIDATE *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -867,7 +865,7 @@ static WERROR srvsvc_NET_NAME_VALIDATE(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRNAMECANONICALIZE *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -877,7 +875,7 @@ static WERROR srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NETRPRNAMECOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRNAMECOMPARE *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1036,7 +1034,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX static WERROR srvsvc_NETRSHAREDELSTART(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSHAREDELSTART *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1046,7 +1044,7 @@ static WERROR srvsvc_NETRSHAREDELSTART(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NETRSHAREDELCOMMIT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSHAREDELCOMMIT *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1056,7 +1054,7 @@ static WERROR srvsvc_NETRSHAREDELCOMMIT(struct dcesrv_call_state *dce_call, TALL static WERROR srvsvc_NET_FILE_QUERY_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_FILE_QUERY_SECDESC *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1066,7 +1064,7 @@ static WERROR srvsvc_NET_FILE_QUERY_SECDESC(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NET_FILE_SET_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NET_FILE_SET_SECDESC *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1076,7 +1074,7 @@ static WERROR srvsvc_NET_FILE_SET_SECDESC(struct dcesrv_call_state *dce_call, TA static WERROR srvsvc_NETRSERVERTRANSPORTADDEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTADDEX *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1086,7 +1084,7 @@ static WERROR srvsvc_NETRSERVERTRANSPORTADDEX(struct dcesrv_call_state *dce_call static WERROR srvsvc_NETRSERVERSETSERVICEBITSEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERSETSERVICEBITSEX *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1096,7 +1094,7 @@ static WERROR srvsvc_NETRSERVERSETSERVICEBITSEX(struct dcesrv_call_state *dce_ca static WERROR srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSGETVERSION *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1106,7 +1104,7 @@ static WERROR srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSCREATELOCALPARTITION *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1116,7 +1114,7 @@ static WERROR srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_c static WERROR srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSDELETELOCALPARTITION *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1126,7 +1124,7 @@ static WERROR srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_c static WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1136,7 +1134,7 @@ static WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_ca static WERROR srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSSETSERVERINFO *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1146,7 +1144,7 @@ static WERROR srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TA static WERROR srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSCREATEEXITPOINT *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1156,7 +1154,7 @@ static WERROR srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSDELETEEXITPOINT *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1166,7 +1164,7 @@ static WERROR srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSMODIFYPREFIX *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1176,7 +1174,7 @@ static WERROR srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TAL static WERROR srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSFIXLOCALVOLUME *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1186,7 +1184,7 @@ static WERROR srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, T static WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1196,7 +1194,7 @@ static WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_ static WERROR srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTDELEX *r) { - return WERR_NOT_SUPPORTED; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } -- cgit From 6ec9c7bd301703ee9f894a10d23b82f4577404f0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 19 Jul 2004 10:15:33 +0000 Subject: r1546: fix the build the function name has changed to srvsvc_NetRemoteTOD because I implemented the idl for it metze (This used to be commit 76cb9966bf961383b36846627c13b562be5edf4e) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 452896fcbf..ad8a7f6db0 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -800,10 +800,10 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, /* - srvsvc_NET_REMOTE_TOD + srvsvc_NetRemoteTOD */ -static WERROR srvsvc_NET_REMOTE_TOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NET_REMOTE_TOD *r) +static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetRemoteTOD *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } -- cgit From 90067934cd3195df80f8b1e614629d51fffcb38b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 10:30:34 +0000 Subject: r3428: switched to using minimal includes for the auto-generated RPC code. The thing that finally convinced me that minimal includes was worth pursuing for rpc was a compiler (tcc) that failed to build Samba due to reaching internal limits of the size of include files. Also the fact that includes.h.gch was 16MB, which really seems excessive. This patch brings it back to 12M, which is still too large, but better. Note that this patch speeds up compile times for both the pch and non-pch case. This change also includes the addition iof a "depends()" option in our IDL files, allowing you to specify that one IDL file depends on another. This capability was needed for the auto-includes generation. (This used to be commit b8f5fa8ac8e8725f3d321004f0aedf4246fc6b49) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index ad8a7f6db0..ead0fba07d 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "librpc/gen_ndr/ndr_srvsvc.h" #include "rpc_server/common/common.h" /* -- cgit From c051779a0a34a9c40a5425fb1eb821983b8dc852 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Nov 2004 07:42:47 +0000 Subject: r3468: split out dcerpc_server.h (This used to be commit 729e0026e4408f74f140375537d4fe48c1fc3242) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index ead0fba07d..d5ecd84f1a 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "rpc_server/dcerpc_server.h" #include "librpc/gen_ndr/ndr_srvsvc.h" #include "rpc_server/common/common.h" -- cgit From 58c326809a816703dc516c3022c9c4dbb9d09445 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 3 Dec 2004 06:24:38 +0000 Subject: r4052: fixed a bunch of code to use the type safe _p allocation macros (This used to be commit 80d15fa3402a9d1183467463f6b21c0b674bc442) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index d5ecd84f1a..0679ac6e42 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -904,7 +904,9 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX if (r->out.ctr.ctr0->count == 0) break; - r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetShareInfo0)); + r->out.ctr.ctr0->array = talloc_array_p(mem_ctx, + struct srvsvc_NetShareInfo0, + r->out.ctr.ctr0->count); WERR_TALLOC_CHECK(r->out.ctr.ctr0->array); for (i=0;iout.ctr.ctr0->count;i++) { @@ -926,7 +928,9 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX if (r->out.ctr.ctr1->count == 0) break; - r->out.ctr.ctr1->array = talloc(mem_ctx, r->out.ctr.ctr1->count*sizeof(struct srvsvc_NetShareInfo1)); + r->out.ctr.ctr1->array = talloc_array_p(mem_ctx, + struct srvsvc_NetShareInfo1, + r->out.ctr.ctr1->count); WERR_TALLOC_CHECK(r->out.ctr.ctr1->array); for (i=0;iout.ctr.ctr1->count;i++) { @@ -949,7 +953,9 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX if (r->out.ctr.ctr2->count == 0) break; - r->out.ctr.ctr2->array = talloc(mem_ctx, r->out.ctr.ctr2->count*sizeof(struct srvsvc_NetShareInfo2)); + r->out.ctr.ctr2->array = talloc_array_p(mem_ctx, + struct srvsvc_NetShareInfo2, + r->out.ctr.ctr2->count); WERR_TALLOC_CHECK(r->out.ctr.ctr2->array); for (i=0;iout.ctr.ctr2->count;i++) { @@ -977,7 +983,9 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX if (r->out.ctr.ctr501->count == 0) break; - r->out.ctr.ctr501->array = talloc(mem_ctx, r->out.ctr.ctr501->count*sizeof(struct srvsvc_NetShareInfo501)); + r->out.ctr.ctr501->array = talloc_array_p(mem_ctx, + struct srvsvc_NetShareInfo501, + r->out.ctr.ctr501->count); WERR_TALLOC_CHECK(r->out.ctr.ctr501->array); for (i=0;iout.ctr.ctr501->count;i++) { @@ -1001,7 +1009,9 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX if (r->out.ctr.ctr502->count == 0) break; - r->out.ctr.ctr502->array = talloc(mem_ctx, r->out.ctr.ctr502->count*sizeof(struct srvsvc_NetShareInfo502)); + r->out.ctr.ctr502->array = talloc_array_p(mem_ctx, + struct srvsvc_NetShareInfo502, + r->out.ctr.ctr502->count); WERR_TALLOC_CHECK(r->out.ctr.ctr502->array); for (i=0;iout.ctr.ctr502->count;i++) { -- cgit From c62615f2686a048bbb470801b146d589b17eece4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 6 Dec 2004 11:10:15 +0000 Subject: r4075: implement RemoteTOD server function metze (This used to be commit 0c6d4246a45f649e7373606f12db74c2acd0f538) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 32 ++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 0679ac6e42..8909fc17a7 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -24,6 +24,7 @@ #include "rpc_server/dcerpc_server.h" #include "librpc/gen_ndr/ndr_srvsvc.h" #include "rpc_server/common/common.h" +#include "system/time.h" /* srvsvc_NetCharDevEnum @@ -807,7 +808,36 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetRemoteTOD *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + struct timeval tval; + time_t t; + struct tm tm; + + r->out.info = talloc_p(mem_ctx, struct srvsvc_NetRemoteTODInfo); + WERR_TALLOC_CHECK(r->out.info); + + GetTimeOfDay(&tval); + t = tval.tv_sec; + + gmtime_r(&t, &tm); + + r->out.info->elapsed = t; + /* fake the uptime: just return the milliseconds till 0:00:00 today */ + r->out.info->msecs = (tm.tm_hour*60*60*1000) + + (tm.tm_min*60*1000) + + (tm.tm_sec*1000) + + (tval.tv_usec/1000); + r->out.info->hours = tm.tm_hour; + r->out.info->mins = tm.tm_min; + r->out.info->secs = tm.tm_sec; + r->out.info->hunds = tval.tv_usec/10000; + r->out.info->timezone = get_time_zone(t)/60; + r->out.info->tinterval = 310; /* just return the same as windows */ + r->out.info->day = tm.tm_mday; + r->out.info->month = tm.tm_mon + 1; + r->out.info->year = tm.tm_year + 1900; + r->out.info->weekday = tm.tm_wday; + + return WERR_OK; } -- cgit From 8da7a605576bf7dc4f96759b65f1387c6a52467d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 30 Dec 2004 17:01:49 +0000 Subject: r4414: Various bits&pieces: * Implement samr_search_domain, filter out all elements with no "objectSid" attribute and all objects outside a specified domain sid. * Minor cleanups in dcerpc_samr.c due to that. * Implement srvsvc_NetSrvGetInfo level 100. A quick hack to get usrmgr.exe one step further. * Same for samr_info_DomInfo1. Volker (This used to be commit cdec89611355fb75d253ecf5b658d0e23de8e440) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 8909fc17a7..12dcf5b738 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -666,7 +666,16 @@ static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CT static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvGetInfo *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + if (r->in.level != 100) + return WERR_UNKNOWN_LEVEL; + + r->out.info.info100 = talloc_p(mem_ctx, struct srvsvc_NetSrvInfo100); + if (r->out.info.info100 == NULL) + return WERR_NOMEM; + + r->out.info.info100->platform_id = 500; /* W2k3 returns this */ + r->out.info.info100->server_unc = lp_netbios_name(); + return WERR_OK; } -- cgit From 09ee8ae1deec97bb1df3c1c77d73192e63df4538 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 31 Dec 2004 02:48:11 +0000 Subject: r4425: - move srvsvc and wkssvc server code to the new W_ERROR_HAVE_NO_MEMORY() macro - add parameters for server_info:platform_id = 500 /* this is PLATFORM_ID_NT */ server_info:version_major = 5 server_info:version_minor = 2 - implmented srvsvc_NetSrvGetInfo level 101 - make dcesrv_common_get_server_name() match w2k3 metze (This used to be commit 16f43207704397c6e3c0132e9f17c8a1a846ddca) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 134 +++++++++++++++++++----------- 1 file changed, 84 insertions(+), 50 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 12dcf5b738..e4c4a9d792 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -39,7 +39,7 @@ static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_C switch (r->in.level) { case 0: r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetCharDevCtr0); - WERR_TALLOC_CHECK(r->out.ctr.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; @@ -48,7 +48,7 @@ static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_C case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevCtr1); - WERR_TALLOC_CHECK(r->out.ctr.ctr1); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; @@ -111,7 +111,7 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ switch (r->in.level) { case 0: r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr0); - WERR_TALLOC_CHECK(r->out.ctr.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; @@ -120,7 +120,7 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr1); - WERR_TALLOC_CHECK(r->out.ctr.ctr1); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; @@ -218,7 +218,7 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr0); - WERR_TALLOC_CHECK(r->out.ctr.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; @@ -227,7 +227,7 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr1); - WERR_TALLOC_CHECK(r->out.ctr.ctr1); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; @@ -255,7 +255,7 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 2: r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr2); - WERR_TALLOC_CHECK(r->out.ctr.ctr2); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; @@ -264,7 +264,7 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 3: r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr3); - WERR_TALLOC_CHECK(r->out.ctr.ctr3); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); r->out.ctr.ctr3->count = 0; r->out.ctr.ctr3->array = NULL; @@ -325,7 +325,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr0); - WERR_TALLOC_CHECK(r->out.ctr.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; @@ -334,7 +334,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 1: r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr1); - WERR_TALLOC_CHECK(r->out.ctr.ctr1); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; @@ -343,7 +343,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 2: r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr2); - WERR_TALLOC_CHECK(r->out.ctr.ctr2); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; @@ -352,7 +352,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 10: r->out.ctr.ctr10 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr10); - WERR_TALLOC_CHECK(r->out.ctr.ctr10); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr10); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; @@ -361,7 +361,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 502: r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr502); - WERR_TALLOC_CHECK(r->out.ctr.ctr502); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; @@ -447,7 +447,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); - WERR_TALLOC_CHECK(r->out.ctr.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr0->array = NULL; @@ -455,11 +455,11 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ if (r->out.ctr.ctr0->count == 0) break; r->out.ctr.ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, r->out.ctr.ctr0->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr0->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array); for (i=0;iout.ctr.ctr0->count;i++) { r->out.ctr.ctr0->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - WERR_TALLOC_CHECK(r->out.ctr.ctr0->array[i].name); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array[i].name); } r->out.totalentries = r->out.ctr.ctr0->count; @@ -469,7 +469,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ case 1: { int i; r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); - WERR_TALLOC_CHECK(r->out.ctr.ctr1); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr1->array = NULL; @@ -477,7 +477,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ if (r->out.ctr.ctr1->count == 0) break; r->out.ctr.ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, r->out.ctr.ctr1->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr1->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1->array); for (i=0;iout.ctr.ctr1->count;i++) { r->out.ctr.ctr1->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); @@ -492,7 +492,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ case 2: { int i; r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); - WERR_TALLOC_CHECK(r->out.ctr.ctr2); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr2->array = NULL; @@ -500,7 +500,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ if (r->out.ctr.ctr2->count == 0) break; r->out.ctr.ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, r->out.ctr.ctr2->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr2->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2->array); for (i=0;iout.ctr.ctr2->count;i++) { r->out.ctr.ctr2->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); @@ -520,7 +520,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ case 501:{ int i; r->out.ctr.ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); - WERR_TALLOC_CHECK(r->out.ctr.ctr501); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501); r->out.ctr.ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr501->array = NULL; @@ -528,7 +528,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ if (r->out.ctr.ctr501->count == 0) break; r->out.ctr.ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, r->out.ctr.ctr501->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr501->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501->array); for (i=0;iout.ctr.ctr501->count;i++) { r->out.ctr.ctr501->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); @@ -544,7 +544,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ case 502:{ int i; r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); - WERR_TALLOC_CHECK(r->out.ctr.ctr502); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); r->out.ctr.ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr502->array = NULL; @@ -552,7 +552,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ if (r->out.ctr.ctr502->count == 0) break; r->out.ctr.ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, r->out.ctr.ctr502->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr502->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502->array); for (i=0;iout.ctr.ctr502->count;i++) { r->out.ctr.ctr502->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); @@ -666,16 +666,50 @@ static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CT static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvGetInfo *r) { - if (r->in.level != 100) - return WERR_UNKNOWN_LEVEL; + struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; - r->out.info.info100 = talloc_p(mem_ctx, struct srvsvc_NetSrvInfo100); - if (r->out.info.info100 == NULL) - return WERR_NOMEM; + ZERO_STRUCT(r->out); - r->out.info.info100->platform_id = 500; /* W2k3 returns this */ - r->out.info.info100->server_unc = lp_netbios_name(); - return WERR_OK; + switch (r->in.level) { + case 100: + { + struct srvsvc_NetSrvInfo100 *info100; + + info100 = talloc_p(mem_ctx, struct srvsvc_NetSrvInfo100); + W_ERROR_HAVE_NO_MEMORY(info100); + + info100->platform_id = dcesrv_common_get_platform_id(mem_ctx, dce_ctx); + info100->server_name = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc); + W_ERROR_HAVE_NO_MEMORY(info100->server_name); + + r->out.info.info100 = info100; + return WERR_OK; + } + case 101: + { + struct srvsvc_NetSrvInfo101 *info101; + + info101 = talloc_p(mem_ctx, struct srvsvc_NetSrvInfo101); + W_ERROR_HAVE_NO_MEMORY(info101); + + info101->platform_id = dcesrv_common_get_platform_id(mem_ctx, dce_ctx); + info101->server_name = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc); + W_ERROR_HAVE_NO_MEMORY(info101->server_name); + + info101->ver_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); + info101->ver_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); + info101->type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); + info101->comment = talloc_strdup(mem_ctx, lp_serverstring()); + W_ERROR_HAVE_NO_MEMORY(info101->comment); + + r->out.info.info101 = info101; + return WERR_OK; + } + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_UNKNOWN_LEVEL; } @@ -703,7 +737,7 @@ static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: { r->out.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetDiskCtr0); - WERR_TALLOC_CHECK(r->out.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr0); r->out.ctr0->unknown = 0x1; r->out.ctr0->count = 0; @@ -754,7 +788,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC switch (r->in.level) { case 0: { r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr0); - WERR_TALLOC_CHECK(r->out.ctr.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; r->out.ctr.ctr0->array = NULL; @@ -764,7 +798,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC } case 1: { r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr1); - WERR_TALLOC_CHECK(r->out.ctr.ctr1); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; r->out.ctr.ctr1->array = NULL; @@ -774,7 +808,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC } case 2: { r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr2); - WERR_TALLOC_CHECK(r->out.ctr.ctr2); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; r->out.ctr.ctr2->array = NULL; @@ -784,7 +818,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC } case 3: { r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr3); - WERR_TALLOC_CHECK(r->out.ctr.ctr3); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); r->out.ctr.ctr3->count = 0; r->out.ctr.ctr3->array = NULL; @@ -822,7 +856,7 @@ static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX struct tm tm; r->out.info = talloc_p(mem_ctx, struct srvsvc_NetRemoteTODInfo); - WERR_TALLOC_CHECK(r->out.info); + W_ERROR_HAVE_NO_MEMORY(r->out.info); GetTimeOfDay(&tval); t = tval.tv_sec; @@ -830,7 +864,7 @@ static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX gmtime_r(&t, &tm); r->out.info->elapsed = t; - /* fake the uptime: just return the milliseconds till 0:00:00 today */ + /* TODO: fake the uptime: just return the milliseconds till 0:00:00 today */ r->out.info->msecs = (tm.tm_hour*60*60*1000) + (tm.tm_min*60*1000) + (tm.tm_sec*1000) @@ -936,7 +970,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX int i; r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); - WERR_TALLOC_CHECK(r->out.ctr.ctr0); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr0->array = NULL; @@ -946,11 +980,11 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, r->out.ctr.ctr0->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr0->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array); for (i=0;iout.ctr.ctr0->count;i++) { r->out.ctr.ctr0->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - WERR_TALLOC_CHECK(r->out.ctr.ctr0->array[i].name); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array[i].name); } r->out.totalentries = r->out.ctr.ctr0->count; @@ -960,7 +994,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 1: { int i; r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); - WERR_TALLOC_CHECK(r->out.ctr.ctr1); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr1->array = NULL; @@ -970,7 +1004,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, r->out.ctr.ctr1->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr1->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1->array); for (i=0;iout.ctr.ctr1->count;i++) { r->out.ctr.ctr1->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); @@ -985,7 +1019,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 2: { int i; r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); - WERR_TALLOC_CHECK(r->out.ctr.ctr2); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr2->array = NULL; @@ -995,7 +1029,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, r->out.ctr.ctr2->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr2->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2->array); for (i=0;iout.ctr.ctr2->count;i++) { r->out.ctr.ctr2->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); @@ -1015,7 +1049,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 501:{ int i; r->out.ctr.ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); - WERR_TALLOC_CHECK(r->out.ctr.ctr501); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501); r->out.ctr.ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr501->array = NULL; @@ -1025,7 +1059,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, r->out.ctr.ctr501->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr501->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501->array); for (i=0;iout.ctr.ctr501->count;i++) { r->out.ctr.ctr501->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); @@ -1041,7 +1075,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 502:{ int i; r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); - WERR_TALLOC_CHECK(r->out.ctr.ctr502); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); r->out.ctr.ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); r->out.ctr.ctr502->array = NULL; @@ -1051,7 +1085,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, r->out.ctr.ctr502->count); - WERR_TALLOC_CHECK(r->out.ctr.ctr502->array); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502->array); for (i=0;iout.ctr.ctr502->count;i++) { r->out.ctr.ctr502->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); -- cgit From d63c481fb9a0dc35f0a4d87864095d8116fb0674 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 31 Dec 2004 05:34:31 +0000 Subject: r4432: - add srvsvc_NetShareInfo level 1006 and 1501 idl - implement srvsvc_NetGetShareInfo() - add more error checks - bring the rest of the code in the same layout metze (This used to be commit 0dd14d9fc611a33dad4e559321d6c50d82efb5d1) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 820 ++++++++++++++++++++---------- 1 file changed, 546 insertions(+), 274 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index e4c4a9d792..0355852ae3 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -69,22 +69,22 @@ static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_C static WERROR srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevGetInfo *r) { + ZERO_STRUCT(r->out); + switch (r->in.level) { case 0: - r->out.info.info0 = NULL; - + { return WERR_NOT_SUPPORTED; - + } case 1: - r->out.info.info1 = NULL; - + { return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -110,6 +110,7 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ switch (r->in.level) { case 0: + { r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); @@ -117,8 +118,9 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ r->out.ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; - + } case 1: + { r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); @@ -126,12 +128,12 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ r->out.ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -141,22 +143,22 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ static WERROR srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQGetInfo *r) { + ZERO_STRUCT(r->out); + switch (r->in.level) { case 0: - r->out.info.info0 = NULL; - + { return WERR_NOT_SUPPORTED; - + } case 1: - r->out.info.info1 = NULL; - + { return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -167,21 +169,25 @@ static WERROR srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALL struct srvsvc_NetCharDevQSetInfo *r) { switch (r->in.level) { - case 0: + case 0: + { if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } return WERR_NOT_SUPPORTED; + } case 1: + { if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } return WERR_NOT_SUPPORTED; + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -217,6 +223,7 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: + { r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); @@ -224,8 +231,9 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; - + } case 1: + { r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); @@ -233,12 +241,12 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -254,6 +262,7 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 2: + { r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr2); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); @@ -261,8 +270,9 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; - + } case 3: + { r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr3); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); @@ -270,12 +280,12 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr3->array = NULL; return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -285,20 +295,22 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX static WERROR srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileGetInfo *r) { + ZERO_STRUCT(r->out); + switch (r->in.level) { case 2: - r->out.info.info2 = NULL; + { return WERR_NOT_SUPPORTED; - + } case 3: - r->out.info.info3 = NULL; + { return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -324,6 +336,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: + { r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); @@ -331,8 +344,9 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; - + } case 1: + { r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); @@ -340,8 +354,9 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; - + } case 2: + { r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr2); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); @@ -349,8 +364,9 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; - + } case 10: + { r->out.ctr.ctr10 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr10); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr10); @@ -358,8 +374,9 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; - + } case 502: + { r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr502); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); @@ -367,12 +384,12 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -393,189 +410,322 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX struct srvsvc_NetShareAdd *r) { switch (r->in.level) { - case 0: + case 0: + { if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } return WERR_NOT_SUPPORTED; - + } case 1: + { if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } return WERR_NOT_SUPPORTED; - + } case 2: + { if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } return WERR_NOT_SUPPORTED; - + } case 501: + { if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } return WERR_NOT_SUPPORTED; - + } case 502: + { if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } return WERR_NOT_SUPPORTED; - + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } +static WERROR srvsvc_fiel_ShareInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + int snum, uint32_t level, union srvsvc_NetShareInfo *info) +{ + struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; + + switch (level) { + case 0: + { + info->info0->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info0->name); + + return WERR_OK; + } + case 1: + { + info->info1->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info1->name); + info->info1->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); + info->info1->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info1->comment); + + return WERR_OK; + } + case 2: + { + info->info2->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info2->name); + info->info2->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); + info->info2->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info2->comment); + info->info2->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, snum); + info->info2->max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, snum); + info->info2->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, snum); + info->info2->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info2->path); + info->info2->password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, snum); + + return WERR_OK; + } + case 501: + { + info->info501->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info501->name); + info->info501->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); + info->info501->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info501->comment); + info->info501->csc_policy = dcesrv_common_get_share_csc_policy(mem_ctx, dce_ctx, snum); + + return WERR_OK; + } + case 502: + { + info->info502->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info502->name); + info->info502->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); + info->info502->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info502->comment); + info->info502->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, snum); + info->info502->max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, snum); + info->info502->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, snum); + info->info502->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, snum); + W_ERROR_HAVE_NO_MEMORY(info->info502->path); + info->info502->password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, snum); + info->info502->unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, snum); + info->info502->sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, snum); + + return WERR_OK; + } + case 1005: + { + info->info1005->dfs_flags = dcesrv_common_get_share_dfs_flags(mem_ctx, dce_ctx, snum); + + return WERR_OK; + } + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_UNKNOWN_LEVEL; +} /* srvsvc_NetShareEnumAll */ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetShareEnumAll *r) + struct srvsvc_NetShareEnumAll *r) { struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; + r->out.level = r->in.level; + ZERO_STRUCT(r->out.ctr); r->out.totalentries = 0; r->out.resume_handle = NULL; + /* TODO: - paging of results + * - access check + */ + switch (r->in.level) { - case 0: { + case 0: + { int i; + struct srvsvc_NetShareCtr0 *ctr0; - r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); + W_ERROR_HAVE_NO_MEMORY(ctr0); - r->out.ctr.ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr0->array = NULL; + ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr0->array = NULL; - if (r->out.ctr.ctr0->count == 0) break; - - r->out.ctr.ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, r->out.ctr.ctr0->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array); - - for (i=0;iout.ctr.ctr0->count;i++) { - r->out.ctr.ctr0->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array[i].name); + if (ctr0->count == 0) { + r->out.ctr.ctr0 = ctr0; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr0->count; + ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); + W_ERROR_HAVE_NO_MEMORY(ctr0->array); + + for (i=0; i < ctr0->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; - break; + info.info0 = &ctr0->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 1: { - int i; - r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); - r->out.ctr.ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr1->array = NULL; + r->out.ctr.ctr0 = ctr0; + r->out.totalentries = r->out.ctr.ctr0->count; + return WERR_OK; + } + case 1: + { + int i; + struct srvsvc_NetShareCtr1 *ctr1; - if (r->out.ctr.ctr1->count == 0) break; + ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); + W_ERROR_HAVE_NO_MEMORY(ctr1); - r->out.ctr.ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, r->out.ctr.ctr1->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1->array); + ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr1->array = NULL; - for (i=0;iout.ctr.ctr1->count;i++) { - r->out.ctr.ctr1->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr1->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr1->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + if (ctr1->count == 0) { + r->out.ctr.ctr1 = ctr1; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr1->count; + ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); + W_ERROR_HAVE_NO_MEMORY(ctr1->array); + + for (i=0; i < ctr1->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; - break; + info.info1 = &ctr1->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 2: { - int i; - r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); - r->out.ctr.ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr2->array = NULL; + r->out.ctr.ctr1 = ctr1; + r->out.totalentries = r->out.ctr.ctr1->count; + return WERR_OK; + } + case 2: + { + int i; + struct srvsvc_NetShareCtr2 *ctr2; - if (r->out.ctr.ctr2->count == 0) break; + ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); + W_ERROR_HAVE_NO_MEMORY(ctr2); - r->out.ctr.ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, r->out.ctr.ctr2->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2->array); + ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr2->array = NULL; - for (i=0;iout.ctr.ctr2->count;i++) { - r->out.ctr.ctr2->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); + if (ctr2->count == 0) { + r->out.ctr.ctr2 = ctr2; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr2->count; + ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); + W_ERROR_HAVE_NO_MEMORY(ctr2->array); + + for (i=0; i < ctr2->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; - break; + info.info2 = &ctr2->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 501:{ - int i; - r->out.ctr.ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501); - r->out.ctr.ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr501->array = NULL; + r->out.ctr.ctr2 = ctr2; + r->out.totalentries = r->out.ctr.ctr2->count; + return WERR_OK; + } + case 501: + { + int i; + struct srvsvc_NetShareCtr501 *ctr501; - if (r->out.ctr.ctr501->count == 0) break; + ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); + W_ERROR_HAVE_NO_MEMORY(ctr501); - r->out.ctr.ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, r->out.ctr.ctr501->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501->array); + ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr501->array = NULL; - for (i=0;iout.ctr.ctr501->count;i++) { - r->out.ctr.ctr501->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr501->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr501->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); - r->out.ctr.ctr501->array[i].csc_policy = dcesrv_common_get_share_csc_policy(mem_ctx, dce_ctx, i); + if (ctr501->count == 0) { + r->out.ctr.ctr501 = ctr501; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr501->count; + ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); + W_ERROR_HAVE_NO_MEMORY(ctr501->array); + + for (i=0; i < ctr501->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; - break; + info.info501 = &ctr501->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 502:{ + + r->out.ctr.ctr501 = ctr501; + r->out.totalentries = r->out.ctr.ctr501->count; + return WERR_OK; + } + case 502: + { int i; - r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); + struct srvsvc_NetShareCtr502 *ctr502; + + ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); + W_ERROR_HAVE_NO_MEMORY(ctr502); + + ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr502->array = NULL; - r->out.ctr.ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr502->array = NULL; - - if (r->out.ctr.ctr502->count == 0) break; - - r->out.ctr.ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, r->out.ctr.ctr502->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502->array); - - for (i=0;iout.ctr.ctr502->count;i++) { - r->out.ctr.ctr502->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, i); + if (ctr502->count == 0) { + r->out.ctr.ctr502 = ctr502; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr502->count; + ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); + W_ERROR_HAVE_NO_MEMORY(ctr502->array); - break; + for (i=0; i < ctr502->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; + + info.info502 = &ctr502->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } + + r->out.ctr.ctr502 = ctr502; + r->out.totalentries = r->out.ctr.ctr502->count; + return WERR_OK; + } default: return WERR_UNKNOWN_LEVEL; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -583,40 +733,126 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ srvsvc_NetShareGetInfo */ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetShareGetInfo *r) + struct srvsvc_NetShareGetInfo *r) { + int snum; + + ZERO_STRUCT(r->out); + + /* TODO: - access check + */ + + if (strcmp("", r->in.share_name) == 0) { + return WERR_INVALID_PARAM; + } + + snum = lp_servicenumber(r->in.share_name); + if (snum < 0) { + return WERR_NET_NAME_NOT_FOUND; + } + switch (r->in.level) { case 0: - r->out.info.info0 = NULL; + { + WERROR status; + union srvsvc_NetShareInfo info; - return WERR_NOT_SUPPORTED; + info.info0 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo0); + W_ERROR_HAVE_NO_MEMORY(info.info0); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } + + r->out.info.info0 = info.info0; + return WERR_OK; + } case 1: - r->out.info.info0 = NULL; + { + WERROR status; + union srvsvc_NetShareInfo info; - return WERR_NOT_SUPPORTED; + info.info1 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo1); + W_ERROR_HAVE_NO_MEMORY(info.info1); + + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } + r->out.info.info1 = info.info1; + return WERR_OK; + } case 2: - r->out.info.info0 = NULL; + { + WERROR status; + union srvsvc_NetShareInfo info; - return WERR_NOT_SUPPORTED; + info.info2 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo2); + W_ERROR_HAVE_NO_MEMORY(info.info2); + + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } + r->out.info.info2 = info.info2; + return WERR_OK; + } case 501: - r->out.info.info0 = NULL; + { + WERROR status; + union srvsvc_NetShareInfo info; - return WERR_NOT_SUPPORTED; + info.info501 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo501); + W_ERROR_HAVE_NO_MEMORY(info.info501); + + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } + r->out.info.info501 = info.info501; + return WERR_OK; + } case 502: - r->out.info.info0 = NULL; + { + WERROR status; + union srvsvc_NetShareInfo info; - return WERR_NOT_SUPPORTED; + info.info502 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo502); + W_ERROR_HAVE_NO_MEMORY(info.info502); + + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } + + r->out.info.info502 = info.info502; + return WERR_OK; + } + case 1005: + { + WERROR status; + union srvsvc_NetShareInfo info; + + info.info1005 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo1005); + W_ERROR_HAVE_NO_MEMORY(info.info1005); + + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } + r->out.info.info1005 = info.info1005; + return WERR_OK; + } default: return WERR_UNKNOWN_LEVEL; - break; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -696,9 +932,9 @@ static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT info101->server_name = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc); W_ERROR_HAVE_NO_MEMORY(info101->server_name); - info101->ver_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); - info101->ver_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); - info101->type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); + info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); + info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); + info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); info101->comment = talloc_strdup(mem_ctx, lp_serverstring()); W_ERROR_HAVE_NO_MEMORY(info101->comment); @@ -735,7 +971,8 @@ static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.resume_handle = NULL; switch (r->in.level) { - case 0: { + case 0: + { r->out.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetDiskCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr0); @@ -744,14 +981,12 @@ static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.ctr0->array = NULL; return WERR_NOT_SUPPORTED; - break; - } + } default: return WERR_UNKNOWN_LEVEL; - break; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -786,7 +1021,8 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC r->out.resume_handle = NULL; switch (r->in.level) { - case 0: { + case 0: + { r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); @@ -794,9 +1030,9 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC r->out.ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; - break; - } - case 1: { + } + case 1: + { r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); @@ -804,9 +1040,9 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC r->out.ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; - break; - } - case 2: { + } + case 2: + { r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr2); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); @@ -814,9 +1050,9 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC r->out.ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; - break; - } - case 3: { + } + case 3: + { r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr3); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); @@ -824,14 +1060,12 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC r->out.ctr.ctr3->array = NULL; return WERR_NOT_SUPPORTED; - break; - } + } default: return WERR_UNKNOWN_LEVEL; - break; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } @@ -958,158 +1192,196 @@ static WERROR srvsvc_NETRPRNAMECOMPARE(struct dcesrv_call_state *dce_call, TALLO srvsvc_NetShareEnum */ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetShareEnum *r) + struct srvsvc_NetShareEnum *r) { struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; + r->out.level = r->in.level; + ZERO_STRUCT(r->out.ctr); r->out.totalentries = 0; r->out.resume_handle = NULL; + /* TODO: - paging of results + * - access check + * - filter out hidden shares + */ + switch (r->in.level) { - case 0: { + case 0: + { int i; + struct srvsvc_NetShareCtr0 *ctr0; - r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); + W_ERROR_HAVE_NO_MEMORY(ctr0); - r->out.ctr.ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr0->array = NULL; + ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr0->array = NULL; - if (r->out.ctr.ctr0->count == 0) break; - - r->out.ctr.ctr0->array = talloc_array_p(mem_ctx, - struct srvsvc_NetShareInfo0, - r->out.ctr.ctr0->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array); - - for (i=0;iout.ctr.ctr0->count;i++) { - r->out.ctr.ctr0->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0->array[i].name); + if (ctr0->count == 0) { + r->out.ctr.ctr0 = ctr0; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr0->count; + ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); + W_ERROR_HAVE_NO_MEMORY(ctr0->array); - break; + for (i=0; i < ctr0->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; + + info.info0 = &ctr0->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 1: { - int i; - r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); - r->out.ctr.ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr1->array = NULL; + r->out.ctr.ctr0 = ctr0; + r->out.totalentries = r->out.ctr.ctr0->count; + return WERR_OK; + } + case 1: + { + int i; + struct srvsvc_NetShareCtr1 *ctr1; - if (r->out.ctr.ctr1->count == 0) break; + ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); + W_ERROR_HAVE_NO_MEMORY(ctr1); - r->out.ctr.ctr1->array = talloc_array_p(mem_ctx, - struct srvsvc_NetShareInfo1, - r->out.ctr.ctr1->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1->array); + ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr1->array = NULL; - for (i=0;iout.ctr.ctr1->count;i++) { - r->out.ctr.ctr1->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr1->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr1->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); + if (ctr1->count == 0) { + r->out.ctr.ctr1 = ctr1; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr1->count; + ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); + W_ERROR_HAVE_NO_MEMORY(ctr1->array); + + for (i=0; i < ctr1->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; - break; + info.info1 = &ctr1->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 2: { + + r->out.ctr.ctr1 = ctr1; + r->out.totalentries = r->out.ctr.ctr1->count; + return WERR_OK; + } + case 2: + { int i; - r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); + struct srvsvc_NetShareCtr2 *ctr2; - r->out.ctr.ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr2->array = NULL; + ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); + W_ERROR_HAVE_NO_MEMORY(ctr2); - if (r->out.ctr.ctr2->count == 0) break; - - r->out.ctr.ctr2->array = talloc_array_p(mem_ctx, - struct srvsvc_NetShareInfo2, - r->out.ctr.ctr2->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2->array); - - for (i=0;iout.ctr.ctr2->count;i++) { - r->out.ctr.ctr2->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); - r->out.ctr.ctr2->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); + ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr2->array = NULL; + + if (ctr2->count == 0) { + r->out.ctr.ctr2 = ctr2; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr2->count; + ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); + W_ERROR_HAVE_NO_MEMORY(ctr2->array); + + for (i=0; i < ctr2->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; - break; + info.info2 = &ctr2->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 501:{ - int i; - r->out.ctr.ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501); - r->out.ctr.ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr501->array = NULL; + r->out.ctr.ctr2 = ctr2; + r->out.totalentries = r->out.ctr.ctr2->count; + return WERR_OK; + } + case 501: + { + int i; + struct srvsvc_NetShareCtr501 *ctr501; - if (r->out.ctr.ctr501->count == 0) break; + ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); + W_ERROR_HAVE_NO_MEMORY(ctr501); - r->out.ctr.ctr501->array = talloc_array_p(mem_ctx, - struct srvsvc_NetShareInfo501, - r->out.ctr.ctr501->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr501->array); + ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr501->array = NULL; - for (i=0;iout.ctr.ctr501->count;i++) { - r->out.ctr.ctr501->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr501->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr501->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); - r->out.ctr.ctr501->array[i].csc_policy = dcesrv_common_get_share_csc_policy(mem_ctx, dce_ctx, i); + if (ctr501->count == 0) { + r->out.ctr.ctr501 = ctr501; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr501->count; + ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); + W_ERROR_HAVE_NO_MEMORY(ctr501->array); + + for (i=0; i < ctr501->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; - break; + info.info501 = &ctr501->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } - case 502:{ + + r->out.ctr.ctr501 = ctr501; + r->out.totalentries = r->out.ctr.ctr501->count; + return WERR_OK; + } + case 502: + { int i; - r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); + struct srvsvc_NetShareCtr502 *ctr502; + + ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); + W_ERROR_HAVE_NO_MEMORY(ctr502); + + ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr502->array = NULL; - r->out.ctr.ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - r->out.ctr.ctr502->array = NULL; - - if (r->out.ctr.ctr502->count == 0) break; - - r->out.ctr.ctr502->array = talloc_array_p(mem_ctx, - struct srvsvc_NetShareInfo502, - r->out.ctr.ctr502->count); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502->array); - - for (i=0;iout.ctr.ctr502->count;i++) { - r->out.ctr.ctr502->array[i].name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, i); - r->out.ctr.ctr502->array[i].sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, i); + if (ctr502->count == 0) { + r->out.ctr.ctr502 = ctr502; + return WERR_OK; } - r->out.totalentries = r->out.ctr.ctr502->count; + ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); + W_ERROR_HAVE_NO_MEMORY(ctr502->array); - break; + for (i=0; i < ctr502->count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; + + info.info502 = &ctr502->array[i]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + if (!W_ERROR_IS_OK(status)) { + return status; + } } + + r->out.ctr.ctr502 = ctr502; + r->out.totalentries = r->out.ctr.ctr502->count; + return WERR_OK; + } default: return WERR_UNKNOWN_LEVEL; - break; } - return WERR_OK; + return WERR_UNKNOWN_LEVEL; } -- cgit From 85b492bb5b90edd636611eb884c7bcfa9c45bd64 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 31 Dec 2004 07:42:57 +0000 Subject: r4440: - add a start of srvsvc_NetShareCheck() server code - filterout hidden shares in NetShareEnum() - get max_connections right metze (This used to be commit c685823c5d75f22177549566866301523a64a1dd) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 74 ++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 12 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 0355852ae3..57afa4530e 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -892,7 +892,23 @@ static WERROR srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareCheck *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + ZERO_STRUCT(r->out); + + /* TODO: - access check + */ + + if (strcmp("", r->in.device_name) == 0) { + r->out.type = STYPE_IPC; + return WERR_OK; + } + + if (strcmp("C:\\", r->in.device_name) == 0) { + r->out.type = STYPE_DISKTREE; + return WERR_OK; + } + + /* TODO: - lookup the share be devicename (path) */ + return WERR_DEVICE_NOT_SHARED; } @@ -1203,13 +1219,13 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* TODO: - paging of results * - access check - * - filter out hidden shares */ switch (r->in.level) { case 0: { int i; + uint32_t count; struct srvsvc_NetShareCtr0 *ctr0; ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); @@ -1226,11 +1242,17 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); W_ERROR_HAVE_NO_MEMORY(ctr0->array); - for (i=0; i < ctr0->count; i++) { + count = ctr0->count; + ctr0->count = 0; + for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - info.info0 = &ctr0->array[i]; + if (!lp_browseable(i)){ + continue; + } + + info.info0 = &ctr0->array[ctr0->count++]; status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; @@ -1244,6 +1266,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 1: { int i; + uint32_t count; struct srvsvc_NetShareCtr1 *ctr1; ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); @@ -1260,11 +1283,17 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); W_ERROR_HAVE_NO_MEMORY(ctr1->array); - for (i=0; i < ctr1->count; i++) { + count = ctr1->count; + ctr1->count = 0; + for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - info.info1 = &ctr1->array[i]; + if (!lp_browseable(i)){ + continue; + } + + info.info1 = &ctr1->array[ctr1->count++]; status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; @@ -1278,6 +1307,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 2: { int i; + uint32_t count; struct srvsvc_NetShareCtr2 *ctr2; ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); @@ -1294,11 +1324,17 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); W_ERROR_HAVE_NO_MEMORY(ctr2->array); - for (i=0; i < ctr2->count; i++) { + count = ctr2->count; + ctr2->count = 0; + for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - info.info2 = &ctr2->array[i]; + if (!lp_browseable(i)){ + continue; + } + + info.info2 = &ctr2->array[ctr2->count++]; status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; @@ -1312,6 +1348,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 501: { int i; + uint32_t count; struct srvsvc_NetShareCtr501 *ctr501; ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); @@ -1328,11 +1365,17 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); W_ERROR_HAVE_NO_MEMORY(ctr501->array); - for (i=0; i < ctr501->count; i++) { + count = ctr501->count; + ctr501->count = 0; + for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - info.info501 = &ctr501->array[i]; + if (!lp_browseable(i)){ + continue; + } + + info.info501 = &ctr501->array[ctr501->count++]; status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; @@ -1346,6 +1389,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX case 502: { int i; + uint32_t count; struct srvsvc_NetShareCtr502 *ctr502; ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); @@ -1362,11 +1406,17 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); W_ERROR_HAVE_NO_MEMORY(ctr502->array); - for (i=0; i < ctr502->count; i++) { + count = ctr502->count; + ctr502->count = 0; + for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - info.info502 = &ctr502->array[i]; + if (!lp_browseable(i)){ + continue; + } + + info.info502 = &ctr502->array[ctr502->count++]; status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; -- 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/rpc_server/srvsvc/dcesrv_srvsvc.c | 94 +++++++++++++++---------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 57afa4530e..3362d2f4d1 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -38,7 +38,7 @@ static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_C switch (r->in.level) { case 0: - r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetCharDevCtr0); + r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; @@ -47,7 +47,7 @@ static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_C return WERR_NOT_SUPPORTED; case 1: - r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevCtr1); + r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; @@ -111,7 +111,7 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ switch (r->in.level) { case 0: { - r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr0); + r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; @@ -121,7 +121,7 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ } case 1: { - r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQCtr1); + r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; @@ -224,7 +224,7 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: { - r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr0); + r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetConnCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; @@ -234,7 +234,7 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 1: { - r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetConnCtr1); + r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetConnCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; @@ -263,7 +263,7 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 2: { - r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr2); + r->out.ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetFileCtr2); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; @@ -273,7 +273,7 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 3: { - r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetFileCtr3); + r->out.ctr.ctr3 = talloc(mem_ctx, struct srvsvc_NetFileCtr3); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); r->out.ctr.ctr3->count = 0; @@ -337,7 +337,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: { - r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr0); + r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetSessCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; @@ -347,7 +347,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 1: { - r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr1); + r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetSessCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; @@ -357,7 +357,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 2: { - r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr2); + r->out.ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetSessCtr2); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; @@ -367,7 +367,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 10: { - r->out.ctr.ctr10 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr10); + r->out.ctr.ctr10 = talloc(mem_ctx, struct srvsvc_NetSessCtr10); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr10); r->out.ctr.ctr2->count = 0; @@ -377,7 +377,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 502: { - r->out.ctr.ctr502 = talloc_p(mem_ctx, struct srvsvc_NetSessCtr502); + r->out.ctr.ctr502 = talloc(mem_ctx, struct srvsvc_NetSessCtr502); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); r->out.ctr.ctr2->count = 0; @@ -556,7 +556,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr0 *ctr0; - ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); + ctr0 = talloc(mem_ctx, struct srvsvc_NetShareCtr0); W_ERROR_HAVE_NO_MEMORY(ctr0); ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -567,7 +567,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_OK; } - ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); + ctr0->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); W_ERROR_HAVE_NO_MEMORY(ctr0->array); for (i=0; i < ctr0->count; i++) { @@ -590,7 +590,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr1 *ctr1; - ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); + ctr1 = talloc(mem_ctx, struct srvsvc_NetShareCtr1); W_ERROR_HAVE_NO_MEMORY(ctr1); ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -601,7 +601,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_OK; } - ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); + ctr1->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); W_ERROR_HAVE_NO_MEMORY(ctr1->array); for (i=0; i < ctr1->count; i++) { @@ -624,7 +624,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr2 *ctr2; - ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); + ctr2 = talloc(mem_ctx, struct srvsvc_NetShareCtr2); W_ERROR_HAVE_NO_MEMORY(ctr2); ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -635,7 +635,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_OK; } - ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); + ctr2->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); W_ERROR_HAVE_NO_MEMORY(ctr2->array); for (i=0; i < ctr2->count; i++) { @@ -658,7 +658,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr501 *ctr501; - ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); + ctr501 = talloc(mem_ctx, struct srvsvc_NetShareCtr501); W_ERROR_HAVE_NO_MEMORY(ctr501); ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -669,7 +669,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_OK; } - ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); + ctr501->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); W_ERROR_HAVE_NO_MEMORY(ctr501->array); for (i=0; i < ctr501->count; i++) { @@ -692,7 +692,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr502 *ctr502; - ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); + ctr502 = talloc(mem_ctx, struct srvsvc_NetShareCtr502); W_ERROR_HAVE_NO_MEMORY(ctr502); ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -703,7 +703,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_OK; } - ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); + ctr502->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); W_ERROR_HAVE_NO_MEMORY(ctr502->array); for (i=0; i < ctr502->count; i++) { @@ -757,7 +757,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; - info.info0 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo0); + info.info0 = talloc(mem_ctx, struct srvsvc_NetShareInfo0); W_ERROR_HAVE_NO_MEMORY(info.info0); status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); @@ -773,7 +773,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; - info.info1 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo1); + info.info1 = talloc(mem_ctx, struct srvsvc_NetShareInfo1); W_ERROR_HAVE_NO_MEMORY(info.info1); status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); @@ -789,7 +789,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; - info.info2 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo2); + info.info2 = talloc(mem_ctx, struct srvsvc_NetShareInfo2); W_ERROR_HAVE_NO_MEMORY(info.info2); status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); @@ -805,7 +805,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; - info.info501 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo501); + info.info501 = talloc(mem_ctx, struct srvsvc_NetShareInfo501); W_ERROR_HAVE_NO_MEMORY(info.info501); status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); @@ -821,7 +821,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; - info.info502 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo502); + info.info502 = talloc(mem_ctx, struct srvsvc_NetShareInfo502); W_ERROR_HAVE_NO_MEMORY(info.info502); status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); @@ -837,7 +837,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; - info.info1005 = talloc_p(mem_ctx, struct srvsvc_NetShareInfo1005); + info.info1005 = talloc(mem_ctx, struct srvsvc_NetShareInfo1005); W_ERROR_HAVE_NO_MEMORY(info.info1005); status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); @@ -927,7 +927,7 @@ static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT { struct srvsvc_NetSrvInfo100 *info100; - info100 = talloc_p(mem_ctx, struct srvsvc_NetSrvInfo100); + info100 = talloc(mem_ctx, struct srvsvc_NetSrvInfo100); W_ERROR_HAVE_NO_MEMORY(info100); info100->platform_id = dcesrv_common_get_platform_id(mem_ctx, dce_ctx); @@ -941,7 +941,7 @@ static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT { struct srvsvc_NetSrvInfo101 *info101; - info101 = talloc_p(mem_ctx, struct srvsvc_NetSrvInfo101); + info101 = talloc(mem_ctx, struct srvsvc_NetSrvInfo101); W_ERROR_HAVE_NO_MEMORY(info101); info101->platform_id = dcesrv_common_get_platform_id(mem_ctx, dce_ctx); @@ -989,7 +989,7 @@ static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 0: { - r->out.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetDiskCtr0); + r->out.ctr0 = talloc(mem_ctx, struct srvsvc_NetDiskCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr0); r->out.ctr0->unknown = 0x1; @@ -1039,7 +1039,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC switch (r->in.level) { case 0: { - r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr0); + r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetTransportCtr0); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); r->out.ctr.ctr0->count = 0; @@ -1049,7 +1049,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC } case 1: { - r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr1); + r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetTransportCtr1); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); r->out.ctr.ctr1->count = 0; @@ -1059,7 +1059,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC } case 2: { - r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr2); + r->out.ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetTransportCtr2); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); r->out.ctr.ctr2->count = 0; @@ -1069,7 +1069,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC } case 3: { - r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr3); + r->out.ctr.ctr3 = talloc(mem_ctx, struct srvsvc_NetTransportCtr3); W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); r->out.ctr.ctr3->count = 0; @@ -1105,7 +1105,7 @@ static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX time_t t; struct tm tm; - r->out.info = talloc_p(mem_ctx, struct srvsvc_NetRemoteTODInfo); + r->out.info = talloc(mem_ctx, struct srvsvc_NetRemoteTODInfo); W_ERROR_HAVE_NO_MEMORY(r->out.info); GetTimeOfDay(&tval); @@ -1228,7 +1228,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX uint32_t count; struct srvsvc_NetShareCtr0 *ctr0; - ctr0 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr0); + ctr0 = talloc(mem_ctx, struct srvsvc_NetShareCtr0); W_ERROR_HAVE_NO_MEMORY(ctr0); ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -1239,7 +1239,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX return WERR_OK; } - ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); + ctr0->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); W_ERROR_HAVE_NO_MEMORY(ctr0->array); count = ctr0->count; @@ -1269,7 +1269,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX uint32_t count; struct srvsvc_NetShareCtr1 *ctr1; - ctr1 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr1); + ctr1 = talloc(mem_ctx, struct srvsvc_NetShareCtr1); W_ERROR_HAVE_NO_MEMORY(ctr1); ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -1280,7 +1280,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX return WERR_OK; } - ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); + ctr1->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); W_ERROR_HAVE_NO_MEMORY(ctr1->array); count = ctr1->count; @@ -1310,7 +1310,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX uint32_t count; struct srvsvc_NetShareCtr2 *ctr2; - ctr2 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr2); + ctr2 = talloc(mem_ctx, struct srvsvc_NetShareCtr2); W_ERROR_HAVE_NO_MEMORY(ctr2); ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -1321,7 +1321,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX return WERR_OK; } - ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); + ctr2->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); W_ERROR_HAVE_NO_MEMORY(ctr2->array); count = ctr2->count; @@ -1351,7 +1351,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX uint32_t count; struct srvsvc_NetShareCtr501 *ctr501; - ctr501 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr501); + ctr501 = talloc(mem_ctx, struct srvsvc_NetShareCtr501); W_ERROR_HAVE_NO_MEMORY(ctr501); ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -1362,7 +1362,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX return WERR_OK; } - ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); + ctr501->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); W_ERROR_HAVE_NO_MEMORY(ctr501->array); count = ctr501->count; @@ -1392,7 +1392,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX uint32_t count; struct srvsvc_NetShareCtr502 *ctr502; - ctr502 = talloc_p(mem_ctx, struct srvsvc_NetShareCtr502); + ctr502 = talloc(mem_ctx, struct srvsvc_NetShareCtr502); W_ERROR_HAVE_NO_MEMORY(ctr502); ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); @@ -1403,7 +1403,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX return WERR_OK; } - ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); + ctr502->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); W_ERROR_HAVE_NO_MEMORY(ctr502->array); count = ctr502->count; -- cgit From 557ad72e7ac1988db6f1f030a990bf2979220a69 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 24 Dec 2005 21:32:52 +0000 Subject: r12461: Some updates to the srvsvc IDL from Ronnie Sahlberg (This used to be commit ff7ef98f34811952331e72095505a2eae430fec0) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 410 +++++++----------------------- 1 file changed, 88 insertions(+), 322 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 3362d2f4d1..997cdc81ac 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -866,16 +866,6 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } -/* - srvsvc_NetShareDel -*/ -static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetShareDel *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - /* srvsvc_NetShareDelSticky */ @@ -981,21 +971,14 @@ static WERROR srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetDiskEnum *r) { - r->out.count = 0; - r->out.ctr0 = NULL; + r->out.disks.discs = NULL; + r->out.disks.count = 0; r->out.totalentries = 0; r->out.resume_handle = NULL; switch (r->in.level) { case 0: { - r->out.ctr0 = talloc(mem_ctx, struct srvsvc_NetDiskCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr0); - - r->out.ctr0->unknown = 0x1; - r->out.ctr0->count = 0; - r->out.ctr0->array = NULL; - return WERR_NOT_SUPPORTED; } default: @@ -1007,20 +990,20 @@ static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* - srvsvc_NETRSERVERSTATISTICSGET + srvsvc_NetServerStatisticsGet */ -static WERROR srvsvc_NETRSERVERSTATISTICSGET(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSERVERSTATISTICSGET *r) +static WERROR srvsvc_NetServerStatisticsGet(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetServerStatisticsGet *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRSERVERTRANSPORTADD + srvsvc_NetTransportAdd */ -static WERROR srvsvc_NETRSERVERTRANSPORTADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSERVERTRANSPORTADD *r) +static WERROR srvsvc_NetTransportAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetTransportAdd *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1039,41 +1022,41 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC switch (r->in.level) { case 0: { - r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetTransportCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + r->out.transports.ctr0 = talloc(mem_ctx, struct srvsvc_NetTransportCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr0); - r->out.ctr.ctr0->count = 0; - r->out.ctr.ctr0->array = NULL; + r->out.transports.ctr0->count = 0; + r->out.transports.ctr0->array = NULL; return WERR_NOT_SUPPORTED; } case 1: { - r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetTransportCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); + r->out.transports.ctr1 = talloc(mem_ctx, struct srvsvc_NetTransportCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr1); - r->out.ctr.ctr1->count = 0; - r->out.ctr.ctr1->array = NULL; + r->out.transports.ctr1->count = 0; + r->out.transports.ctr1->array = NULL; return WERR_NOT_SUPPORTED; } case 2: { - r->out.ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetTransportCtr2); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); + r->out.transports.ctr2 = talloc(mem_ctx, struct srvsvc_NetTransportCtr2); + W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr2); - r->out.ctr.ctr2->count = 0; - r->out.ctr.ctr2->array = NULL; + r->out.transports.ctr2->count = 0; + r->out.transports.ctr2->array = NULL; return WERR_NOT_SUPPORTED; } case 3: { - r->out.ctr.ctr3 = talloc(mem_ctx, struct srvsvc_NetTransportCtr3); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); + r->out.transports.ctr3 = talloc(mem_ctx, struct srvsvc_NetTransportCtr3); + W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr3); - r->out.ctr.ctr3->count = 0; - r->out.ctr.ctr3->array = NULL; + r->out.transports.ctr3->count = 0; + r->out.transports.ctr3->array = NULL; return WERR_NOT_SUPPORTED; } @@ -1084,12 +1067,11 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC return WERR_UNKNOWN_LEVEL; } - /* - srvsvc_NETRSERVERTRANSPORTDEL + srvsvc_NetTransportDel */ -static WERROR srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSERVERTRANSPORTDEL *r) +static WERROR srvsvc_NetTransportDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetTransportDel *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1133,72 +1115,51 @@ static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX return WERR_OK; } - -/* - srvsvc_NETRSERVERSETSERVICEBITS -*/ -static WERROR srvsvc_NETRSERVERSETSERVICEBITS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSERVERSETSERVICEBITS *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - -/* - srvsvc_NETRPRPATHTYPE -*/ -static WERROR srvsvc_NETRPRPATHTYPE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRPRPATHTYPE *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - /* - srvsvc_NETRPRPATHCANONICALIZE + srvsvc_NetPathType */ -static WERROR srvsvc_NETRPRPATHCANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRPRPATHCANONICALIZE *r) +static WERROR srvsvc_NetPathType(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetPathType *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRPRPATHCOMPARE + srvsvc_NetPathCanonicalize */ -static WERROR srvsvc_NETRPRPATHCOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRPRPATHCOMPARE *r) +static WERROR srvsvc_NetPathCanonicalize(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetPathCanonicalize *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NET_NAME_VALIDATE + srvsvc_NetPathCompare */ -static WERROR srvsvc_NET_NAME_VALIDATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NET_NAME_VALIDATE *r) +static WERROR srvsvc_NetPathCompare(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetPathCompare *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRPRNAMECANONICALIZE + srvsvc_NetNameValidate */ -static WERROR srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRPRNAMECANONICALIZE *r) +static WERROR srvsvc_NetNameValidate(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetNameValidate *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRPRNAMECOMPARE + srvsvc_NetPRNameCompare */ -static WERROR srvsvc_NETRPRNAMECOMPARE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRPRNAMECOMPARE *r) +static WERROR srvsvc_NetPRNameCompare(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetPRNameCompare *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1208,288 +1169,67 @@ static WERROR srvsvc_NETRPRNAMECOMPARE(struct dcesrv_call_state *dce_call, TALLO srvsvc_NetShareEnum */ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetShareEnum *r) + struct srvsvc_NetShareEnum *r) { - struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; - - r->out.level = r->in.level; - ZERO_STRUCT(r->out.ctr); - r->out.totalentries = 0; - r->out.resume_handle = NULL; - - /* TODO: - paging of results - * - access check - */ - - switch (r->in.level) { - case 0: - { - int i; - uint32_t count; - struct srvsvc_NetShareCtr0 *ctr0; - - ctr0 = talloc(mem_ctx, struct srvsvc_NetShareCtr0); - W_ERROR_HAVE_NO_MEMORY(ctr0); - - ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - ctr0->array = NULL; - - if (ctr0->count == 0) { - r->out.ctr.ctr0 = ctr0; - return WERR_OK; - } - - ctr0->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); - W_ERROR_HAVE_NO_MEMORY(ctr0->array); - - count = ctr0->count; - ctr0->count = 0; - for (i=0; i < count; i++) { - WERROR status; - union srvsvc_NetShareInfo info; - - if (!lp_browseable(i)){ - continue; - } - - info.info0 = &ctr0->array[ctr0->count++]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); - if (!W_ERROR_IS_OK(status)) { - return status; - } - } - - r->out.ctr.ctr0 = ctr0; - r->out.totalentries = r->out.ctr.ctr0->count; - return WERR_OK; - } - case 1: - { - int i; - uint32_t count; - struct srvsvc_NetShareCtr1 *ctr1; - - ctr1 = talloc(mem_ctx, struct srvsvc_NetShareCtr1); - W_ERROR_HAVE_NO_MEMORY(ctr1); - - ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - ctr1->array = NULL; - - if (ctr1->count == 0) { - r->out.ctr.ctr1 = ctr1; - return WERR_OK; - } - - ctr1->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo1, ctr1->count); - W_ERROR_HAVE_NO_MEMORY(ctr1->array); - - count = ctr1->count; - ctr1->count = 0; - for (i=0; i < count; i++) { - WERROR status; - union srvsvc_NetShareInfo info; - - if (!lp_browseable(i)){ - continue; - } - - info.info1 = &ctr1->array[ctr1->count++]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); - if (!W_ERROR_IS_OK(status)) { - return status; - } - } - - r->out.ctr.ctr1 = ctr1; - r->out.totalentries = r->out.ctr.ctr1->count; - return WERR_OK; - } - case 2: - { - int i; - uint32_t count; - struct srvsvc_NetShareCtr2 *ctr2; - - ctr2 = talloc(mem_ctx, struct srvsvc_NetShareCtr2); - W_ERROR_HAVE_NO_MEMORY(ctr2); - - ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - ctr2->array = NULL; - - if (ctr2->count == 0) { - r->out.ctr.ctr2 = ctr2; - return WERR_OK; - } - - ctr2->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo2, ctr2->count); - W_ERROR_HAVE_NO_MEMORY(ctr2->array); - - count = ctr2->count; - ctr2->count = 0; - for (i=0; i < count; i++) { - WERROR status; - union srvsvc_NetShareInfo info; - - if (!lp_browseable(i)){ - continue; - } - - info.info2 = &ctr2->array[ctr2->count++]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); - if (!W_ERROR_IS_OK(status)) { - return status; - } - } - - r->out.ctr.ctr2 = ctr2; - r->out.totalentries = r->out.ctr.ctr2->count; - return WERR_OK; - } - case 501: - { - int i; - uint32_t count; - struct srvsvc_NetShareCtr501 *ctr501; - - ctr501 = talloc(mem_ctx, struct srvsvc_NetShareCtr501); - W_ERROR_HAVE_NO_MEMORY(ctr501); - - ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - ctr501->array = NULL; - - if (ctr501->count == 0) { - r->out.ctr.ctr501 = ctr501; - return WERR_OK; - } - - ctr501->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo501, ctr501->count); - W_ERROR_HAVE_NO_MEMORY(ctr501->array); - - count = ctr501->count; - ctr501->count = 0; - for (i=0; i < count; i++) { - WERROR status; - union srvsvc_NetShareInfo info; - - if (!lp_browseable(i)){ - continue; - } - - info.info501 = &ctr501->array[ctr501->count++]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); - if (!W_ERROR_IS_OK(status)) { - return status; - } - } - - r->out.ctr.ctr501 = ctr501; - r->out.totalentries = r->out.ctr.ctr501->count; - return WERR_OK; - } - case 502: - { - int i; - uint32_t count; - struct srvsvc_NetShareCtr502 *ctr502; - - ctr502 = talloc(mem_ctx, struct srvsvc_NetShareCtr502); - W_ERROR_HAVE_NO_MEMORY(ctr502); - - ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); - ctr502->array = NULL; - - if (ctr502->count == 0) { - r->out.ctr.ctr502 = ctr502; - return WERR_OK; - } - - ctr502->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo502, ctr502->count); - W_ERROR_HAVE_NO_MEMORY(ctr502->array); - - count = ctr502->count; - ctr502->count = 0; - for (i=0; i < count; i++) { - WERROR status; - union srvsvc_NetShareInfo info; - - if (!lp_browseable(i)){ - continue; - } - - info.info502 = &ctr502->array[ctr502->count++]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); - if (!W_ERROR_IS_OK(status)) { - return status; - } - } - - r->out.ctr.ctr502 = ctr502; - r->out.totalentries = r->out.ctr.ctr502->count; - return WERR_OK; - } - default: - return WERR_UNKNOWN_LEVEL; - } - - return WERR_UNKNOWN_LEVEL; + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRSHAREDELSTART + srvsvc_NetShareDelStart */ -static WERROR srvsvc_NETRSHAREDELSTART(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSHAREDELSTART *r) +static WERROR srvsvc_NetShareDelStart(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareDelStart *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRSHAREDELCOMMIT + srvsvc_NetShareDelCommit */ -static WERROR srvsvc_NETRSHAREDELCOMMIT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSHAREDELCOMMIT *r) +static WERROR srvsvc_NetShareDelCommit(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareDelCommit *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NET_FILE_QUERY_SECDESC + srvsvc_NetGetFileSecurity */ -static WERROR srvsvc_NET_FILE_QUERY_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NET_FILE_QUERY_SECDESC *r) +static WERROR srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetGetFileSecurity *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NET_FILE_SET_SECDESC + srvsvc_NetSetFileSecurity */ -static WERROR srvsvc_NET_FILE_SET_SECDESC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NET_FILE_SET_SECDESC *r) +static WERROR srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetSetFileSecurity *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRSERVERTRANSPORTADDEX + srvsvc_NetServerTransportAddEx */ -static WERROR srvsvc_NETRSERVERTRANSPORTADDEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSERVERTRANSPORTADDEX *r) +static WERROR srvsvc_NetServerTransportAddEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetServerTransportAddEx *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } /* - srvsvc_NETRSERVERSETSERVICEBITSEX + srvsvc_NetServerSetServiceBitsEx */ -static WERROR srvsvc_NETRSERVERSETSERVICEBITSEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NETRSERVERSETSERVICEBITSEX *r) +static WERROR srvsvc_NetServerSetServiceBitsEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetServerSetServiceBitsEx *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } @@ -1604,6 +1344,32 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } +/* + srvsvc_NetShareDel +*/ +static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareDel *r) +{ + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); +} + +/* + srvsvc_NetSetServiceBits +*/ +static WERROR srvsvc_NetSetServiceBits(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetSetServiceBits *r) +{ + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); +} + +/* + srvsvc_NETRPRNAMECANONICALIZE +*/ +static WERROR srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NETRPRNAMECANONICALIZE *r) +{ + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); +} /* include the generated boilerplate */ #include "librpc/gen_ndr/ndr_srvsvc_s.c" -- cgit From b6063c6732b6d3c2330dcfb62085b4227fbdc571 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 26 Apr 2006 12:07:01 +0000 Subject: r15272: - implement NetShareEnum - add access checks to NEtShareEnumAll and NetShareEnum metze (This used to be commit dca1c2e686457ee753bd9c52a925637acd3abffa) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 206 +++++++++++++++++++++++++++++- 1 file changed, 204 insertions(+), 2 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 997cdc81ac..911f997fc0 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -24,8 +24,18 @@ #include "rpc_server/dcerpc_server.h" #include "librpc/gen_ndr/ndr_srvsvc.h" #include "rpc_server/common/common.h" +#include "auth/auth.h" +#include "libcli/security/security.h" #include "system/time.h" +#define SRVSVC_CHECK_ADMIN_ACCESS do { \ + struct security_token *t = dce_call->conn->auth_state.session_info->security_token; \ + if (!security_token_has_builtin_administrators(t) && \ + !security_token_has_sid_string(t, SID_BUILTIN_SERVER_OPERATORS)) { \ + return WERR_ACCESS_DENIED; \ + } \ +} while (0) + /* srvsvc_NetCharDevEnum */ @@ -547,7 +557,6 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ r->out.resume_handle = NULL; /* TODO: - paging of results - * - access check */ switch (r->in.level) { @@ -624,6 +633,8 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr2 *ctr2; + SRVSVC_CHECK_ADMIN_ACCESS; + ctr2 = talloc(mem_ctx, struct srvsvc_NetShareCtr2); W_ERROR_HAVE_NO_MEMORY(ctr2); @@ -658,6 +669,8 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr501 *ctr501; + SRVSVC_CHECK_ADMIN_ACCESS; + ctr501 = talloc(mem_ctx, struct srvsvc_NetShareCtr501); W_ERROR_HAVE_NO_MEMORY(ctr501); @@ -692,6 +705,8 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ int i; struct srvsvc_NetShareCtr502 *ctr502; + SRVSVC_CHECK_ADMIN_ACCESS; + ctr502 = talloc(mem_ctx, struct srvsvc_NetShareCtr502); W_ERROR_HAVE_NO_MEMORY(ctr502); @@ -789,6 +804,8 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; + SRVSVC_CHECK_ADMIN_ACCESS; + info.info2 = talloc(mem_ctx, struct srvsvc_NetShareInfo2); W_ERROR_HAVE_NO_MEMORY(info.info2); @@ -821,6 +838,8 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; + SRVSVC_CHECK_ADMIN_ACCESS; + info.info502 = talloc(mem_ctx, struct srvsvc_NetShareInfo502); W_ERROR_HAVE_NO_MEMORY(info.info502); @@ -1171,7 +1190,190 @@ static WERROR srvsvc_NetPRNameCompare(struct dcesrv_call_state *dce_call, TALLOC static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareEnum *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; + + r->out.level = r->in.level; + ZERO_STRUCT(r->out.ctr); + r->out.totalentries = 0; + r->out.resume_handle = NULL; + + /* TODO: - paging of results + */ + + switch (r->in.level) { + case 0: + { + int i, y = 0; + int count; + struct srvsvc_NetShareCtr0 *ctr0; + + ctr0 = talloc(mem_ctx, struct srvsvc_NetShareCtr0); + W_ERROR_HAVE_NO_MEMORY(ctr0); + + count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr0->count = count; + ctr0->array = NULL; + + if (ctr0->count == 0) { + r->out.ctr.ctr0 = ctr0; + return WERR_OK; + } + + ctr0->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo0, count); + W_ERROR_HAVE_NO_MEMORY(ctr0->array); + + for (i=0; i < count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; + enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + + if (type & STYPE_HIDDEN) { + ctr0->count--; + continue; + } + + info.info0 = &ctr0->array[y]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + W_ERROR_NOT_OK_RETURN(status); + y++; + } + + r->out.ctr.ctr0 = ctr0; + r->out.totalentries = r->out.ctr.ctr0->count; + return WERR_OK; + } + case 1: + { + int i, y = 0; + int count; + struct srvsvc_NetShareCtr1 *ctr1; + + ctr1 = talloc(mem_ctx, struct srvsvc_NetShareCtr1); + W_ERROR_HAVE_NO_MEMORY(ctr1); + + count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr1->count = count; + ctr1->array = NULL; + + if (ctr1->count == 0) { + r->out.ctr.ctr1 = ctr1; + return WERR_OK; + } + + ctr1->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo1, count); + W_ERROR_HAVE_NO_MEMORY(ctr1->array); + + for (i=0; i < count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; + enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + + if (type & STYPE_HIDDEN) { + ctr1->count--; + continue; + } + + info.info1 = &ctr1->array[y]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + W_ERROR_NOT_OK_RETURN(status); + y++; + } + + r->out.ctr.ctr1 = ctr1; + r->out.totalentries = r->out.ctr.ctr1->count; + return WERR_OK; + } + case 2: + { + int i, y = 0; + int count; + struct srvsvc_NetShareCtr2 *ctr2; + + SRVSVC_CHECK_ADMIN_ACCESS; + + ctr2 = talloc(mem_ctx, struct srvsvc_NetShareCtr2); + W_ERROR_HAVE_NO_MEMORY(ctr2); + + count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr2->count = count; + ctr2->array = NULL; + + if (ctr2->count == 0) { + r->out.ctr.ctr2 = ctr2; + return WERR_OK; + } + + ctr2->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo2, count); + W_ERROR_HAVE_NO_MEMORY(ctr2->array); + + for (i=0; i < count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; + enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + + if (type & STYPE_HIDDEN) { + ctr2->count--; + continue; + } + + info.info2 = &ctr2->array[y]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + W_ERROR_NOT_OK_RETURN(status); + y++; + } + + r->out.ctr.ctr2 = ctr2; + r->out.totalentries = r->out.ctr.ctr2->count; + return WERR_OK; + } + case 502: + { + int i, y = 0; + int count; + struct srvsvc_NetShareCtr502 *ctr502; + + SRVSVC_CHECK_ADMIN_ACCESS; + + ctr502 = talloc(mem_ctx, struct srvsvc_NetShareCtr502); + W_ERROR_HAVE_NO_MEMORY(ctr502); + + count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr502->count = count; + ctr502->array = NULL; + + if (ctr502->count == 0) { + r->out.ctr.ctr502 = ctr502; + return WERR_OK; + } + + ctr502->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo502, count); + W_ERROR_HAVE_NO_MEMORY(ctr502->array); + + for (i=0; i < count; i++) { + WERROR status; + union srvsvc_NetShareInfo info; + enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + + if (type & STYPE_HIDDEN) { + ctr502->count--; + continue; + } + + info.info502 = &ctr502->array[y]; + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + W_ERROR_NOT_OK_RETURN(status); + y++; + } + + r->out.ctr.ctr502 = ctr502; + r->out.totalentries = r->out.ctr.ctr502->count; + return WERR_OK; + } + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_UNKNOWN_LEVEL; } -- cgit From 2e415d4e98530f4b95114a2d49850702ee214a6f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 21 May 2006 12:15:04 +0000 Subject: r15773: - implement srvsvc_NetGetFileSecurity() and srvsvc_NetSetFileSecurity() - we do this by just creating a ntvfs_context (this doesn't need and smbsrv_* stuff :-) and then call ntvfs_qpathinfo() and ntvfs_setpathinfo() metze (This used to be commit e1635ce5c07615eded6eac237cde3945a46ebbd9) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 68 +++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 911f997fc0..c1854a6b20 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -3,7 +3,7 @@ endpoint server for the srvsvc pipe - Copyright (C) Stefan (metze) Metzmacher 2004 + Copyright (C) Stefan (metze) Metzmacher 2004-2006 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 @@ -27,6 +27,8 @@ #include "auth/auth.h" #include "libcli/security/security.h" #include "system/time.h" +#include "ntvfs/ntvfs.h" +#include "rpc_server/srvsvc/proto.h" #define SRVSVC_CHECK_ADMIN_ACCESS do { \ struct security_token *t = dce_call->conn->auth_state.session_info->security_token; \ @@ -1403,7 +1405,40 @@ static WERROR srvsvc_NetShareDelCommit(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetGetFileSecurity *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + struct sec_desc_buf *sd_buf; + struct ntvfs_context *ntvfs_ctx = NULL; + struct ntvfs_request *ntvfs_req; + union smb_fileinfo *io; + NTSTATUS nt_status; + + nt_status = srvsvc_create_ntvfs_context(dce_call, mem_ctx, r->in.share, &ntvfs_ctx); + if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status); + + ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx, + dce_call->conn->auth_state.session_info, + 0, + 0, + dce_call->time, + NULL, NULL, 0); + W_ERROR_HAVE_NO_MEMORY(ntvfs_req); + + sd_buf = talloc(mem_ctx, struct sec_desc_buf); + W_ERROR_HAVE_NO_MEMORY(sd_buf); + + io = talloc(mem_ctx, union smb_fileinfo); + W_ERROR_HAVE_NO_MEMORY(io); + + io->query_secdesc.level = RAW_FILEINFO_SEC_DESC; + io->query_secdesc.in.file.path = r->in.file; + io->query_secdesc.in.secinfo_flags = r->in.securityinformation; + + nt_status = ntvfs_qpathinfo(ntvfs_req, io); + if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status); + + sd_buf->sd = io->query_secdesc.out.sd; + + r->out.sd_buf = sd_buf; + return WERR_OK; } @@ -1413,7 +1448,34 @@ static WERROR srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALL static WERROR srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSetFileSecurity *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + struct ntvfs_context *ntvfs_ctx; + struct ntvfs_request *ntvfs_req; + union smb_setfileinfo *io; + NTSTATUS nt_status; + + nt_status = srvsvc_create_ntvfs_context(dce_call, mem_ctx, r->in.share, &ntvfs_ctx); + if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status); + + ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx, + dce_call->conn->auth_state.session_info, + 0, + 0, + dce_call->time, + NULL, NULL, 0); + W_ERROR_HAVE_NO_MEMORY(ntvfs_req); + + io = talloc(mem_ctx, union smb_setfileinfo); + W_ERROR_HAVE_NO_MEMORY(io); + + io->set_secdesc.level = RAW_FILEINFO_SEC_DESC; + io->set_secdesc.in.file.path = r->in.file; + io->set_secdesc.in.secinfo_flags = r->in.securityinformation; + io->set_secdesc.in.sd = r->in.sd_buf.sd; + + nt_status = ntvfs_setpathinfo(ntvfs_req, io); + if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status); + + return WERR_OK; } -- cgit From 3b36a857980b1f9fa5a6be0253e85c975f35c13f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 11 Jul 2006 18:15:42 +0000 Subject: r16950: remove the smb mid from the ntvfs layer and keep a list of pending requests on the smbsrv_connection, to be able to match then on ntcancel metze (This used to be commit 04f0d3d03179b6060fd013b867d13caa92ec6460) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index c1854a6b20..44296655ac 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1417,7 +1417,6 @@ static WERROR srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALL ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx, dce_call->conn->auth_state.session_info, 0, - 0, dce_call->time, NULL, NULL, 0); W_ERROR_HAVE_NO_MEMORY(ntvfs_req); @@ -1459,7 +1458,6 @@ static WERROR srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALL ntvfs_req = ntvfs_request_create(ntvfs_ctx, mem_ctx, dce_call->conn->auth_state.session_info, 0, - 0, dce_call->time, NULL, NULL, 0); W_ERROR_HAVE_NO_MEMORY(ntvfs_req); -- cgit From 9c66f601f1520a99b9236c32bc9f03a33bd4b2aa Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 23 Jul 2006 18:43:07 +0000 Subject: r17206: Add a modular API for share configuration. Commit the classic backwards compatible module which is the default one (This used to be commit a89cc346b9296cb49929898d257a064a6c2bae86) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 238 ++++++++++++++++++++++-------- 1 file changed, 175 insertions(+), 63 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 44296655ac..fbff1d6cf8 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -21,13 +21,13 @@ */ #include "includes.h" +#include "ntvfs/ntvfs.h" #include "rpc_server/dcerpc_server.h" #include "librpc/gen_ndr/ndr_srvsvc.h" #include "rpc_server/common/common.h" #include "auth/auth.h" #include "libcli/security/security.h" #include "system/time.h" -#include "ntvfs/ntvfs.h" #include "rpc_server/srvsvc/proto.h" #define SRVSVC_CHECK_ADMIN_ACCESS do { \ @@ -465,76 +465,77 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX } static WERROR srvsvc_fiel_ShareInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - int snum, uint32_t level, union srvsvc_NetShareInfo *info) + struct share_config *scfg, uint32_t level, + union srvsvc_NetShareInfo *info) { struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; switch (level) { case 0: { - info->info0->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + info->info0->name = talloc_strdup(mem_ctx, scfg->name); W_ERROR_HAVE_NO_MEMORY(info->info0->name); return WERR_OK; } case 1: { - info->info1->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + info->info1->name = talloc_strdup(mem_ctx, scfg->name); W_ERROR_HAVE_NO_MEMORY(info->info1->name); - info->info1->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); - info->info1->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + info->info1->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); + info->info1->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, "")); W_ERROR_HAVE_NO_MEMORY(info->info1->comment); return WERR_OK; } case 2: { - info->info2->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + info->info2->name = talloc_strdup(mem_ctx, scfg->name); W_ERROR_HAVE_NO_MEMORY(info->info2->name); - info->info2->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); - info->info2->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + info->info2->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); + info->info2->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, "")); W_ERROR_HAVE_NO_MEMORY(info->info2->comment); - info->info2->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, snum); - info->info2->max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, snum); - info->info2->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, snum); - info->info2->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, snum); + info->info2->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, scfg); + info->info2->max_users = share_int_option(scfg, SHARE_MAX_CONNECTIONS, SHARE_MAX_CONNECTIONS_DEFAULT); + info->info2->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, scfg); + info->info2->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, scfg); W_ERROR_HAVE_NO_MEMORY(info->info2->path); - info->info2->password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, snum); + info->info2->password = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_PASSWORD, NULL)); return WERR_OK; } case 501: { - info->info501->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + info->info501->name = talloc_strdup(mem_ctx, scfg->name); W_ERROR_HAVE_NO_MEMORY(info->info501->name); - info->info501->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); - info->info501->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + info->info501->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); + info->info501->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, "")); W_ERROR_HAVE_NO_MEMORY(info->info501->comment); - info->info501->csc_policy = dcesrv_common_get_share_csc_policy(mem_ctx, dce_ctx, snum); + info->info501->csc_policy = share_int_option(scfg, SHARE_CSC_POLICY, SHARE_CSC_POLICY_DEFAULT); return WERR_OK; } case 502: { - info->info502->name = dcesrv_common_get_share_name(mem_ctx, dce_ctx, snum); + info->info502->name = talloc_strdup(mem_ctx, scfg->name); W_ERROR_HAVE_NO_MEMORY(info->info502->name); - info->info502->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, snum); - info->info502->comment = dcesrv_common_get_share_comment(mem_ctx, dce_ctx, snum); + info->info502->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); + info->info502->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, "")); W_ERROR_HAVE_NO_MEMORY(info->info502->comment); - info->info502->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, snum); - info->info502->max_users = dcesrv_common_get_share_max_users(mem_ctx, dce_ctx, snum); - info->info502->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, snum); - info->info502->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, snum); + info->info502->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, scfg); + info->info502->max_users = share_int_option(scfg, SHARE_MAX_CONNECTIONS, SHARE_MAX_CONNECTIONS_DEFAULT); + info->info502->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, scfg); + info->info502->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, scfg); W_ERROR_HAVE_NO_MEMORY(info->info502->path); - info->info502->password = dcesrv_common_get_share_password(mem_ctx, dce_ctx, snum); - info->info502->unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, snum); - info->info502->sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, snum); + info->info502->password = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_PASSWORD, NULL)); + info->info502->unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, scfg); + info->info502->sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, scfg); return WERR_OK; } case 1005: { - info->info1005->dfs_flags = dcesrv_common_get_share_dfs_flags(mem_ctx, dce_ctx, snum); + info->info1005->dfs_flags = dcesrv_common_get_share_dfs_flags(mem_ctx, dce_ctx, scfg); return WERR_OK; } @@ -551,7 +552,11 @@ static WERROR srvsvc_fiel_ShareInfo(struct dcesrv_call_state *dce_call, TALLOC_C static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareEnumAll *r) { - struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; + NTSTATUS nterr; + int numshares = 0; + const char **snames; + struct share_context *sctx; + struct share_config *scfg; r->out.level = r->in.level; ZERO_STRUCT(r->out.ctr); @@ -561,6 +566,16 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ /* TODO: - paging of results */ + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + nterr = share_list_all(mem_ctx, sctx, &numshares, &snames); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + switch (r->in.level) { case 0: { @@ -570,7 +585,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ ctr0 = talloc(mem_ctx, struct srvsvc_NetShareCtr0); W_ERROR_HAVE_NO_MEMORY(ctr0); - ctr0->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr0->count = numshares; ctr0->array = NULL; if (ctr0->count == 0) { @@ -581,16 +596,23 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ ctr0->array = talloc_array(mem_ctx, struct srvsvc_NetShareInfo0, ctr0->count); W_ERROR_HAVE_NO_MEMORY(ctr0->array); - for (i=0; i < ctr0->count; i++) { + for (i = 0; i < ctr0->count; i++) { WERROR status; union srvsvc_NetShareInfo info; + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } info.info0 = &ctr0->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } + talloc_free(scfg); } + talloc_free(snames); r->out.ctr.ctr0 = ctr0; r->out.totalentries = r->out.ctr.ctr0->count; @@ -604,7 +626,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ ctr1 = talloc(mem_ctx, struct srvsvc_NetShareCtr1); W_ERROR_HAVE_NO_MEMORY(ctr1); - ctr1->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr1->count = numshares; ctr1->array = NULL; if (ctr1->count == 0) { @@ -619,12 +641,19 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } info.info1 = &ctr1->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } + talloc_free(scfg); } + talloc_free(snames); r->out.ctr.ctr1 = ctr1; r->out.totalentries = r->out.ctr.ctr1->count; @@ -640,7 +669,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ ctr2 = talloc(mem_ctx, struct srvsvc_NetShareCtr2); W_ERROR_HAVE_NO_MEMORY(ctr2); - ctr2->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr2->count = numshares; ctr2->array = NULL; if (ctr2->count == 0) { @@ -655,12 +684,19 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } info.info2 = &ctr2->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } + talloc_free(scfg); } + talloc_free(snames); r->out.ctr.ctr2 = ctr2; r->out.totalentries = r->out.ctr.ctr2->count; @@ -676,7 +712,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ ctr501 = talloc(mem_ctx, struct srvsvc_NetShareCtr501); W_ERROR_HAVE_NO_MEMORY(ctr501); - ctr501->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr501->count = numshares; ctr501->array = NULL; if (ctr501->count == 0) { @@ -691,12 +727,19 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } info.info501 = &ctr501->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } + talloc_free(scfg); } + talloc_free(snames); r->out.ctr.ctr501 = ctr501; r->out.totalentries = r->out.ctr.ctr501->count; @@ -712,7 +755,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ ctr502 = talloc(mem_ctx, struct srvsvc_NetShareCtr502); W_ERROR_HAVE_NO_MEMORY(ctr502); - ctr502->count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + ctr502->count = numshares; ctr502->array = NULL; if (ctr502->count == 0) { @@ -727,12 +770,19 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } info.info502 = &ctr502->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } + talloc_free(scfg); } + talloc_free(snames); r->out.ctr.ctr502 = ctr502; r->out.totalentries = r->out.ctr.ctr502->count; @@ -752,7 +802,9 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareGetInfo *r) { - int snum; + NTSTATUS nterr; + struct share_context *sctx = NULL; + struct share_config *scfg = NULL; ZERO_STRUCT(r->out); @@ -763,9 +815,14 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_INVALID_PARAM; } - snum = lp_servicenumber(r->in.share_name); - if (snum < 0) { - return WERR_NET_NAME_NOT_FOUND; + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + nterr = share_get_config(mem_ctx, sctx, r->in.share_name, &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); } switch (r->in.level) { @@ -777,7 +834,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info0 = talloc(mem_ctx, struct srvsvc_NetShareInfo0); W_ERROR_HAVE_NO_MEMORY(info.info0); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -793,7 +850,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info1 = talloc(mem_ctx, struct srvsvc_NetShareInfo1); W_ERROR_HAVE_NO_MEMORY(info.info1); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -811,7 +868,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info2 = talloc(mem_ctx, struct srvsvc_NetShareInfo2); W_ERROR_HAVE_NO_MEMORY(info.info2); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -827,7 +884,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info501 = talloc(mem_ctx, struct srvsvc_NetShareInfo501); W_ERROR_HAVE_NO_MEMORY(info.info501); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -845,7 +902,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info502 = talloc(mem_ctx, struct srvsvc_NetShareInfo502); W_ERROR_HAVE_NO_MEMORY(info.info502); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -861,7 +918,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info1005 = talloc(mem_ctx, struct srvsvc_NetShareInfo1005); W_ERROR_HAVE_NO_MEMORY(info.info1005); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, snum, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -1192,6 +1249,11 @@ static WERROR srvsvc_NetPRNameCompare(struct dcesrv_call_state *dce_call, TALLOC static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareEnum *r) { + NTSTATUS nterr; + int numshares = 0; + const char **snames; + struct share_context *sctx; + struct share_config *scfg; struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; r->out.level = r->in.level; @@ -1202,6 +1264,16 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* TODO: - paging of results */ + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + nterr = share_list_all(mem_ctx, sctx, &numshares, &snames); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + switch (r->in.level) { case 0: { @@ -1212,7 +1284,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr0 = talloc(mem_ctx, struct srvsvc_NetShareCtr0); W_ERROR_HAVE_NO_MEMORY(ctr0); - count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + count = numshares; ctr0->count = count; ctr0->array = NULL; @@ -1227,18 +1299,28 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + enum srvsvc_ShareType type; + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } + + type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); if (type & STYPE_HIDDEN) { ctr0->count--; + talloc_free(scfg); continue; } info.info0 = &ctr0->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); + talloc_free(scfg); y++; } + talloc_free(snames); r->out.ctr.ctr0 = ctr0; r->out.totalentries = r->out.ctr.ctr0->count; @@ -1253,7 +1335,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr1 = talloc(mem_ctx, struct srvsvc_NetShareCtr1); W_ERROR_HAVE_NO_MEMORY(ctr1); - count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + count = numshares; ctr1->count = count; ctr1->array = NULL; @@ -1268,18 +1350,28 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + enum srvsvc_ShareType type; + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } + + type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); if (type & STYPE_HIDDEN) { ctr1->count--; + talloc_free(scfg); continue; } info.info1 = &ctr1->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); + talloc_free(scfg); y++; } + talloc_free(snames); r->out.ctr.ctr1 = ctr1; r->out.totalentries = r->out.ctr.ctr1->count; @@ -1296,7 +1388,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr2 = talloc(mem_ctx, struct srvsvc_NetShareCtr2); W_ERROR_HAVE_NO_MEMORY(ctr2); - count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + count = numshares; ctr2->count = count; ctr2->array = NULL; @@ -1311,18 +1403,28 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + enum srvsvc_ShareType type; + + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } + type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); if (type & STYPE_HIDDEN) { ctr2->count--; + talloc_free(scfg); continue; } info.info2 = &ctr2->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); + talloc_free(scfg); y++; } + talloc_free(snames); r->out.ctr.ctr2 = ctr2; r->out.totalentries = r->out.ctr.ctr2->count; @@ -1339,7 +1441,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX ctr502 = talloc(mem_ctx, struct srvsvc_NetShareCtr502); W_ERROR_HAVE_NO_MEMORY(ctr502); - count = dcesrv_common_get_count_of_shares(mem_ctx, dce_ctx); + count = numshares; ctr502->count = count; ctr502->array = NULL; @@ -1354,18 +1456,28 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX for (i=0; i < count; i++) { WERROR status; union srvsvc_NetShareInfo info; - enum srvsvc_ShareType type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, i); + enum srvsvc_ShareType type; + + nterr = share_get_config(mem_ctx, sctx, snames[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames[i])); + return WERR_GENERAL_FAILURE; + } + type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg); if (type & STYPE_HIDDEN) { ctr502->count--; + talloc_free(scfg); continue; } info.info502 = &ctr502->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, i, r->in.level, &info); + status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); + talloc_free(scfg); y++; } + talloc_free(snames); r->out.ctr.ctr502 = ctr502; r->out.totalentries = r->out.ctr.ctr502->count; -- cgit From 92689d180502896cbb07ada29c7349733af4a4b1 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 10 Sep 2006 00:41:15 +0000 Subject: r18315: Implement netSrvGetInfo level 102 fix names to be consistent between level 101 and 102 and typo in idl (This used to be commit 1962fb92d706962544c293770718294e595f9fc4) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index fbff1d6cf8..d852f7a40c 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1025,6 +1025,35 @@ static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT r->out.info.info101 = info101; return WERR_OK; } + case 102: + { + struct srvsvc_NetSrvInfo102 *info102; + + info102 = talloc(mem_ctx, struct srvsvc_NetSrvInfo102); + W_ERROR_HAVE_NO_MEMORY(info102); + + info102->platform_id = dcesrv_common_get_platform_id(mem_ctx, dce_ctx); + info102->server_name = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc); + W_ERROR_HAVE_NO_MEMORY(info102->server_name); + + info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); + info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); + info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); + info102->comment = talloc_strdup(mem_ctx, lp_serverstring()); + W_ERROR_HAVE_NO_MEMORY(info102->comment); + + info102->users = dcesrv_common_get_users(mem_ctx, dce_ctx); + info102->disc = dcesrv_common_get_disc(mem_ctx, dce_ctx); + info102->hidden = dcesrv_common_get_hidden(mem_ctx, dce_ctx); + info102->announce = dcesrv_common_get_announce(mem_ctx, dce_ctx); + info102->anndelta = dcesrv_common_get_anndelta(mem_ctx, dce_ctx); + info102->licenses = dcesrv_common_get_licenses(mem_ctx, dce_ctx); + info102->userpath = dcesrv_common_get_userpath(mem_ctx, dce_ctx); + W_ERROR_HAVE_NO_MEMORY(info102->userpath); + + r->out.info.info102 = info102; + return WERR_OK; + } default: return WERR_UNKNOWN_LEVEL; } -- cgit From c74d5b9204c004f30494645f04d34306667990c8 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 10 Sep 2006 03:58:00 +0000 Subject: r18318: Implement DiskEnum Fix spelling and consistencies issues in idl (This used to be commit 1347c971ac4dd62e6e6643293d48917ac065d19c) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index d852f7a40c..d850af5ebd 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1078,15 +1078,30 @@ static WERROR srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetDiskEnum *r) { - r->out.disks.discs = NULL; - r->out.disks.count = 0; + r->out.info.disks = NULL; + r->out.info.count = 0; r->out.totalentries = 0; r->out.resume_handle = NULL; switch (r->in.level) { case 0: { - return WERR_NOT_SUPPORTED; + /* we can safely hardcode the reply and report we have only one disk (C:) */ + /* for some reason Windows wants 2 entries with the second being empty */ + r->out.info.disks = talloc_array(mem_ctx, struct srvsvc_NetDiskInfo0, 2); + W_ERROR_HAVE_NO_MEMORY(r->out.info.disks); + r->out.info.count = 2; + + r->out.info.disks[0].disk = talloc_strdup(mem_ctx, "C:"); + W_ERROR_HAVE_NO_MEMORY(r->out.info.disks[0].disk); + + r->out.info.disks[1].disk = talloc_strdup(mem_ctx, ""); + W_ERROR_HAVE_NO_MEMORY(r->out.info.disks[1].disk); + + r->out.totalentries = 1; + r->out.resume_handle = r->in.resume_handle; + + return WERR_OK; } default: return WERR_UNKNOWN_LEVEL; -- cgit From 7736d2f65cf0479c6a1588e3656809047a4b3d49 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 12 Sep 2006 02:24:21 +0000 Subject: r18412: Implement NetiNameValidate but just for share name right now (type 9) Simo. (This used to be commit 906429834a102349582017ef73a69e211ef5c500) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 42 ++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index d850af5ebd..2464da447a 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1273,7 +1273,47 @@ static WERROR srvsvc_NetPathCompare(struct dcesrv_call_state *dce_call, TALLOC_C static WERROR srvsvc_NetNameValidate(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetNameValidate *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + int len; + + if ((r->in.flags != 0x0) && (r->in.flags != 0x80000000)) { + return WERR_INVALID_NAME; + } + + switch (r->in.name_type) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + return WERR_NOT_SUPPORTED; + + case 9: /* validate share name */ + + len = strlen_m(r->in.name); + if ((r->in.flags == 0x0) && (len > 81)) { + return WERR_INVALID_NAME; + } + if ((r->in.flags == 0x80000000) && (len > 13)) { + return WERR_INVALID_NAME; + } + if (! dcesrv_common_validate_share_name(mem_ctx, r->in.name)) { + return WERR_INVALID_NAME; + } + return WERR_OK; + + case 10: + case 11: + case 12: + case 13: + return WERR_NOT_SUPPORTED; + default: + return WERR_INVALID_PARAM; + } + + return WERR_INVALID_PARAM; } -- cgit From b0fb34fd24f5d73cfc2d3aca09379d85b9fb57dd Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 15 Sep 2006 05:18:53 +0000 Subject: r18542: Some late nite work. Now we can add and remove a share from the "Computer Management" console (not yet modify!) usinf share backend = ldb (This used to be commit ae2f6d4a5a372a37b9783a02bb8e7f16588b21f0) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 75 ++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 2464da447a..68ab1498c2 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -452,10 +452,68 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 502: { + NTSTATUS nterr; + struct share_info *info; + struct share_context *sctx; + + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + info = talloc_zero(mem_ctx, struct share_info); + W_ERROR_HAVE_NO_MEMORY(info); + + info->name = talloc_strdup(info, r->in.info.info502->name); + W_ERROR_HAVE_NO_MEMORY(info->name); + switch (r->in.info.info502->type) { + case 0x00: + info->type = talloc_strdup(mem_ctx, "DISK"); + break; + case 0x01: + info->type = talloc_strdup(mem_ctx, "PRINTER"); + break; + case 0x03: + info->type = talloc_strdup(mem_ctx, "IPC"); + break; + default: + return WERR_INVALID_PARAM; + } + W_ERROR_HAVE_NO_MEMORY(info->type); + + /* Windows will send a path in a form of C:\example\path */ + if (r->in.info.info502->path[1] == ':') { + info->path = talloc_strdup(info, &r->in.info.info502->path[2]); + } else { + info->path = talloc_strdup(info, r->in.info.info502->path); + } + W_ERROR_HAVE_NO_MEMORY(info->path); + all_string_sub(info->path, "\\", "/", 0); + + if (r->in.info.info502->comment && r->in.info.info502->comment[0]) { + info->comment = talloc_strdup(info, r->in.info.info502->comment); + W_ERROR_HAVE_NO_MEMORY(info->comment); + } + + if (r->in.info.info502->password && r->in.info.info502->password[0]) { + info->password = talloc_strdup(info, r->in.info.info502->password); + W_ERROR_HAVE_NO_MEMORY(info->password); + } + + info->max_users = r->in.info.info502->max_users; + /* TODO: security descriptor */ + + + nterr = share_create(sctx, info); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - return WERR_NOT_SUPPORTED; + + return WERR_OK; } default: return WERR_UNKNOWN_LEVEL; @@ -1808,7 +1866,20 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDel *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + NTSTATUS nterr; + struct share_context *sctx; + + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + nterr = share_remove(sctx, r->in.share_name); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + return WERR_OK; } /* -- cgit From fa257e78b5e1de1ba12e12968b1b2a6edbead7c6 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 15 Sep 2006 16:27:55 +0000 Subject: r18558: Fix ShareCheck which was assuming all paths are "C:\" Also cope with the fact that we define the FSTYPE as NTFS by default. We never use this anywhere else, so we may just change it, but just detect the fact and return DISK in share_classic for now. (This used to be commit 4daf5f7764ce69c14066f7320961c90141f0863a) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 141 +++++++++++++++++++++++++++--- 1 file changed, 128 insertions(+), 13 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 68ab1498c2..2ca5c8ee97 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -455,7 +455,7 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX NTSTATUS nterr; struct share_info *info; struct share_context *sctx; - + nterr = share_get_context(mem_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); @@ -481,14 +481,17 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX } W_ERROR_HAVE_NO_MEMORY(info->type); - /* Windows will send a path in a form of C:\example\path */ - if (r->in.info.info502->path[1] == ':') { - info->path = talloc_strdup(info, &r->in.info.info502->path[2]); - } else { - info->path = talloc_strdup(info, r->in.info.info502->path); + if (r->in.info.info502->path && r->in.info.info502->path[0]) { + /* Windows will send a path in a form of C:\example\path */ + if (strncmp(r->in.info.info502->path, "C:", 2) == 0) { + info->path = talloc_strdup(info, &r->in.info.info502->path[2]); + } else { + /* very strange let's try to set as is */ + info->path = talloc_strdup(info, r->in.info.info502->path); + } + W_ERROR_HAVE_NO_MEMORY(info->path); + all_string_sub(info->path, "\\", "/", 0); } - W_ERROR_HAVE_NO_MEMORY(info->path); - all_string_sub(info->path, "\\", "/", 0); if (r->in.info.info502->comment && r->in.info.info502->comment[0]) { info->comment = talloc_strdup(info, r->in.info.info502->comment); @@ -998,7 +1001,67 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareSetInfo *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + NTSTATUS nterr; + struct share_context *sctx = NULL; + struct share_config *scfg = NULL; + + ZERO_STRUCT(r->out); + + /* TODO: - access check + */ + + if (strcmp("", r->in.share_name) == 0) { + return WERR_INVALID_PARAM; + } + + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + switch (r->in.level) { + case 0: + { + return WERR_NOT_SUPPORTED; + } + case 1: + { + return WERR_NOT_SUPPORTED; + } + case 2: + { + return WERR_NOT_SUPPORTED; + } + case 501: + { + return WERR_NOT_SUPPORTED; + } + case 502: + { + return WERR_NOT_SUPPORTED; + } + case 1004: + { + WERROR status; + union srvsvc_NetShareInfo info; + + /* r->out.info.comment; */ + return WERR_NOT_SUPPORTED; + } + case 1005: + { + WERROR status; + union srvsvc_NetShareInfo info; + + /* r->out.info.dfs_flags; */ + + return WERR_NOT_SUPPORTED; + } + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_UNKNOWN_LEVEL; } @@ -1018,6 +1081,13 @@ static WERROR srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLO static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareCheck *r) { + NTSTATUS nterr; + struct share_context *sctx = NULL; + struct share_config *scfg = NULL; + char *device; + const char **names; + int count, i; + ZERO_STRUCT(r->out); /* TODO: - access check @@ -1028,12 +1098,57 @@ static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CT return WERR_OK; } - if (strcmp("C:\\", r->in.device_name) == 0) { - r->out.type = STYPE_DISKTREE; - return WERR_OK; + /* copy the path skipping C:\ */ + if (strncasecmp(r->in.device_name, "C:", 2) == 0) { + device = talloc_strdup(mem_ctx, &r->in.device_name[2]); + } else { + /* no chance we have a share that doesn't start with C:\ */ + return WERR_DEVICE_NOT_SHARED; + } + all_string_sub(device, "\\", "/", 0); + + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + nterr = share_list_all(mem_ctx, sctx, &count, &names); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + for (i = 0; i < count; i++) { + const char *path; + const char *type; + + nterr = share_get_config(mem_ctx, sctx, names[i], &scfg); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + path = share_string_option(scfg, SHARE_PATH, NULL); + if (!path) continue; + + if (strcmp(device, path) == 0) { + type = share_string_option(scfg, SHARE_TYPE, NULL); + if (!type) continue; + + if (strcmp(type, "DISK") == 0) { + r->out.type = STYPE_DISKTREE; + return WERR_OK; + } + + if (strcmp(type, "IPC") == 0) { + r->out.type = STYPE_IPC; + return WERR_OK; + } + + if (strcmp(type, "PRINTER") == 0) { + r->out.type = STYPE_PRINTQ; + return WERR_OK; + } + } } - /* TODO: - lookup the share be devicename (path) */ return WERR_DEVICE_NOT_SHARED; } -- cgit From c4d45aac9da6b4fdade4e8ff3434a412af6db8fc Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 17 Sep 2006 00:15:13 +0000 Subject: r18590: Some more work on the srvsvc pipe (This used to be commit 2c035787d47c6055c4081021f30d08929f178ca3) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 340 +++++++++++++++++++++++++++--- 1 file changed, 314 insertions(+), 26 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 2ca5c8ee97..b8da68e920 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -438,10 +438,94 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX } case 2: { + NTSTATUS nterr; + struct share_info *info; + struct share_context *sctx; + int count = 8; + int i; + + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + /* there are no more than 8 options in struct srvsvc_NetShareInfo2 */ + info = talloc_array(mem_ctx, struct share_info, count); + W_ERROR_HAVE_NO_MEMORY(info); + + i = 0; + + info[i].name = SHARE_TYPE; + info[i].type = SHARE_INFO_STRING; + switch (r->in.info.info2->type) { + case 0x00: + info[i].value = talloc_strdup(info, "DISK"); + break; + case 0x01: + info[i].value = talloc_strdup(info, "PRINTER"); + break; + case 0x03: + info[i].value = talloc_strdup(info, "IPC"); + break; + default: + return WERR_INVALID_PARAM; + } + W_ERROR_HAVE_NO_MEMORY(info[i].value); + i++; + + if (r->in.info.info2->path && r->in.info.info2->path[0]) { + info[i].name = SHARE_PATH; + info[i].type = SHARE_INFO_STRING; + + /* Windows will send a path in a form of C:\example\path */ + if (r->in.info.info2->path[1] == ':') { + info[i].value = talloc_strdup(info, &r->in.info.info2->path[2]); + } else { + /* very strange let's try to set as is */ + info[i].value = talloc_strdup(info, r->in.info.info2->path); + } + W_ERROR_HAVE_NO_MEMORY(info[i].value); + all_string_sub((char *)info[i].value, "\\", "/", 0); + + i++; + } + + if (r->in.info.info2->comment && r->in.info.info2->comment[0]) { + info[i].name = SHARE_COMMENT; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info2->comment); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; + } + + if (r->in.info.info2->password && r->in.info.info2->password[0]) { + info[i].name = SHARE_PASSWORD; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info502->password); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; + } + + info[i].name = SHARE_MAX_CONNECTIONS; + info[i].type = SHARE_INFO_INT; + info[i].value = talloc(info, int); + *((int *)info[i].value) = r->in.info.info2->max_users; + i++; + + /* TODO: security descriptor */ + + nterr = share_create(sctx, r->in.info.info2->name, info, i); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + if (r->in.parm_error) { r->out.parm_error = r->in.parm_error; } - return WERR_NOT_SUPPORTED; + + return WERR_OK; } case 501: { @@ -455,59 +539,82 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX NTSTATUS nterr; struct share_info *info; struct share_context *sctx; + int count = 10; + int i; nterr = share_get_context(mem_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } - - info = talloc_zero(mem_ctx, struct share_info); + + /* there are no more than 10 options in struct srvsvc_NetShareInfo502 */ + info = talloc_array(mem_ctx, struct share_info, count); W_ERROR_HAVE_NO_MEMORY(info); - info->name = talloc_strdup(info, r->in.info.info502->name); - W_ERROR_HAVE_NO_MEMORY(info->name); + i = 0; + + info[i].name = SHARE_TYPE; + info[i].type = SHARE_INFO_STRING; switch (r->in.info.info502->type) { case 0x00: - info->type = talloc_strdup(mem_ctx, "DISK"); + info[i].value = talloc_strdup(info, "DISK"); break; case 0x01: - info->type = talloc_strdup(mem_ctx, "PRINTER"); + info[i].value = talloc_strdup(info, "PRINTER"); break; case 0x03: - info->type = talloc_strdup(mem_ctx, "IPC"); + info[i].value = talloc_strdup(info, "IPC"); break; default: return WERR_INVALID_PARAM; } - W_ERROR_HAVE_NO_MEMORY(info->type); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + i++; if (r->in.info.info502->path && r->in.info.info502->path[0]) { + info[i].name = SHARE_PATH; + info[i].type = SHARE_INFO_STRING; + /* Windows will send a path in a form of C:\example\path */ - if (strncmp(r->in.info.info502->path, "C:", 2) == 0) { - info->path = talloc_strdup(info, &r->in.info.info502->path[2]); + if (r->in.info.info2->path[1] == ':') { + info[i].value = talloc_strdup(info, &r->in.info.info502->path[2]); } else { /* very strange let's try to set as is */ - info->path = talloc_strdup(info, r->in.info.info502->path); + info[i].value = talloc_strdup(info, r->in.info.info502->path); } - W_ERROR_HAVE_NO_MEMORY(info->path); - all_string_sub(info->path, "\\", "/", 0); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + all_string_sub((char *)info[i].value, "\\", "/", 0); + + i++; } if (r->in.info.info502->comment && r->in.info.info502->comment[0]) { - info->comment = talloc_strdup(info, r->in.info.info502->comment); - W_ERROR_HAVE_NO_MEMORY(info->comment); + info[i].name = SHARE_COMMENT; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info502->comment); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; } if (r->in.info.info502->password && r->in.info.info502->password[0]) { - info->password = talloc_strdup(info, r->in.info.info502->password); - W_ERROR_HAVE_NO_MEMORY(info->password); + info[i].name = SHARE_PASSWORD; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info502->password); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; } - info->max_users = r->in.info.info502->max_users; + info[i].name = SHARE_MAX_CONNECTIONS; + info[i].type = SHARE_INFO_INT; + info[i].value = talloc(info, int); + *((int *)info[i].value) = r->in.info.info502->max_users; + i++; + /* TODO: security descriptor */ - - nterr = share_create(sctx, info); + nterr = share_create(sctx, r->in.info.info502->name, info, i); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1030,7 +1137,95 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } case 2: { - return WERR_NOT_SUPPORTED; + struct share_info *info; + int count = 8; + int i; + + /* there are no more than 8 options in struct srvsvc_NetShareInfo2 */ + info = talloc_array(mem_ctx, struct share_info, count); + W_ERROR_HAVE_NO_MEMORY(info); + + i = 0; + + if (strcasecmp(r->in.share_name, r->in.info.info2->name) != 0) { + info[i].name = SHARE_NAME; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info2->name); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + i++; + } + + info[i].name = SHARE_TYPE; + info[i].type = SHARE_INFO_STRING; + switch (r->in.info.info2->type) { + case 0x00: + info[i].value = talloc_strdup(info, "DISK"); + break; + case 0x01: + info[i].value = talloc_strdup(info, "PRINTER"); + break; + case 0x03: + info[i].value = talloc_strdup(info, "IPC"); + break; + default: + return WERR_INVALID_PARAM; + } + W_ERROR_HAVE_NO_MEMORY(info[i].value); + i++; + + if (r->in.info.info2->path && r->in.info.info2->path[0]) { + info[i].name = SHARE_PATH; + info[i].type = SHARE_INFO_STRING; + + /* Windows will send a path in a form of C:\example\path */ + if (r->in.info.info2->path[1] == ':') { + info[i].value = talloc_strdup(info, &r->in.info.info2->path[2]); + } else { + /* very strange let's try to set as is */ + info[i].value = talloc_strdup(info, r->in.info.info2->path); + } + W_ERROR_HAVE_NO_MEMORY(info[i].value); + all_string_sub((char *)info[i].value, "\\", "/", 0); + + i++; + } + + if (r->in.info.info2->comment && r->in.info.info2->comment[0]) { + info[i].name = SHARE_COMMENT; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info2->comment); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; + } + + if (r->in.info.info2->password && r->in.info.info2->password[0]) { + info[i].name = SHARE_PASSWORD; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info502->password); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; + } + + info[i].name = SHARE_MAX_CONNECTIONS; + info[i].type = SHARE_INFO_INT; + info[i].value = talloc(info, int); + *((int *)info[i].value) = r->in.info.info2->max_users; + i++; + + /* TODO: security descriptor */ + + nterr = share_set(sctx, r->in.share_name, info, i); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + + return WERR_OK; } case 501: { @@ -1038,14 +1233,103 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } case 502: { - return WERR_NOT_SUPPORTED; + struct share_info *info; + int count = 8; + int i; + + /* there are no more than 8 options in struct srvsvc_NetShareInfo502 */ + info = talloc_array(mem_ctx, struct share_info, count); + W_ERROR_HAVE_NO_MEMORY(info); + + i = 0; + + if (strcasecmp(r->in.share_name, r->in.info.info502->name) != 0) { + info[i].name = SHARE_NAME; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info502->name); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + i++; + } + + info[i].name = SHARE_TYPE; + info[i].type = SHARE_INFO_STRING; + switch (r->in.info.info502->type) { + case 0x00: + info[i].value = talloc_strdup(info, "DISK"); + break; + case 0x01: + info[i].value = talloc_strdup(info, "PRINTER"); + break; + case 0x03: + info[i].value = talloc_strdup(info, "IPC"); + break; + default: + return WERR_INVALID_PARAM; + } + W_ERROR_HAVE_NO_MEMORY(info[i].value); + i++; + + if (r->in.info.info502->path && r->in.info.info502->path[0]) { + info[i].name = SHARE_PATH; + info[i].type = SHARE_INFO_STRING; + + /* Windows will send a path in a form of C:\example\path */ + if (r->in.info.info2->path[1] == ':') { + info[i].value = talloc_strdup(info, &r->in.info.info502->path[2]); + } else { + /* very strange let's try to set as is */ + info[i].value = talloc_strdup(info, r->in.info.info502->path); + } + W_ERROR_HAVE_NO_MEMORY(info[i].value); + all_string_sub((char *)info[i].value, "\\", "/", 0); + + i++; + } + + if (r->in.info.info502->comment && r->in.info.info502->comment[0]) { + info[i].name = SHARE_COMMENT; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info502->comment); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; + } + + if (r->in.info.info502->password && r->in.info.info502->password[0]) { + info[i].name = SHARE_PASSWORD; + info[i].type = SHARE_INFO_STRING; + info[i].value = talloc_strdup(info, r->in.info.info502->password); + W_ERROR_HAVE_NO_MEMORY(info[i].value); + + i++; + } + + info[i].name = SHARE_MAX_CONNECTIONS; + info[i].type = SHARE_INFO_INT; + info[i].value = talloc(info, int); + *((int *)info[i].value) = r->in.info.info502->max_users; + i++; + + /* TODO: security descriptor */ + + nterr = share_set(sctx, r->in.share_name, info, i); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + + return WERR_OK; } case 1004: { WERROR status; union srvsvc_NetShareInfo info; - /* r->out.info.comment; */ + /* r->in.info.comment; */ + return WERR_NOT_SUPPORTED; } case 1005: @@ -1053,9 +1337,13 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ WERROR status; union srvsvc_NetShareInfo info; - /* r->out.info.dfs_flags; */ + /* r->in.info.dfs_flags; */ - return WERR_NOT_SUPPORTED; + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + + return WERR_OK; } default: return WERR_UNKNOWN_LEVEL; -- cgit From fec00fd6f8f68bc9ebb96c4590fb8bed7d1930b5 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 20 Sep 2006 20:32:36 +0000 Subject: r18740: Some more work around srvsvc (This used to be commit be2f4a2c44ed2b4d586f0d6e9976158f33fb29d8) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 351 ++++++++++++++++-------------- 1 file changed, 185 insertions(+), 166 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index b8da68e920..983c51f137 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1101,88 +1101,45 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_UNKNOWN_LEVEL; } - -/* - srvsvc_NetShareSetInfo -*/ -static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct srvsvc_NetShareSetInfo *r) +static WERROR srvsvc_fill_share_info(struct share_info *info, int *count, + const char *share_name, int level, + const char *name, + const char *path, + const char *comment, + const char *password, + enum srvsvc_ShareType type, + int32_t max_users, + uint32_t csc_policy, + struct security_descriptor *sd) { - NTSTATUS nterr; - struct share_context *sctx = NULL; - struct share_config *scfg = NULL; - - ZERO_STRUCT(r->out); + int i = 0; - /* TODO: - access check - */ - - if (strcmp("", r->in.share_name) == 0) { - return WERR_INVALID_PARAM; - } - - nterr = share_get_context(mem_ctx, &sctx); - if (!NT_STATUS_IS_OK(nterr)) { - return ntstatus_to_werror(nterr); - } - - switch (r->in.level) { - case 0: - { - return WERR_NOT_SUPPORTED; - } - case 1: - { - return WERR_NOT_SUPPORTED; + if (level == 501) { + info[i].name = SHARE_CSC_POLICY; + info[i].type = SHARE_INFO_INT; + info[i].value = talloc(info, int); + *((int *)info[i].value) = csc_policy; + i++; } - case 2: - { - struct share_info *info; - int count = 8; - int i; + + switch(level) { - /* there are no more than 8 options in struct srvsvc_NetShareInfo2 */ - info = talloc_array(mem_ctx, struct share_info, count); - W_ERROR_HAVE_NO_MEMORY(info); - - i = 0; - - if (strcasecmp(r->in.share_name, r->in.info.info2->name) != 0) { - info[i].name = SHARE_NAME; - info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info2->name); - W_ERROR_HAVE_NO_MEMORY(info[i].value); - i++; - } + case 502: + /* TODO: check if unknown is csc_policy */ - info[i].name = SHARE_TYPE; - info[i].type = SHARE_INFO_STRING; - switch (r->in.info.info2->type) { - case 0x00: - info[i].value = talloc_strdup(info, "DISK"); - break; - case 0x01: - info[i].value = talloc_strdup(info, "PRINTER"); - break; - case 0x03: - info[i].value = talloc_strdup(info, "IPC"); - break; - default: - return WERR_INVALID_PARAM; - } - W_ERROR_HAVE_NO_MEMORY(info[i].value); - i++; + /* TODO: security descriptor */ - if (r->in.info.info2->path && r->in.info.info2->path[0]) { + case 2: + if (path && path[0]) { info[i].name = SHARE_PATH; info[i].type = SHARE_INFO_STRING; /* Windows will send a path in a form of C:\example\path */ - if (r->in.info.info2->path[1] == ':') { - info[i].value = talloc_strdup(info, &r->in.info.info2->path[2]); + if (path[1] == ':') { + info[i].value = talloc_strdup(info, &path[2]); } else { /* very strange let's try to set as is */ - info[i].value = talloc_strdup(info, r->in.info.info2->path); + info[i].value = talloc_strdup(info, path); } W_ERROR_HAVE_NO_MEMORY(info[i].value); all_string_sub((char *)info[i].value, "\\", "/", 0); @@ -1190,19 +1147,10 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ i++; } - if (r->in.info.info2->comment && r->in.info.info2->comment[0]) { - info[i].name = SHARE_COMMENT; - info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info2->comment); - W_ERROR_HAVE_NO_MEMORY(info[i].value); - - i++; - } - - if (r->in.info.info2->password && r->in.info.info2->password[0]) { + if (password && password[0]) { info[i].name = SHARE_PASSWORD; info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info502->password); + info[i].value = talloc_strdup(info, password); W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; @@ -1211,49 +1159,14 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info[i].name = SHARE_MAX_CONNECTIONS; info[i].type = SHARE_INFO_INT; info[i].value = talloc(info, int); - *((int *)info[i].value) = r->in.info.info2->max_users; + *((int *)info[i].value) = max_users; i++; - /* TODO: security descriptor */ - - nterr = share_set(sctx, r->in.share_name, info, i); - if (!NT_STATUS_IS_OK(nterr)) { - return ntstatus_to_werror(nterr); - } - - if (r->in.parm_error) { - r->out.parm_error = r->in.parm_error; - } - - return WERR_OK; - } case 501: - { - return WERR_NOT_SUPPORTED; - } - case 502: - { - struct share_info *info; - int count = 8; - int i; - - /* there are no more than 8 options in struct srvsvc_NetShareInfo502 */ - info = talloc_array(mem_ctx, struct share_info, count); - W_ERROR_HAVE_NO_MEMORY(info); - - i = 0; - - if (strcasecmp(r->in.share_name, r->in.info.info502->name) != 0) { - info[i].name = SHARE_NAME; - info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info502->name); - W_ERROR_HAVE_NO_MEMORY(info[i].value); - i++; - } - + case 1: info[i].name = SHARE_TYPE; info[i].type = SHARE_INFO_STRING; - switch (r->in.info.info502->type) { + switch (type) { case 0x00: info[i].value = talloc_strdup(info, "DISK"); break; @@ -1269,74 +1182,171 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; - if (r->in.info.info502->path && r->in.info.info502->path[0]) { - info[i].name = SHARE_PATH; + case 1004: + if (comment) { + info[i].name = SHARE_COMMENT; info[i].type = SHARE_INFO_STRING; - - /* Windows will send a path in a form of C:\example\path */ - if (r->in.info.info2->path[1] == ':') { - info[i].value = talloc_strdup(info, &r->in.info.info502->path[2]); - } else { - /* very strange let's try to set as is */ - info[i].value = talloc_strdup(info, r->in.info.info502->path); - } + info[i].value = talloc_strdup(info, comment); W_ERROR_HAVE_NO_MEMORY(info[i].value); - all_string_sub((char *)info[i].value, "\\", "/", 0); i++; } - - if (r->in.info.info502->comment && r->in.info.info502->comment[0]) { - info[i].name = SHARE_COMMENT; + case 0: + if (name && + strcasecmp(share_name, name) != 0) { + info[i].name = SHARE_NAME; info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info502->comment); + info[i].value = talloc_strdup(info, name); W_ERROR_HAVE_NO_MEMORY(info[i].value); - i++; } - if (r->in.info.info502->password && r->in.info.info502->password[0]) { - info[i].name = SHARE_PASSWORD; - info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info502->password); - W_ERROR_HAVE_NO_MEMORY(info[i].value); + break; - i++; - } + default: + return WERR_UNKNOWN_LEVEL; + } - info[i].name = SHARE_MAX_CONNECTIONS; - info[i].type = SHARE_INFO_INT; - info[i].value = talloc(info, int); - *((int *)info[i].value) = r->in.info.info502->max_users; - i++; + *count = i; - /* TODO: security descriptor */ + return WERR_OK; +} - nterr = share_set(sctx, r->in.share_name, info, i); - if (!NT_STATUS_IS_OK(nterr)) { - return ntstatus_to_werror(nterr); - } +/* + srvsvc_NetShareSetInfo +*/ +static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct srvsvc_NetShareSetInfo *r) +{ + NTSTATUS nterr; + WERROR status; + struct share_context *sctx = NULL; + struct share_info *info; + int count; - if (r->in.parm_error) { - r->out.parm_error = r->in.parm_error; + /* TODO: - access check + */ + + /* there are no more than 10 options in all struct srvsvc_NetShareInfoXXX */ + info = talloc_array(mem_ctx, struct share_info, 10); + W_ERROR_HAVE_NO_MEMORY(info); + + ZERO_STRUCT(r->out); + + if (strcmp("", r->in.share_name) == 0) { + return WERR_INVALID_PARAM; + } + + nterr = share_get_context(mem_ctx, &sctx); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + switch (r->in.level) { + case 0: + { + status = srvsvc_fill_share_info(info, &count, + r->in.share_name, r->in.level, + r->in.info.info0->name, + NULL, + NULL, + NULL, + 0, + 0, + 0, + NULL); + if (status != WERR_OK) { + return status; } - - return WERR_OK; + break; + } + case 1: + { + status = srvsvc_fill_share_info(info, &count, + r->in.share_name, r->in.level, + r->in.info.info1->name, + NULL, + r->in.info.info1->comment, + NULL, + r->in.info.info1->type, + 0, + 0, + NULL); + if (status != WERR_OK) { + return status; + } + break; + } + case 2: + { + status = srvsvc_fill_share_info(info, &count, + r->in.share_name, r->in.level, + r->in.info.info2->name, + r->in.info.info2->path, + r->in.info.info2->comment, + r->in.info.info2->password, + r->in.info.info2->type, + r->in.info.info2->max_users, + 0, + NULL); + if (status != WERR_OK) { + return status; + } + break; + } + case 501: + { + status = srvsvc_fill_share_info(info, &count, + r->in.share_name, r->in.level, + r->in.info.info501->name, + NULL, + r->in.info.info501->comment, + NULL, + r->in.info.info501->type, + 0, + r->in.info.info501->csc_policy, + NULL); + if (status != WERR_OK) { + return status; + } + break; + } + case 502: + { + status = srvsvc_fill_share_info(info, &count, + r->in.share_name, r->in.level, + r->in.info.info502->name, + r->in.info.info502->path, + r->in.info.info502->comment, + r->in.info.info502->password, + r->in.info.info502->type, + r->in.info.info502->max_users, + 0, + r->in.info.info502->sd); + if (status != WERR_OK) { + return status; + } + break; } case 1004: { - WERROR status; - union srvsvc_NetShareInfo info; - - /* r->in.info.comment; */ - - return WERR_NOT_SUPPORTED; + status = srvsvc_fill_share_info(info, &count, + r->in.share_name, r->in.level, + NULL, + NULL, + r->in.info.info1004->comment, + NULL, + 0, + 0, + 0, + NULL); + if (status != WERR_OK) { + return status; + } + break; } case 1005: { - WERROR status; - union srvsvc_NetShareInfo info; - /* r->in.info.dfs_flags; */ if (r->in.parm_error) { @@ -1349,7 +1359,16 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_UNKNOWN_LEVEL; } - return WERR_UNKNOWN_LEVEL; + nterr = share_set(sctx, r->in.share_name, info, count); + if (!NT_STATUS_IS_OK(nterr)) { + return ntstatus_to_werror(nterr); + } + + if (r->in.parm_error) { + r->out.parm_error = r->in.parm_error; + } + + return WERR_OK; } -- cgit From 443a22b7f77f8aa640b6c75b49d853d4614d34d1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 24 Sep 2006 02:05:37 +0000 Subject: r18860: fixed some code that bitrotted while we didn't have the safety check with NTSTATUS, WERROR etc. (This used to be commit fddb85bfa8bb5df7812d226a7a6f6fb41ccf107f) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 983c51f137..f2d09527a3 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1255,7 +1255,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ 0, 0, NULL); - if (status != WERR_OK) { + if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } break; @@ -1272,7 +1272,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ 0, 0, NULL); - if (status != WERR_OK) { + if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } break; @@ -1289,7 +1289,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ r->in.info.info2->max_users, 0, NULL); - if (status != WERR_OK) { + if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } break; @@ -1306,7 +1306,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ 0, r->in.info.info501->csc_policy, NULL); - if (status != WERR_OK) { + if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } break; @@ -1323,7 +1323,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ r->in.info.info502->max_users, 0, r->in.info.info502->sd); - if (status != WERR_OK) { + if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } break; @@ -1340,7 +1340,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ 0, 0, NULL); - if (status != WERR_OK) { + if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } break; -- cgit From 64e88a8ccf2faa34ee9d182f4e89fa6e44c609a6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 17 Jan 2007 14:49:36 +0000 Subject: r20850: Prefix all server calls with dcesrv_ (This used to be commit 76c78b0339cd88c61a13745f7f4e037f400db21b) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 154 +++++++++++++++--------------- 1 file changed, 77 insertions(+), 77 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index f2d09527a3..5f85c291c9 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -41,7 +41,7 @@ /* srvsvc_NetCharDevEnum */ -static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevEnum *r) { r->out.level = r->in.level; @@ -78,7 +78,7 @@ static WERROR srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_C /* srvsvc_NetCharDevGetInfo */ -static WERROR srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevGetInfo *r) { ZERO_STRUCT(r->out); @@ -103,7 +103,7 @@ static WERROR srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLO /* srvsvc_NetCharDevControl */ -static WERROR srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevControl *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -113,7 +113,7 @@ static WERROR srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call, TALLO /* srvsvc_NetCharDevQEnum */ -static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQEnum *r) { r->out.level = r->in.level; @@ -152,7 +152,7 @@ static WERROR srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_ /* srvsvc_NetCharDevQGetInfo */ -static WERROR srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQGetInfo *r) { ZERO_STRUCT(r->out); @@ -177,7 +177,7 @@ static WERROR srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALL /* srvsvc_NetCharDevQSetInfo */ -static WERROR srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQSetInfo *r) { switch (r->in.level) { @@ -206,7 +206,7 @@ static WERROR srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state *dce_call, TALL /* srvsvc_NetCharDevQPurge */ -static WERROR srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQPurge *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -216,7 +216,7 @@ static WERROR srvsvc_NetCharDevQPurge(struct dcesrv_call_state *dce_call, TALLOC /* srvsvc_NetCharDevQPurgeSelf */ -static WERROR srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQPurgeSelf *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -226,7 +226,7 @@ static WERROR srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_call, TA /* srvsvc_NetConnEnum */ -static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetConnEnum *r) { r->out.level = r->in.level; @@ -265,7 +265,7 @@ static WERROR srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetFileEnum */ -static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileEnum *r) { r->out.level = r->in.level; @@ -304,7 +304,7 @@ static WERROR srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetFileGetInfo */ -static WERROR srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileGetInfo *r) { ZERO_STRUCT(r->out); @@ -329,7 +329,7 @@ static WERROR srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_C /* srvsvc_NetFileClose */ -static WERROR srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileClose *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -339,7 +339,7 @@ static WERROR srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetSessEnum */ -static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSessEnum *r) { r->out.level = r->in.level; @@ -408,7 +408,7 @@ static WERROR srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetSessDel */ -static WERROR srvsvc_NetSessDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetSessDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSessDel *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -418,7 +418,7 @@ static WERROR srvsvc_NetSessDel(struct dcesrv_call_state *dce_call, TALLOC_CTX * /* srvsvc_NetShareAdd */ -static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareAdd *r) { switch (r->in.level) { @@ -632,7 +632,7 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX return WERR_UNKNOWN_LEVEL; } -static WERROR srvsvc_fiel_ShareInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_fiel_ShareInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct share_config *scfg, uint32_t level, union srvsvc_NetShareInfo *info) { @@ -717,7 +717,7 @@ static WERROR srvsvc_fiel_ShareInfo(struct dcesrv_call_state *dce_call, TALLOC_C /* srvsvc_NetShareEnumAll */ -static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareEnumAll *r) { NTSTATUS nterr; @@ -774,7 +774,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_GENERAL_FAILURE; } info.info0 = &ctr0->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -815,7 +815,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_GENERAL_FAILURE; } info.info1 = &ctr1->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -858,7 +858,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_GENERAL_FAILURE; } info.info2 = &ctr2->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -901,7 +901,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_GENERAL_FAILURE; } info.info501 = &ctr501->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -944,7 +944,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_GENERAL_FAILURE; } info.info502 = &ctr502->array[i]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -967,7 +967,7 @@ static WERROR srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLOC_ /* srvsvc_NetShareGetInfo */ -static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareGetInfo *r) { NTSTATUS nterr; @@ -1002,7 +1002,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info0 = talloc(mem_ctx, struct srvsvc_NetShareInfo0); W_ERROR_HAVE_NO_MEMORY(info.info0); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -1018,7 +1018,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info1 = talloc(mem_ctx, struct srvsvc_NetShareInfo1); W_ERROR_HAVE_NO_MEMORY(info.info1); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -1036,7 +1036,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info2 = talloc(mem_ctx, struct srvsvc_NetShareInfo2); W_ERROR_HAVE_NO_MEMORY(info.info2); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -1052,7 +1052,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info501 = talloc(mem_ctx, struct srvsvc_NetShareInfo501); W_ERROR_HAVE_NO_MEMORY(info.info501); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -1070,7 +1070,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info502 = talloc(mem_ctx, struct srvsvc_NetShareInfo502); W_ERROR_HAVE_NO_MEMORY(info.info502); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -1086,7 +1086,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ info.info1005 = talloc(mem_ctx, struct srvsvc_NetShareInfo1005); W_ERROR_HAVE_NO_MEMORY(info.info1005); - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -1101,7 +1101,7 @@ static WERROR srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, TALLOC_ return WERR_UNKNOWN_LEVEL; } -static WERROR srvsvc_fill_share_info(struct share_info *info, int *count, +static WERROR dcesrv_srvsvc_fill_share_info(struct share_info *info, int *count, const char *share_name, int level, const char *name, const char *path, @@ -1215,7 +1215,7 @@ static WERROR srvsvc_fill_share_info(struct share_info *info, int *count, /* srvsvc_NetShareSetInfo */ -static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareSetInfo *r) { NTSTATUS nterr; @@ -1245,7 +1245,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ switch (r->in.level) { case 0: { - status = srvsvc_fill_share_info(info, &count, + status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, r->in.info.info0->name, NULL, @@ -1262,7 +1262,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } case 1: { - status = srvsvc_fill_share_info(info, &count, + status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, r->in.info.info1->name, NULL, @@ -1279,7 +1279,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } case 2: { - status = srvsvc_fill_share_info(info, &count, + status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, r->in.info.info2->name, r->in.info.info2->path, @@ -1296,7 +1296,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } case 501: { - status = srvsvc_fill_share_info(info, &count, + status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, r->in.info.info501->name, NULL, @@ -1313,7 +1313,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } case 502: { - status = srvsvc_fill_share_info(info, &count, + status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, r->in.info.info502->name, r->in.info.info502->path, @@ -1330,7 +1330,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ } case 1004: { - status = srvsvc_fill_share_info(info, &count, + status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, NULL, NULL, @@ -1375,7 +1375,7 @@ static WERROR srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, TALLOC_ /* srvsvc_NetShareDelSticky */ -static WERROR srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDelSticky *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1385,7 +1385,7 @@ static WERROR srvsvc_NetShareDelSticky(struct dcesrv_call_state *dce_call, TALLO /* srvsvc_NetShareCheck */ -static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareCheck *r) { NTSTATUS nterr; @@ -1463,7 +1463,7 @@ static WERROR srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TALLOC_CT /* srvsvc_NetSrvGetInfo */ -static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvGetInfo *r) { struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; @@ -1545,7 +1545,7 @@ static WERROR srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT /* srvsvc_NetSrvSetInfo */ -static WERROR srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSrvSetInfo *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1555,7 +1555,7 @@ static WERROR srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TALLOC_CT /* srvsvc_NetDiskEnum */ -static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetDiskEnum *r) { r->out.info.disks = NULL; @@ -1594,7 +1594,7 @@ static WERROR srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetServerStatisticsGet */ -static WERROR srvsvc_NetServerStatisticsGet(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetServerStatisticsGet(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetServerStatisticsGet *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1604,7 +1604,7 @@ static WERROR srvsvc_NetServerStatisticsGet(struct dcesrv_call_state *dce_call, /* srvsvc_NetTransportAdd */ -static WERROR srvsvc_NetTransportAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetTransportAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetTransportAdd *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1614,7 +1614,7 @@ static WERROR srvsvc_NetTransportAdd(struct dcesrv_call_state *dce_call, TALLOC_ /* srvsvc_NetTransportEnum */ -static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetTransportEnum *r) { r->out.level = r->in.level; @@ -1672,7 +1672,7 @@ static WERROR srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC /* srvsvc_NetTransportDel */ -static WERROR srvsvc_NetTransportDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetTransportDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetTransportDel *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1682,7 +1682,7 @@ static WERROR srvsvc_NetTransportDel(struct dcesrv_call_state *dce_call, TALLOC_ /* srvsvc_NetRemoteTOD */ -static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetRemoteTOD *r) { struct timeval tval; @@ -1720,7 +1720,7 @@ static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetPathType */ -static WERROR srvsvc_NetPathType(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetPathType(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetPathType *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1730,7 +1730,7 @@ static WERROR srvsvc_NetPathType(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetPathCanonicalize */ -static WERROR srvsvc_NetPathCanonicalize(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetPathCanonicalize(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetPathCanonicalize *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1740,7 +1740,7 @@ static WERROR srvsvc_NetPathCanonicalize(struct dcesrv_call_state *dce_call, TAL /* srvsvc_NetPathCompare */ -static WERROR srvsvc_NetPathCompare(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetPathCompare(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetPathCompare *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1750,7 +1750,7 @@ static WERROR srvsvc_NetPathCompare(struct dcesrv_call_state *dce_call, TALLOC_C /* srvsvc_NetNameValidate */ -static WERROR srvsvc_NetNameValidate(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetNameValidate(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetNameValidate *r) { int len; @@ -1800,7 +1800,7 @@ static WERROR srvsvc_NetNameValidate(struct dcesrv_call_state *dce_call, TALLOC_ /* srvsvc_NetPRNameCompare */ -static WERROR srvsvc_NetPRNameCompare(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetPRNameCompare(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetPRNameCompare *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -1810,7 +1810,7 @@ static WERROR srvsvc_NetPRNameCompare(struct dcesrv_call_state *dce_call, TALLOC /* srvsvc_NetShareEnum */ -static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareEnum *r) { NTSTATUS nterr; @@ -1879,7 +1879,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } info.info0 = &ctr0->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; @@ -1930,7 +1930,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } info.info1 = &ctr1->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; @@ -1983,7 +1983,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } info.info2 = &ctr2->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; @@ -2036,7 +2036,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX } info.info502 = &ctr502->array[y]; - status = srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; @@ -2058,7 +2058,7 @@ static WERROR srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetShareDelStart */ -static WERROR srvsvc_NetShareDelStart(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareDelStart(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDelStart *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2068,7 +2068,7 @@ static WERROR srvsvc_NetShareDelStart(struct dcesrv_call_state *dce_call, TALLOC /* srvsvc_NetShareDelCommit */ -static WERROR srvsvc_NetShareDelCommit(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareDelCommit(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDelCommit *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2078,7 +2078,7 @@ static WERROR srvsvc_NetShareDelCommit(struct dcesrv_call_state *dce_call, TALLO /* srvsvc_NetGetFileSecurity */ -static WERROR srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetGetFileSecurity *r) { struct sec_desc_buf *sd_buf; @@ -2120,7 +2120,7 @@ static WERROR srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_call, TALL /* srvsvc_NetSetFileSecurity */ -static WERROR srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSetFileSecurity *r) { struct ntvfs_context *ntvfs_ctx; @@ -2156,7 +2156,7 @@ static WERROR srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_call, TALL /* srvsvc_NetServerTransportAddEx */ -static WERROR srvsvc_NetServerTransportAddEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetServerTransportAddEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetServerTransportAddEx *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2166,7 +2166,7 @@ static WERROR srvsvc_NetServerTransportAddEx(struct dcesrv_call_state *dce_call, /* srvsvc_NetServerSetServiceBitsEx */ -static WERROR srvsvc_NetServerSetServiceBitsEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetServerSetServiceBitsEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetServerSetServiceBitsEx *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2176,7 +2176,7 @@ static WERROR srvsvc_NetServerSetServiceBitsEx(struct dcesrv_call_state *dce_cal /* srvsvc_NETRDFSGETVERSION */ -static WERROR srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSGETVERSION *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2186,7 +2186,7 @@ static WERROR srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state *dce_call, TALLO /* srvsvc_NETRDFSCREATELOCALPARTITION */ -static WERROR srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSCREATELOCALPARTITION *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2196,7 +2196,7 @@ static WERROR srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state *dce_c /* srvsvc_NETRDFSDELETELOCALPARTITION */ -static WERROR srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSDELETELOCALPARTITION *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2206,7 +2206,7 @@ static WERROR srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state *dce_c /* srvsvc_NETRDFSSETLOCALVOLUMESTATE */ -static WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2216,7 +2216,7 @@ static WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state *dce_ca /* srvsvc_NETRDFSSETSERVERINFO */ -static WERROR srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSSETSERVERINFO *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2226,7 +2226,7 @@ static WERROR srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state *dce_call, TA /* srvsvc_NETRDFSCREATEEXITPOINT */ -static WERROR srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSCREATEEXITPOINT *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2236,7 +2236,7 @@ static WERROR srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state *dce_call, /* srvsvc_NETRDFSDELETEEXITPOINT */ -static WERROR srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSDELETEEXITPOINT *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2246,7 +2246,7 @@ static WERROR srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state *dce_call, /* srvsvc_NETRDFSMODIFYPREFIX */ -static WERROR srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSMODIFYPREFIX *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2256,7 +2256,7 @@ static WERROR srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state *dce_call, TAL /* srvsvc_NETRDFSFIXLOCALVOLUME */ -static WERROR srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSFIXLOCALVOLUME *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2266,7 +2266,7 @@ static WERROR srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state *dce_call, T /* srvsvc_NETRDFSMANAGERREPORTSITEINFO */ -static WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2276,7 +2276,7 @@ static WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state *dce_ /* srvsvc_NETRSERVERTRANSPORTDELEX */ -static WERROR srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRSERVERTRANSPORTDELEX *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2285,7 +2285,7 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call /* srvsvc_NetShareDel */ -static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareDel *r) { NTSTATUS nterr; @@ -2307,7 +2307,7 @@ static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX /* srvsvc_NetSetServiceBits */ -static WERROR srvsvc_NetSetServiceBits(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NetSetServiceBits(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSetServiceBits *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); @@ -2316,7 +2316,7 @@ static WERROR srvsvc_NetSetServiceBits(struct dcesrv_call_state *dce_call, TALLO /* srvsvc_NETRPRNAMECANONICALIZE */ -static WERROR srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, +static WERROR dcesrv_srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NETRPRNAMECANONICALIZE *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -- 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/rpc_server/srvsvc/dcesrv_srvsvc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 5f85c291c9..c0e1a0d2b4 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -7,7 +7,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, @@ -16,8 +16,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 ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index c0e1a0d2b4..6e8732f788 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -28,6 +28,7 @@ #include "libcli/security/security.h" #include "system/time.h" #include "rpc_server/srvsvc/proto.h" +#include "param/param.h" #define SRVSVC_CHECK_ADMIN_ACCESS do { \ struct security_token *t = dce_call->conn->auth_state.session_info->security_token; \ -- cgit From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 6e8732f788..aee88d915c 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); - info101->comment = talloc_strdup(mem_ctx, lp_serverstring()); + info101->comment = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(info101->comment); r->out.info.info101 = info101; @@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); - info102->comment = talloc_strdup(mem_ctx, lp_serverstring()); + info102->comment = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(info102->comment); info102->users = dcesrv_common_get_users(mem_ctx, dce_ctx); -- cgit From 57f20ccd242e45ff91850341594aa040d113c19e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 4 Dec 2007 20:05:00 +0100 Subject: r26296: Store loadparm context in DCE/RPC server context. (This used to be commit fc1f4d2d65d4c983cba5421e7ffb64dd75482860) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index aee88d915c..d76e83ba17 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); - info101->comment = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm)); + info101->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info101->comment); r->out.info.info101 = info101; @@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); - info102->comment = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm)); + info102->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info102->comment); info102->users = dcesrv_common_get_users(mem_ctx, dce_ctx); -- cgit From 2f5ca872a80ad872ab864061f0c6982d8605393f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 6 Dec 2007 16:54:34 +0100 Subject: r26313: Fix more uses of static loadparm. (This used to be commit 6fd0d9d3b75546d08c24c513e05b1843d5777608) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index d76e83ba17..55a647b7ef 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1496,8 +1496,8 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info101->server_name = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc); W_ERROR_HAVE_NO_MEMORY(info101->server_name); - info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); - info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); + info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx); + info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx); info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); info101->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info101->comment); @@ -1516,8 +1516,8 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info102->server_name = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc); W_ERROR_HAVE_NO_MEMORY(info102->server_name); - info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); - info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); + info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx); + info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx); info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); info102->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info102->comment); -- cgit From f055893ca571fbeac3675c02344c7cc53106bea1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 10 Dec 2007 18:41:55 +0100 Subject: r26382: Remove more uses of global_loadparm. (This used to be commit 6d4c59853481855c232e7cf97264a391f40af2b5) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 55a647b7ef..b9e097356a 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -444,7 +444,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 8; int i; - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -542,7 +542,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 10; int i; - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -734,7 +734,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, /* TODO: - paging of results */ - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -983,7 +983,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1237,7 +1237,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1414,7 +1414,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA } all_string_sub(device, "\\", "/", 0); - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1828,7 +1828,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL /* TODO: - paging of results */ - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -2291,7 +2291,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL NTSTATUS nterr; struct share_context *sctx; - nterr = share_get_context(mem_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } -- cgit From e31abef15f7696cf39e9e81307f153da93568e02 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:55 +0100 Subject: r26440: Remove more uses of global_loadparm. (This used to be commit 8858cf39722f192865e531164c72039fd18d7a8d) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index b9e097356a..ebbeb2d0df 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -444,7 +444,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 8; int i; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -542,7 +542,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 10; int i; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -734,7 +734,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, /* TODO: - paging of results */ - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -983,7 +983,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1237,7 +1237,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1414,7 +1414,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA } all_string_sub(device, "\\", "/", 0); - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1828,7 +1828,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL /* TODO: - paging of results */ - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -2291,7 +2291,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL NTSTATUS nterr; struct share_context *sctx; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } -- cgit From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index ebbeb2d0df..23e40d9976 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -24,6 +24,7 @@ #include "rpc_server/dcerpc_server.h" #include "librpc/gen_ndr/ndr_srvsvc.h" #include "rpc_server/common/common.h" +#include "rpc_server/common/proto.h" #include "auth/auth.h" #include "libcli/security/security.h" #include "system/time.h" -- 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/rpc_server/srvsvc/dcesrv_srvsvc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c') diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 23e40d9976..8dc42bf43b 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -445,7 +445,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 8; int i; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -543,7 +543,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 10; int i; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -735,7 +735,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, /* TODO: - paging of results */ - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -984,7 +984,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1238,7 +1238,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1415,7 +1415,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA } all_string_sub(device, "\\", "/", 0); - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx); info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx); - info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); + info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx); info101->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info101->comment); @@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx); info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx); - info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); + info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx); info102->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info102->comment); @@ -1829,7 +1829,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL /* TODO: - paging of results */ - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -2292,7 +2292,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL NTSTATUS nterr; struct share_context *sctx; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } -- cgit