2 Unix SMB/CIFS implementation.
4 endpoint server for the srvsvc pipe
6 Copyright (C) Stefan (metze) Metzmacher 2004-2006
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "ntvfs/ntvfs.h"
24 #include "rpc_server/dcerpc_server.h"
25 #include "librpc/gen_ndr/ndr_srvsvc.h"
26 #include "rpc_server/common/common.h"
27 #include "rpc_server/common/share.h"
28 #include "auth/auth.h"
29 #include "libcli/security/security.h"
30 #include "system/time.h"
31 #include "rpc_server/srvsvc/proto.h"
32 #include "param/param.h"
34 #define SRVSVC_CHECK_ADMIN_ACCESS do { \
35 struct security_token *t = dce_call->conn->auth_state.session_info->security_token; \
36 if (!security_token_has_builtin_administrators(t) && \
37 !security_token_has_sid(t, &global_sid_Builtin_Server_Operators)) { \
38 return WERR_ACCESS_DENIED; \
45 static WERROR
dcesrv_srvsvc_NetCharDevEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
46 struct srvsvc_NetCharDevEnum
*r
)
48 *r
->out
.totalentries
= 0;
50 switch (r
->in
.info_ctr
->level
) {
52 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetCharDevCtr0
);
53 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
55 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
56 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
58 return WERR_NOT_SUPPORTED
;
61 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetCharDevCtr1
);
62 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
64 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
65 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
67 return WERR_NOT_SUPPORTED
;
70 return WERR_INVALID_LEVEL
;
76 srvsvc_NetCharDevGetInfo
78 static WERROR
dcesrv_srvsvc_NetCharDevGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
79 struct srvsvc_NetCharDevGetInfo
*r
)
81 ZERO_STRUCTP(r
->out
.info
);
83 switch (r
->in
.level
) {
86 return WERR_NOT_SUPPORTED
;
90 return WERR_NOT_SUPPORTED
;
93 return WERR_INVALID_LEVEL
;
99 srvsvc_NetCharDevControl
101 static WERROR
dcesrv_srvsvc_NetCharDevControl(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
102 struct srvsvc_NetCharDevControl
*r
)
104 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
109 srvsvc_NetCharDevQEnum
111 static WERROR
dcesrv_srvsvc_NetCharDevQEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
112 struct srvsvc_NetCharDevQEnum
*r
)
114 *r
->out
.totalentries
= 0;
116 switch (r
->in
.info_ctr
->level
) {
119 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetCharDevQCtr0
);
120 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
122 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
123 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
125 return WERR_NOT_SUPPORTED
;
129 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetCharDevQCtr1
);
130 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
132 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
133 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
135 return WERR_NOT_SUPPORTED
;
138 return WERR_INVALID_LEVEL
;
144 srvsvc_NetCharDevQGetInfo
146 static WERROR
dcesrv_srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
147 struct srvsvc_NetCharDevQGetInfo
*r
)
149 ZERO_STRUCTP(r
->out
.info
);
151 switch (r
->in
.level
) {
154 return WERR_NOT_SUPPORTED
;
158 return WERR_NOT_SUPPORTED
;
161 return WERR_INVALID_LEVEL
;
167 srvsvc_NetCharDevQSetInfo
169 static WERROR
dcesrv_srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
170 struct srvsvc_NetCharDevQSetInfo
*r
)
172 switch (r
->in
.level
) {
175 if (r
->in
.parm_error
) {
176 r
->out
.parm_error
= r
->in
.parm_error
;
178 return WERR_NOT_SUPPORTED
;
182 if (r
->in
.parm_error
) {
183 r
->out
.parm_error
= r
->in
.parm_error
;
185 return WERR_NOT_SUPPORTED
;
188 return WERR_INVALID_LEVEL
;
194 srvsvc_NetCharDevQPurge
196 static WERROR
dcesrv_srvsvc_NetCharDevQPurge(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
197 struct srvsvc_NetCharDevQPurge
*r
)
199 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
204 srvsvc_NetCharDevQPurgeSelf
206 static WERROR
dcesrv_srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
207 struct srvsvc_NetCharDevQPurgeSelf
*r
)
209 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
216 static WERROR
dcesrv_srvsvc_NetConnEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
217 struct srvsvc_NetConnEnum
*r
)
219 *r
->out
.totalentries
= 0;
221 switch (r
->in
.info_ctr
->level
) {
224 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetConnCtr0
);
225 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
227 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
228 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
230 return WERR_NOT_SUPPORTED
;
234 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetConnCtr1
);
235 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
237 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
238 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
240 return WERR_NOT_SUPPORTED
;
243 return WERR_INVALID_LEVEL
;
251 static WERROR
dcesrv_srvsvc_NetFileEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
252 struct srvsvc_NetFileEnum
*r
)
254 *r
->out
.totalentries
= 0;
256 switch (r
->in
.info_ctr
->level
) {
259 r
->out
.info_ctr
->ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetFileCtr2
);
260 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr2
);
262 r
->out
.info_ctr
->ctr
.ctr2
->count
= 0;
263 r
->out
.info_ctr
->ctr
.ctr2
->array
= NULL
;
265 return WERR_NOT_SUPPORTED
;
269 r
->out
.info_ctr
->ctr
.ctr3
= talloc(mem_ctx
, struct srvsvc_NetFileCtr3
);
270 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr3
);
272 r
->out
.info_ctr
->ctr
.ctr3
->count
= 0;
273 r
->out
.info_ctr
->ctr
.ctr3
->array
= NULL
;
275 return WERR_NOT_SUPPORTED
;
278 return WERR_INVALID_LEVEL
;
284 srvsvc_NetFileGetInfo
286 static WERROR
dcesrv_srvsvc_NetFileGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
287 struct srvsvc_NetFileGetInfo
*r
)
289 ZERO_STRUCTP(r
->out
.info
);
291 switch (r
->in
.level
) {
294 return WERR_NOT_SUPPORTED
;
298 return WERR_NOT_SUPPORTED
;
301 return WERR_INVALID_LEVEL
;
309 static WERROR
dcesrv_srvsvc_NetFileClose(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
310 struct srvsvc_NetFileClose
*r
)
312 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
319 static WERROR
dcesrv_srvsvc_NetSessEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
320 struct srvsvc_NetSessEnum
*r
)
322 *r
->out
.totalentries
= 0;
324 switch (r
->in
.info_ctr
->level
) {
327 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetSessCtr0
);
328 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
330 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
331 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
333 return WERR_NOT_SUPPORTED
;
337 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetSessCtr1
);
338 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
340 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
341 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
343 return WERR_NOT_SUPPORTED
;
347 r
->out
.info_ctr
->ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetSessCtr2
);
348 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr2
);
350 r
->out
.info_ctr
->ctr
.ctr2
->count
= 0;
351 r
->out
.info_ctr
->ctr
.ctr2
->array
= NULL
;
353 return WERR_NOT_SUPPORTED
;
357 r
->out
.info_ctr
->ctr
.ctr10
= talloc(mem_ctx
, struct srvsvc_NetSessCtr10
);
358 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr10
);
360 r
->out
.info_ctr
->ctr
.ctr10
->count
= 0;
361 r
->out
.info_ctr
->ctr
.ctr10
->array
= NULL
;
363 return WERR_NOT_SUPPORTED
;
367 r
->out
.info_ctr
->ctr
.ctr502
= talloc(mem_ctx
, struct srvsvc_NetSessCtr502
);
368 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr502
);
370 r
->out
.info_ctr
->ctr
.ctr502
->count
= 0;
371 r
->out
.info_ctr
->ctr
.ctr502
->array
= NULL
;
373 return WERR_NOT_SUPPORTED
;
376 return WERR_INVALID_LEVEL
;
384 static WERROR
dcesrv_srvsvc_NetSessDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
385 struct srvsvc_NetSessDel
*r
)
387 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
394 static WERROR
dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
395 struct srvsvc_NetShareAdd
*r
)
397 switch (r
->in
.level
) {
400 if (r
->in
.parm_error
) {
401 r
->out
.parm_error
= r
->in
.parm_error
;
403 return WERR_NOT_SUPPORTED
;
407 if (r
->in
.parm_error
) {
408 r
->out
.parm_error
= r
->in
.parm_error
;
410 return WERR_NOT_SUPPORTED
;
415 struct share_info
*info
;
416 struct share_context
*sctx
;
417 unsigned int count
= 8;
420 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
421 if (!NT_STATUS_IS_OK(nterr
)) {
422 return ntstatus_to_werror(nterr
);
425 /* there are no more than 8 options in struct srvsvc_NetShareInfo2 */
426 info
= talloc_array(mem_ctx
, struct share_info
, count
);
427 W_ERROR_HAVE_NO_MEMORY(info
);
431 info
[i
].name
= SHARE_TYPE
;
432 info
[i
].type
= SHARE_INFO_STRING
;
433 switch (r
->in
.info
->info2
->type
) {
435 info
[i
].value
= talloc_strdup(info
, "DISK");
438 info
[i
].value
= talloc_strdup(info
, "PRINTER");
441 info
[i
].value
= talloc_strdup(info
, "IPC");
444 return WERR_INVALID_PARAMETER
;
446 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
449 if (r
->in
.info
->info2
->path
&& r
->in
.info
->info2
->path
[0]) {
450 info
[i
].name
= SHARE_PATH
;
451 info
[i
].type
= SHARE_INFO_STRING
;
453 /* Windows will send a path in a form of C:\example\path */
454 if (r
->in
.info
->info2
->path
[1] == ':') {
455 info
[i
].value
= talloc_strdup(info
, &r
->in
.info
->info2
->path
[2]);
457 /* very strange let's try to set as is */
458 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->path
);
460 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
461 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
466 if (r
->in
.info
->info2
->comment
&& r
->in
.info
->info2
->comment
[0]) {
467 info
[i
].name
= SHARE_COMMENT
;
468 info
[i
].type
= SHARE_INFO_STRING
;
469 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->comment
);
470 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
475 if (r
->in
.info
->info2
->password
&& r
->in
.info
->info2
->password
[0]) {
476 info
[i
].name
= SHARE_PASSWORD
;
477 info
[i
].type
= SHARE_INFO_STRING
;
478 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->password
);
479 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
484 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
485 info
[i
].type
= SHARE_INFO_INT
;
486 info
[i
].value
= talloc(info
, int);
487 *((int *)info
[i
].value
) = r
->in
.info
->info2
->max_users
;
490 /* TODO: security descriptor */
492 nterr
= share_create(sctx
, r
->in
.info
->info2
->name
, info
, i
);
493 if (!NT_STATUS_IS_OK(nterr
)) {
494 return ntstatus_to_werror(nterr
);
497 if (r
->in
.parm_error
) {
498 r
->out
.parm_error
= r
->in
.parm_error
;
505 if (r
->in
.parm_error
) {
506 r
->out
.parm_error
= r
->in
.parm_error
;
508 return WERR_NOT_SUPPORTED
;
513 struct share_info
*info
;
514 struct share_context
*sctx
;
515 unsigned int count
= 10;
518 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
519 if (!NT_STATUS_IS_OK(nterr
)) {
520 return ntstatus_to_werror(nterr
);
523 /* there are no more than 10 options in struct srvsvc_NetShareInfo502 */
524 info
= talloc_array(mem_ctx
, struct share_info
, count
);
525 W_ERROR_HAVE_NO_MEMORY(info
);
529 info
[i
].name
= SHARE_TYPE
;
530 info
[i
].type
= SHARE_INFO_STRING
;
531 switch (r
->in
.info
->info502
->type
) {
533 info
[i
].value
= talloc_strdup(info
, "DISK");
536 info
[i
].value
= talloc_strdup(info
, "PRINTER");
539 info
[i
].value
= talloc_strdup(info
, "IPC");
542 return WERR_INVALID_PARAMETER
;
544 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
547 if (r
->in
.info
->info502
->path
&& r
->in
.info
->info502
->path
[0]) {
548 info
[i
].name
= SHARE_PATH
;
549 info
[i
].type
= SHARE_INFO_STRING
;
551 /* Windows will send a path in a form of C:\example\path */
552 if (r
->in
.info
->info502
->path
[1] == ':') {
553 info
[i
].value
= talloc_strdup(info
, &r
->in
.info
->info502
->path
[2]);
555 /* very strange let's try to set as is */
556 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->path
);
558 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
559 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
564 if (r
->in
.info
->info502
->comment
&& r
->in
.info
->info502
->comment
[0]) {
565 info
[i
].name
= SHARE_COMMENT
;
566 info
[i
].type
= SHARE_INFO_STRING
;
567 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->comment
);
568 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
573 if (r
->in
.info
->info502
->password
&& r
->in
.info
->info502
->password
[0]) {
574 info
[i
].name
= SHARE_PASSWORD
;
575 info
[i
].type
= SHARE_INFO_STRING
;
576 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->password
);
577 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
582 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
583 info
[i
].type
= SHARE_INFO_INT
;
584 info
[i
].value
= talloc(info
, int);
585 *((int *)info
[i
].value
) = r
->in
.info
->info502
->max_users
;
588 /* TODO: security descriptor */
590 nterr
= share_create(sctx
, r
->in
.info
->info502
->name
, info
, i
);
591 if (!NT_STATUS_IS_OK(nterr
)) {
592 return ntstatus_to_werror(nterr
);
595 if (r
->in
.parm_error
) {
596 r
->out
.parm_error
= r
->in
.parm_error
;
602 return WERR_INVALID_LEVEL
;
606 static WERROR
dcesrv_srvsvc_fiel_ShareInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
607 struct share_config
*scfg
, uint32_t level
,
608 union srvsvc_NetShareInfo
*info
)
610 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
615 info
->info0
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
616 W_ERROR_HAVE_NO_MEMORY(info
->info0
->name
);
622 info
->info1
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
623 W_ERROR_HAVE_NO_MEMORY(info
->info1
->name
);
624 info
->info1
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
625 info
->info1
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
626 W_ERROR_HAVE_NO_MEMORY(info
->info1
->comment
);
632 info
->info2
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
633 W_ERROR_HAVE_NO_MEMORY(info
->info2
->name
);
634 info
->info2
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
635 info
->info2
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
636 W_ERROR_HAVE_NO_MEMORY(info
->info2
->comment
);
637 info
->info2
->permissions
= dcesrv_common_get_share_permissions(mem_ctx
, dce_ctx
, scfg
);
638 info
->info2
->max_users
= share_int_option(scfg
, SHARE_MAX_CONNECTIONS
, SHARE_MAX_CONNECTIONS_DEFAULT
);
639 info
->info2
->current_users
= dcesrv_common_get_share_current_users(mem_ctx
, dce_ctx
, scfg
);
640 info
->info2
->path
= dcesrv_common_get_share_path(mem_ctx
, dce_ctx
, scfg
);
641 W_ERROR_HAVE_NO_MEMORY(info
->info2
->path
);
642 info
->info2
->password
= share_string_option(mem_ctx
, scfg
, SHARE_PASSWORD
, NULL
);
648 info
->info501
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
649 W_ERROR_HAVE_NO_MEMORY(info
->info501
->name
);
650 info
->info501
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
651 info
->info501
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
652 W_ERROR_HAVE_NO_MEMORY(info
->info501
->comment
);
653 info
->info501
->csc_policy
= share_int_option(scfg
, SHARE_CSC_POLICY
, SHARE_CSC_POLICY_DEFAULT
);
659 info
->info502
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
660 W_ERROR_HAVE_NO_MEMORY(info
->info502
->name
);
661 info
->info502
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
662 info
->info502
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
663 W_ERROR_HAVE_NO_MEMORY(info
->info502
->comment
);
664 info
->info502
->permissions
= dcesrv_common_get_share_permissions(mem_ctx
, dce_ctx
, scfg
);
665 info
->info502
->max_users
= share_int_option(scfg
, SHARE_MAX_CONNECTIONS
, SHARE_MAX_CONNECTIONS_DEFAULT
);
666 info
->info502
->current_users
= dcesrv_common_get_share_current_users(mem_ctx
, dce_ctx
, scfg
);
667 info
->info502
->path
= dcesrv_common_get_share_path(mem_ctx
, dce_ctx
, scfg
);
668 W_ERROR_HAVE_NO_MEMORY(info
->info502
->path
);
669 info
->info502
->password
= share_string_option(mem_ctx
, scfg
, SHARE_PASSWORD
, NULL
);
670 info
->info502
->sd_buf
.sd
= dcesrv_common_get_security_descriptor(mem_ctx
, dce_ctx
, scfg
);
676 info
->info1005
->dfs_flags
= dcesrv_common_get_share_dfs_flags(mem_ctx
, dce_ctx
, scfg
);
681 return WERR_INVALID_LEVEL
;
686 srvsvc_NetShareEnumAll
688 static WERROR
dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
689 struct srvsvc_NetShareEnumAll
*r
)
694 struct share_context
*sctx
;
695 struct share_config
*scfg
;
697 *r
->out
.totalentries
= 0;
699 /* TODO: - paging of results
702 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
703 if (!NT_STATUS_IS_OK(nterr
)) {
704 return ntstatus_to_werror(nterr
);
707 nterr
= share_list_all(mem_ctx
, sctx
, &numshares
, &snames
);
708 if (!NT_STATUS_IS_OK(nterr
)) {
709 return ntstatus_to_werror(nterr
);
712 switch (r
->in
.info_ctr
->level
) {
716 struct srvsvc_NetShareCtr0
*ctr0
;
718 ctr0
= talloc(mem_ctx
, struct srvsvc_NetShareCtr0
);
719 W_ERROR_HAVE_NO_MEMORY(ctr0
);
721 ctr0
->count
= numshares
;
724 if (ctr0
->count
== 0) {
725 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
729 ctr0
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo0
, ctr0
->count
);
730 W_ERROR_HAVE_NO_MEMORY(ctr0
->array
);
732 for (i
= 0; i
< ctr0
->count
; i
++) {
734 union srvsvc_NetShareInfo info
;
736 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
737 if (!NT_STATUS_IS_OK(nterr
)) {
738 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
739 return WERR_GEN_FAILURE
;
741 info
.info0
= &ctr0
->array
[i
];
742 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
743 if (!W_ERROR_IS_OK(status
)) {
750 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
751 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr0
->count
;
757 struct srvsvc_NetShareCtr1
*ctr1
;
759 ctr1
= talloc(mem_ctx
, struct srvsvc_NetShareCtr1
);
760 W_ERROR_HAVE_NO_MEMORY(ctr1
);
762 ctr1
->count
= numshares
;
765 if (ctr1
->count
== 0) {
766 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
770 ctr1
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo1
, ctr1
->count
);
771 W_ERROR_HAVE_NO_MEMORY(ctr1
->array
);
773 for (i
=0; i
< ctr1
->count
; i
++) {
775 union srvsvc_NetShareInfo info
;
777 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
778 if (!NT_STATUS_IS_OK(nterr
)) {
779 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
780 return WERR_GEN_FAILURE
;
782 info
.info1
= &ctr1
->array
[i
];
783 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
784 if (!W_ERROR_IS_OK(status
)) {
791 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
792 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr1
->count
;
799 struct srvsvc_NetShareCtr2
*ctr2
;
801 SRVSVC_CHECK_ADMIN_ACCESS
;
803 ctr2
= talloc(mem_ctx
, struct srvsvc_NetShareCtr2
);
804 W_ERROR_HAVE_NO_MEMORY(ctr2
);
806 ctr2
->count
= numshares
;
809 if (ctr2
->count
== 0) {
810 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
814 ctr2
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo2
, ctr2
->count
);
815 W_ERROR_HAVE_NO_MEMORY(ctr2
->array
);
817 for (i
=0; i
< ctr2
->count
; i
++) {
819 union srvsvc_NetShareInfo info
;
821 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
822 if (!NT_STATUS_IS_OK(nterr
)) {
823 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
824 return WERR_GEN_FAILURE
;
826 info
.info2
= &ctr2
->array
[i
];
827 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
828 if (!W_ERROR_IS_OK(status
)) {
835 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
836 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr2
->count
;
843 struct srvsvc_NetShareCtr501
*ctr501
;
845 SRVSVC_CHECK_ADMIN_ACCESS
;
847 ctr501
= talloc(mem_ctx
, struct srvsvc_NetShareCtr501
);
848 W_ERROR_HAVE_NO_MEMORY(ctr501
);
850 ctr501
->count
= numshares
;
851 ctr501
->array
= NULL
;
853 if (ctr501
->count
== 0) {
854 r
->out
.info_ctr
->ctr
.ctr501
= ctr501
;
858 ctr501
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo501
, ctr501
->count
);
859 W_ERROR_HAVE_NO_MEMORY(ctr501
->array
);
861 for (i
=0; i
< ctr501
->count
; i
++) {
863 union srvsvc_NetShareInfo info
;
865 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
866 if (!NT_STATUS_IS_OK(nterr
)) {
867 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
868 return WERR_GEN_FAILURE
;
870 info
.info501
= &ctr501
->array
[i
];
871 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
872 if (!W_ERROR_IS_OK(status
)) {
879 r
->out
.info_ctr
->ctr
.ctr501
= ctr501
;
880 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr501
->count
;
887 struct srvsvc_NetShareCtr502
*ctr502
;
889 SRVSVC_CHECK_ADMIN_ACCESS
;
891 ctr502
= talloc(mem_ctx
, struct srvsvc_NetShareCtr502
);
892 W_ERROR_HAVE_NO_MEMORY(ctr502
);
894 ctr502
->count
= numshares
;
895 ctr502
->array
= NULL
;
897 if (ctr502
->count
== 0) {
898 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
902 ctr502
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo502
, ctr502
->count
);
903 W_ERROR_HAVE_NO_MEMORY(ctr502
->array
);
905 for (i
=0; i
< ctr502
->count
; i
++) {
907 union srvsvc_NetShareInfo info
;
909 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
910 if (!NT_STATUS_IS_OK(nterr
)) {
911 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
912 return WERR_GEN_FAILURE
;
914 info
.info502
= &ctr502
->array
[i
];
915 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
916 if (!W_ERROR_IS_OK(status
)) {
923 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
924 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr502
->count
;
929 return WERR_INVALID_LEVEL
;
935 srvsvc_NetShareGetInfo
937 static WERROR
dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
938 struct srvsvc_NetShareGetInfo
*r
)
941 struct share_context
*sctx
= NULL
;
942 struct share_config
*scfg
= NULL
;
944 ZERO_STRUCTP(r
->out
.info
);
946 /* TODO: - access check
949 if (strcmp("", r
->in
.share_name
) == 0) {
950 return WERR_INVALID_PARAMETER
;
953 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
954 if (!NT_STATUS_IS_OK(nterr
)) {
955 return ntstatus_to_werror(nterr
);
958 nterr
= share_get_config(mem_ctx
, sctx
, r
->in
.share_name
, &scfg
);
959 if (!NT_STATUS_IS_OK(nterr
)) {
960 return ntstatus_to_werror(nterr
);
963 switch (r
->in
.level
) {
967 union srvsvc_NetShareInfo info
;
969 info
.info0
= talloc(mem_ctx
, struct srvsvc_NetShareInfo0
);
970 W_ERROR_HAVE_NO_MEMORY(info
.info0
);
972 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
973 if (!W_ERROR_IS_OK(status
)) {
977 r
->out
.info
->info0
= info
.info0
;
983 union srvsvc_NetShareInfo info
;
985 info
.info1
= talloc(mem_ctx
, struct srvsvc_NetShareInfo1
);
986 W_ERROR_HAVE_NO_MEMORY(info
.info1
);
988 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
989 if (!W_ERROR_IS_OK(status
)) {
993 r
->out
.info
->info1
= info
.info1
;
999 union srvsvc_NetShareInfo info
;
1001 SRVSVC_CHECK_ADMIN_ACCESS
;
1003 info
.info2
= talloc(mem_ctx
, struct srvsvc_NetShareInfo2
);
1004 W_ERROR_HAVE_NO_MEMORY(info
.info2
);
1006 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1007 if (!W_ERROR_IS_OK(status
)) {
1011 r
->out
.info
->info2
= info
.info2
;
1017 union srvsvc_NetShareInfo info
;
1019 info
.info501
= talloc(mem_ctx
, struct srvsvc_NetShareInfo501
);
1020 W_ERROR_HAVE_NO_MEMORY(info
.info501
);
1022 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1023 if (!W_ERROR_IS_OK(status
)) {
1027 r
->out
.info
->info501
= info
.info501
;
1033 union srvsvc_NetShareInfo info
;
1035 SRVSVC_CHECK_ADMIN_ACCESS
;
1037 info
.info502
= talloc(mem_ctx
, struct srvsvc_NetShareInfo502
);
1038 W_ERROR_HAVE_NO_MEMORY(info
.info502
);
1040 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1041 if (!W_ERROR_IS_OK(status
)) {
1045 r
->out
.info
->info502
= info
.info502
;
1051 union srvsvc_NetShareInfo info
;
1053 info
.info1005
= talloc(mem_ctx
, struct srvsvc_NetShareInfo1005
);
1054 W_ERROR_HAVE_NO_MEMORY(info
.info1005
);
1056 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1057 if (!W_ERROR_IS_OK(status
)) {
1061 r
->out
.info
->info1005
= info
.info1005
;
1065 return WERR_INVALID_LEVEL
;
1069 static WERROR
dcesrv_srvsvc_fill_share_info(struct share_info
*info
, int *count
,
1070 const char *share_name
, int level
,
1073 const char *comment
,
1074 const char *password
,
1075 enum srvsvc_ShareType type
,
1077 uint32_t csc_policy
,
1078 struct security_descriptor
*sd
)
1083 info
[i
].name
= SHARE_CSC_POLICY
;
1084 info
[i
].type
= SHARE_INFO_INT
;
1085 info
[i
].value
= talloc(info
, int);
1086 *((int *)info
[i
].value
) = csc_policy
;
1093 /* TODO: check if unknown is csc_policy */
1095 /* TODO: security descriptor */
1098 if (path
&& path
[0]) {
1099 info
[i
].name
= SHARE_PATH
;
1100 info
[i
].type
= SHARE_INFO_STRING
;
1102 /* Windows will send a path in a form of C:\example\path */
1103 if (path
[1] == ':') {
1104 info
[i
].value
= talloc_strdup(info
, &path
[2]);
1106 /* very strange let's try to set as is */
1107 info
[i
].value
= talloc_strdup(info
, path
);
1109 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1110 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
1115 if (password
&& password
[0]) {
1116 info
[i
].name
= SHARE_PASSWORD
;
1117 info
[i
].type
= SHARE_INFO_STRING
;
1118 info
[i
].value
= talloc_strdup(info
, password
);
1119 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1124 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
1125 info
[i
].type
= SHARE_INFO_INT
;
1126 info
[i
].value
= talloc(info
, int);
1127 *((int *)info
[i
].value
) = max_users
;
1133 info
[i
].name
= SHARE_TYPE
;
1134 info
[i
].type
= SHARE_INFO_STRING
;
1137 info
[i
].value
= talloc_strdup(info
, "DISK");
1140 info
[i
].value
= talloc_strdup(info
, "PRINTER");
1143 info
[i
].value
= talloc_strdup(info
, "IPC");
1146 return WERR_INVALID_PARAMETER
;
1148 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1154 info
[i
].name
= SHARE_COMMENT
;
1155 info
[i
].type
= SHARE_INFO_STRING
;
1156 info
[i
].value
= talloc_strdup(info
, comment
);
1157 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1165 strcasecmp(share_name
, name
) != 0) {
1166 info
[i
].name
= SHARE_NAME
;
1167 info
[i
].type
= SHARE_INFO_STRING
;
1168 info
[i
].value
= talloc_strdup(info
, name
);
1169 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1176 return WERR_INVALID_LEVEL
;
1185 srvsvc_NetShareSetInfo
1187 static WERROR
dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1188 struct srvsvc_NetShareSetInfo
*r
)
1192 struct share_context
*sctx
= NULL
;
1193 struct share_info
*info
;
1196 /* TODO: - access check
1199 /* there are no more than 10 options in all struct srvsvc_NetShareInfoXXX */
1200 info
= talloc_array(mem_ctx
, struct share_info
, 10);
1201 W_ERROR_HAVE_NO_MEMORY(info
);
1203 if (strcmp("", r
->in
.share_name
) == 0) {
1204 return WERR_INVALID_PARAMETER
;
1207 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
1208 if (!NT_STATUS_IS_OK(nterr
)) {
1209 return ntstatus_to_werror(nterr
);
1212 switch (r
->in
.level
) {
1215 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1216 r
->in
.share_name
, r
->in
.level
,
1217 r
->in
.info
->info0
->name
,
1225 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1232 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1233 r
->in
.share_name
, r
->in
.level
,
1234 r
->in
.info
->info1
->name
,
1236 r
->in
.info
->info1
->comment
,
1238 r
->in
.info
->info1
->type
,
1242 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1249 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1250 r
->in
.share_name
, r
->in
.level
,
1251 r
->in
.info
->info2
->name
,
1252 r
->in
.info
->info2
->path
,
1253 r
->in
.info
->info2
->comment
,
1254 r
->in
.info
->info2
->password
,
1255 r
->in
.info
->info2
->type
,
1256 r
->in
.info
->info2
->max_users
,
1259 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1266 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1267 r
->in
.share_name
, r
->in
.level
,
1268 r
->in
.info
->info501
->name
,
1270 r
->in
.info
->info501
->comment
,
1272 r
->in
.info
->info501
->type
,
1274 r
->in
.info
->info501
->csc_policy
,
1276 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1283 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1284 r
->in
.share_name
, r
->in
.level
,
1285 r
->in
.info
->info502
->name
,
1286 r
->in
.info
->info502
->path
,
1287 r
->in
.info
->info502
->comment
,
1288 r
->in
.info
->info502
->password
,
1289 r
->in
.info
->info502
->type
,
1290 r
->in
.info
->info502
->max_users
,
1292 r
->in
.info
->info502
->sd_buf
.sd
);
1293 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1300 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1301 r
->in
.share_name
, r
->in
.level
,
1304 r
->in
.info
->info1004
->comment
,
1310 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1317 /* r->in.info.dfs_flags; */
1319 if (r
->in
.parm_error
) {
1320 r
->out
.parm_error
= r
->in
.parm_error
;
1326 return WERR_INVALID_LEVEL
;
1329 nterr
= share_set(sctx
, r
->in
.share_name
, info
, count
);
1330 if (!NT_STATUS_IS_OK(nterr
)) {
1331 return ntstatus_to_werror(nterr
);
1334 if (r
->in
.parm_error
) {
1335 r
->out
.parm_error
= r
->in
.parm_error
;
1343 srvsvc_NetShareDelSticky
1345 static WERROR
dcesrv_srvsvc_NetShareDelSticky(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1346 struct srvsvc_NetShareDelSticky
*r
)
1348 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1353 srvsvc_NetShareCheck
1355 static WERROR
dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1356 struct srvsvc_NetShareCheck
*r
)
1359 struct share_context
*sctx
= NULL
;
1360 struct share_config
*scfg
= NULL
;
1368 /* TODO: - access check
1371 if (strcmp("", r
->in
.device_name
) == 0) {
1372 *r
->out
.type
= STYPE_IPC
;
1376 /* copy the path skipping C:\ */
1377 if (strncasecmp(r
->in
.device_name
, "C:", 2) == 0) {
1378 device
= talloc_strdup(mem_ctx
, &r
->in
.device_name
[2]);
1380 /* no chance we have a share that doesn't start with C:\ */
1381 return WERR_NERR_DEVICENOTSHARED
;
1383 all_string_sub(device
, "\\", "/", 0);
1385 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
1386 if (!NT_STATUS_IS_OK(nterr
)) {
1387 return ntstatus_to_werror(nterr
);
1390 nterr
= share_list_all(mem_ctx
, sctx
, &count
, &names
);
1391 if (!NT_STATUS_IS_OK(nterr
)) {
1392 return ntstatus_to_werror(nterr
);
1395 for (i
= 0; i
< count
; i
++) {
1399 nterr
= share_get_config(mem_ctx
, sctx
, names
[i
], &scfg
);
1400 if (!NT_STATUS_IS_OK(nterr
)) {
1401 return ntstatus_to_werror(nterr
);
1403 path
= share_string_option(mem_ctx
, scfg
, SHARE_PATH
, NULL
);
1404 if (!path
) continue;
1406 if (strcmp(device
, path
) == 0) {
1407 type
= share_string_option(mem_ctx
, scfg
, SHARE_TYPE
, NULL
);
1408 if (!type
) continue;
1410 if (strcmp(type
, "DISK") == 0) {
1411 *r
->out
.type
= STYPE_DISKTREE
;
1415 if (strcmp(type
, "IPC") == 0) {
1416 *r
->out
.type
= STYPE_IPC
;
1420 if (strcmp(type
, "PRINTER") == 0) {
1421 *r
->out
.type
= STYPE_PRINTQ
;
1427 return WERR_NERR_DEVICENOTSHARED
;
1432 srvsvc_NetSrvGetInfo
1434 static WERROR
dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1435 struct srvsvc_NetSrvGetInfo
*r
)
1437 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
1438 struct dcerpc_server_info
*server_info
= lpcfg_dcerpc_server_info(mem_ctx
, dce_ctx
->lp_ctx
);
1440 ZERO_STRUCTP(r
->out
.info
);
1442 switch (r
->in
.level
) {
1445 struct srvsvc_NetSrvInfo100
*info100
;
1447 info100
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo100
);
1448 W_ERROR_HAVE_NO_MEMORY(info100
);
1450 info100
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1451 info100
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1452 W_ERROR_HAVE_NO_MEMORY(info100
->server_name
);
1454 r
->out
.info
->info100
= info100
;
1459 struct srvsvc_NetSrvInfo101
*info101
;
1461 info101
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo101
);
1462 W_ERROR_HAVE_NO_MEMORY(info101
);
1464 info101
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1465 info101
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1466 W_ERROR_HAVE_NO_MEMORY(info101
->server_name
);
1468 info101
->version_major
= server_info
->version_major
;
1469 info101
->version_minor
= server_info
->version_minor
;
1470 info101
->server_type
= dcesrv_common_get_server_type(mem_ctx
, dce_call
->event_ctx
, dce_ctx
);
1471 info101
->comment
= lpcfg_server_string(dce_ctx
->lp_ctx
, mem_ctx
);
1472 W_ERROR_HAVE_NO_MEMORY(info101
->comment
);
1474 r
->out
.info
->info101
= info101
;
1479 struct srvsvc_NetSrvInfo102
*info102
;
1481 info102
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo102
);
1482 W_ERROR_HAVE_NO_MEMORY(info102
);
1484 info102
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1485 info102
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1486 W_ERROR_HAVE_NO_MEMORY(info102
->server_name
);
1488 info102
->version_major
= server_info
->version_major
;
1489 info102
->version_minor
= server_info
->version_minor
;
1490 info102
->server_type
= dcesrv_common_get_server_type(mem_ctx
, dce_call
->event_ctx
, dce_ctx
);
1491 info102
->comment
= lpcfg_server_string(dce_ctx
->lp_ctx
, mem_ctx
);
1492 W_ERROR_HAVE_NO_MEMORY(info102
->comment
);
1494 info102
->users
= dcesrv_common_get_users(mem_ctx
, dce_ctx
);
1495 info102
->disc
= dcesrv_common_get_disc(mem_ctx
, dce_ctx
);
1496 info102
->hidden
= dcesrv_common_get_hidden(mem_ctx
, dce_ctx
);
1497 info102
->announce
= dcesrv_common_get_announce(mem_ctx
, dce_ctx
);
1498 info102
->anndelta
= dcesrv_common_get_anndelta(mem_ctx
, dce_ctx
);
1499 info102
->licenses
= dcesrv_common_get_licenses(mem_ctx
, dce_ctx
);
1500 info102
->userpath
= dcesrv_common_get_userpath(mem_ctx
, dce_ctx
);
1501 W_ERROR_HAVE_NO_MEMORY(info102
->userpath
);
1503 r
->out
.info
->info102
= info102
;
1507 return WERR_INVALID_LEVEL
;
1513 srvsvc_NetSrvSetInfo
1515 static WERROR
dcesrv_srvsvc_NetSrvSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1516 struct srvsvc_NetSrvSetInfo
*r
)
1518 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1525 static WERROR
dcesrv_srvsvc_NetDiskEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1526 struct srvsvc_NetDiskEnum
*r
)
1528 r
->out
.info
->disks
= NULL
;
1529 r
->out
.info
->count
= 0;
1530 *r
->out
.totalentries
= 0;
1532 switch (r
->in
.level
) {
1535 /* we can safely hardcode the reply and report we have only one disk (C:) */
1536 /* for some reason Windows wants 2 entries with the second being empty */
1537 r
->out
.info
->disks
= talloc_array(mem_ctx
, struct srvsvc_NetDiskInfo0
, 2);
1538 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
);
1539 r
->out
.info
->count
= 2;
1541 r
->out
.info
->disks
[0].disk
= talloc_strdup(mem_ctx
, "C:");
1542 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
[0].disk
);
1544 r
->out
.info
->disks
[1].disk
= talloc_strdup(mem_ctx
, "");
1545 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
[1].disk
);
1547 *r
->out
.totalentries
= 1;
1548 r
->out
.resume_handle
= r
->in
.resume_handle
;
1553 return WERR_INVALID_LEVEL
;
1559 srvsvc_NetServerStatisticsGet
1561 static WERROR
dcesrv_srvsvc_NetServerStatisticsGet(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1562 struct srvsvc_NetServerStatisticsGet
*r
)
1564 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1569 srvsvc_NetTransportAdd
1571 static WERROR
dcesrv_srvsvc_NetTransportAdd(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1572 struct srvsvc_NetTransportAdd
*r
)
1574 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1579 srvsvc_NetTransportEnum
1581 static WERROR
dcesrv_srvsvc_NetTransportEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1582 struct srvsvc_NetTransportEnum
*r
)
1584 r
->out
.transports
->level
= r
->in
.transports
->level
;
1585 *r
->out
.totalentries
= 0;
1586 if (r
->out
.resume_handle
) {
1587 *r
->out
.resume_handle
= 0;
1590 switch (r
->in
.transports
->level
) {
1593 r
->out
.transports
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr0
);
1594 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr0
);
1596 r
->out
.transports
->ctr
.ctr0
->count
= 0;
1597 r
->out
.transports
->ctr
.ctr0
->array
= NULL
;
1599 return WERR_NOT_SUPPORTED
;
1603 r
->out
.transports
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr1
);
1604 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr1
);
1606 r
->out
.transports
->ctr
.ctr1
->count
= 0;
1607 r
->out
.transports
->ctr
.ctr1
->array
= NULL
;
1609 return WERR_NOT_SUPPORTED
;
1613 r
->out
.transports
->ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr2
);
1614 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr2
);
1616 r
->out
.transports
->ctr
.ctr2
->count
= 0;
1617 r
->out
.transports
->ctr
.ctr2
->array
= NULL
;
1619 return WERR_NOT_SUPPORTED
;
1623 r
->out
.transports
->ctr
.ctr3
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr3
);
1624 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr3
);
1626 r
->out
.transports
->ctr
.ctr3
->count
= 0;
1627 r
->out
.transports
->ctr
.ctr3
->array
= NULL
;
1629 return WERR_NOT_SUPPORTED
;
1632 return WERR_INVALID_LEVEL
;
1637 srvsvc_NetTransportDel
1639 static WERROR
dcesrv_srvsvc_NetTransportDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1640 struct srvsvc_NetTransportDel
*r
)
1642 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1649 static WERROR
dcesrv_srvsvc_NetRemoteTOD(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1650 struct srvsvc_NetRemoteTOD
*r
)
1652 struct timeval tval
;
1655 struct srvsvc_NetRemoteTODInfo
*info
;
1657 info
= talloc(mem_ctx
, struct srvsvc_NetRemoteTODInfo
);
1658 W_ERROR_HAVE_NO_MEMORY(info
);
1660 GetTimeOfDay(&tval
);
1666 /* TODO: fake the uptime: just return the milliseconds till 0:00:00 today */
1667 info
->msecs
= (tm
.tm_hour
*60*60*1000)
1668 + (tm
.tm_min
*60*1000)
1670 + (tval
.tv_usec
/1000);
1671 info
->hours
= tm
.tm_hour
;
1672 info
->mins
= tm
.tm_min
;
1673 info
->secs
= tm
.tm_sec
;
1674 info
->hunds
= tval
.tv_usec
/10000;
1675 info
->timezone
= get_time_zone(t
)/60;
1676 info
->tinterval
= 310; /* just return the same as windows */
1677 info
->day
= tm
.tm_mday
;
1678 info
->month
= tm
.tm_mon
+ 1;
1679 info
->year
= tm
.tm_year
+ 1900;
1680 info
->weekday
= tm
.tm_wday
;
1682 *r
->out
.info
= info
;
1690 static WERROR
dcesrv_srvsvc_NetPathType(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1691 struct srvsvc_NetPathType
*r
)
1693 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1698 srvsvc_NetPathCanonicalize
1700 static WERROR
dcesrv_srvsvc_NetPathCanonicalize(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1701 struct srvsvc_NetPathCanonicalize
*r
)
1703 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1708 srvsvc_NetPathCompare
1710 static WERROR
dcesrv_srvsvc_NetPathCompare(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1711 struct srvsvc_NetPathCompare
*r
)
1713 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1718 srvsvc_NetNameValidate
1720 static WERROR
dcesrv_srvsvc_NetNameValidate(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1721 struct srvsvc_NetNameValidate
*r
)
1725 if ((r
->in
.flags
!= 0x0) && (r
->in
.flags
!= 0x80000000)) {
1726 return WERR_INVALID_NAME
;
1729 switch (r
->in
.name_type
) {
1738 return WERR_NOT_SUPPORTED
;
1740 case 9: /* validate share name */
1742 len
= strlen_m(r
->in
.name
);
1743 if ((r
->in
.flags
== 0x0) && (len
> 81)) {
1744 return WERR_INVALID_NAME
;
1746 if ((r
->in
.flags
== 0x80000000) && (len
> 13)) {
1747 return WERR_INVALID_NAME
;
1749 if (! dcesrv_common_validate_share_name(mem_ctx
, r
->in
.name
)) {
1750 return WERR_INVALID_NAME
;
1758 return WERR_NOT_SUPPORTED
;
1760 return WERR_INVALID_PARAMETER
;
1766 srvsvc_NetPRNameCompare
1768 static WERROR
dcesrv_srvsvc_NetPRNameCompare(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1769 struct srvsvc_NetPRNameCompare
*r
)
1771 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1778 static WERROR
dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1779 struct srvsvc_NetShareEnum
*r
)
1783 const char **snames
;
1784 struct share_context
*sctx
;
1785 struct share_config
*scfg
;
1786 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
1788 *r
->out
.totalentries
= 0;
1790 /* TODO: - paging of results
1793 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
1794 if (!NT_STATUS_IS_OK(nterr
)) {
1795 return ntstatus_to_werror(nterr
);
1798 nterr
= share_list_all(mem_ctx
, sctx
, &numshares
, &snames
);
1799 if (!NT_STATUS_IS_OK(nterr
)) {
1800 return ntstatus_to_werror(nterr
);
1803 switch (r
->in
.info_ctr
->level
) {
1806 unsigned int i
, y
= 0;
1808 struct srvsvc_NetShareCtr0
*ctr0
;
1810 ctr0
= talloc(mem_ctx
, struct srvsvc_NetShareCtr0
);
1811 W_ERROR_HAVE_NO_MEMORY(ctr0
);
1814 ctr0
->count
= count
;
1817 if (ctr0
->count
== 0) {
1818 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
1822 ctr0
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo0
, count
);
1823 W_ERROR_HAVE_NO_MEMORY(ctr0
->array
);
1825 for (i
=0; i
< count
; i
++) {
1827 union srvsvc_NetShareInfo info
;
1828 enum srvsvc_ShareType type
;
1830 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1831 if (!NT_STATUS_IS_OK(nterr
)) {
1832 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1833 return WERR_GEN_FAILURE
;
1836 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1837 if (type
& STYPE_HIDDEN
) {
1843 info
.info0
= &ctr0
->array
[y
];
1844 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
1845 W_ERROR_NOT_OK_RETURN(status
);
1849 talloc_free(snames
);
1851 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
1852 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr0
->count
;
1858 unsigned int i
, y
= 0;
1860 struct srvsvc_NetShareCtr1
*ctr1
;
1862 ctr1
= talloc(mem_ctx
, struct srvsvc_NetShareCtr1
);
1863 W_ERROR_HAVE_NO_MEMORY(ctr1
);
1866 ctr1
->count
= count
;
1869 if (ctr1
->count
== 0) {
1870 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
1874 ctr1
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo1
, count
);
1875 W_ERROR_HAVE_NO_MEMORY(ctr1
->array
);
1877 for (i
=0; i
< count
; i
++) {
1879 union srvsvc_NetShareInfo info
;
1880 enum srvsvc_ShareType type
;
1882 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1883 if (!NT_STATUS_IS_OK(nterr
)) {
1884 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1885 return WERR_GEN_FAILURE
;
1888 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1889 if (type
& STYPE_HIDDEN
) {
1895 info
.info1
= &ctr1
->array
[y
];
1896 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
1897 W_ERROR_NOT_OK_RETURN(status
);
1901 talloc_free(snames
);
1903 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
1904 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr1
->count
;
1910 unsigned int i
, y
= 0;
1912 struct srvsvc_NetShareCtr2
*ctr2
;
1914 SRVSVC_CHECK_ADMIN_ACCESS
;
1916 ctr2
= talloc(mem_ctx
, struct srvsvc_NetShareCtr2
);
1917 W_ERROR_HAVE_NO_MEMORY(ctr2
);
1920 ctr2
->count
= count
;
1923 if (ctr2
->count
== 0) {
1924 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
1928 ctr2
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo2
, count
);
1929 W_ERROR_HAVE_NO_MEMORY(ctr2
->array
);
1931 for (i
=0; i
< count
; i
++) {
1933 union srvsvc_NetShareInfo info
;
1934 enum srvsvc_ShareType type
;
1936 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1937 if (!NT_STATUS_IS_OK(nterr
)) {
1938 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1939 return WERR_GEN_FAILURE
;
1942 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1943 if (type
& STYPE_HIDDEN
) {
1949 info
.info2
= &ctr2
->array
[y
];
1950 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
1951 W_ERROR_NOT_OK_RETURN(status
);
1955 talloc_free(snames
);
1957 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
1958 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr2
->count
;
1964 unsigned int i
, y
= 0;
1966 struct srvsvc_NetShareCtr502
*ctr502
;
1968 SRVSVC_CHECK_ADMIN_ACCESS
;
1970 ctr502
= talloc(mem_ctx
, struct srvsvc_NetShareCtr502
);
1971 W_ERROR_HAVE_NO_MEMORY(ctr502
);
1974 ctr502
->count
= count
;
1975 ctr502
->array
= NULL
;
1977 if (ctr502
->count
== 0) {
1978 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
1982 ctr502
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo502
, count
);
1983 W_ERROR_HAVE_NO_MEMORY(ctr502
->array
);
1985 for (i
=0; i
< count
; i
++) {
1987 union srvsvc_NetShareInfo info
;
1988 enum srvsvc_ShareType type
;
1990 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1991 if (!NT_STATUS_IS_OK(nterr
)) {
1992 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1993 return WERR_GEN_FAILURE
;
1996 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1997 if (type
& STYPE_HIDDEN
) {
2003 info
.info502
= &ctr502
->array
[y
];
2004 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
2005 W_ERROR_NOT_OK_RETURN(status
);
2009 talloc_free(snames
);
2011 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
2012 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr502
->count
;
2017 return WERR_INVALID_LEVEL
;
2023 srvsvc_NetShareDelStart
2025 static WERROR
dcesrv_srvsvc_NetShareDelStart(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2026 struct srvsvc_NetShareDelStart
*r
)
2028 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2033 srvsvc_NetShareDelCommit
2035 static WERROR
dcesrv_srvsvc_NetShareDelCommit(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2036 struct srvsvc_NetShareDelCommit
*r
)
2038 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2043 srvsvc_NetGetFileSecurity
2045 static WERROR
dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2046 struct srvsvc_NetGetFileSecurity
*r
)
2048 struct sec_desc_buf
*sd_buf
;
2049 struct ntvfs_context
*ntvfs_ctx
= NULL
;
2050 struct ntvfs_request
*ntvfs_req
;
2051 union smb_fileinfo
*io
;
2054 nt_status
= srvsvc_create_ntvfs_context(dce_call
, mem_ctx
, r
->in
.share
, &ntvfs_ctx
);
2055 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2057 ntvfs_req
= ntvfs_request_create(ntvfs_ctx
, mem_ctx
,
2058 dce_call
->conn
->auth_state
.session_info
,
2062 W_ERROR_HAVE_NO_MEMORY(ntvfs_req
);
2064 sd_buf
= talloc(mem_ctx
, struct sec_desc_buf
);
2065 W_ERROR_HAVE_NO_MEMORY(sd_buf
);
2067 io
= talloc(mem_ctx
, union smb_fileinfo
);
2068 W_ERROR_HAVE_NO_MEMORY(io
);
2070 io
->query_secdesc
.level
= RAW_FILEINFO_SEC_DESC
;
2071 io
->query_secdesc
.in
.file
.path
= r
->in
.file
;
2072 io
->query_secdesc
.in
.secinfo_flags
= r
->in
.securityinformation
;
2074 nt_status
= ntvfs_qpathinfo(ntvfs_req
, io
);
2075 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2077 sd_buf
->sd
= io
->query_secdesc
.out
.sd
;
2079 *r
->out
.sd_buf
= sd_buf
;
2085 srvsvc_NetSetFileSecurity
2087 static WERROR
dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2088 struct srvsvc_NetSetFileSecurity
*r
)
2090 struct ntvfs_context
*ntvfs_ctx
;
2091 struct ntvfs_request
*ntvfs_req
;
2092 union smb_setfileinfo
*io
;
2095 nt_status
= srvsvc_create_ntvfs_context(dce_call
, mem_ctx
, r
->in
.share
, &ntvfs_ctx
);
2096 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2098 ntvfs_req
= ntvfs_request_create(ntvfs_ctx
, mem_ctx
,
2099 dce_call
->conn
->auth_state
.session_info
,
2103 W_ERROR_HAVE_NO_MEMORY(ntvfs_req
);
2105 io
= talloc(mem_ctx
, union smb_setfileinfo
);
2106 W_ERROR_HAVE_NO_MEMORY(io
);
2108 io
->set_secdesc
.level
= RAW_SFILEINFO_SEC_DESC
;
2109 io
->set_secdesc
.in
.file
.path
= r
->in
.file
;
2110 io
->set_secdesc
.in
.secinfo_flags
= r
->in
.securityinformation
;
2111 io
->set_secdesc
.in
.sd
= r
->in
.sd_buf
->sd
;
2113 nt_status
= ntvfs_setpathinfo(ntvfs_req
, io
);
2114 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2121 srvsvc_NetServerTransportAddEx
2123 static WERROR
dcesrv_srvsvc_NetServerTransportAddEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2124 struct srvsvc_NetServerTransportAddEx
*r
)
2126 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2131 srvsvc_NetServerSetServiceBitsEx
2133 static WERROR
dcesrv_srvsvc_NetServerSetServiceBitsEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2134 struct srvsvc_NetServerSetServiceBitsEx
*r
)
2136 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2141 srvsvc_NETRDFSGETVERSION
2143 static WERROR
dcesrv_srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2144 struct srvsvc_NETRDFSGETVERSION
*r
)
2146 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2151 srvsvc_NETRDFSCREATELOCALPARTITION
2153 static WERROR
dcesrv_srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2154 struct srvsvc_NETRDFSCREATELOCALPARTITION
*r
)
2156 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2161 srvsvc_NETRDFSDELETELOCALPARTITION
2163 static WERROR
dcesrv_srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2164 struct srvsvc_NETRDFSDELETELOCALPARTITION
*r
)
2166 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2171 srvsvc_NETRDFSSETLOCALVOLUMESTATE
2173 static WERROR
dcesrv_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2174 struct srvsvc_NETRDFSSETLOCALVOLUMESTATE
*r
)
2176 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2181 srvsvc_NETRDFSSETSERVERINFO
2183 static WERROR
dcesrv_srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2184 struct srvsvc_NETRDFSSETSERVERINFO
*r
)
2186 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2191 srvsvc_NETRDFSCREATEEXITPOINT
2193 static WERROR
dcesrv_srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2194 struct srvsvc_NETRDFSCREATEEXITPOINT
*r
)
2196 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2201 srvsvc_NETRDFSDELETEEXITPOINT
2203 static WERROR
dcesrv_srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2204 struct srvsvc_NETRDFSDELETEEXITPOINT
*r
)
2206 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2211 srvsvc_NETRDFSMODIFYPREFIX
2213 static WERROR
dcesrv_srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2214 struct srvsvc_NETRDFSMODIFYPREFIX
*r
)
2216 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2221 srvsvc_NETRDFSFIXLOCALVOLUME
2223 static WERROR
dcesrv_srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2224 struct srvsvc_NETRDFSFIXLOCALVOLUME
*r
)
2226 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2231 srvsvc_NETRDFSMANAGERREPORTSITEINFO
2233 static WERROR
dcesrv_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2234 struct srvsvc_NETRDFSMANAGERREPORTSITEINFO
*r
)
2236 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2241 srvsvc_NETRSERVERTRANSPORTDELEX
2243 static WERROR
dcesrv_srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2244 struct srvsvc_NETRSERVERTRANSPORTDELEX
*r
)
2246 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2252 static WERROR
dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2253 struct srvsvc_NetShareDel
*r
)
2256 struct share_context
*sctx
;
2258 nterr
= share_get_context_by_name(mem_ctx
, lpcfg_share_backend(dce_call
->conn
->dce_ctx
->lp_ctx
), dce_call
->event_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
2259 if (!NT_STATUS_IS_OK(nterr
)) {
2260 return ntstatus_to_werror(nterr
);
2263 nterr
= share_remove(sctx
, r
->in
.share_name
);
2264 if (!NT_STATUS_IS_OK(nterr
)) {
2265 return ntstatus_to_werror(nterr
);
2272 srvsvc_NetSetServiceBits
2274 static WERROR
dcesrv_srvsvc_NetSetServiceBits(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2275 struct srvsvc_NetSetServiceBits
*r
)
2277 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2281 srvsvc_NETRPRNAMECANONICALIZE
2283 static WERROR
dcesrv_srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2284 struct srvsvc_NETRPRNAMECANONICALIZE
*r
)
2286 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2289 /* include the generated boilerplate */
2290 #include "librpc/gen_ndr/ndr_srvsvc_s.c"