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/proto.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_string(t, 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_UNKNOWN_LEVEL
;
78 srvsvc_NetCharDevGetInfo
80 static WERROR
dcesrv_srvsvc_NetCharDevGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
81 struct srvsvc_NetCharDevGetInfo
*r
)
83 ZERO_STRUCTP(r
->out
.info
);
85 switch (r
->in
.level
) {
88 return WERR_NOT_SUPPORTED
;
92 return WERR_NOT_SUPPORTED
;
95 return WERR_UNKNOWN_LEVEL
;
98 return WERR_UNKNOWN_LEVEL
;
103 srvsvc_NetCharDevControl
105 static WERROR
dcesrv_srvsvc_NetCharDevControl(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
106 struct srvsvc_NetCharDevControl
*r
)
108 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
113 srvsvc_NetCharDevQEnum
115 static WERROR
dcesrv_srvsvc_NetCharDevQEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
116 struct srvsvc_NetCharDevQEnum
*r
)
118 *r
->out
.totalentries
= 0;
120 switch (r
->in
.info_ctr
->level
) {
123 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetCharDevQCtr0
);
124 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
126 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
127 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
129 return WERR_NOT_SUPPORTED
;
133 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetCharDevQCtr1
);
134 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
136 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
137 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
139 return WERR_NOT_SUPPORTED
;
142 return WERR_UNKNOWN_LEVEL
;
145 return WERR_UNKNOWN_LEVEL
;
150 srvsvc_NetCharDevQGetInfo
152 static WERROR
dcesrv_srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
153 struct srvsvc_NetCharDevQGetInfo
*r
)
155 ZERO_STRUCTP(r
->out
.info
);
157 switch (r
->in
.level
) {
160 return WERR_NOT_SUPPORTED
;
164 return WERR_NOT_SUPPORTED
;
167 return WERR_UNKNOWN_LEVEL
;
170 return WERR_UNKNOWN_LEVEL
;
175 srvsvc_NetCharDevQSetInfo
177 static WERROR
dcesrv_srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
178 struct srvsvc_NetCharDevQSetInfo
*r
)
180 switch (r
->in
.level
) {
183 if (r
->in
.parm_error
) {
184 r
->out
.parm_error
= r
->in
.parm_error
;
186 return WERR_NOT_SUPPORTED
;
190 if (r
->in
.parm_error
) {
191 r
->out
.parm_error
= r
->in
.parm_error
;
193 return WERR_NOT_SUPPORTED
;
196 return WERR_UNKNOWN_LEVEL
;
199 return WERR_UNKNOWN_LEVEL
;
204 srvsvc_NetCharDevQPurge
206 static WERROR
dcesrv_srvsvc_NetCharDevQPurge(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
207 struct srvsvc_NetCharDevQPurge
*r
)
209 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
214 srvsvc_NetCharDevQPurgeSelf
216 static WERROR
dcesrv_srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
217 struct srvsvc_NetCharDevQPurgeSelf
*r
)
219 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
226 static WERROR
dcesrv_srvsvc_NetConnEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
227 struct srvsvc_NetConnEnum
*r
)
229 *r
->out
.totalentries
= 0;
231 switch (r
->in
.info_ctr
->level
) {
234 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetConnCtr0
);
235 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
237 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
238 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
240 return WERR_NOT_SUPPORTED
;
244 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetConnCtr1
);
245 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
247 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
248 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
250 return WERR_NOT_SUPPORTED
;
253 return WERR_UNKNOWN_LEVEL
;
256 return WERR_UNKNOWN_LEVEL
;
263 static WERROR
dcesrv_srvsvc_NetFileEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
264 struct srvsvc_NetFileEnum
*r
)
266 r
->out
.level
= r
->in
.level
;
267 r
->out
.totalentries
= 0;
268 r
->out
.resume_handle
= NULL
;
270 switch (r
->in
.level
) {
273 r
->out
.ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetFileCtr2
);
274 W_ERROR_HAVE_NO_MEMORY(r
->out
.ctr
.ctr2
);
276 r
->out
.ctr
.ctr2
->count
= 0;
277 r
->out
.ctr
.ctr2
->array
= NULL
;
279 return WERR_NOT_SUPPORTED
;
283 r
->out
.ctr
.ctr3
= talloc(mem_ctx
, struct srvsvc_NetFileCtr3
);
284 W_ERROR_HAVE_NO_MEMORY(r
->out
.ctr
.ctr3
);
286 r
->out
.ctr
.ctr3
->count
= 0;
287 r
->out
.ctr
.ctr3
->array
= NULL
;
289 return WERR_NOT_SUPPORTED
;
292 return WERR_UNKNOWN_LEVEL
;
295 return WERR_UNKNOWN_LEVEL
;
300 srvsvc_NetFileGetInfo
302 static WERROR
dcesrv_srvsvc_NetFileGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
303 struct srvsvc_NetFileGetInfo
*r
)
305 ZERO_STRUCTP(r
->out
.info
);
307 switch (r
->in
.level
) {
310 return WERR_NOT_SUPPORTED
;
314 return WERR_NOT_SUPPORTED
;
317 return WERR_UNKNOWN_LEVEL
;
320 return WERR_UNKNOWN_LEVEL
;
327 static WERROR
dcesrv_srvsvc_NetFileClose(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
328 struct srvsvc_NetFileClose
*r
)
330 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
337 static WERROR
dcesrv_srvsvc_NetSessEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
338 struct srvsvc_NetSessEnum
*r
)
340 r
->out
.level
= r
->in
.level
;
341 r
->out
.totalentries
= 0;
342 r
->out
.resume_handle
= NULL
;
344 switch (r
->in
.level
) {
347 r
->out
.ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetSessCtr0
);
348 W_ERROR_HAVE_NO_MEMORY(r
->out
.ctr
.ctr0
);
350 r
->out
.ctr
.ctr0
->count
= 0;
351 r
->out
.ctr
.ctr0
->array
= NULL
;
353 return WERR_NOT_SUPPORTED
;
357 r
->out
.ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetSessCtr1
);
358 W_ERROR_HAVE_NO_MEMORY(r
->out
.ctr
.ctr1
);
360 r
->out
.ctr
.ctr1
->count
= 0;
361 r
->out
.ctr
.ctr1
->array
= NULL
;
363 return WERR_NOT_SUPPORTED
;
367 r
->out
.ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetSessCtr2
);
368 W_ERROR_HAVE_NO_MEMORY(r
->out
.ctr
.ctr2
);
370 r
->out
.ctr
.ctr2
->count
= 0;
371 r
->out
.ctr
.ctr2
->array
= NULL
;
373 return WERR_NOT_SUPPORTED
;
377 r
->out
.ctr
.ctr10
= talloc(mem_ctx
, struct srvsvc_NetSessCtr10
);
378 W_ERROR_HAVE_NO_MEMORY(r
->out
.ctr
.ctr10
);
380 r
->out
.ctr
.ctr2
->count
= 0;
381 r
->out
.ctr
.ctr2
->array
= NULL
;
383 return WERR_NOT_SUPPORTED
;
387 r
->out
.ctr
.ctr502
= talloc(mem_ctx
, struct srvsvc_NetSessCtr502
);
388 W_ERROR_HAVE_NO_MEMORY(r
->out
.ctr
.ctr502
);
390 r
->out
.ctr
.ctr2
->count
= 0;
391 r
->out
.ctr
.ctr2
->array
= NULL
;
393 return WERR_NOT_SUPPORTED
;
396 return WERR_UNKNOWN_LEVEL
;
399 return WERR_UNKNOWN_LEVEL
;
406 static WERROR
dcesrv_srvsvc_NetSessDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
407 struct srvsvc_NetSessDel
*r
)
409 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
416 static WERROR
dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
417 struct srvsvc_NetShareAdd
*r
)
419 switch (r
->in
.level
) {
422 if (r
->in
.parm_error
) {
423 r
->out
.parm_error
= r
->in
.parm_error
;
425 return WERR_NOT_SUPPORTED
;
429 if (r
->in
.parm_error
) {
430 r
->out
.parm_error
= r
->in
.parm_error
;
432 return WERR_NOT_SUPPORTED
;
437 struct share_info
*info
;
438 struct share_context
*sctx
;
442 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
);
443 if (!NT_STATUS_IS_OK(nterr
)) {
444 return ntstatus_to_werror(nterr
);
447 /* there are no more than 8 options in struct srvsvc_NetShareInfo2 */
448 info
= talloc_array(mem_ctx
, struct share_info
, count
);
449 W_ERROR_HAVE_NO_MEMORY(info
);
453 info
[i
].name
= SHARE_TYPE
;
454 info
[i
].type
= SHARE_INFO_STRING
;
455 switch (r
->in
.info
->info2
->type
) {
457 info
[i
].value
= talloc_strdup(info
, "DISK");
460 info
[i
].value
= talloc_strdup(info
, "PRINTER");
463 info
[i
].value
= talloc_strdup(info
, "IPC");
466 return WERR_INVALID_PARAM
;
468 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
471 if (r
->in
.info
->info2
->path
&& r
->in
.info
->info2
->path
[0]) {
472 info
[i
].name
= SHARE_PATH
;
473 info
[i
].type
= SHARE_INFO_STRING
;
475 /* Windows will send a path in a form of C:\example\path */
476 if (r
->in
.info
->info2
->path
[1] == ':') {
477 info
[i
].value
= talloc_strdup(info
, &r
->in
.info
->info2
->path
[2]);
479 /* very strange let's try to set as is */
480 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->path
);
482 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
483 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
488 if (r
->in
.info
->info2
->comment
&& r
->in
.info
->info2
->comment
[0]) {
489 info
[i
].name
= SHARE_COMMENT
;
490 info
[i
].type
= SHARE_INFO_STRING
;
491 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->comment
);
492 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
497 if (r
->in
.info
->info2
->password
&& r
->in
.info
->info2
->password
[0]) {
498 info
[i
].name
= SHARE_PASSWORD
;
499 info
[i
].type
= SHARE_INFO_STRING
;
500 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->password
);
501 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
506 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
507 info
[i
].type
= SHARE_INFO_INT
;
508 info
[i
].value
= talloc(info
, int);
509 *((int *)info
[i
].value
) = r
->in
.info
->info2
->max_users
;
512 /* TODO: security descriptor */
514 nterr
= share_create(sctx
, r
->in
.info
->info2
->name
, info
, i
);
515 if (!NT_STATUS_IS_OK(nterr
)) {
516 return ntstatus_to_werror(nterr
);
519 if (r
->in
.parm_error
) {
520 r
->out
.parm_error
= r
->in
.parm_error
;
527 if (r
->in
.parm_error
) {
528 r
->out
.parm_error
= r
->in
.parm_error
;
530 return WERR_NOT_SUPPORTED
;
535 struct share_info
*info
;
536 struct share_context
*sctx
;
540 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
);
541 if (!NT_STATUS_IS_OK(nterr
)) {
542 return ntstatus_to_werror(nterr
);
545 /* there are no more than 10 options in struct srvsvc_NetShareInfo502 */
546 info
= talloc_array(mem_ctx
, struct share_info
, count
);
547 W_ERROR_HAVE_NO_MEMORY(info
);
551 info
[i
].name
= SHARE_TYPE
;
552 info
[i
].type
= SHARE_INFO_STRING
;
553 switch (r
->in
.info
->info502
->type
) {
555 info
[i
].value
= talloc_strdup(info
, "DISK");
558 info
[i
].value
= talloc_strdup(info
, "PRINTER");
561 info
[i
].value
= talloc_strdup(info
, "IPC");
564 return WERR_INVALID_PARAM
;
566 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
569 if (r
->in
.info
->info502
->path
&& r
->in
.info
->info502
->path
[0]) {
570 info
[i
].name
= SHARE_PATH
;
571 info
[i
].type
= SHARE_INFO_STRING
;
573 /* Windows will send a path in a form of C:\example\path */
574 if (r
->in
.info
->info502
->path
[1] == ':') {
575 info
[i
].value
= talloc_strdup(info
, &r
->in
.info
->info502
->path
[2]);
577 /* very strange let's try to set as is */
578 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->path
);
580 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
581 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
586 if (r
->in
.info
->info502
->comment
&& r
->in
.info
->info502
->comment
[0]) {
587 info
[i
].name
= SHARE_COMMENT
;
588 info
[i
].type
= SHARE_INFO_STRING
;
589 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->comment
);
590 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
595 if (r
->in
.info
->info502
->password
&& r
->in
.info
->info502
->password
[0]) {
596 info
[i
].name
= SHARE_PASSWORD
;
597 info
[i
].type
= SHARE_INFO_STRING
;
598 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->password
);
599 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
604 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
605 info
[i
].type
= SHARE_INFO_INT
;
606 info
[i
].value
= talloc(info
, int);
607 *((int *)info
[i
].value
) = r
->in
.info
->info502
->max_users
;
610 /* TODO: security descriptor */
612 nterr
= share_create(sctx
, r
->in
.info
->info502
->name
, info
, i
);
613 if (!NT_STATUS_IS_OK(nterr
)) {
614 return ntstatus_to_werror(nterr
);
617 if (r
->in
.parm_error
) {
618 r
->out
.parm_error
= r
->in
.parm_error
;
624 return WERR_UNKNOWN_LEVEL
;
627 return WERR_UNKNOWN_LEVEL
;
630 static WERROR
dcesrv_srvsvc_fiel_ShareInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
631 struct share_config
*scfg
, uint32_t level
,
632 union srvsvc_NetShareInfo
*info
)
634 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
639 info
->info0
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
640 W_ERROR_HAVE_NO_MEMORY(info
->info0
->name
);
646 info
->info1
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
647 W_ERROR_HAVE_NO_MEMORY(info
->info1
->name
);
648 info
->info1
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
649 info
->info1
->comment
= talloc_strdup(mem_ctx
, share_string_option(scfg
, SHARE_COMMENT
, ""));
650 W_ERROR_HAVE_NO_MEMORY(info
->info1
->comment
);
656 info
->info2
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
657 W_ERROR_HAVE_NO_MEMORY(info
->info2
->name
);
658 info
->info2
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
659 info
->info2
->comment
= talloc_strdup(mem_ctx
, share_string_option(scfg
, SHARE_COMMENT
, ""));
660 W_ERROR_HAVE_NO_MEMORY(info
->info2
->comment
);
661 info
->info2
->permissions
= dcesrv_common_get_share_permissions(mem_ctx
, dce_ctx
, scfg
);
662 info
->info2
->max_users
= share_int_option(scfg
, SHARE_MAX_CONNECTIONS
, SHARE_MAX_CONNECTIONS_DEFAULT
);
663 info
->info2
->current_users
= dcesrv_common_get_share_current_users(mem_ctx
, dce_ctx
, scfg
);
664 info
->info2
->path
= dcesrv_common_get_share_path(mem_ctx
, dce_ctx
, scfg
);
665 W_ERROR_HAVE_NO_MEMORY(info
->info2
->path
);
666 info
->info2
->password
= talloc_strdup(mem_ctx
, share_string_option(scfg
, SHARE_PASSWORD
, NULL
));
672 info
->info501
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
673 W_ERROR_HAVE_NO_MEMORY(info
->info501
->name
);
674 info
->info501
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
675 info
->info501
->comment
= talloc_strdup(mem_ctx
, share_string_option(scfg
, SHARE_COMMENT
, ""));
676 W_ERROR_HAVE_NO_MEMORY(info
->info501
->comment
);
677 info
->info501
->csc_policy
= share_int_option(scfg
, SHARE_CSC_POLICY
, SHARE_CSC_POLICY_DEFAULT
);
683 info
->info502
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
684 W_ERROR_HAVE_NO_MEMORY(info
->info502
->name
);
685 info
->info502
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
686 info
->info502
->comment
= talloc_strdup(mem_ctx
, share_string_option(scfg
, SHARE_COMMENT
, ""));
687 W_ERROR_HAVE_NO_MEMORY(info
->info502
->comment
);
688 info
->info502
->permissions
= dcesrv_common_get_share_permissions(mem_ctx
, dce_ctx
, scfg
);
689 info
->info502
->max_users
= share_int_option(scfg
, SHARE_MAX_CONNECTIONS
, SHARE_MAX_CONNECTIONS_DEFAULT
);
690 info
->info502
->current_users
= dcesrv_common_get_share_current_users(mem_ctx
, dce_ctx
, scfg
);
691 info
->info502
->path
= dcesrv_common_get_share_path(mem_ctx
, dce_ctx
, scfg
);
692 W_ERROR_HAVE_NO_MEMORY(info
->info502
->path
);
693 info
->info502
->password
= talloc_strdup(mem_ctx
, share_string_option(scfg
, SHARE_PASSWORD
, NULL
));
694 info
->info502
->sd_buf
.sd
= dcesrv_common_get_security_descriptor(mem_ctx
, dce_ctx
, scfg
);
700 info
->info1005
->dfs_flags
= dcesrv_common_get_share_dfs_flags(mem_ctx
, dce_ctx
, scfg
);
705 return WERR_UNKNOWN_LEVEL
;
708 return WERR_UNKNOWN_LEVEL
;
712 srvsvc_NetShareEnumAll
714 static WERROR
dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
715 struct srvsvc_NetShareEnumAll
*r
)
720 struct share_context
*sctx
;
721 struct share_config
*scfg
;
723 r
->out
.level
= r
->in
.level
;
724 ZERO_STRUCT(r
->out
.ctr
);
725 r
->out
.totalentries
= 0;
726 r
->out
.resume_handle
= NULL
;
728 /* TODO: - paging of results
731 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
);
732 if (!NT_STATUS_IS_OK(nterr
)) {
733 return ntstatus_to_werror(nterr
);
736 nterr
= share_list_all(mem_ctx
, sctx
, &numshares
, &snames
);
737 if (!NT_STATUS_IS_OK(nterr
)) {
738 return ntstatus_to_werror(nterr
);
741 switch (r
->in
.level
) {
745 struct srvsvc_NetShareCtr0
*ctr0
;
747 ctr0
= talloc(mem_ctx
, struct srvsvc_NetShareCtr0
);
748 W_ERROR_HAVE_NO_MEMORY(ctr0
);
750 ctr0
->count
= numshares
;
753 if (ctr0
->count
== 0) {
754 r
->out
.ctr
.ctr0
= ctr0
;
758 ctr0
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo0
, ctr0
->count
);
759 W_ERROR_HAVE_NO_MEMORY(ctr0
->array
);
761 for (i
= 0; i
< ctr0
->count
; i
++) {
763 union srvsvc_NetShareInfo info
;
765 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
766 if (!NT_STATUS_IS_OK(nterr
)) {
767 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
768 return WERR_GENERAL_FAILURE
;
770 info
.info0
= &ctr0
->array
[i
];
771 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
772 if (!W_ERROR_IS_OK(status
)) {
779 r
->out
.ctr
.ctr0
= ctr0
;
780 r
->out
.totalentries
= r
->out
.ctr
.ctr0
->count
;
786 struct srvsvc_NetShareCtr1
*ctr1
;
788 ctr1
= talloc(mem_ctx
, struct srvsvc_NetShareCtr1
);
789 W_ERROR_HAVE_NO_MEMORY(ctr1
);
791 ctr1
->count
= numshares
;
794 if (ctr1
->count
== 0) {
795 r
->out
.ctr
.ctr1
= ctr1
;
799 ctr1
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo1
, ctr1
->count
);
800 W_ERROR_HAVE_NO_MEMORY(ctr1
->array
);
802 for (i
=0; i
< ctr1
->count
; i
++) {
804 union srvsvc_NetShareInfo info
;
806 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
807 if (!NT_STATUS_IS_OK(nterr
)) {
808 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
809 return WERR_GENERAL_FAILURE
;
811 info
.info1
= &ctr1
->array
[i
];
812 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
813 if (!W_ERROR_IS_OK(status
)) {
820 r
->out
.ctr
.ctr1
= ctr1
;
821 r
->out
.totalentries
= r
->out
.ctr
.ctr1
->count
;
827 struct srvsvc_NetShareCtr2
*ctr2
;
829 SRVSVC_CHECK_ADMIN_ACCESS
;
831 ctr2
= talloc(mem_ctx
, struct srvsvc_NetShareCtr2
);
832 W_ERROR_HAVE_NO_MEMORY(ctr2
);
834 ctr2
->count
= numshares
;
837 if (ctr2
->count
== 0) {
838 r
->out
.ctr
.ctr2
= ctr2
;
842 ctr2
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo2
, ctr2
->count
);
843 W_ERROR_HAVE_NO_MEMORY(ctr2
->array
);
845 for (i
=0; i
< ctr2
->count
; i
++) {
847 union srvsvc_NetShareInfo info
;
849 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
850 if (!NT_STATUS_IS_OK(nterr
)) {
851 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
852 return WERR_GENERAL_FAILURE
;
854 info
.info2
= &ctr2
->array
[i
];
855 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
856 if (!W_ERROR_IS_OK(status
)) {
863 r
->out
.ctr
.ctr2
= ctr2
;
864 r
->out
.totalentries
= r
->out
.ctr
.ctr2
->count
;
870 struct srvsvc_NetShareCtr501
*ctr501
;
872 SRVSVC_CHECK_ADMIN_ACCESS
;
874 ctr501
= talloc(mem_ctx
, struct srvsvc_NetShareCtr501
);
875 W_ERROR_HAVE_NO_MEMORY(ctr501
);
877 ctr501
->count
= numshares
;
878 ctr501
->array
= NULL
;
880 if (ctr501
->count
== 0) {
881 r
->out
.ctr
.ctr501
= ctr501
;
885 ctr501
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo501
, ctr501
->count
);
886 W_ERROR_HAVE_NO_MEMORY(ctr501
->array
);
888 for (i
=0; i
< ctr501
->count
; i
++) {
890 union srvsvc_NetShareInfo info
;
892 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
893 if (!NT_STATUS_IS_OK(nterr
)) {
894 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
895 return WERR_GENERAL_FAILURE
;
897 info
.info501
= &ctr501
->array
[i
];
898 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
899 if (!W_ERROR_IS_OK(status
)) {
906 r
->out
.ctr
.ctr501
= ctr501
;
907 r
->out
.totalentries
= r
->out
.ctr
.ctr501
->count
;
913 struct srvsvc_NetShareCtr502
*ctr502
;
915 SRVSVC_CHECK_ADMIN_ACCESS
;
917 ctr502
= talloc(mem_ctx
, struct srvsvc_NetShareCtr502
);
918 W_ERROR_HAVE_NO_MEMORY(ctr502
);
920 ctr502
->count
= numshares
;
921 ctr502
->array
= NULL
;
923 if (ctr502
->count
== 0) {
924 r
->out
.ctr
.ctr502
= ctr502
;
928 ctr502
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo502
, ctr502
->count
);
929 W_ERROR_HAVE_NO_MEMORY(ctr502
->array
);
931 for (i
=0; i
< ctr502
->count
; i
++) {
933 union srvsvc_NetShareInfo info
;
935 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
936 if (!NT_STATUS_IS_OK(nterr
)) {
937 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
938 return WERR_GENERAL_FAILURE
;
940 info
.info502
= &ctr502
->array
[i
];
941 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
942 if (!W_ERROR_IS_OK(status
)) {
949 r
->out
.ctr
.ctr502
= ctr502
;
950 r
->out
.totalentries
= r
->out
.ctr
.ctr502
->count
;
954 return WERR_UNKNOWN_LEVEL
;
957 return WERR_UNKNOWN_LEVEL
;
962 srvsvc_NetShareGetInfo
964 static WERROR
dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
965 struct srvsvc_NetShareGetInfo
*r
)
968 struct share_context
*sctx
= NULL
;
969 struct share_config
*scfg
= NULL
;
971 ZERO_STRUCTP(r
->out
.info
);
973 /* TODO: - access check
976 if (strcmp("", r
->in
.share_name
) == 0) {
977 return WERR_INVALID_PARAM
;
980 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
);
981 if (!NT_STATUS_IS_OK(nterr
)) {
982 return ntstatus_to_werror(nterr
);
985 nterr
= share_get_config(mem_ctx
, sctx
, r
->in
.share_name
, &scfg
);
986 if (!NT_STATUS_IS_OK(nterr
)) {
987 return ntstatus_to_werror(nterr
);
990 switch (r
->in
.level
) {
994 union srvsvc_NetShareInfo info
;
996 info
.info0
= talloc(mem_ctx
, struct srvsvc_NetShareInfo0
);
997 W_ERROR_HAVE_NO_MEMORY(info
.info0
);
999 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1000 if (!W_ERROR_IS_OK(status
)) {
1004 r
->out
.info
->info0
= info
.info0
;
1010 union srvsvc_NetShareInfo info
;
1012 info
.info1
= talloc(mem_ctx
, struct srvsvc_NetShareInfo1
);
1013 W_ERROR_HAVE_NO_MEMORY(info
.info1
);
1015 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1016 if (!W_ERROR_IS_OK(status
)) {
1020 r
->out
.info
->info1
= info
.info1
;
1026 union srvsvc_NetShareInfo info
;
1028 SRVSVC_CHECK_ADMIN_ACCESS
;
1030 info
.info2
= talloc(mem_ctx
, struct srvsvc_NetShareInfo2
);
1031 W_ERROR_HAVE_NO_MEMORY(info
.info2
);
1033 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1034 if (!W_ERROR_IS_OK(status
)) {
1038 r
->out
.info
->info2
= info
.info2
;
1044 union srvsvc_NetShareInfo info
;
1046 info
.info501
= talloc(mem_ctx
, struct srvsvc_NetShareInfo501
);
1047 W_ERROR_HAVE_NO_MEMORY(info
.info501
);
1049 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1050 if (!W_ERROR_IS_OK(status
)) {
1054 r
->out
.info
->info501
= info
.info501
;
1060 union srvsvc_NetShareInfo info
;
1062 SRVSVC_CHECK_ADMIN_ACCESS
;
1064 info
.info502
= talloc(mem_ctx
, struct srvsvc_NetShareInfo502
);
1065 W_ERROR_HAVE_NO_MEMORY(info
.info502
);
1067 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1068 if (!W_ERROR_IS_OK(status
)) {
1072 r
->out
.info
->info502
= info
.info502
;
1078 union srvsvc_NetShareInfo info
;
1080 info
.info1005
= talloc(mem_ctx
, struct srvsvc_NetShareInfo1005
);
1081 W_ERROR_HAVE_NO_MEMORY(info
.info1005
);
1083 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1084 if (!W_ERROR_IS_OK(status
)) {
1088 r
->out
.info
->info1005
= info
.info1005
;
1092 return WERR_UNKNOWN_LEVEL
;
1095 return WERR_UNKNOWN_LEVEL
;
1098 static WERROR
dcesrv_srvsvc_fill_share_info(struct share_info
*info
, int *count
,
1099 const char *share_name
, int level
,
1102 const char *comment
,
1103 const char *password
,
1104 enum srvsvc_ShareType type
,
1106 uint32_t csc_policy
,
1107 struct security_descriptor
*sd
)
1112 info
[i
].name
= SHARE_CSC_POLICY
;
1113 info
[i
].type
= SHARE_INFO_INT
;
1114 info
[i
].value
= talloc(info
, int);
1115 *((int *)info
[i
].value
) = csc_policy
;
1122 /* TODO: check if unknown is csc_policy */
1124 /* TODO: security descriptor */
1127 if (path
&& path
[0]) {
1128 info
[i
].name
= SHARE_PATH
;
1129 info
[i
].type
= SHARE_INFO_STRING
;
1131 /* Windows will send a path in a form of C:\example\path */
1132 if (path
[1] == ':') {
1133 info
[i
].value
= talloc_strdup(info
, &path
[2]);
1135 /* very strange let's try to set as is */
1136 info
[i
].value
= talloc_strdup(info
, path
);
1138 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1139 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
1144 if (password
&& password
[0]) {
1145 info
[i
].name
= SHARE_PASSWORD
;
1146 info
[i
].type
= SHARE_INFO_STRING
;
1147 info
[i
].value
= talloc_strdup(info
, password
);
1148 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1153 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
1154 info
[i
].type
= SHARE_INFO_INT
;
1155 info
[i
].value
= talloc(info
, int);
1156 *((int *)info
[i
].value
) = max_users
;
1161 info
[i
].name
= SHARE_TYPE
;
1162 info
[i
].type
= SHARE_INFO_STRING
;
1165 info
[i
].value
= talloc_strdup(info
, "DISK");
1168 info
[i
].value
= talloc_strdup(info
, "PRINTER");
1171 info
[i
].value
= talloc_strdup(info
, "IPC");
1174 return WERR_INVALID_PARAM
;
1176 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1181 info
[i
].name
= SHARE_COMMENT
;
1182 info
[i
].type
= SHARE_INFO_STRING
;
1183 info
[i
].value
= talloc_strdup(info
, comment
);
1184 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1190 strcasecmp(share_name
, name
) != 0) {
1191 info
[i
].name
= SHARE_NAME
;
1192 info
[i
].type
= SHARE_INFO_STRING
;
1193 info
[i
].value
= talloc_strdup(info
, name
);
1194 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1201 return WERR_UNKNOWN_LEVEL
;
1210 srvsvc_NetShareSetInfo
1212 static WERROR
dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1213 struct srvsvc_NetShareSetInfo
*r
)
1217 struct share_context
*sctx
= NULL
;
1218 struct share_info
*info
;
1221 /* TODO: - access check
1224 /* there are no more than 10 options in all struct srvsvc_NetShareInfoXXX */
1225 info
= talloc_array(mem_ctx
, struct share_info
, 10);
1226 W_ERROR_HAVE_NO_MEMORY(info
);
1228 ZERO_STRUCT(r
->out
);
1230 if (strcmp("", r
->in
.share_name
) == 0) {
1231 return WERR_INVALID_PARAM
;
1234 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
);
1235 if (!NT_STATUS_IS_OK(nterr
)) {
1236 return ntstatus_to_werror(nterr
);
1239 switch (r
->in
.level
) {
1242 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1243 r
->in
.share_name
, r
->in
.level
,
1244 r
->in
.info
->info0
->name
,
1252 if (W_ERROR_EQUAL(status
, WERR_OK
)) {
1259 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1260 r
->in
.share_name
, r
->in
.level
,
1261 r
->in
.info
->info1
->name
,
1263 r
->in
.info
->info1
->comment
,
1265 r
->in
.info
->info1
->type
,
1269 if (W_ERROR_EQUAL(status
, WERR_OK
)) {
1276 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1277 r
->in
.share_name
, r
->in
.level
,
1278 r
->in
.info
->info2
->name
,
1279 r
->in
.info
->info2
->path
,
1280 r
->in
.info
->info2
->comment
,
1281 r
->in
.info
->info2
->password
,
1282 r
->in
.info
->info2
->type
,
1283 r
->in
.info
->info2
->max_users
,
1286 if (W_ERROR_EQUAL(status
, WERR_OK
)) {
1293 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1294 r
->in
.share_name
, r
->in
.level
,
1295 r
->in
.info
->info501
->name
,
1297 r
->in
.info
->info501
->comment
,
1299 r
->in
.info
->info501
->type
,
1301 r
->in
.info
->info501
->csc_policy
,
1303 if (W_ERROR_EQUAL(status
, WERR_OK
)) {
1310 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1311 r
->in
.share_name
, r
->in
.level
,
1312 r
->in
.info
->info502
->name
,
1313 r
->in
.info
->info502
->path
,
1314 r
->in
.info
->info502
->comment
,
1315 r
->in
.info
->info502
->password
,
1316 r
->in
.info
->info502
->type
,
1317 r
->in
.info
->info502
->max_users
,
1319 r
->in
.info
->info502
->sd_buf
.sd
);
1320 if (W_ERROR_EQUAL(status
, WERR_OK
)) {
1327 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1328 r
->in
.share_name
, r
->in
.level
,
1331 r
->in
.info
->info1004
->comment
,
1337 if (W_ERROR_EQUAL(status
, WERR_OK
)) {
1344 /* r->in.info.dfs_flags; */
1346 if (r
->in
.parm_error
) {
1347 r
->out
.parm_error
= r
->in
.parm_error
;
1353 return WERR_UNKNOWN_LEVEL
;
1356 nterr
= share_set(sctx
, r
->in
.share_name
, info
, count
);
1357 if (!NT_STATUS_IS_OK(nterr
)) {
1358 return ntstatus_to_werror(nterr
);
1361 if (r
->in
.parm_error
) {
1362 r
->out
.parm_error
= r
->in
.parm_error
;
1370 srvsvc_NetShareDelSticky
1372 static WERROR
dcesrv_srvsvc_NetShareDelSticky(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1373 struct srvsvc_NetShareDelSticky
*r
)
1375 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1380 srvsvc_NetShareCheck
1382 static WERROR
dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1383 struct srvsvc_NetShareCheck
*r
)
1386 struct share_context
*sctx
= NULL
;
1387 struct share_config
*scfg
= NULL
;
1394 /* TODO: - access check
1397 if (strcmp("", r
->in
.device_name
) == 0) {
1398 *r
->out
.type
= STYPE_IPC
;
1402 /* copy the path skipping C:\ */
1403 if (strncasecmp(r
->in
.device_name
, "C:", 2) == 0) {
1404 device
= talloc_strdup(mem_ctx
, &r
->in
.device_name
[2]);
1406 /* no chance we have a share that doesn't start with C:\ */
1407 return WERR_DEVICE_NOT_SHARED
;
1409 all_string_sub(device
, "\\", "/", 0);
1411 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
);
1412 if (!NT_STATUS_IS_OK(nterr
)) {
1413 return ntstatus_to_werror(nterr
);
1416 nterr
= share_list_all(mem_ctx
, sctx
, &count
, &names
);
1417 if (!NT_STATUS_IS_OK(nterr
)) {
1418 return ntstatus_to_werror(nterr
);
1421 for (i
= 0; i
< count
; i
++) {
1425 nterr
= share_get_config(mem_ctx
, sctx
, names
[i
], &scfg
);
1426 if (!NT_STATUS_IS_OK(nterr
)) {
1427 return ntstatus_to_werror(nterr
);
1429 path
= share_string_option(scfg
, SHARE_PATH
, NULL
);
1430 if (!path
) continue;
1432 if (strcmp(device
, path
) == 0) {
1433 type
= share_string_option(scfg
, SHARE_TYPE
, NULL
);
1434 if (!type
) continue;
1436 if (strcmp(type
, "DISK") == 0) {
1437 *r
->out
.type
= STYPE_DISKTREE
;
1441 if (strcmp(type
, "IPC") == 0) {
1442 *r
->out
.type
= STYPE_IPC
;
1446 if (strcmp(type
, "PRINTER") == 0) {
1447 *r
->out
.type
= STYPE_PRINTQ
;
1453 return WERR_DEVICE_NOT_SHARED
;
1458 srvsvc_NetSrvGetInfo
1460 static WERROR
dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1461 struct srvsvc_NetSrvGetInfo
*r
)
1463 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
1465 ZERO_STRUCTP(r
->out
.info
);
1467 switch (r
->in
.level
) {
1470 struct srvsvc_NetSrvInfo100
*info100
;
1472 info100
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo100
);
1473 W_ERROR_HAVE_NO_MEMORY(info100
);
1475 info100
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1476 info100
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1477 W_ERROR_HAVE_NO_MEMORY(info100
->server_name
);
1479 r
->out
.info
->info100
= info100
;
1484 struct srvsvc_NetSrvInfo101
*info101
;
1486 info101
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo101
);
1487 W_ERROR_HAVE_NO_MEMORY(info101
);
1489 info101
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1490 info101
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1491 W_ERROR_HAVE_NO_MEMORY(info101
->server_name
);
1493 info101
->version_major
= dcesrv_common_get_version_major(mem_ctx
, dce_ctx
->lp_ctx
);
1494 info101
->version_minor
= dcesrv_common_get_version_minor(mem_ctx
, dce_ctx
->lp_ctx
);
1495 info101
->server_type
= dcesrv_common_get_server_type(mem_ctx
, dce_call
->event_ctx
, dce_ctx
);
1496 info101
->comment
= talloc_strdup(mem_ctx
, lp_serverstring(dce_ctx
->lp_ctx
));
1497 W_ERROR_HAVE_NO_MEMORY(info101
->comment
);
1499 r
->out
.info
->info101
= info101
;
1504 struct srvsvc_NetSrvInfo102
*info102
;
1506 info102
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo102
);
1507 W_ERROR_HAVE_NO_MEMORY(info102
);
1509 info102
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1510 info102
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1511 W_ERROR_HAVE_NO_MEMORY(info102
->server_name
);
1513 info102
->version_major
= dcesrv_common_get_version_major(mem_ctx
, dce_ctx
->lp_ctx
);
1514 info102
->version_minor
= dcesrv_common_get_version_minor(mem_ctx
, dce_ctx
->lp_ctx
);
1515 info102
->server_type
= dcesrv_common_get_server_type(mem_ctx
, dce_call
->event_ctx
, dce_ctx
);
1516 info102
->comment
= talloc_strdup(mem_ctx
, lp_serverstring(dce_ctx
->lp_ctx
));
1517 W_ERROR_HAVE_NO_MEMORY(info102
->comment
);
1519 info102
->users
= dcesrv_common_get_users(mem_ctx
, dce_ctx
);
1520 info102
->disc
= dcesrv_common_get_disc(mem_ctx
, dce_ctx
);
1521 info102
->hidden
= dcesrv_common_get_hidden(mem_ctx
, dce_ctx
);
1522 info102
->announce
= dcesrv_common_get_announce(mem_ctx
, dce_ctx
);
1523 info102
->anndelta
= dcesrv_common_get_anndelta(mem_ctx
, dce_ctx
);
1524 info102
->licenses
= dcesrv_common_get_licenses(mem_ctx
, dce_ctx
);
1525 info102
->userpath
= dcesrv_common_get_userpath(mem_ctx
, dce_ctx
);
1526 W_ERROR_HAVE_NO_MEMORY(info102
->userpath
);
1528 r
->out
.info
->info102
= info102
;
1532 return WERR_UNKNOWN_LEVEL
;
1535 return WERR_UNKNOWN_LEVEL
;
1540 srvsvc_NetSrvSetInfo
1542 static WERROR
dcesrv_srvsvc_NetSrvSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1543 struct srvsvc_NetSrvSetInfo
*r
)
1545 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1552 static WERROR
dcesrv_srvsvc_NetDiskEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1553 struct srvsvc_NetDiskEnum
*r
)
1555 r
->out
.info
->disks
= NULL
;
1556 r
->out
.info
->count
= 0;
1557 *r
->out
.totalentries
= 0;
1559 switch (r
->in
.level
) {
1562 /* we can safely hardcode the reply and report we have only one disk (C:) */
1563 /* for some reason Windows wants 2 entries with the second being empty */
1564 r
->out
.info
->disks
= talloc_array(mem_ctx
, struct srvsvc_NetDiskInfo0
, 2);
1565 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
);
1566 r
->out
.info
->count
= 2;
1568 r
->out
.info
->disks
[0].disk
= talloc_strdup(mem_ctx
, "C:");
1569 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
[0].disk
);
1571 r
->out
.info
->disks
[1].disk
= talloc_strdup(mem_ctx
, "");
1572 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
[1].disk
);
1574 *r
->out
.totalentries
= 1;
1575 r
->out
.resume_handle
= r
->in
.resume_handle
;
1580 return WERR_UNKNOWN_LEVEL
;
1583 return WERR_UNKNOWN_LEVEL
;
1588 srvsvc_NetServerStatisticsGet
1590 static WERROR
dcesrv_srvsvc_NetServerStatisticsGet(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1591 struct srvsvc_NetServerStatisticsGet
*r
)
1593 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1598 srvsvc_NetTransportAdd
1600 static WERROR
dcesrv_srvsvc_NetTransportAdd(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1601 struct srvsvc_NetTransportAdd
*r
)
1603 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1608 srvsvc_NetTransportEnum
1610 static WERROR
dcesrv_srvsvc_NetTransportEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1611 struct srvsvc_NetTransportEnum
*r
)
1613 r
->out
.transports
->level
= r
->in
.transports
->level
;
1614 *r
->out
.totalentries
= 0;
1615 if (r
->out
.resume_handle
) {
1616 *r
->out
.resume_handle
= 0;
1619 switch (r
->in
.transports
->level
) {
1622 r
->out
.transports
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr0
);
1623 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr0
);
1625 r
->out
.transports
->ctr
.ctr0
->count
= 0;
1626 r
->out
.transports
->ctr
.ctr0
->array
= NULL
;
1628 return WERR_NOT_SUPPORTED
;
1632 r
->out
.transports
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr1
);
1633 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr1
);
1635 r
->out
.transports
->ctr
.ctr1
->count
= 0;
1636 r
->out
.transports
->ctr
.ctr1
->array
= NULL
;
1638 return WERR_NOT_SUPPORTED
;
1642 r
->out
.transports
->ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr2
);
1643 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr2
);
1645 r
->out
.transports
->ctr
.ctr2
->count
= 0;
1646 r
->out
.transports
->ctr
.ctr2
->array
= NULL
;
1648 return WERR_NOT_SUPPORTED
;
1652 r
->out
.transports
->ctr
.ctr3
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr3
);
1653 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr3
);
1655 r
->out
.transports
->ctr
.ctr3
->count
= 0;
1656 r
->out
.transports
->ctr
.ctr3
->array
= NULL
;
1658 return WERR_NOT_SUPPORTED
;
1661 return WERR_UNKNOWN_LEVEL
;
1664 return WERR_UNKNOWN_LEVEL
;
1668 srvsvc_NetTransportDel
1670 static WERROR
dcesrv_srvsvc_NetTransportDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1671 struct srvsvc_NetTransportDel
*r
)
1673 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1680 static WERROR
dcesrv_srvsvc_NetRemoteTOD(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1681 struct srvsvc_NetRemoteTOD
*r
)
1683 struct timeval tval
;
1686 struct srvsvc_NetRemoteTODInfo
*info
;
1688 info
= talloc(mem_ctx
, struct srvsvc_NetRemoteTODInfo
);
1689 W_ERROR_HAVE_NO_MEMORY(info
);
1691 GetTimeOfDay(&tval
);
1697 /* TODO: fake the uptime: just return the milliseconds till 0:00:00 today */
1698 info
->msecs
= (tm
.tm_hour
*60*60*1000)
1699 + (tm
.tm_min
*60*1000)
1701 + (tval
.tv_usec
/1000);
1702 info
->hours
= tm
.tm_hour
;
1703 info
->mins
= tm
.tm_min
;
1704 info
->secs
= tm
.tm_sec
;
1705 info
->hunds
= tval
.tv_usec
/10000;
1706 info
->timezone
= get_time_zone(t
)/60;
1707 info
->tinterval
= 310; /* just return the same as windows */
1708 info
->day
= tm
.tm_mday
;
1709 info
->month
= tm
.tm_mon
+ 1;
1710 info
->year
= tm
.tm_year
+ 1900;
1711 info
->weekday
= tm
.tm_wday
;
1713 *r
->out
.info
= info
;
1721 static WERROR
dcesrv_srvsvc_NetPathType(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1722 struct srvsvc_NetPathType
*r
)
1724 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1729 srvsvc_NetPathCanonicalize
1731 static WERROR
dcesrv_srvsvc_NetPathCanonicalize(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1732 struct srvsvc_NetPathCanonicalize
*r
)
1734 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1739 srvsvc_NetPathCompare
1741 static WERROR
dcesrv_srvsvc_NetPathCompare(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1742 struct srvsvc_NetPathCompare
*r
)
1744 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1749 srvsvc_NetNameValidate
1751 static WERROR
dcesrv_srvsvc_NetNameValidate(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1752 struct srvsvc_NetNameValidate
*r
)
1756 if ((r
->in
.flags
!= 0x0) && (r
->in
.flags
!= 0x80000000)) {
1757 return WERR_INVALID_NAME
;
1760 switch (r
->in
.name_type
) {
1769 return WERR_NOT_SUPPORTED
;
1771 case 9: /* validate share name */
1773 len
= strlen_m(r
->in
.name
);
1774 if ((r
->in
.flags
== 0x0) && (len
> 81)) {
1775 return WERR_INVALID_NAME
;
1777 if ((r
->in
.flags
== 0x80000000) && (len
> 13)) {
1778 return WERR_INVALID_NAME
;
1780 if (! dcesrv_common_validate_share_name(mem_ctx
, r
->in
.name
)) {
1781 return WERR_INVALID_NAME
;
1789 return WERR_NOT_SUPPORTED
;
1791 return WERR_INVALID_PARAM
;
1794 return WERR_INVALID_PARAM
;
1799 srvsvc_NetPRNameCompare
1801 static WERROR
dcesrv_srvsvc_NetPRNameCompare(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1802 struct srvsvc_NetPRNameCompare
*r
)
1804 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1811 static WERROR
dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1812 struct srvsvc_NetShareEnum
*r
)
1816 const char **snames
;
1817 struct share_context
*sctx
;
1818 struct share_config
*scfg
;
1819 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
1821 r
->out
.level
= r
->in
.level
;
1822 ZERO_STRUCT(r
->out
.ctr
);
1823 r
->out
.totalentries
= 0;
1824 r
->out
.resume_handle
= NULL
;
1826 /* TODO: - paging of results
1829 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
);
1830 if (!NT_STATUS_IS_OK(nterr
)) {
1831 return ntstatus_to_werror(nterr
);
1834 nterr
= share_list_all(mem_ctx
, sctx
, &numshares
, &snames
);
1835 if (!NT_STATUS_IS_OK(nterr
)) {
1836 return ntstatus_to_werror(nterr
);
1839 switch (r
->in
.level
) {
1844 struct srvsvc_NetShareCtr0
*ctr0
;
1846 ctr0
= talloc(mem_ctx
, struct srvsvc_NetShareCtr0
);
1847 W_ERROR_HAVE_NO_MEMORY(ctr0
);
1850 ctr0
->count
= count
;
1853 if (ctr0
->count
== 0) {
1854 r
->out
.ctr
.ctr0
= ctr0
;
1858 ctr0
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo0
, count
);
1859 W_ERROR_HAVE_NO_MEMORY(ctr0
->array
);
1861 for (i
=0; i
< count
; i
++) {
1863 union srvsvc_NetShareInfo info
;
1864 enum srvsvc_ShareType type
;
1866 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1867 if (!NT_STATUS_IS_OK(nterr
)) {
1868 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1869 return WERR_GENERAL_FAILURE
;
1872 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1873 if (type
& STYPE_HIDDEN
) {
1879 info
.info0
= &ctr0
->array
[y
];
1880 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1881 W_ERROR_NOT_OK_RETURN(status
);
1885 talloc_free(snames
);
1887 r
->out
.ctr
.ctr0
= ctr0
;
1888 r
->out
.totalentries
= r
->out
.ctr
.ctr0
->count
;
1895 struct srvsvc_NetShareCtr1
*ctr1
;
1897 ctr1
= talloc(mem_ctx
, struct srvsvc_NetShareCtr1
);
1898 W_ERROR_HAVE_NO_MEMORY(ctr1
);
1901 ctr1
->count
= count
;
1904 if (ctr1
->count
== 0) {
1905 r
->out
.ctr
.ctr1
= ctr1
;
1909 ctr1
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo1
, count
);
1910 W_ERROR_HAVE_NO_MEMORY(ctr1
->array
);
1912 for (i
=0; i
< count
; i
++) {
1914 union srvsvc_NetShareInfo info
;
1915 enum srvsvc_ShareType type
;
1917 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1918 if (!NT_STATUS_IS_OK(nterr
)) {
1919 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1920 return WERR_GENERAL_FAILURE
;
1923 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1924 if (type
& STYPE_HIDDEN
) {
1930 info
.info1
= &ctr1
->array
[y
];
1931 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1932 W_ERROR_NOT_OK_RETURN(status
);
1936 talloc_free(snames
);
1938 r
->out
.ctr
.ctr1
= ctr1
;
1939 r
->out
.totalentries
= r
->out
.ctr
.ctr1
->count
;
1946 struct srvsvc_NetShareCtr2
*ctr2
;
1948 SRVSVC_CHECK_ADMIN_ACCESS
;
1950 ctr2
= talloc(mem_ctx
, struct srvsvc_NetShareCtr2
);
1951 W_ERROR_HAVE_NO_MEMORY(ctr2
);
1954 ctr2
->count
= count
;
1957 if (ctr2
->count
== 0) {
1958 r
->out
.ctr
.ctr2
= ctr2
;
1962 ctr2
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo2
, count
);
1963 W_ERROR_HAVE_NO_MEMORY(ctr2
->array
);
1965 for (i
=0; i
< count
; i
++) {
1967 union srvsvc_NetShareInfo info
;
1968 enum srvsvc_ShareType type
;
1970 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1971 if (!NT_STATUS_IS_OK(nterr
)) {
1972 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1973 return WERR_GENERAL_FAILURE
;
1976 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1977 if (type
& STYPE_HIDDEN
) {
1983 info
.info2
= &ctr2
->array
[y
];
1984 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1985 W_ERROR_NOT_OK_RETURN(status
);
1989 talloc_free(snames
);
1991 r
->out
.ctr
.ctr2
= ctr2
;
1992 r
->out
.totalentries
= r
->out
.ctr
.ctr2
->count
;
1999 struct srvsvc_NetShareCtr502
*ctr502
;
2001 SRVSVC_CHECK_ADMIN_ACCESS
;
2003 ctr502
= talloc(mem_ctx
, struct srvsvc_NetShareCtr502
);
2004 W_ERROR_HAVE_NO_MEMORY(ctr502
);
2007 ctr502
->count
= count
;
2008 ctr502
->array
= NULL
;
2010 if (ctr502
->count
== 0) {
2011 r
->out
.ctr
.ctr502
= ctr502
;
2015 ctr502
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo502
, count
);
2016 W_ERROR_HAVE_NO_MEMORY(ctr502
->array
);
2018 for (i
=0; i
< count
; i
++) {
2020 union srvsvc_NetShareInfo info
;
2021 enum srvsvc_ShareType type
;
2023 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
2024 if (!NT_STATUS_IS_OK(nterr
)) {
2025 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
2026 return WERR_GENERAL_FAILURE
;
2029 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
2030 if (type
& STYPE_HIDDEN
) {
2036 info
.info502
= &ctr502
->array
[y
];
2037 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
2038 W_ERROR_NOT_OK_RETURN(status
);
2042 talloc_free(snames
);
2044 r
->out
.ctr
.ctr502
= ctr502
;
2045 r
->out
.totalentries
= r
->out
.ctr
.ctr502
->count
;
2049 return WERR_UNKNOWN_LEVEL
;
2052 return WERR_UNKNOWN_LEVEL
;
2057 srvsvc_NetShareDelStart
2059 static WERROR
dcesrv_srvsvc_NetShareDelStart(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2060 struct srvsvc_NetShareDelStart
*r
)
2062 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2067 srvsvc_NetShareDelCommit
2069 static WERROR
dcesrv_srvsvc_NetShareDelCommit(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2070 struct srvsvc_NetShareDelCommit
*r
)
2072 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2077 srvsvc_NetGetFileSecurity
2079 static WERROR
dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2080 struct srvsvc_NetGetFileSecurity
*r
)
2082 struct sec_desc_buf
*sd_buf
;
2083 struct ntvfs_context
*ntvfs_ctx
= NULL
;
2084 struct ntvfs_request
*ntvfs_req
;
2085 union smb_fileinfo
*io
;
2088 nt_status
= srvsvc_create_ntvfs_context(dce_call
, mem_ctx
, r
->in
.share
, &ntvfs_ctx
);
2089 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2091 ntvfs_req
= ntvfs_request_create(ntvfs_ctx
, mem_ctx
,
2092 dce_call
->conn
->auth_state
.session_info
,
2096 W_ERROR_HAVE_NO_MEMORY(ntvfs_req
);
2098 sd_buf
= talloc(mem_ctx
, struct sec_desc_buf
);
2099 W_ERROR_HAVE_NO_MEMORY(sd_buf
);
2101 io
= talloc(mem_ctx
, union smb_fileinfo
);
2102 W_ERROR_HAVE_NO_MEMORY(io
);
2104 io
->query_secdesc
.level
= RAW_FILEINFO_SEC_DESC
;
2105 io
->query_secdesc
.in
.file
.path
= r
->in
.file
;
2106 io
->query_secdesc
.in
.secinfo_flags
= r
->in
.securityinformation
;
2108 nt_status
= ntvfs_qpathinfo(ntvfs_req
, io
);
2109 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2111 sd_buf
->sd
= io
->query_secdesc
.out
.sd
;
2113 *r
->out
.sd_buf
= sd_buf
;
2119 srvsvc_NetSetFileSecurity
2121 static WERROR
dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2122 struct srvsvc_NetSetFileSecurity
*r
)
2124 struct ntvfs_context
*ntvfs_ctx
;
2125 struct ntvfs_request
*ntvfs_req
;
2126 union smb_setfileinfo
*io
;
2129 nt_status
= srvsvc_create_ntvfs_context(dce_call
, mem_ctx
, r
->in
.share
, &ntvfs_ctx
);
2130 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2132 ntvfs_req
= ntvfs_request_create(ntvfs_ctx
, mem_ctx
,
2133 dce_call
->conn
->auth_state
.session_info
,
2137 W_ERROR_HAVE_NO_MEMORY(ntvfs_req
);
2139 io
= talloc(mem_ctx
, union smb_setfileinfo
);
2140 W_ERROR_HAVE_NO_MEMORY(io
);
2142 io
->set_secdesc
.level
= RAW_FILEINFO_SEC_DESC
;
2143 io
->set_secdesc
.in
.file
.path
= r
->in
.file
;
2144 io
->set_secdesc
.in
.secinfo_flags
= r
->in
.securityinformation
;
2145 io
->set_secdesc
.in
.sd
= r
->in
.sd_buf
->sd
;
2147 nt_status
= ntvfs_setpathinfo(ntvfs_req
, io
);
2148 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2155 srvsvc_NetServerTransportAddEx
2157 static WERROR
dcesrv_srvsvc_NetServerTransportAddEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2158 struct srvsvc_NetServerTransportAddEx
*r
)
2160 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2165 srvsvc_NetServerSetServiceBitsEx
2167 static WERROR
dcesrv_srvsvc_NetServerSetServiceBitsEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2168 struct srvsvc_NetServerSetServiceBitsEx
*r
)
2170 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2175 srvsvc_NETRDFSGETVERSION
2177 static WERROR
dcesrv_srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2178 struct srvsvc_NETRDFSGETVERSION
*r
)
2180 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2185 srvsvc_NETRDFSCREATELOCALPARTITION
2187 static WERROR
dcesrv_srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2188 struct srvsvc_NETRDFSCREATELOCALPARTITION
*r
)
2190 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2195 srvsvc_NETRDFSDELETELOCALPARTITION
2197 static WERROR
dcesrv_srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2198 struct srvsvc_NETRDFSDELETELOCALPARTITION
*r
)
2200 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2205 srvsvc_NETRDFSSETLOCALVOLUMESTATE
2207 static WERROR
dcesrv_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2208 struct srvsvc_NETRDFSSETLOCALVOLUMESTATE
*r
)
2210 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2215 srvsvc_NETRDFSSETSERVERINFO
2217 static WERROR
dcesrv_srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2218 struct srvsvc_NETRDFSSETSERVERINFO
*r
)
2220 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2225 srvsvc_NETRDFSCREATEEXITPOINT
2227 static WERROR
dcesrv_srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2228 struct srvsvc_NETRDFSCREATEEXITPOINT
*r
)
2230 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2235 srvsvc_NETRDFSDELETEEXITPOINT
2237 static WERROR
dcesrv_srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2238 struct srvsvc_NETRDFSDELETEEXITPOINT
*r
)
2240 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2245 srvsvc_NETRDFSMODIFYPREFIX
2247 static WERROR
dcesrv_srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2248 struct srvsvc_NETRDFSMODIFYPREFIX
*r
)
2250 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2255 srvsvc_NETRDFSFIXLOCALVOLUME
2257 static WERROR
dcesrv_srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2258 struct srvsvc_NETRDFSFIXLOCALVOLUME
*r
)
2260 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2265 srvsvc_NETRDFSMANAGERREPORTSITEINFO
2267 static WERROR
dcesrv_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2268 struct srvsvc_NETRDFSMANAGERREPORTSITEINFO
*r
)
2270 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2275 srvsvc_NETRSERVERTRANSPORTDELEX
2277 static WERROR
dcesrv_srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2278 struct srvsvc_NETRSERVERTRANSPORTDELEX
*r
)
2280 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2286 static WERROR
dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2287 struct srvsvc_NetShareDel
*r
)
2290 struct share_context
*sctx
;
2292 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
);
2293 if (!NT_STATUS_IS_OK(nterr
)) {
2294 return ntstatus_to_werror(nterr
);
2297 nterr
= share_remove(sctx
, r
->in
.share_name
);
2298 if (!NT_STATUS_IS_OK(nterr
)) {
2299 return ntstatus_to_werror(nterr
);
2306 srvsvc_NetSetServiceBits
2308 static WERROR
dcesrv_srvsvc_NetSetServiceBits(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2309 struct srvsvc_NetSetServiceBits
*r
)
2311 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2315 srvsvc_NETRPRNAMECANONICALIZE
2317 static WERROR
dcesrv_srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2318 struct srvsvc_NETRPRNAMECANONICALIZE
*r
)
2320 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2323 /* include the generated boilerplate */
2324 #include "librpc/gen_ndr/ndr_srvsvc_s.c"