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"
37 #define SRVSVC_CHECK_ADMIN_ACCESS do { \
38 struct auth_session_info *si = dcesrv_call_session_info(dce_call); \
39 struct security_token *t = si->security_token; \
40 if (!security_token_has_builtin_administrators(t) && \
41 !security_token_has_sid(t, &global_sid_Builtin_Server_Operators)) { \
42 return WERR_ACCESS_DENIED; \
49 static WERROR
dcesrv_srvsvc_NetCharDevEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
50 struct srvsvc_NetCharDevEnum
*r
)
52 *r
->out
.totalentries
= 0;
54 switch (r
->in
.info_ctr
->level
) {
56 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetCharDevCtr0
);
57 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
59 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
60 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
62 return WERR_NOT_SUPPORTED
;
65 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetCharDevCtr1
);
66 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
68 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
69 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
71 return WERR_NOT_SUPPORTED
;
74 return WERR_INVALID_LEVEL
;
80 srvsvc_NetCharDevGetInfo
82 static WERROR
dcesrv_srvsvc_NetCharDevGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
83 struct srvsvc_NetCharDevGetInfo
*r
)
85 ZERO_STRUCTP(r
->out
.info
);
87 switch (r
->in
.level
) {
90 return WERR_NOT_SUPPORTED
;
94 return WERR_NOT_SUPPORTED
;
97 return WERR_INVALID_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_INVALID_LEVEL
;
148 srvsvc_NetCharDevQGetInfo
150 static WERROR
dcesrv_srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
151 struct srvsvc_NetCharDevQGetInfo
*r
)
153 ZERO_STRUCTP(r
->out
.info
);
155 switch (r
->in
.level
) {
158 return WERR_NOT_SUPPORTED
;
162 return WERR_NOT_SUPPORTED
;
165 return WERR_INVALID_LEVEL
;
171 srvsvc_NetCharDevQSetInfo
173 static WERROR
dcesrv_srvsvc_NetCharDevQSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
174 struct srvsvc_NetCharDevQSetInfo
*r
)
176 switch (r
->in
.level
) {
179 if (r
->in
.parm_error
) {
180 r
->out
.parm_error
= r
->in
.parm_error
;
182 return WERR_NOT_SUPPORTED
;
186 if (r
->in
.parm_error
) {
187 r
->out
.parm_error
= r
->in
.parm_error
;
189 return WERR_NOT_SUPPORTED
;
192 return WERR_INVALID_LEVEL
;
198 srvsvc_NetCharDevQPurge
200 static WERROR
dcesrv_srvsvc_NetCharDevQPurge(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
201 struct srvsvc_NetCharDevQPurge
*r
)
203 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
208 srvsvc_NetCharDevQPurgeSelf
210 static WERROR
dcesrv_srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
211 struct srvsvc_NetCharDevQPurgeSelf
*r
)
213 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
220 static WERROR
dcesrv_srvsvc_NetConnEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
221 struct srvsvc_NetConnEnum
*r
)
223 *r
->out
.totalentries
= 0;
225 switch (r
->in
.info_ctr
->level
) {
228 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetConnCtr0
);
229 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
231 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
232 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
234 return WERR_NOT_SUPPORTED
;
238 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetConnCtr1
);
239 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
241 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
242 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
244 return WERR_NOT_SUPPORTED
;
247 return WERR_INVALID_LEVEL
;
255 static WERROR
dcesrv_srvsvc_NetFileEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
256 struct srvsvc_NetFileEnum
*r
)
258 *r
->out
.totalentries
= 0;
260 switch (r
->in
.info_ctr
->level
) {
263 r
->out
.info_ctr
->ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetFileCtr2
);
264 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr2
);
266 r
->out
.info_ctr
->ctr
.ctr2
->count
= 0;
267 r
->out
.info_ctr
->ctr
.ctr2
->array
= NULL
;
269 return WERR_NOT_SUPPORTED
;
273 r
->out
.info_ctr
->ctr
.ctr3
= talloc(mem_ctx
, struct srvsvc_NetFileCtr3
);
274 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr3
);
276 r
->out
.info_ctr
->ctr
.ctr3
->count
= 0;
277 r
->out
.info_ctr
->ctr
.ctr3
->array
= NULL
;
279 return WERR_NOT_SUPPORTED
;
282 return WERR_INVALID_LEVEL
;
288 srvsvc_NetFileGetInfo
290 static WERROR
dcesrv_srvsvc_NetFileGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
291 struct srvsvc_NetFileGetInfo
*r
)
293 ZERO_STRUCTP(r
->out
.info
);
295 switch (r
->in
.level
) {
298 return WERR_NOT_SUPPORTED
;
302 return WERR_NOT_SUPPORTED
;
305 return WERR_INVALID_LEVEL
;
313 static WERROR
dcesrv_srvsvc_NetFileClose(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
314 struct srvsvc_NetFileClose
*r
)
316 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
323 static WERROR
dcesrv_srvsvc_NetSessEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
324 struct srvsvc_NetSessEnum
*r
)
326 *r
->out
.totalentries
= 0;
328 switch (r
->in
.info_ctr
->level
) {
331 r
->out
.info_ctr
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetSessCtr0
);
332 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr0
);
334 r
->out
.info_ctr
->ctr
.ctr0
->count
= 0;
335 r
->out
.info_ctr
->ctr
.ctr0
->array
= NULL
;
337 return WERR_NOT_SUPPORTED
;
341 r
->out
.info_ctr
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetSessCtr1
);
342 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr1
);
344 r
->out
.info_ctr
->ctr
.ctr1
->count
= 0;
345 r
->out
.info_ctr
->ctr
.ctr1
->array
= NULL
;
347 return WERR_NOT_SUPPORTED
;
351 r
->out
.info_ctr
->ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetSessCtr2
);
352 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr2
);
354 r
->out
.info_ctr
->ctr
.ctr2
->count
= 0;
355 r
->out
.info_ctr
->ctr
.ctr2
->array
= NULL
;
357 return WERR_NOT_SUPPORTED
;
361 r
->out
.info_ctr
->ctr
.ctr10
= talloc(mem_ctx
, struct srvsvc_NetSessCtr10
);
362 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr10
);
364 r
->out
.info_ctr
->ctr
.ctr10
->count
= 0;
365 r
->out
.info_ctr
->ctr
.ctr10
->array
= NULL
;
367 return WERR_NOT_SUPPORTED
;
371 r
->out
.info_ctr
->ctr
.ctr502
= talloc(mem_ctx
, struct srvsvc_NetSessCtr502
);
372 W_ERROR_HAVE_NO_MEMORY(r
->out
.info_ctr
->ctr
.ctr502
);
374 r
->out
.info_ctr
->ctr
.ctr502
->count
= 0;
375 r
->out
.info_ctr
->ctr
.ctr502
->array
= NULL
;
377 return WERR_NOT_SUPPORTED
;
380 return WERR_INVALID_LEVEL
;
388 static WERROR
dcesrv_srvsvc_NetSessDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
389 struct srvsvc_NetSessDel
*r
)
391 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
398 static WERROR
dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
399 struct srvsvc_NetShareAdd
*r
)
401 switch (r
->in
.level
) {
404 if (r
->in
.parm_error
) {
405 r
->out
.parm_error
= r
->in
.parm_error
;
407 return WERR_NOT_SUPPORTED
;
411 if (r
->in
.parm_error
) {
412 r
->out
.parm_error
= r
->in
.parm_error
;
414 return WERR_NOT_SUPPORTED
;
419 struct share_info
*info
;
420 struct share_context
*sctx
;
421 unsigned int count
= 8;
424 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
425 if (!NT_STATUS_IS_OK(nterr
)) {
426 return ntstatus_to_werror(nterr
);
429 /* there are no more than 8 options in struct srvsvc_NetShareInfo2 */
430 info
= talloc_array(mem_ctx
, struct share_info
, count
);
431 W_ERROR_HAVE_NO_MEMORY(info
);
435 info
[i
].name
= SHARE_TYPE
;
436 info
[i
].type
= SHARE_INFO_STRING
;
437 switch (r
->in
.info
->info2
->type
) {
439 info
[i
].value
= talloc_strdup(info
, "DISK");
442 info
[i
].value
= talloc_strdup(info
, "PRINTER");
445 info
[i
].value
= talloc_strdup(info
, "IPC");
448 return WERR_INVALID_PARAMETER
;
450 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
453 if (r
->in
.info
->info2
->path
&& r
->in
.info
->info2
->path
[0]) {
454 info
[i
].name
= SHARE_PATH
;
455 info
[i
].type
= SHARE_INFO_STRING
;
457 /* Windows will send a path in a form of C:\example\path */
458 if (r
->in
.info
->info2
->path
[1] == ':') {
459 info
[i
].value
= talloc_strdup(info
, &r
->in
.info
->info2
->path
[2]);
461 /* very strange let's try to set as is */
462 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->path
);
464 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
465 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
470 if (r
->in
.info
->info2
->comment
&& r
->in
.info
->info2
->comment
[0]) {
471 info
[i
].name
= SHARE_COMMENT
;
472 info
[i
].type
= SHARE_INFO_STRING
;
473 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->comment
);
474 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
479 if (r
->in
.info
->info2
->password
&& r
->in
.info
->info2
->password
[0]) {
480 info
[i
].name
= SHARE_PASSWORD
;
481 info
[i
].type
= SHARE_INFO_STRING
;
482 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info2
->password
);
483 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
488 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
489 info
[i
].type
= SHARE_INFO_INT
;
490 info
[i
].value
= talloc(info
, int);
491 *((int *)info
[i
].value
) = r
->in
.info
->info2
->max_users
;
494 /* TODO: security descriptor */
496 nterr
= share_create(sctx
, r
->in
.info
->info2
->name
, info
, i
);
497 if (!NT_STATUS_IS_OK(nterr
)) {
498 return ntstatus_to_werror(nterr
);
501 if (r
->in
.parm_error
) {
502 r
->out
.parm_error
= r
->in
.parm_error
;
509 if (r
->in
.parm_error
) {
510 r
->out
.parm_error
= r
->in
.parm_error
;
512 return WERR_NOT_SUPPORTED
;
517 struct share_info
*info
;
518 struct share_context
*sctx
;
519 unsigned int count
= 10;
522 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
523 if (!NT_STATUS_IS_OK(nterr
)) {
524 return ntstatus_to_werror(nterr
);
527 /* there are no more than 10 options in struct srvsvc_NetShareInfo502 */
528 info
= talloc_array(mem_ctx
, struct share_info
, count
);
529 W_ERROR_HAVE_NO_MEMORY(info
);
533 info
[i
].name
= SHARE_TYPE
;
534 info
[i
].type
= SHARE_INFO_STRING
;
535 switch (r
->in
.info
->info502
->type
) {
537 info
[i
].value
= talloc_strdup(info
, "DISK");
540 info
[i
].value
= talloc_strdup(info
, "PRINTER");
543 info
[i
].value
= talloc_strdup(info
, "IPC");
546 return WERR_INVALID_PARAMETER
;
548 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
551 if (r
->in
.info
->info502
->path
&& r
->in
.info
->info502
->path
[0]) {
552 info
[i
].name
= SHARE_PATH
;
553 info
[i
].type
= SHARE_INFO_STRING
;
555 /* Windows will send a path in a form of C:\example\path */
556 if (r
->in
.info
->info502
->path
[1] == ':') {
557 info
[i
].value
= talloc_strdup(info
, &r
->in
.info
->info502
->path
[2]);
559 /* very strange let's try to set as is */
560 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->path
);
562 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
563 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
568 if (r
->in
.info
->info502
->comment
&& r
->in
.info
->info502
->comment
[0]) {
569 info
[i
].name
= SHARE_COMMENT
;
570 info
[i
].type
= SHARE_INFO_STRING
;
571 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->comment
);
572 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
577 if (r
->in
.info
->info502
->password
&& r
->in
.info
->info502
->password
[0]) {
578 info
[i
].name
= SHARE_PASSWORD
;
579 info
[i
].type
= SHARE_INFO_STRING
;
580 info
[i
].value
= talloc_strdup(info
, r
->in
.info
->info502
->password
);
581 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
586 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
587 info
[i
].type
= SHARE_INFO_INT
;
588 info
[i
].value
= talloc(info
, int);
589 *((int *)info
[i
].value
) = r
->in
.info
->info502
->max_users
;
592 /* TODO: security descriptor */
594 nterr
= share_create(sctx
, r
->in
.info
->info502
->name
, info
, i
);
595 if (!NT_STATUS_IS_OK(nterr
)) {
596 return ntstatus_to_werror(nterr
);
599 if (r
->in
.parm_error
) {
600 r
->out
.parm_error
= r
->in
.parm_error
;
606 return WERR_INVALID_LEVEL
;
610 static WERROR
dcesrv_srvsvc_fiel_ShareInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
611 struct share_config
*scfg
, uint32_t level
,
612 union srvsvc_NetShareInfo
*info
)
614 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
619 info
->info0
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
620 W_ERROR_HAVE_NO_MEMORY(info
->info0
->name
);
626 info
->info1
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
627 W_ERROR_HAVE_NO_MEMORY(info
->info1
->name
);
628 info
->info1
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
629 info
->info1
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
630 W_ERROR_HAVE_NO_MEMORY(info
->info1
->comment
);
636 info
->info2
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
637 W_ERROR_HAVE_NO_MEMORY(info
->info2
->name
);
638 info
->info2
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
639 info
->info2
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
640 W_ERROR_HAVE_NO_MEMORY(info
->info2
->comment
);
641 info
->info2
->permissions
= dcesrv_common_get_share_permissions(mem_ctx
, dce_ctx
, scfg
);
642 info
->info2
->max_users
= share_int_option(scfg
, SHARE_MAX_CONNECTIONS
, SHARE_MAX_CONNECTIONS_DEFAULT
);
643 info
->info2
->current_users
= dcesrv_common_get_share_current_users(mem_ctx
, dce_ctx
, scfg
);
644 info
->info2
->path
= dcesrv_common_get_share_path(mem_ctx
, dce_ctx
, scfg
);
645 W_ERROR_HAVE_NO_MEMORY(info
->info2
->path
);
646 info
->info2
->password
= share_string_option(mem_ctx
, scfg
, SHARE_PASSWORD
, NULL
);
652 info
->info501
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
653 W_ERROR_HAVE_NO_MEMORY(info
->info501
->name
);
654 info
->info501
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
655 info
->info501
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
656 W_ERROR_HAVE_NO_MEMORY(info
->info501
->comment
);
657 info
->info501
->csc_policy
= share_int_option(scfg
, SHARE_CSC_POLICY
, SHARE_CSC_POLICY_DEFAULT
);
663 info
->info502
->name
= talloc_strdup(mem_ctx
, scfg
->name
);
664 W_ERROR_HAVE_NO_MEMORY(info
->info502
->name
);
665 info
->info502
->type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
666 info
->info502
->comment
= share_string_option(mem_ctx
, scfg
, SHARE_COMMENT
, "");
667 W_ERROR_HAVE_NO_MEMORY(info
->info502
->comment
);
668 info
->info502
->permissions
= dcesrv_common_get_share_permissions(mem_ctx
, dce_ctx
, scfg
);
669 info
->info502
->max_users
= share_int_option(scfg
, SHARE_MAX_CONNECTIONS
, SHARE_MAX_CONNECTIONS_DEFAULT
);
670 info
->info502
->current_users
= dcesrv_common_get_share_current_users(mem_ctx
, dce_ctx
, scfg
);
671 info
->info502
->path
= dcesrv_common_get_share_path(mem_ctx
, dce_ctx
, scfg
);
672 W_ERROR_HAVE_NO_MEMORY(info
->info502
->path
);
673 info
->info502
->password
= share_string_option(mem_ctx
, scfg
, SHARE_PASSWORD
, NULL
);
674 info
->info502
->sd_buf
.sd
= dcesrv_common_get_security_descriptor(mem_ctx
, dce_ctx
, scfg
);
680 info
->info1005
->dfs_flags
= dcesrv_common_get_share_dfs_flags(mem_ctx
, dce_ctx
, scfg
);
685 return WERR_INVALID_LEVEL
;
690 srvsvc_NetShareEnumAll
692 static WERROR
dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
693 struct srvsvc_NetShareEnumAll
*r
)
698 struct share_context
*sctx
;
699 struct share_config
*scfg
;
701 *r
->out
.totalentries
= 0;
703 /* TODO: - paging of results
706 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
707 if (!NT_STATUS_IS_OK(nterr
)) {
708 return ntstatus_to_werror(nterr
);
711 nterr
= share_list_all(mem_ctx
, sctx
, &numshares
, &snames
);
712 if (!NT_STATUS_IS_OK(nterr
)) {
713 return ntstatus_to_werror(nterr
);
716 switch (r
->in
.info_ctr
->level
) {
720 struct srvsvc_NetShareCtr0
*ctr0
;
722 ctr0
= talloc(mem_ctx
, struct srvsvc_NetShareCtr0
);
723 W_ERROR_HAVE_NO_MEMORY(ctr0
);
725 ctr0
->count
= numshares
;
728 if (ctr0
->count
== 0) {
729 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
733 ctr0
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo0
, ctr0
->count
);
734 W_ERROR_HAVE_NO_MEMORY(ctr0
->array
);
736 for (i
= 0; i
< ctr0
->count
; i
++) {
738 union srvsvc_NetShareInfo info
;
740 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
741 if (!NT_STATUS_IS_OK(nterr
)) {
742 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
743 return WERR_GEN_FAILURE
;
745 info
.info0
= &ctr0
->array
[i
];
746 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
747 if (!W_ERROR_IS_OK(status
)) {
754 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
755 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr0
->count
;
761 struct srvsvc_NetShareCtr1
*ctr1
;
763 ctr1
= talloc(mem_ctx
, struct srvsvc_NetShareCtr1
);
764 W_ERROR_HAVE_NO_MEMORY(ctr1
);
766 ctr1
->count
= numshares
;
769 if (ctr1
->count
== 0) {
770 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
774 ctr1
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo1
, ctr1
->count
);
775 W_ERROR_HAVE_NO_MEMORY(ctr1
->array
);
777 for (i
=0; i
< ctr1
->count
; i
++) {
779 union srvsvc_NetShareInfo info
;
781 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
782 if (!NT_STATUS_IS_OK(nterr
)) {
783 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
784 return WERR_GEN_FAILURE
;
786 info
.info1
= &ctr1
->array
[i
];
787 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
788 if (!W_ERROR_IS_OK(status
)) {
795 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
796 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr1
->count
;
803 struct srvsvc_NetShareCtr2
*ctr2
;
805 SRVSVC_CHECK_ADMIN_ACCESS
;
807 ctr2
= talloc(mem_ctx
, struct srvsvc_NetShareCtr2
);
808 W_ERROR_HAVE_NO_MEMORY(ctr2
);
810 ctr2
->count
= numshares
;
813 if (ctr2
->count
== 0) {
814 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
818 ctr2
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo2
, ctr2
->count
);
819 W_ERROR_HAVE_NO_MEMORY(ctr2
->array
);
821 for (i
=0; i
< ctr2
->count
; i
++) {
823 union srvsvc_NetShareInfo info
;
825 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
826 if (!NT_STATUS_IS_OK(nterr
)) {
827 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
828 return WERR_GEN_FAILURE
;
830 info
.info2
= &ctr2
->array
[i
];
831 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
832 if (!W_ERROR_IS_OK(status
)) {
839 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
840 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr2
->count
;
847 struct srvsvc_NetShareCtr501
*ctr501
;
849 SRVSVC_CHECK_ADMIN_ACCESS
;
851 ctr501
= talloc(mem_ctx
, struct srvsvc_NetShareCtr501
);
852 W_ERROR_HAVE_NO_MEMORY(ctr501
);
854 ctr501
->count
= numshares
;
855 ctr501
->array
= NULL
;
857 if (ctr501
->count
== 0) {
858 r
->out
.info_ctr
->ctr
.ctr501
= ctr501
;
862 ctr501
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo501
, ctr501
->count
);
863 W_ERROR_HAVE_NO_MEMORY(ctr501
->array
);
865 for (i
=0; i
< ctr501
->count
; i
++) {
867 union srvsvc_NetShareInfo info
;
869 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
870 if (!NT_STATUS_IS_OK(nterr
)) {
871 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
872 return WERR_GEN_FAILURE
;
874 info
.info501
= &ctr501
->array
[i
];
875 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
876 if (!W_ERROR_IS_OK(status
)) {
883 r
->out
.info_ctr
->ctr
.ctr501
= ctr501
;
884 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr501
->count
;
891 struct srvsvc_NetShareCtr502
*ctr502
;
893 SRVSVC_CHECK_ADMIN_ACCESS
;
895 ctr502
= talloc(mem_ctx
, struct srvsvc_NetShareCtr502
);
896 W_ERROR_HAVE_NO_MEMORY(ctr502
);
898 ctr502
->count
= numshares
;
899 ctr502
->array
= NULL
;
901 if (ctr502
->count
== 0) {
902 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
906 ctr502
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo502
, ctr502
->count
);
907 W_ERROR_HAVE_NO_MEMORY(ctr502
->array
);
909 for (i
=0; i
< ctr502
->count
; i
++) {
911 union srvsvc_NetShareInfo info
;
913 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
914 if (!NT_STATUS_IS_OK(nterr
)) {
915 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
916 return WERR_GEN_FAILURE
;
918 info
.info502
= &ctr502
->array
[i
];
919 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
920 if (!W_ERROR_IS_OK(status
)) {
927 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
928 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr502
->count
;
933 return WERR_INVALID_LEVEL
;
939 srvsvc_NetShareGetInfo
941 static WERROR
dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
942 struct srvsvc_NetShareGetInfo
*r
)
945 struct share_context
*sctx
= NULL
;
946 struct share_config
*scfg
= NULL
;
948 ZERO_STRUCTP(r
->out
.info
);
950 /* TODO: - access check
953 if (strcmp("", r
->in
.share_name
) == 0) {
954 return WERR_INVALID_PARAMETER
;
957 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
958 if (!NT_STATUS_IS_OK(nterr
)) {
959 return ntstatus_to_werror(nterr
);
962 nterr
= share_get_config(mem_ctx
, sctx
, r
->in
.share_name
, &scfg
);
963 if (!NT_STATUS_IS_OK(nterr
)) {
964 return ntstatus_to_werror(nterr
);
967 switch (r
->in
.level
) {
971 union srvsvc_NetShareInfo info
;
973 info
.info0
= talloc(mem_ctx
, struct srvsvc_NetShareInfo0
);
974 W_ERROR_HAVE_NO_MEMORY(info
.info0
);
976 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
977 if (!W_ERROR_IS_OK(status
)) {
981 r
->out
.info
->info0
= info
.info0
;
987 union srvsvc_NetShareInfo info
;
989 info
.info1
= talloc(mem_ctx
, struct srvsvc_NetShareInfo1
);
990 W_ERROR_HAVE_NO_MEMORY(info
.info1
);
992 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
993 if (!W_ERROR_IS_OK(status
)) {
997 r
->out
.info
->info1
= info
.info1
;
1003 union srvsvc_NetShareInfo info
;
1005 SRVSVC_CHECK_ADMIN_ACCESS
;
1007 info
.info2
= talloc(mem_ctx
, struct srvsvc_NetShareInfo2
);
1008 W_ERROR_HAVE_NO_MEMORY(info
.info2
);
1010 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1011 if (!W_ERROR_IS_OK(status
)) {
1015 r
->out
.info
->info2
= info
.info2
;
1021 union srvsvc_NetShareInfo info
;
1023 info
.info501
= talloc(mem_ctx
, struct srvsvc_NetShareInfo501
);
1024 W_ERROR_HAVE_NO_MEMORY(info
.info501
);
1026 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1027 if (!W_ERROR_IS_OK(status
)) {
1031 r
->out
.info
->info501
= info
.info501
;
1037 union srvsvc_NetShareInfo info
;
1039 SRVSVC_CHECK_ADMIN_ACCESS
;
1041 info
.info502
= talloc(mem_ctx
, struct srvsvc_NetShareInfo502
);
1042 W_ERROR_HAVE_NO_MEMORY(info
.info502
);
1044 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1045 if (!W_ERROR_IS_OK(status
)) {
1049 r
->out
.info
->info502
= info
.info502
;
1055 union srvsvc_NetShareInfo info
;
1057 info
.info1005
= talloc(mem_ctx
, struct srvsvc_NetShareInfo1005
);
1058 W_ERROR_HAVE_NO_MEMORY(info
.info1005
);
1060 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.level
, &info
);
1061 if (!W_ERROR_IS_OK(status
)) {
1065 r
->out
.info
->info1005
= info
.info1005
;
1069 return WERR_INVALID_LEVEL
;
1073 static WERROR
dcesrv_srvsvc_fill_share_info(struct share_info
*info
, int *count
,
1074 const char *share_name
, int level
,
1077 const char *comment
,
1078 const char *password
,
1079 enum srvsvc_ShareType type
,
1081 uint32_t csc_policy
,
1082 struct security_descriptor
*sd
)
1087 info
[i
].name
= SHARE_CSC_POLICY
;
1088 info
[i
].type
= SHARE_INFO_INT
;
1089 info
[i
].value
= talloc(info
, int);
1090 *((int *)info
[i
].value
) = csc_policy
;
1097 /* TODO: check if unknown is csc_policy */
1099 /* TODO: security descriptor */
1102 if (path
&& path
[0]) {
1103 info
[i
].name
= SHARE_PATH
;
1104 info
[i
].type
= SHARE_INFO_STRING
;
1106 /* Windows will send a path in a form of C:\example\path */
1107 if (path
[1] == ':') {
1108 info
[i
].value
= talloc_strdup(info
, &path
[2]);
1110 /* very strange let's try to set as is */
1111 info
[i
].value
= talloc_strdup(info
, path
);
1113 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1114 all_string_sub((char *)info
[i
].value
, "\\", "/", 0);
1119 if (password
&& password
[0]) {
1120 info
[i
].name
= SHARE_PASSWORD
;
1121 info
[i
].type
= SHARE_INFO_STRING
;
1122 info
[i
].value
= talloc_strdup(info
, password
);
1123 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1128 info
[i
].name
= SHARE_MAX_CONNECTIONS
;
1129 info
[i
].type
= SHARE_INFO_INT
;
1130 info
[i
].value
= talloc(info
, int);
1131 *((int *)info
[i
].value
) = max_users
;
1137 info
[i
].name
= SHARE_TYPE
;
1138 info
[i
].type
= SHARE_INFO_STRING
;
1141 info
[i
].value
= talloc_strdup(info
, "DISK");
1144 info
[i
].value
= talloc_strdup(info
, "PRINTER");
1147 info
[i
].value
= talloc_strdup(info
, "IPC");
1150 return WERR_INVALID_PARAMETER
;
1152 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1158 info
[i
].name
= SHARE_COMMENT
;
1159 info
[i
].type
= SHARE_INFO_STRING
;
1160 info
[i
].value
= talloc_strdup(info
, comment
);
1161 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1169 strcasecmp(share_name
, name
) != 0) {
1170 info
[i
].name
= SHARE_NAME
;
1171 info
[i
].type
= SHARE_INFO_STRING
;
1172 info
[i
].value
= talloc_strdup(info
, name
);
1173 W_ERROR_HAVE_NO_MEMORY(info
[i
].value
);
1180 return WERR_INVALID_LEVEL
;
1189 srvsvc_NetShareSetInfo
1191 static WERROR
dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1192 struct srvsvc_NetShareSetInfo
*r
)
1196 struct share_context
*sctx
= NULL
;
1197 struct share_info
*info
;
1200 /* TODO: - access check
1203 /* there are no more than 10 options in all struct srvsvc_NetShareInfoXXX */
1204 info
= talloc_array(mem_ctx
, struct share_info
, 10);
1205 W_ERROR_HAVE_NO_MEMORY(info
);
1207 if (strcmp("", r
->in
.share_name
) == 0) {
1208 return WERR_INVALID_PARAMETER
;
1211 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
1212 if (!NT_STATUS_IS_OK(nterr
)) {
1213 return ntstatus_to_werror(nterr
);
1216 switch (r
->in
.level
) {
1219 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1220 r
->in
.share_name
, r
->in
.level
,
1221 r
->in
.info
->info0
->name
,
1229 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1236 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1237 r
->in
.share_name
, r
->in
.level
,
1238 r
->in
.info
->info1
->name
,
1240 r
->in
.info
->info1
->comment
,
1242 r
->in
.info
->info1
->type
,
1246 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1253 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1254 r
->in
.share_name
, r
->in
.level
,
1255 r
->in
.info
->info2
->name
,
1256 r
->in
.info
->info2
->path
,
1257 r
->in
.info
->info2
->comment
,
1258 r
->in
.info
->info2
->password
,
1259 r
->in
.info
->info2
->type
,
1260 r
->in
.info
->info2
->max_users
,
1263 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1270 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1271 r
->in
.share_name
, r
->in
.level
,
1272 r
->in
.info
->info501
->name
,
1274 r
->in
.info
->info501
->comment
,
1276 r
->in
.info
->info501
->type
,
1278 r
->in
.info
->info501
->csc_policy
,
1280 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1287 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1288 r
->in
.share_name
, r
->in
.level
,
1289 r
->in
.info
->info502
->name
,
1290 r
->in
.info
->info502
->path
,
1291 r
->in
.info
->info502
->comment
,
1292 r
->in
.info
->info502
->password
,
1293 r
->in
.info
->info502
->type
,
1294 r
->in
.info
->info502
->max_users
,
1296 r
->in
.info
->info502
->sd_buf
.sd
);
1297 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1304 status
= dcesrv_srvsvc_fill_share_info(info
, &count
,
1305 r
->in
.share_name
, r
->in
.level
,
1308 r
->in
.info
->info1004
->comment
,
1314 if (!W_ERROR_EQUAL(status
, WERR_OK
)) {
1321 /* r->in.info.dfs_flags; */
1323 if (r
->in
.parm_error
) {
1324 r
->out
.parm_error
= r
->in
.parm_error
;
1330 return WERR_INVALID_LEVEL
;
1333 nterr
= share_set(sctx
, r
->in
.share_name
, info
, count
);
1334 if (!NT_STATUS_IS_OK(nterr
)) {
1335 return ntstatus_to_werror(nterr
);
1338 if (r
->in
.parm_error
) {
1339 r
->out
.parm_error
= r
->in
.parm_error
;
1347 srvsvc_NetShareDelSticky
1349 static WERROR
dcesrv_srvsvc_NetShareDelSticky(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1350 struct srvsvc_NetShareDelSticky
*r
)
1352 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1357 srvsvc_NetShareCheck
1359 static WERROR
dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1360 struct srvsvc_NetShareCheck
*r
)
1363 struct share_context
*sctx
= NULL
;
1364 struct share_config
*scfg
= NULL
;
1372 /* TODO: - access check
1375 if (strcmp("", r
->in
.device_name
) == 0) {
1376 *r
->out
.type
= STYPE_IPC
;
1380 /* copy the path skipping C:\ */
1381 if (strncasecmp(r
->in
.device_name
, "C:", 2) == 0) {
1382 device
= talloc_strdup(mem_ctx
, &r
->in
.device_name
[2]);
1384 /* no chance we have a share that doesn't start with C:\ */
1385 return WERR_NERR_DEVICENOTSHARED
;
1387 all_string_sub(device
, "\\", "/", 0);
1389 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
1390 if (!NT_STATUS_IS_OK(nterr
)) {
1391 return ntstatus_to_werror(nterr
);
1394 nterr
= share_list_all(mem_ctx
, sctx
, &count
, &names
);
1395 if (!NT_STATUS_IS_OK(nterr
)) {
1396 return ntstatus_to_werror(nterr
);
1399 for (i
= 0; i
< count
; i
++) {
1403 nterr
= share_get_config(mem_ctx
, sctx
, names
[i
], &scfg
);
1404 if (!NT_STATUS_IS_OK(nterr
)) {
1405 return ntstatus_to_werror(nterr
);
1407 path
= share_string_option(mem_ctx
, scfg
, SHARE_PATH
, NULL
);
1408 if (!path
) continue;
1410 if (strcmp(device
, path
) == 0) {
1411 type
= share_string_option(mem_ctx
, scfg
, SHARE_TYPE
, NULL
);
1412 if (!type
) continue;
1414 if (strcmp(type
, "DISK") == 0) {
1415 *r
->out
.type
= STYPE_DISKTREE
;
1419 if (strcmp(type
, "IPC") == 0) {
1420 *r
->out
.type
= STYPE_IPC
;
1424 if (strcmp(type
, "PRINTER") == 0) {
1425 *r
->out
.type
= STYPE_PRINTQ
;
1431 return WERR_NERR_DEVICENOTSHARED
;
1436 srvsvc_NetSrvGetInfo
1438 static WERROR
dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1439 struct srvsvc_NetSrvGetInfo
*r
)
1441 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
1442 struct dcerpc_server_info
*server_info
= lpcfg_dcerpc_server_info(mem_ctx
, dce_ctx
->lp_ctx
);
1443 const struct loadparm_substitution
*lp_sub
=
1444 lpcfg_noop_substitution();
1446 ZERO_STRUCTP(r
->out
.info
);
1448 switch (r
->in
.level
) {
1451 struct srvsvc_NetSrvInfo100
*info100
;
1453 info100
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo100
);
1454 W_ERROR_HAVE_NO_MEMORY(info100
);
1456 info100
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1457 info100
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1458 W_ERROR_HAVE_NO_MEMORY(info100
->server_name
);
1460 r
->out
.info
->info100
= info100
;
1465 struct srvsvc_NetSrvInfo101
*info101
;
1467 info101
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo101
);
1468 W_ERROR_HAVE_NO_MEMORY(info101
);
1470 info101
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1471 info101
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1472 W_ERROR_HAVE_NO_MEMORY(info101
->server_name
);
1474 info101
->version_major
= server_info
->version_major
;
1475 info101
->version_minor
= server_info
->version_minor
;
1476 info101
->server_type
= dcesrv_common_get_server_type(mem_ctx
, dce_call
->event_ctx
, dce_ctx
);
1477 info101
->comment
= lpcfg_server_string(dce_ctx
->lp_ctx
, lp_sub
, mem_ctx
);
1478 W_ERROR_HAVE_NO_MEMORY(info101
->comment
);
1480 r
->out
.info
->info101
= info101
;
1485 struct srvsvc_NetSrvInfo102
*info102
;
1487 info102
= talloc(mem_ctx
, struct srvsvc_NetSrvInfo102
);
1488 W_ERROR_HAVE_NO_MEMORY(info102
);
1490 info102
->platform_id
= dcesrv_common_get_platform_id(mem_ctx
, dce_ctx
);
1491 info102
->server_name
= dcesrv_common_get_server_name(mem_ctx
, dce_ctx
, r
->in
.server_unc
);
1492 W_ERROR_HAVE_NO_MEMORY(info102
->server_name
);
1494 info102
->version_major
= server_info
->version_major
;
1495 info102
->version_minor
= server_info
->version_minor
;
1496 info102
->server_type
= dcesrv_common_get_server_type(mem_ctx
, dce_call
->event_ctx
, dce_ctx
);
1497 info102
->comment
= lpcfg_server_string(dce_ctx
->lp_ctx
, lp_sub
, mem_ctx
);
1498 W_ERROR_HAVE_NO_MEMORY(info102
->comment
);
1500 info102
->users
= dcesrv_common_get_users(mem_ctx
, dce_ctx
);
1501 info102
->disc
= dcesrv_common_get_disc(mem_ctx
, dce_ctx
);
1502 info102
->hidden
= dcesrv_common_get_hidden(mem_ctx
, dce_ctx
);
1503 info102
->announce
= dcesrv_common_get_announce(mem_ctx
, dce_ctx
);
1504 info102
->anndelta
= dcesrv_common_get_anndelta(mem_ctx
, dce_ctx
);
1505 info102
->licenses
= dcesrv_common_get_licenses(mem_ctx
, dce_ctx
);
1506 info102
->userpath
= dcesrv_common_get_userpath(mem_ctx
, dce_ctx
);
1507 W_ERROR_HAVE_NO_MEMORY(info102
->userpath
);
1509 r
->out
.info
->info102
= info102
;
1513 return WERR_INVALID_LEVEL
;
1519 srvsvc_NetSrvSetInfo
1521 static WERROR
dcesrv_srvsvc_NetSrvSetInfo(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1522 struct srvsvc_NetSrvSetInfo
*r
)
1524 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1531 static WERROR
dcesrv_srvsvc_NetDiskEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1532 struct srvsvc_NetDiskEnum
*r
)
1534 r
->out
.info
->disks
= NULL
;
1535 r
->out
.info
->count
= 0;
1536 *r
->out
.totalentries
= 0;
1538 switch (r
->in
.level
) {
1541 /* we can safely hardcode the reply and report we have only one disk (C:) */
1542 /* for some reason Windows wants 2 entries with the second being empty */
1543 r
->out
.info
->disks
= talloc_array(mem_ctx
, struct srvsvc_NetDiskInfo0
, 2);
1544 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
);
1545 r
->out
.info
->count
= 2;
1547 r
->out
.info
->disks
[0].disk
= talloc_strdup(mem_ctx
, "C:");
1548 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
[0].disk
);
1550 r
->out
.info
->disks
[1].disk
= talloc_strdup(mem_ctx
, "");
1551 W_ERROR_HAVE_NO_MEMORY(r
->out
.info
->disks
[1].disk
);
1553 *r
->out
.totalentries
= 1;
1554 r
->out
.resume_handle
= r
->in
.resume_handle
;
1559 return WERR_INVALID_LEVEL
;
1565 srvsvc_NetServerStatisticsGet
1567 static WERROR
dcesrv_srvsvc_NetServerStatisticsGet(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1568 struct srvsvc_NetServerStatisticsGet
*r
)
1570 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1575 srvsvc_NetTransportAdd
1577 static WERROR
dcesrv_srvsvc_NetTransportAdd(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1578 struct srvsvc_NetTransportAdd
*r
)
1580 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1585 srvsvc_NetTransportEnum
1587 static WERROR
dcesrv_srvsvc_NetTransportEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1588 struct srvsvc_NetTransportEnum
*r
)
1590 r
->out
.transports
->level
= r
->in
.transports
->level
;
1591 *r
->out
.totalentries
= 0;
1592 if (r
->out
.resume_handle
) {
1593 *r
->out
.resume_handle
= 0;
1596 switch (r
->in
.transports
->level
) {
1599 r
->out
.transports
->ctr
.ctr0
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr0
);
1600 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr0
);
1602 r
->out
.transports
->ctr
.ctr0
->count
= 0;
1603 r
->out
.transports
->ctr
.ctr0
->array
= NULL
;
1605 return WERR_NOT_SUPPORTED
;
1609 r
->out
.transports
->ctr
.ctr1
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr1
);
1610 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr1
);
1612 r
->out
.transports
->ctr
.ctr1
->count
= 0;
1613 r
->out
.transports
->ctr
.ctr1
->array
= NULL
;
1615 return WERR_NOT_SUPPORTED
;
1619 r
->out
.transports
->ctr
.ctr2
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr2
);
1620 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr2
);
1622 r
->out
.transports
->ctr
.ctr2
->count
= 0;
1623 r
->out
.transports
->ctr
.ctr2
->array
= NULL
;
1625 return WERR_NOT_SUPPORTED
;
1629 r
->out
.transports
->ctr
.ctr3
= talloc(mem_ctx
, struct srvsvc_NetTransportCtr3
);
1630 W_ERROR_HAVE_NO_MEMORY(r
->out
.transports
->ctr
.ctr3
);
1632 r
->out
.transports
->ctr
.ctr3
->count
= 0;
1633 r
->out
.transports
->ctr
.ctr3
->array
= NULL
;
1635 return WERR_NOT_SUPPORTED
;
1638 return WERR_INVALID_LEVEL
;
1643 srvsvc_NetTransportDel
1645 static WERROR
dcesrv_srvsvc_NetTransportDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1646 struct srvsvc_NetTransportDel
*r
)
1648 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1655 static WERROR
dcesrv_srvsvc_NetRemoteTOD(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1656 struct srvsvc_NetRemoteTOD
*r
)
1658 struct timeval tval
;
1661 struct srvsvc_NetRemoteTODInfo
*info
;
1663 info
= talloc(mem_ctx
, struct srvsvc_NetRemoteTODInfo
);
1664 W_ERROR_HAVE_NO_MEMORY(info
);
1666 GetTimeOfDay(&tval
);
1672 /* TODO: fake the uptime: just return the milliseconds till 0:00:00 today */
1673 info
->msecs
= (tm
.tm_hour
*60*60*1000)
1674 + (tm
.tm_min
*60*1000)
1676 + (tval
.tv_usec
/1000);
1677 info
->hours
= tm
.tm_hour
;
1678 info
->mins
= tm
.tm_min
;
1679 info
->secs
= tm
.tm_sec
;
1680 info
->hunds
= tval
.tv_usec
/10000;
1681 info
->timezone
= get_time_zone(t
)/60;
1682 info
->tinterval
= 310; /* just return the same as windows */
1683 info
->day
= tm
.tm_mday
;
1684 info
->month
= tm
.tm_mon
+ 1;
1685 info
->year
= tm
.tm_year
+ 1900;
1686 info
->weekday
= tm
.tm_wday
;
1688 *r
->out
.info
= info
;
1696 static WERROR
dcesrv_srvsvc_NetPathType(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1697 struct srvsvc_NetPathType
*r
)
1699 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1704 srvsvc_NetPathCanonicalize
1706 static WERROR
dcesrv_srvsvc_NetPathCanonicalize(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1707 struct srvsvc_NetPathCanonicalize
*r
)
1709 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1714 srvsvc_NetPathCompare
1716 static WERROR
dcesrv_srvsvc_NetPathCompare(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1717 struct srvsvc_NetPathCompare
*r
)
1719 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1724 srvsvc_NetNameValidate
1726 static WERROR
dcesrv_srvsvc_NetNameValidate(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1727 struct srvsvc_NetNameValidate
*r
)
1731 if ((r
->in
.flags
!= 0x0) && (r
->in
.flags
!= 0x80000000)) {
1732 return WERR_INVALID_NAME
;
1735 switch (r
->in
.name_type
) {
1744 return WERR_NOT_SUPPORTED
;
1746 case 9: /* validate share name */
1748 len
= strlen_m(r
->in
.name
);
1749 if ((r
->in
.flags
== 0x0) && (len
> 81)) {
1750 return WERR_INVALID_NAME
;
1752 if ((r
->in
.flags
== 0x80000000) && (len
> 13)) {
1753 return WERR_INVALID_NAME
;
1755 if (! dcesrv_common_validate_share_name(mem_ctx
, r
->in
.name
)) {
1756 return WERR_INVALID_NAME
;
1764 return WERR_NOT_SUPPORTED
;
1766 return WERR_INVALID_PARAMETER
;
1772 srvsvc_NetPRNameCompare
1774 static WERROR
dcesrv_srvsvc_NetPRNameCompare(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1775 struct srvsvc_NetPRNameCompare
*r
)
1777 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
1784 static WERROR
dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
1785 struct srvsvc_NetShareEnum
*r
)
1789 const char **snames
;
1790 struct share_context
*sctx
;
1791 struct share_config
*scfg
;
1792 struct dcesrv_context
*dce_ctx
= dce_call
->conn
->dce_ctx
;
1794 *r
->out
.totalentries
= 0;
1796 /* TODO: - paging of results
1799 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
1800 if (!NT_STATUS_IS_OK(nterr
)) {
1801 return ntstatus_to_werror(nterr
);
1804 nterr
= share_list_all(mem_ctx
, sctx
, &numshares
, &snames
);
1805 if (!NT_STATUS_IS_OK(nterr
)) {
1806 return ntstatus_to_werror(nterr
);
1809 switch (r
->in
.info_ctr
->level
) {
1812 unsigned int i
, y
= 0;
1814 struct srvsvc_NetShareCtr0
*ctr0
;
1816 ctr0
= talloc(mem_ctx
, struct srvsvc_NetShareCtr0
);
1817 W_ERROR_HAVE_NO_MEMORY(ctr0
);
1820 ctr0
->count
= count
;
1823 if (ctr0
->count
== 0) {
1824 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
1828 ctr0
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo0
, count
);
1829 W_ERROR_HAVE_NO_MEMORY(ctr0
->array
);
1831 for (i
=0; i
< count
; i
++) {
1833 union srvsvc_NetShareInfo info
;
1834 enum srvsvc_ShareType type
;
1836 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1837 if (!NT_STATUS_IS_OK(nterr
)) {
1838 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1839 return WERR_GEN_FAILURE
;
1842 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1843 if (type
& STYPE_HIDDEN
) {
1849 info
.info0
= &ctr0
->array
[y
];
1850 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
1851 W_ERROR_NOT_OK_RETURN(status
);
1855 talloc_free(snames
);
1857 r
->out
.info_ctr
->ctr
.ctr0
= ctr0
;
1858 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr0
->count
;
1864 unsigned int i
, y
= 0;
1866 struct srvsvc_NetShareCtr1
*ctr1
;
1868 ctr1
= talloc(mem_ctx
, struct srvsvc_NetShareCtr1
);
1869 W_ERROR_HAVE_NO_MEMORY(ctr1
);
1872 ctr1
->count
= count
;
1875 if (ctr1
->count
== 0) {
1876 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
1880 ctr1
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo1
, count
);
1881 W_ERROR_HAVE_NO_MEMORY(ctr1
->array
);
1883 for (i
=0; i
< count
; i
++) {
1885 union srvsvc_NetShareInfo info
;
1886 enum srvsvc_ShareType type
;
1888 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1889 if (!NT_STATUS_IS_OK(nterr
)) {
1890 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1891 return WERR_GEN_FAILURE
;
1894 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1895 if (type
& STYPE_HIDDEN
) {
1901 info
.info1
= &ctr1
->array
[y
];
1902 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
1903 W_ERROR_NOT_OK_RETURN(status
);
1907 talloc_free(snames
);
1909 r
->out
.info_ctr
->ctr
.ctr1
= ctr1
;
1910 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr1
->count
;
1916 unsigned int i
, y
= 0;
1918 struct srvsvc_NetShareCtr2
*ctr2
;
1920 SRVSVC_CHECK_ADMIN_ACCESS
;
1922 ctr2
= talloc(mem_ctx
, struct srvsvc_NetShareCtr2
);
1923 W_ERROR_HAVE_NO_MEMORY(ctr2
);
1926 ctr2
->count
= count
;
1929 if (ctr2
->count
== 0) {
1930 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
1934 ctr2
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo2
, count
);
1935 W_ERROR_HAVE_NO_MEMORY(ctr2
->array
);
1937 for (i
=0; i
< count
; i
++) {
1939 union srvsvc_NetShareInfo info
;
1940 enum srvsvc_ShareType type
;
1942 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1943 if (!NT_STATUS_IS_OK(nterr
)) {
1944 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1945 return WERR_GEN_FAILURE
;
1948 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
1949 if (type
& STYPE_HIDDEN
) {
1955 info
.info2
= &ctr2
->array
[y
];
1956 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
1957 W_ERROR_NOT_OK_RETURN(status
);
1961 talloc_free(snames
);
1963 r
->out
.info_ctr
->ctr
.ctr2
= ctr2
;
1964 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr2
->count
;
1970 unsigned int i
, y
= 0;
1972 struct srvsvc_NetShareCtr502
*ctr502
;
1974 SRVSVC_CHECK_ADMIN_ACCESS
;
1976 ctr502
= talloc(mem_ctx
, struct srvsvc_NetShareCtr502
);
1977 W_ERROR_HAVE_NO_MEMORY(ctr502
);
1980 ctr502
->count
= count
;
1981 ctr502
->array
= NULL
;
1983 if (ctr502
->count
== 0) {
1984 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
1988 ctr502
->array
= talloc_array(mem_ctx
, struct srvsvc_NetShareInfo502
, count
);
1989 W_ERROR_HAVE_NO_MEMORY(ctr502
->array
);
1991 for (i
=0; i
< count
; i
++) {
1993 union srvsvc_NetShareInfo info
;
1994 enum srvsvc_ShareType type
;
1996 nterr
= share_get_config(mem_ctx
, sctx
, snames
[i
], &scfg
);
1997 if (!NT_STATUS_IS_OK(nterr
)) {
1998 DEBUG(1, ("ERROR: Service [%s] disappeared after enumeration", snames
[i
]));
1999 return WERR_GEN_FAILURE
;
2002 type
= dcesrv_common_get_share_type(mem_ctx
, dce_ctx
, scfg
);
2003 if (type
& STYPE_HIDDEN
) {
2009 info
.info502
= &ctr502
->array
[y
];
2010 status
= dcesrv_srvsvc_fiel_ShareInfo(dce_call
, mem_ctx
, scfg
, r
->in
.info_ctr
->level
, &info
);
2011 W_ERROR_NOT_OK_RETURN(status
);
2015 talloc_free(snames
);
2017 r
->out
.info_ctr
->ctr
.ctr502
= ctr502
;
2018 *r
->out
.totalentries
= r
->out
.info_ctr
->ctr
.ctr502
->count
;
2023 return WERR_INVALID_LEVEL
;
2029 srvsvc_NetShareDelStart
2031 static WERROR
dcesrv_srvsvc_NetShareDelStart(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2032 struct srvsvc_NetShareDelStart
*r
)
2034 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2039 srvsvc_NetShareDelCommit
2041 static WERROR
dcesrv_srvsvc_NetShareDelCommit(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2042 struct srvsvc_NetShareDelCommit
*r
)
2044 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2049 srvsvc_NetGetFileSecurity
2051 static WERROR
dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2052 struct srvsvc_NetGetFileSecurity
*r
)
2054 struct auth_session_info
*session_info
=
2055 dcesrv_call_session_info(dce_call
);
2056 struct sec_desc_buf
*sd_buf
;
2057 struct ntvfs_context
*ntvfs_ctx
= NULL
;
2058 struct ntvfs_request
*ntvfs_req
;
2059 union smb_fileinfo
*io
;
2062 nt_status
= srvsvc_create_ntvfs_context(dce_call
, mem_ctx
, r
->in
.share
, &ntvfs_ctx
);
2063 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2065 ntvfs_req
= ntvfs_request_create(ntvfs_ctx
, mem_ctx
,
2070 W_ERROR_HAVE_NO_MEMORY(ntvfs_req
);
2072 sd_buf
= talloc(mem_ctx
, struct sec_desc_buf
);
2073 W_ERROR_HAVE_NO_MEMORY(sd_buf
);
2075 io
= talloc(mem_ctx
, union smb_fileinfo
);
2076 W_ERROR_HAVE_NO_MEMORY(io
);
2078 io
->query_secdesc
.level
= RAW_FILEINFO_SEC_DESC
;
2079 io
->query_secdesc
.in
.file
.path
= r
->in
.file
;
2080 io
->query_secdesc
.in
.secinfo_flags
= r
->in
.securityinformation
;
2082 nt_status
= ntvfs_qpathinfo(ntvfs_req
, io
);
2083 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2085 sd_buf
->sd
= io
->query_secdesc
.out
.sd
;
2087 *r
->out
.sd_buf
= sd_buf
;
2093 srvsvc_NetSetFileSecurity
2095 static WERROR
dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2096 struct srvsvc_NetSetFileSecurity
*r
)
2098 struct auth_session_info
*session_info
=
2099 dcesrv_call_session_info(dce_call
);
2100 struct ntvfs_context
*ntvfs_ctx
;
2101 struct ntvfs_request
*ntvfs_req
;
2102 union smb_setfileinfo
*io
;
2105 nt_status
= srvsvc_create_ntvfs_context(dce_call
, mem_ctx
, r
->in
.share
, &ntvfs_ctx
);
2106 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2108 ntvfs_req
= ntvfs_request_create(ntvfs_ctx
, mem_ctx
,
2113 W_ERROR_HAVE_NO_MEMORY(ntvfs_req
);
2115 io
= talloc(mem_ctx
, union smb_setfileinfo
);
2116 W_ERROR_HAVE_NO_MEMORY(io
);
2118 io
->set_secdesc
.level
= RAW_SFILEINFO_SEC_DESC
;
2119 io
->set_secdesc
.in
.file
.path
= r
->in
.file
;
2120 io
->set_secdesc
.in
.secinfo_flags
= r
->in
.securityinformation
;
2121 io
->set_secdesc
.in
.sd
= r
->in
.sd_buf
->sd
;
2123 nt_status
= ntvfs_setpathinfo(ntvfs_req
, io
);
2124 if (!NT_STATUS_IS_OK(nt_status
)) return ntstatus_to_werror(nt_status
);
2131 srvsvc_NetServerTransportAddEx
2133 static WERROR
dcesrv_srvsvc_NetServerTransportAddEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2134 struct srvsvc_NetServerTransportAddEx
*r
)
2136 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2141 srvsvc_NetServerSetServiceBitsEx
2143 static WERROR
dcesrv_srvsvc_NetServerSetServiceBitsEx(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2144 struct srvsvc_NetServerSetServiceBitsEx
*r
)
2146 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2151 srvsvc_NETRDFSGETVERSION
2153 static WERROR
dcesrv_srvsvc_NETRDFSGETVERSION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2154 struct srvsvc_NETRDFSGETVERSION
*r
)
2156 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2161 srvsvc_NETRDFSCREATELOCALPARTITION
2163 static WERROR
dcesrv_srvsvc_NETRDFSCREATELOCALPARTITION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2164 struct srvsvc_NETRDFSCREATELOCALPARTITION
*r
)
2166 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2171 srvsvc_NETRDFSDELETELOCALPARTITION
2173 static WERROR
dcesrv_srvsvc_NETRDFSDELETELOCALPARTITION(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2174 struct srvsvc_NETRDFSDELETELOCALPARTITION
*r
)
2176 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2181 srvsvc_NETRDFSSETLOCALVOLUMESTATE
2183 static WERROR
dcesrv_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2184 struct srvsvc_NETRDFSSETLOCALVOLUMESTATE
*r
)
2186 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2191 srvsvc_NETRDFSSETSERVERINFO
2193 static WERROR
dcesrv_srvsvc_NETRDFSSETSERVERINFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2194 struct srvsvc_NETRDFSSETSERVERINFO
*r
)
2196 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2201 srvsvc_NETRDFSCREATEEXITPOINT
2203 static WERROR
dcesrv_srvsvc_NETRDFSCREATEEXITPOINT(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2204 struct srvsvc_NETRDFSCREATEEXITPOINT
*r
)
2206 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2211 srvsvc_NETRDFSDELETEEXITPOINT
2213 static WERROR
dcesrv_srvsvc_NETRDFSDELETEEXITPOINT(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2214 struct srvsvc_NETRDFSDELETEEXITPOINT
*r
)
2216 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2221 srvsvc_NETRDFSMODIFYPREFIX
2223 static WERROR
dcesrv_srvsvc_NETRDFSMODIFYPREFIX(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2224 struct srvsvc_NETRDFSMODIFYPREFIX
*r
)
2226 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2231 srvsvc_NETRDFSFIXLOCALVOLUME
2233 static WERROR
dcesrv_srvsvc_NETRDFSFIXLOCALVOLUME(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2234 struct srvsvc_NETRDFSFIXLOCALVOLUME
*r
)
2236 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2241 srvsvc_NETRDFSMANAGERREPORTSITEINFO
2243 static WERROR
dcesrv_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2244 struct srvsvc_NETRDFSMANAGERREPORTSITEINFO
*r
)
2246 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2251 srvsvc_NETRSERVERTRANSPORTDELEX
2253 static WERROR
dcesrv_srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2254 struct srvsvc_NETRSERVERTRANSPORTDELEX
*r
)
2256 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2262 static WERROR
dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2263 struct srvsvc_NetShareDel
*r
)
2266 struct share_context
*sctx
;
2268 nterr
= share_get_context(mem_ctx
, dce_call
->conn
->dce_ctx
->lp_ctx
, &sctx
);
2269 if (!NT_STATUS_IS_OK(nterr
)) {
2270 return ntstatus_to_werror(nterr
);
2273 nterr
= share_remove(sctx
, r
->in
.share_name
);
2274 if (!NT_STATUS_IS_OK(nterr
)) {
2275 return ntstatus_to_werror(nterr
);
2282 srvsvc_NetSetServiceBits
2284 static WERROR
dcesrv_srvsvc_NetSetServiceBits(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2285 struct srvsvc_NetSetServiceBits
*r
)
2287 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2291 srvsvc_NETRPRNAMECANONICALIZE
2293 static WERROR
dcesrv_srvsvc_NETRPRNAMECANONICALIZE(struct dcesrv_call_state
*dce_call
, TALLOC_CTX
*mem_ctx
,
2294 struct srvsvc_NETRPRNAMECANONICALIZE
*r
)
2296 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR
);
2299 /* include the generated boilerplate */
2300 #include "librpc/gen_ndr/ndr_srvsvc_s.c"