2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Jeremy Allison 2001.
6 * Copyright (C) Nigel Williams 2001.
7 * Copyright (C) Gerald (Jerry) Carter 2006.
8 * Copyright (C) Guenther Deschner 2008.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 /* This is the implementation of the srvsvc pipe. */
28 extern const struct generic_mapping file_generic_mapping;
31 #define DBGC_CLASS DBGC_RPC_SRV
33 #define MAX_SERVER_DISK_ENTRIES 15
35 /* Use for enumerating connections, pipes, & files */
37 struct file_enum_count {
40 struct srvsvc_NetFileCtr3 *ctr3;
43 struct sess_file_count {
49 /****************************************************************************
50 Count the entries belonging to a service in the connection db.
51 ****************************************************************************/
53 static int pipe_enum_fn( struct db_record *rec, void *p)
55 struct pipe_open_rec prec;
56 struct file_enum_count *fenum = (struct file_enum_count *)p;
57 struct srvsvc_NetFileInfo3 *f;
58 int i = fenum->ctr3->count;
59 char *fullpath = NULL;
62 if (rec->value.dsize != sizeof(struct pipe_open_rec))
65 memcpy(&prec, rec->value.dptr, sizeof(struct pipe_open_rec));
67 if ( !process_exists(prec.pid) ) {
71 username = uidtoname(prec.uid);
73 if ((fenum->username != NULL)
74 && !strequal(username, fenum->username)) {
78 fullpath = talloc_asprintf(fenum->ctx, "\\PIPE\\%s", prec.name );
83 f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array,
84 struct srvsvc_NetFileInfo3, i+1);
86 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
89 fenum->ctr3->array = f;
91 fenum->ctr3->array[i].fid =
92 (((uint32_t)(procid_to_pid(&prec.pid))<<16) | prec.pnum);
93 fenum->ctr3->array[i].permissions =
94 (FILE_READ_DATA|FILE_WRITE_DATA);
95 fenum->ctr3->array[i].num_locks = 0;
96 fenum->ctr3->array[i].path = fullpath;
97 fenum->ctr3->array[i].user = username;
104 /*******************************************************************
105 ********************************************************************/
107 static WERROR net_enum_pipes(TALLOC_CTX *ctx,
108 const char *username,
109 struct srvsvc_NetFileCtr3 **ctr3,
112 struct file_enum_count fenum;
115 fenum.username = username;
118 if (connections_traverse(pipe_enum_fn, &fenum) == -1) {
119 DEBUG(0,("net_enum_pipes: traverse of connections.tdb "
129 /*******************************************************************
130 ********************************************************************/
132 static void enum_file_fn( const struct share_mode_entry *e,
133 const char *sharepath, const char *fname,
136 struct file_enum_count *fenum =
137 (struct file_enum_count *)private_data;
139 struct srvsvc_NetFileInfo3 *f;
140 int i = fenum->ctr3->count;
142 struct byte_range_lock *brl;
144 char *fullpath = NULL;
146 const char *username;
148 /* If the pid was not found delete the entry from connections.tdb */
150 if ( !process_exists(e->pid) ) {
154 username = uidtoname(e->uid);
156 if ((fenum->username != NULL)
157 && !strequal(username, fenum->username)) {
161 f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array,
162 struct srvsvc_NetFileInfo3, i+1);
164 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
167 fenum->ctr3->array = f;
169 /* need to count the number of locks on a file */
174 if ( (brl = brl_get_locks(talloc_tos(), &fsp)) != NULL ) {
175 num_locks = brl->num_locks;
179 if ( strcmp( fname, "." ) == 0 ) {
180 fullpath = talloc_asprintf(fenum->ctx, "C:%s", sharepath );
182 fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s",
188 string_replace( fullpath, '/', '\\' );
190 /* mask out create (what ever that is) */
191 permissions = e->access_mask & (FILE_READ_DATA|FILE_WRITE_DATA);
193 /* now fill in the srvsvc_NetFileInfo3 struct */
195 fenum->ctr3->array[i].fid =
196 (((uint32_t)(procid_to_pid(&e->pid))<<16) | e->share_file_id);
197 fenum->ctr3->array[i].permissions = permissions;
198 fenum->ctr3->array[i].num_locks = num_locks;
199 fenum->ctr3->array[i].path = fullpath;
200 fenum->ctr3->array[i].user = username;
202 fenum->ctr3->count++;
205 /*******************************************************************
206 ********************************************************************/
208 static WERROR net_enum_files(TALLOC_CTX *ctx,
209 const char *username,
210 struct srvsvc_NetFileCtr3 **ctr3,
213 struct file_enum_count f_enum_cnt;
215 f_enum_cnt.ctx = ctx;
216 f_enum_cnt.username = username;
217 f_enum_cnt.ctr3 = *ctr3;
219 share_mode_forall( enum_file_fn, (void *)&f_enum_cnt );
221 *ctr3 = f_enum_cnt.ctr3;
226 /*******************************************************************
227 Utility function to get the 'type' of a share from an snum.
228 ********************************************************************/
229 static uint32 get_share_type(int snum)
231 /* work out the share type */
232 uint32 type = STYPE_DISKTREE;
234 if (lp_print_ok(snum))
236 if (strequal(lp_fstype(snum), "IPC"))
238 if (lp_administrative_share(snum))
239 type |= STYPE_HIDDEN;
244 /*******************************************************************
245 Fill in a share info level 0 structure.
246 ********************************************************************/
248 static void init_srv_share_info_0(pipes_struct *p, struct srvsvc_NetShareInfo0 *r, int snum)
250 r->name = lp_servicename(snum);
253 /*******************************************************************
254 Fill in a share info level 1 structure.
255 ********************************************************************/
257 static void init_srv_share_info_1(pipes_struct *p, struct srvsvc_NetShareInfo1 *r, int snum)
259 char *net_name = lp_servicename(snum);
260 char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
263 remark = talloc_sub_advanced(
264 p->mem_ctx, lp_servicename(snum),
265 get_current_username(), lp_pathname(snum),
266 p->server_info->utok.uid, get_current_username(),
271 r->type = get_share_type(snum);
272 r->comment = remark ? remark : "";
275 /*******************************************************************
276 Fill in a share info level 2 structure.
277 ********************************************************************/
279 static void init_srv_share_info_2(pipes_struct *p, struct srvsvc_NetShareInfo2 *r, int snum)
283 int max_connections = lp_max_connections(snum);
284 uint32_t max_uses = max_connections!=0 ? max_connections : (uint32_t)-1;
285 char *net_name = lp_servicename(snum);
287 remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
289 remark = talloc_sub_advanced(
290 p->mem_ctx, lp_servicename(snum),
291 get_current_username(), lp_pathname(snum),
292 p->server_info->utok.uid, get_current_username(),
295 path = talloc_asprintf(p->mem_ctx,
296 "C:%s", lp_pathname(snum));
300 * Change / to \\ so that win2k will see it as a valid path.
301 * This was added to enable use of browsing in win2k add
305 string_replace(path, '/', '\\');
309 r->type = get_share_type(snum);
310 r->comment = remark ? remark : "";
312 r->max_users = max_uses;
313 r->current_users = count_current_connections(net_name, false);
314 r->path = path ? path : "";
318 /*******************************************************************
319 Map any generic bits to file specific bits.
320 ********************************************************************/
322 static void map_generic_share_sd_bits(SEC_DESC *psd)
325 SEC_ACL *ps_dacl = NULL;
334 for (i = 0; i < ps_dacl->num_aces; i++) {
335 SEC_ACE *psa = &ps_dacl->aces[i];
336 uint32 orig_mask = psa->access_mask;
338 se_map_generic(&psa->access_mask, &file_generic_mapping);
339 psa->access_mask |= orig_mask;
343 /*******************************************************************
344 Fill in a share info level 501 structure.
345 ********************************************************************/
347 static void init_srv_share_info_501(pipes_struct *p, struct srvsvc_NetShareInfo501 *r, int snum)
349 const char *net_name = lp_servicename(snum);
350 char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
353 remark = talloc_sub_advanced(
354 p->mem_ctx, lp_servicename(snum),
355 get_current_username(), lp_pathname(snum),
356 p->server_info->utok.uid, get_current_username(),
361 r->type = get_share_type(snum);
362 r->comment = remark ? remark : "";
363 r->csc_policy = (lp_csc_policy(snum) << 4);
366 /*******************************************************************
367 Fill in a share info level 502 structure.
368 ********************************************************************/
370 static void init_srv_share_info_502(pipes_struct *p, struct srvsvc_NetShareInfo502 *r, int snum)
372 const char *net_name = lp_servicename(snum);
375 struct sec_desc_buf *sd_buf = NULL;
377 TALLOC_CTX *ctx = p->mem_ctx;
378 char *remark = talloc_strdup(ctx, lp_comment(snum));;
381 remark = talloc_sub_advanced(
382 p->mem_ctx, lp_servicename(snum),
383 get_current_username(), lp_pathname(snum),
384 p->server_info->utok.uid, get_current_username(),
387 path = talloc_asprintf(ctx, "C:%s", lp_pathname(snum));
390 * Change / to \\ so that win2k will see it as a valid path. This was added to
391 * enable use of browsing in win2k add share dialog.
393 string_replace(path, '/', '\\');
396 sd = get_share_security(ctx, lp_servicename(snum), &sd_size);
398 sd_buf = make_sec_desc_buf(p->mem_ctx, sd_size, sd);
401 r->type = get_share_type(snum);
402 r->comment = remark ? remark : "";
404 r->max_users = (uint32_t)-1;
405 r->current_users = 1; /* ??? */
406 r->path = path ? path : "";
411 /***************************************************************************
412 Fill in a share info level 1004 structure.
413 ***************************************************************************/
415 static void init_srv_share_info_1004(pipes_struct *p, struct srvsvc_NetShareInfo1004 *r, int snum)
417 char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
420 remark = talloc_sub_advanced(
421 p->mem_ctx, lp_servicename(snum),
422 get_current_username(), lp_pathname(snum),
423 p->server_info->utok.uid, get_current_username(),
427 r->comment = remark ? remark : "";
430 /***************************************************************************
431 Fill in a share info level 1005 structure.
432 ***************************************************************************/
434 static void init_srv_share_info_1005(pipes_struct *p, struct srvsvc_NetShareInfo1005 *r, int snum)
436 uint32_t dfs_flags = 0;
438 if (lp_host_msdfs() && lp_msdfs_root(snum)) {
439 dfs_flags |= SHARE_1005_IN_DFS | SHARE_1005_DFS_ROOT;
442 dfs_flags |= lp_csc_policy(snum) << SHARE_1005_CSC_POLICY_SHIFT;
444 r->dfs_flags = dfs_flags;
447 /***************************************************************************
448 Fill in a share info level 1006 structure.
449 ***************************************************************************/
451 static void init_srv_share_info_1006(pipes_struct *p, struct srvsvc_NetShareInfo1006 *r, int snum)
453 r->max_users = (uint32_t)-1;
456 /***************************************************************************
457 Fill in a share info level 1007 structure.
458 ***************************************************************************/
460 static void init_srv_share_info_1007(pipes_struct *p, struct srvsvc_NetShareInfo1007 *r, int snum)
463 r->alternate_directory_name = "";
466 /*******************************************************************
467 Fill in a share info level 1501 structure.
468 ********************************************************************/
470 static void init_srv_share_info_1501(pipes_struct *p, struct sec_desc_buf *r, int snum)
474 TALLOC_CTX *ctx = p->mem_ctx;
476 sd = get_share_security(ctx, lp_servicename(snum), &sd_size);
478 r = make_sec_desc_buf(p->mem_ctx, sd_size, sd);
481 /*******************************************************************
482 True if it ends in '$'.
483 ********************************************************************/
485 static bool is_hidden_share(int snum)
487 const char *net_name = lp_servicename(snum);
489 return (net_name[strlen(net_name) - 1] == '$') ? True : False;
492 /*******************************************************************
493 Verify user is allowed to view share, access based enumeration
494 ********************************************************************/
495 static bool is_enumeration_allowed(pipes_struct *p,
498 if (!lp_access_based_share_enum(snum))
501 return share_access_check(p->server_info->ptok, lp_servicename(snum),
505 /*******************************************************************
506 Fill in a share info structure.
507 ********************************************************************/
509 static WERROR init_srv_share_info_ctr(pipes_struct *p,
510 struct srvsvc_NetShareInfoCtr *info_ctr,
511 uint32_t *resume_handle_p,
512 uint32_t *total_entries,
516 int alloc_entries = 0;
517 int num_services = 0;
519 TALLOC_CTX *ctx = p->mem_ctx;
521 int valid_share_count = 0;
523 union srvsvc_NetShareCtr ctr;
524 uint32_t resume_handle = resume_handle_p ? *resume_handle_p : 0;
526 DEBUG(5,("init_srv_share_info_ctr\n"));
528 /* Ensure all the usershares are loaded. */
530 load_usershare_shares();
531 load_registry_shares();
532 num_services = lp_numservices();
535 allowed = TALLOC_ZERO_ARRAY(ctx, bool, num_services);
536 W_ERROR_HAVE_NO_MEMORY(allowed);
538 /* Count the number of entries. */
539 for (snum = 0; snum < num_services; snum++) {
540 if (lp_browseable(snum) && lp_snum_ok(snum) &&
541 is_enumeration_allowed(p, snum) &&
542 (all_shares || !is_hidden_share(snum)) ) {
543 DEBUG(10, ("counting service %s\n",
544 lp_servicename(snum) ? lp_servicename(snum) : "(null)"));
545 allowed[snum] = true;
548 DEBUG(10, ("NOT counting service %s\n",
549 lp_servicename(snum) ? lp_servicename(snum) : "(null)"));
553 if (!num_entries || (resume_handle >= num_entries)) {
557 /* Calculate alloc entries. */
558 alloc_entries = num_entries - resume_handle;
559 switch (info_ctr->level) {
561 ctr.ctr0 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr0);
562 W_ERROR_HAVE_NO_MEMORY(ctr.ctr0);
564 ctr.ctr0->count = alloc_entries;
565 ctr.ctr0->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo0, alloc_entries);
566 W_ERROR_HAVE_NO_MEMORY(ctr.ctr0->array);
568 for (snum = 0; snum < num_services; snum++) {
570 (resume_handle <= (i + valid_share_count++)) ) {
571 init_srv_share_info_0(p, &ctr.ctr0->array[i++], snum);
578 ctr.ctr1 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1);
579 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1);
581 ctr.ctr1->count = alloc_entries;
582 ctr.ctr1->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1, alloc_entries);
583 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1->array);
585 for (snum = 0; snum < num_services; snum++) {
587 (resume_handle <= (i + valid_share_count++)) ) {
588 init_srv_share_info_1(p, &ctr.ctr1->array[i++], snum);
595 ctr.ctr2 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr2);
596 W_ERROR_HAVE_NO_MEMORY(ctr.ctr2);
598 ctr.ctr2->count = alloc_entries;
599 ctr.ctr2->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo2, alloc_entries);
600 W_ERROR_HAVE_NO_MEMORY(ctr.ctr2->array);
602 for (snum = 0; snum < num_services; snum++) {
604 (resume_handle <= (i + valid_share_count++)) ) {
605 init_srv_share_info_2(p, &ctr.ctr2->array[i++], snum);
612 ctr.ctr501 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr501);
613 W_ERROR_HAVE_NO_MEMORY(ctr.ctr501);
615 ctr.ctr501->count = alloc_entries;
616 ctr.ctr501->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo501, alloc_entries);
617 W_ERROR_HAVE_NO_MEMORY(ctr.ctr501->array);
619 for (snum = 0; snum < num_services; snum++) {
621 (resume_handle <= (i + valid_share_count++)) ) {
622 init_srv_share_info_501(p, &ctr.ctr501->array[i++], snum);
629 ctr.ctr502 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr502);
630 W_ERROR_HAVE_NO_MEMORY(ctr.ctr502);
632 ctr.ctr502->count = alloc_entries;
633 ctr.ctr502->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo502, alloc_entries);
634 W_ERROR_HAVE_NO_MEMORY(ctr.ctr502->array);
636 for (snum = 0; snum < num_services; snum++) {
638 (resume_handle <= (i + valid_share_count++)) ) {
639 init_srv_share_info_502(p, &ctr.ctr502->array[i++], snum);
646 ctr.ctr1004 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1004);
647 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004);
649 ctr.ctr1004->count = alloc_entries;
650 ctr.ctr1004->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1004, alloc_entries);
651 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004->array);
653 for (snum = 0; snum < num_services; snum++) {
655 (resume_handle <= (i + valid_share_count++)) ) {
656 init_srv_share_info_1004(p, &ctr.ctr1004->array[i++], snum);
663 ctr.ctr1005 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1005);
664 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005);
666 ctr.ctr1005->count = alloc_entries;
667 ctr.ctr1005->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1005, alloc_entries);
668 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005->array);
670 for (snum = 0; snum < num_services; snum++) {
672 (resume_handle <= (i + valid_share_count++)) ) {
673 init_srv_share_info_1005(p, &ctr.ctr1005->array[i++], snum);
680 ctr.ctr1006 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1006);
681 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006);
683 ctr.ctr1006->count = alloc_entries;
684 ctr.ctr1006->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1006, alloc_entries);
685 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006->array);
687 for (snum = 0; snum < num_services; snum++) {
689 (resume_handle <= (i + valid_share_count++)) ) {
690 init_srv_share_info_1006(p, &ctr.ctr1006->array[i++], snum);
697 ctr.ctr1007 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1007);
698 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007);
700 ctr.ctr1007->count = alloc_entries;
701 ctr.ctr1007->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1007, alloc_entries);
702 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007->array);
704 for (snum = 0; snum < num_services; snum++) {
706 (resume_handle <= (i + valid_share_count++)) ) {
707 init_srv_share_info_1007(p, &ctr.ctr1007->array[i++], snum);
714 ctr.ctr1501 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1501);
715 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501);
717 ctr.ctr1501->count = alloc_entries;
718 ctr.ctr1501->array = TALLOC_ZERO_ARRAY(ctx, struct sec_desc_buf, alloc_entries);
719 W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501->array);
721 for (snum = 0; snum < num_services; snum++) {
723 (resume_handle <= (i + valid_share_count++)) ) {
724 init_srv_share_info_1501(p, &ctr.ctr1501->array[i++], snum);
731 DEBUG(5,("init_srv_share_info_ctr: unsupported switch value %d\n",
733 return WERR_UNKNOWN_LEVEL;
736 *total_entries = alloc_entries;
737 if (resume_handle_p) {
739 *resume_handle_p = (num_entries == 0) ? *resume_handle_p : 0;
741 *resume_handle_p = num_entries;
750 /*******************************************************************
751 fill in a sess info level 0 structure.
752 ********************************************************************/
754 static WERROR init_srv_sess_info_0(pipes_struct *p,
755 struct srvsvc_NetSessCtr0 *ctr0,
756 uint32_t *resume_handle_p,
757 uint32_t *total_entries)
759 struct sessionid *session_list;
760 uint32_t num_entries = 0;
761 uint32_t resume_handle = resume_handle_p ? *resume_handle_p : 0;
762 *total_entries = list_sessions(p->mem_ctx, &session_list);
764 DEBUG(5,("init_srv_sess_info_0\n"));
767 if (resume_handle_p) {
768 *resume_handle_p = 0;
773 for (; resume_handle < *total_entries; resume_handle++) {
775 ctr0->array = TALLOC_REALLOC_ARRAY(p->mem_ctx,
777 struct srvsvc_NetSessInfo0,
779 W_ERROR_HAVE_NO_MEMORY(ctr0->array);
781 ctr0->array[num_entries].client =
782 session_list[resume_handle].remote_machine;
787 ctr0->count = num_entries;
789 if (resume_handle_p) {
790 if (*resume_handle_p >= *total_entries) {
791 *resume_handle_p = 0;
793 *resume_handle_p = resume_handle;
800 /*******************************************************************
801 ********************************************************************/
803 static void sess_file_fn( const struct share_mode_entry *e,
804 const char *sharepath, const char *fname,
807 struct sess_file_count *sess = (struct sess_file_count *)data;
809 if ( procid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid) ) {
816 /*******************************************************************
817 ********************************************************************/
819 static int net_count_files( uid_t uid, struct server_id pid )
821 struct sess_file_count s_file_cnt;
823 s_file_cnt.count = 0;
824 s_file_cnt.uid = uid;
825 s_file_cnt.pid = pid;
827 share_mode_forall( sess_file_fn, &s_file_cnt );
829 return s_file_cnt.count;
832 /*******************************************************************
833 fill in a sess info level 1 structure.
834 ********************************************************************/
836 static WERROR init_srv_sess_info_1(pipes_struct *p,
837 struct srvsvc_NetSessCtr1 *ctr1,
838 uint32_t *resume_handle_p,
839 uint32_t *total_entries)
841 struct sessionid *session_list;
842 uint32_t num_entries = 0;
843 time_t now = time(NULL);
844 uint32_t resume_handle = resume_handle_p ? *resume_handle_p : 0;
849 if (resume_handle_p) {
850 *resume_handle_p = 0;
855 *total_entries = list_sessions(p->mem_ctx, &session_list);
857 for (; resume_handle < *total_entries; resume_handle++) {
860 struct passwd *pw = sys_getpwnam(session_list[resume_handle].username);
864 DEBUG(10,("init_srv_sess_info_1: failed to find owner: %s\n",
865 session_list[resume_handle].username));
869 connect_time = (uint32_t)(now - session_list[resume_handle].connect_start);
870 num_files = net_count_files(pw->pw_uid, session_list[resume_handle].pid);
871 guest = strequal( session_list[resume_handle].username, lp_guestaccount() );
873 ctr1->array = TALLOC_REALLOC_ARRAY(p->mem_ctx,
875 struct srvsvc_NetSessInfo1,
877 W_ERROR_HAVE_NO_MEMORY(ctr1->array);
879 ctr1->array[num_entries].client = session_list[resume_handle].remote_machine;
880 ctr1->array[num_entries].user = session_list[resume_handle].username;
881 ctr1->array[num_entries].num_open = num_files;
882 ctr1->array[num_entries].time = connect_time;
883 ctr1->array[num_entries].idle_time = 0;
884 ctr1->array[num_entries].user_flags = guest;
889 ctr1->count = num_entries;
891 if (resume_handle_p) {
892 if (*resume_handle_p >= *total_entries) {
893 *resume_handle_p = 0;
895 *resume_handle_p = resume_handle;
902 /*******************************************************************
903 fill in a conn info level 0 structure.
904 ********************************************************************/
906 static WERROR init_srv_conn_info_0(struct srvsvc_NetConnCtr0 *ctr0,
907 uint32_t *resume_handle_p,
908 uint32_t *total_entries)
910 uint32_t num_entries = 0;
911 uint32_t resume_handle = resume_handle_p ? *resume_handle_p : 0;
913 DEBUG(5,("init_srv_conn_info_0\n"));
916 if (resume_handle_p) {
917 *resume_handle_p = 0;
926 for (; resume_handle < *total_entries; resume_handle++) {
928 ctr0->array = TALLOC_REALLOC_ARRAY(talloc_tos(),
930 struct srvsvc_NetConnInfo0,
936 ctr0->array[num_entries].conn_id = *total_entries;
938 /* move on to creating next connection */
942 ctr0->count = num_entries;
943 *total_entries = num_entries;
945 if (resume_handle_p) {
946 if (*resume_handle_p >= *total_entries) {
947 *resume_handle_p = 0;
949 *resume_handle_p = resume_handle;
956 /*******************************************************************
957 fill in a conn info level 1 structure.
958 ********************************************************************/
960 static WERROR init_srv_conn_info_1(struct srvsvc_NetConnCtr1 *ctr1,
961 uint32_t *resume_handle_p,
962 uint32_t *total_entries)
964 uint32_t num_entries = 0;
965 uint32_t resume_handle = resume_handle_p ? *resume_handle_p : 0;
967 DEBUG(5,("init_srv_conn_info_1\n"));
970 if (resume_handle_p) {
971 *resume_handle_p = 0;
980 for (; resume_handle < *total_entries; resume_handle++) {
982 ctr1->array = TALLOC_REALLOC_ARRAY(talloc_tos(),
984 struct srvsvc_NetConnInfo1,
990 ctr1->array[num_entries].conn_id = *total_entries;
991 ctr1->array[num_entries].conn_type = 0x3;
992 ctr1->array[num_entries].num_open = 1;
993 ctr1->array[num_entries].num_users = 1;
994 ctr1->array[num_entries].conn_time = 3;
995 ctr1->array[num_entries].user = "dummy_user";
996 ctr1->array[num_entries].share = "IPC$";
998 /* move on to creating next connection */
1002 ctr1->count = num_entries;
1003 *total_entries = num_entries;
1005 if (resume_handle_p) {
1006 if (*resume_handle_p >= *total_entries) {
1007 *resume_handle_p = 0;
1009 *resume_handle_p = resume_handle;
1016 /*******************************************************************
1018 *******************************************************************/
1020 WERROR _srvsvc_NetFileEnum(pipes_struct *p,
1021 struct srvsvc_NetFileEnum *r)
1023 TALLOC_CTX *ctx = NULL;
1024 struct srvsvc_NetFileCtr3 *ctr3;
1025 uint32_t resume_hnd = 0;
1028 switch (r->in.info_ctr->level) {
1032 return WERR_UNKNOWN_LEVEL;
1036 ctr3 = r->in.info_ctr->ctr.ctr3;
1038 werr = WERR_INVALID_PARAM;
1042 /* TODO -- Windows enumerates
1044 (c) open directories and files */
1046 werr = net_enum_files(ctx, r->in.user, &ctr3, resume_hnd);
1047 if (!W_ERROR_IS_OK(werr)) {
1051 werr = net_enum_pipes(ctx, r->in.user, &ctr3, resume_hnd);
1052 if (!W_ERROR_IS_OK(werr)) {
1056 *r->out.totalentries = ctr3->count;
1057 r->out.info_ctr->ctr.ctr3->array = ctr3->array;
1058 r->out.info_ctr->ctr.ctr3->count = ctr3->count;
1066 /*******************************************************************
1067 _srvsvc_NetSrvGetInfo
1068 ********************************************************************/
1070 WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p,
1071 struct srvsvc_NetSrvGetInfo *r)
1073 WERROR status = WERR_OK;
1075 DEBUG(5,("_srvsvc_NetSrvGetInfo: %d\n", __LINE__));
1077 if (!pipe_access_check(p)) {
1078 DEBUG(3, ("access denied to _srvsvc_NetSrvGetInfo\n"));
1079 return WERR_ACCESS_DENIED;
1082 switch (r->in.level) {
1084 /* Technically level 102 should only be available to
1085 Administrators but there isn't anything super-secret
1086 here, as most of it is made up. */
1089 struct srvsvc_NetSrvInfo102 *info102;
1091 info102 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo102);
1096 info102->platform_id = PLATFORM_ID_NT;
1097 info102->server_name = global_myname();
1098 info102->version_major = lp_major_announce_version();
1099 info102->version_minor = lp_minor_announce_version();
1100 info102->server_type = lp_default_server_announce();
1101 info102->comment = string_truncate(lp_serverstring(),
1102 MAX_SERVER_STRING_LENGTH);
1103 info102->users = 0xffffffff;
1104 info102->disc = 0xf;
1105 info102->hidden = 0;
1106 info102->announce = 240;
1107 info102->anndelta = 3000;
1108 info102->licenses = 100000;
1109 info102->userpath = "C:\\";
1111 r->out.info->info102 = info102;
1115 struct srvsvc_NetSrvInfo101 *info101;
1117 info101 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo101);
1122 info101->platform_id = PLATFORM_ID_NT;
1123 info101->server_name = global_myname();
1124 info101->version_major = lp_major_announce_version();
1125 info101->version_minor = lp_minor_announce_version();
1126 info101->server_type = lp_default_server_announce();
1127 info101->comment = string_truncate(lp_serverstring(),
1128 MAX_SERVER_STRING_LENGTH);
1130 r->out.info->info101 = info101;
1134 struct srvsvc_NetSrvInfo100 *info100;
1136 info100 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo100);
1141 info100->platform_id = PLATFORM_ID_NT;
1142 info100->server_name = global_myname();
1144 r->out.info->info100 = info100;
1149 status = WERR_UNKNOWN_LEVEL;
1153 DEBUG(5,("_srvsvc_NetSrvGetInfo: %d\n", __LINE__));
1158 /*******************************************************************
1159 _srvsvc_NetSrvSetInfo
1160 ********************************************************************/
1162 WERROR _srvsvc_NetSrvSetInfo(pipes_struct *p,
1163 struct srvsvc_NetSrvSetInfo *r)
1165 WERROR status = WERR_OK;
1167 DEBUG(5,("_srvsvc_NetSrvSetInfo: %d\n", __LINE__));
1169 /* Set up the net server set info structure. */
1171 DEBUG(5,("_srvsvc_NetSrvSetInfo: %d\n", __LINE__));
1176 /*******************************************************************
1178 ********************************************************************/
1180 WERROR _srvsvc_NetConnEnum(pipes_struct *p,
1181 struct srvsvc_NetConnEnum *r)
1185 DEBUG(5,("_srvsvc_NetConnEnum: %d\n", __LINE__));
1187 switch (r->in.info_ctr->level) {
1189 werr = init_srv_conn_info_0(r->in.info_ctr->ctr.ctr0,
1190 r->in.resume_handle,
1191 r->out.totalentries);
1194 werr = init_srv_conn_info_1(r->in.info_ctr->ctr.ctr1,
1195 r->in.resume_handle,
1196 r->out.totalentries);
1199 return WERR_UNKNOWN_LEVEL;
1202 DEBUG(5,("_srvsvc_NetConnEnum: %d\n", __LINE__));
1207 /*******************************************************************
1209 ********************************************************************/
1211 WERROR _srvsvc_NetSessEnum(pipes_struct *p,
1212 struct srvsvc_NetSessEnum *r)
1216 DEBUG(5,("_srvsvc_NetSessEnum: %d\n", __LINE__));
1218 switch (r->in.info_ctr->level) {
1220 werr = init_srv_sess_info_0(p,
1221 r->in.info_ctr->ctr.ctr0,
1222 r->in.resume_handle,
1223 r->out.totalentries);
1226 werr = init_srv_sess_info_1(p,
1227 r->in.info_ctr->ctr.ctr1,
1228 r->in.resume_handle,
1229 r->out.totalentries);
1232 return WERR_UNKNOWN_LEVEL;
1235 DEBUG(5,("_srvsvc_NetSessEnum: %d\n", __LINE__));
1240 /*******************************************************************
1242 ********************************************************************/
1244 WERROR _srvsvc_NetSessDel(pipes_struct *p,
1245 struct srvsvc_NetSessDel *r)
1247 struct sessionid *session_list;
1248 int num_sessions, snum;
1249 const char *username;
1250 const char *machine;
1251 bool not_root = False;
1254 username = r->in.user;
1255 machine = r->in.client;
1257 /* strip leading backslashes if any */
1258 if (machine && machine[0] == '\\' && machine[1] == '\\') {
1262 num_sessions = list_sessions(p->mem_ctx, &session_list);
1264 DEBUG(5,("_srvsvc_NetSessDel: %d\n", __LINE__));
1266 werr = WERR_ACCESS_DENIED;
1268 /* fail out now if you are not root or not a domain admin */
1270 if ((p->server_info->utok.uid != sec_initial_uid()) &&
1271 ( ! nt_token_check_domain_rid(p->server_info->ptok,
1272 DOMAIN_GROUP_RID_ADMINS))) {
1277 for (snum = 0; snum < num_sessions; snum++) {
1279 if ((strequal(session_list[snum].username, username) || username[0] == '\0' ) &&
1280 strequal(session_list[snum].remote_machine, machine)) {
1284 if (p->server_info->utok.uid != sec_initial_uid()) {
1289 ntstat = messaging_send(smbd_messaging_context(),
1290 session_list[snum].pid,
1291 MSG_SHUTDOWN, &data_blob_null);
1293 if (NT_STATUS_IS_OK(ntstat))
1301 DEBUG(5,("_srvsvc_NetSessDel: %d\n", __LINE__));
1308 /*******************************************************************
1309 _srvsvc_NetShareEnumAll
1310 ********************************************************************/
1312 WERROR _srvsvc_NetShareEnumAll(pipes_struct *p,
1313 struct srvsvc_NetShareEnumAll *r)
1317 DEBUG(5,("_srvsvc_NetShareEnumAll: %d\n", __LINE__));
1319 if (!pipe_access_check(p)) {
1320 DEBUG(3, ("access denied to _srvsvc_NetShareEnumAll\n"));
1321 return WERR_ACCESS_DENIED;
1324 /* Create the list of shares for the response. */
1325 werr = init_srv_share_info_ctr(p,
1327 r->in.resume_handle,
1328 r->out.totalentries,
1331 DEBUG(5,("_srvsvc_NetShareEnumAll: %d\n", __LINE__));
1336 /*******************************************************************
1337 _srvsvc_NetShareEnum
1338 ********************************************************************/
1340 WERROR _srvsvc_NetShareEnum(pipes_struct *p,
1341 struct srvsvc_NetShareEnum *r)
1345 DEBUG(5,("_srvsvc_NetShareEnum: %d\n", __LINE__));
1347 if (!pipe_access_check(p)) {
1348 DEBUG(3, ("access denied to _srvsvc_NetShareEnum\n"));
1349 return WERR_ACCESS_DENIED;
1352 /* Create the list of shares for the response. */
1353 werr = init_srv_share_info_ctr(p,
1355 r->in.resume_handle,
1356 r->out.totalentries,
1359 DEBUG(5,("_srvsvc_NetShareEnum: %d\n", __LINE__));
1364 /*******************************************************************
1365 _srvsvc_NetShareGetInfo
1366 ********************************************************************/
1368 WERROR _srvsvc_NetShareGetInfo(pipes_struct *p,
1369 struct srvsvc_NetShareGetInfo *r)
1371 WERROR status = WERR_OK;
1374 union srvsvc_NetShareInfo *info = r->out.info;
1376 DEBUG(5,("_srvsvc_NetShareGetInfo: %d\n", __LINE__));
1378 fstrcpy(share_name, r->in.share_name);
1380 snum = find_service(share_name);
1382 return WERR_INVALID_NAME;
1385 switch (r->in.level) {
1387 info->info0 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo0);
1388 W_ERROR_HAVE_NO_MEMORY(info->info0);
1389 init_srv_share_info_0(p, info->info0, snum);
1392 info->info1 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1);
1393 W_ERROR_HAVE_NO_MEMORY(info->info1);
1394 init_srv_share_info_1(p, info->info1, snum);
1397 info->info2 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo2);
1398 W_ERROR_HAVE_NO_MEMORY(info->info2);
1399 init_srv_share_info_2(p, info->info2, snum);
1402 info->info501 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo501);
1403 W_ERROR_HAVE_NO_MEMORY(info->info501);
1404 init_srv_share_info_501(p, info->info501, snum);
1407 info->info502 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo502);
1408 W_ERROR_HAVE_NO_MEMORY(info->info502);
1409 init_srv_share_info_502(p, info->info502, snum);
1412 info->info1004 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1004);
1413 W_ERROR_HAVE_NO_MEMORY(info->info1004);
1414 init_srv_share_info_1004(p, info->info1004, snum);
1417 info->info1005 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1005);
1418 W_ERROR_HAVE_NO_MEMORY(info->info1005);
1419 init_srv_share_info_1005(p, info->info1005, snum);
1422 info->info1006 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1006);
1423 W_ERROR_HAVE_NO_MEMORY(info->info1006);
1424 init_srv_share_info_1006(p, info->info1006, snum);
1427 info->info1007 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1007);
1428 W_ERROR_HAVE_NO_MEMORY(info->info1007);
1429 init_srv_share_info_1007(p, info->info1007, snum);
1432 init_srv_share_info_1501(p, info->info1501, snum);
1435 DEBUG(5,("_srvsvc_NetShareGetInfo: unsupported switch value %d\n",
1437 status = WERR_UNKNOWN_LEVEL;
1441 DEBUG(5,("_srvsvc_NetShareGetInfo: %d\n", __LINE__));
1446 /*******************************************************************
1447 Check a given DOS pathname is valid for a share.
1448 ********************************************************************/
1450 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname)
1454 if (!dos_pathname) {
1458 ptr = talloc_strdup(ctx, dos_pathname);
1462 /* Convert any '\' paths to '/' */
1464 ptr = unix_clean_name(ctx, ptr);
1469 /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
1470 if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/')
1473 /* Only absolute paths allowed. */
1480 /*******************************************************************
1481 _srvsvc_NetShareSetInfo. Modify share details.
1482 ********************************************************************/
1484 WERROR _srvsvc_NetShareSetInfo(pipes_struct *p,
1485 struct srvsvc_NetShareSetInfo *r)
1487 char *command = NULL;
1488 char *share_name = NULL;
1489 char *comment = NULL;
1490 const char *pathname = NULL;
1495 SEC_DESC *psd = NULL;
1496 SE_PRIV se_diskop = SE_DISK_OPERATOR;
1497 bool is_disk_op = False;
1498 int max_connections = 0;
1499 TALLOC_CTX *ctx = p->mem_ctx;
1500 union srvsvc_NetShareInfo *info = r->in.info;
1502 DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
1504 share_name = talloc_strdup(p->mem_ctx, r->in.share_name);
1509 if (r->out.parm_error) {
1510 *r->out.parm_error = 0;
1513 if ( strequal(share_name,"IPC$")
1514 || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") )
1515 || strequal(share_name,"global") )
1517 return WERR_ACCESS_DENIED;
1520 snum = find_service(share_name);
1522 /* Does this share exist ? */
1524 return WERR_NET_NAME_NOT_FOUND;
1526 /* No change to printer shares. */
1527 if (lp_print_ok(snum))
1528 return WERR_ACCESS_DENIED;
1530 is_disk_op = user_has_privileges( p->server_info->ptok, &se_diskop );
1532 /* fail out now if you are not root and not a disk op */
1534 if ( p->server_info->utok.uid != sec_initial_uid() && !is_disk_op )
1535 return WERR_ACCESS_DENIED;
1537 switch (r->in.level) {
1539 pathname = talloc_strdup(ctx, lp_pathname(snum));
1540 comment = talloc_strdup(ctx, info->info1->comment);
1541 type = info->info1->type;
1545 comment = talloc_strdup(ctx, info->info2->comment);
1546 pathname = info->info2->path;
1547 type = info->info2->type;
1548 max_connections = (info->info2->max_users == (uint32_t)-1) ?
1549 0 : info->info2->max_users;
1553 /* not supported on set but here for completeness */
1555 comment = talloc_strdup(ctx, info->info501->comment);
1556 type = info->info501->type;
1561 comment = talloc_strdup(ctx, info->info502->comment);
1562 pathname = info->info502->path;
1563 type = info->info502->type;
1564 psd = info->info502->sd_buf.sd;
1565 map_generic_share_sd_bits(psd);
1568 pathname = talloc_strdup(ctx, lp_pathname(snum));
1569 comment = talloc_strdup(ctx, info->info1004->comment);
1570 type = STYPE_DISKTREE;
1573 /* XP re-sets the csc policy even if it wasn't changed by the
1574 user, so we must compare it to see if it's what is set in
1575 smb.conf, so that we can contine other ops like setting
1577 if (((info->info1005->dfs_flags &
1578 SHARE_1005_CSC_POLICY_MASK) >>
1579 SHARE_1005_CSC_POLICY_SHIFT) == lp_csc_policy(snum))
1582 DEBUG(3, ("_srvsvc_NetShareSetInfo: client is trying to change csc policy from the network; must be done with smb.conf\n"));
1583 return WERR_ACCESS_DENIED;
1587 return WERR_ACCESS_DENIED;
1589 pathname = talloc_strdup(ctx, lp_pathname(snum));
1590 comment = talloc_strdup(ctx, lp_comment(snum));
1591 psd = info->info1501->sd;
1592 map_generic_share_sd_bits(psd);
1593 type = STYPE_DISKTREE;
1596 DEBUG(5,("_srvsvc_NetShareSetInfo: unsupported switch value %d\n",
1598 return WERR_UNKNOWN_LEVEL;
1601 /* We can only modify disk shares. */
1602 if (type != STYPE_DISKTREE)
1603 return WERR_ACCESS_DENIED;
1605 if (comment == NULL) {
1609 /* Check if the pathname is valid. */
1610 if (!(path = valid_share_pathname(p->mem_ctx, pathname )))
1611 return WERR_OBJECT_PATH_INVALID;
1613 /* Ensure share name, pathname and comment don't contain '"' characters. */
1614 string_replace(share_name, '"', ' ');
1615 string_replace(path, '"', ' ');
1616 string_replace(comment, '"', ' ');
1618 DEBUG(10,("_srvsvc_NetShareSetInfo: change share command = %s\n",
1619 lp_change_share_cmd() ? lp_change_share_cmd() : "NULL" ));
1621 /* Only call modify function if something changed. */
1623 if (strcmp(path, lp_pathname(snum)) || strcmp(comment, lp_comment(snum))
1624 || (lp_max_connections(snum) != max_connections)) {
1625 if (!lp_change_share_cmd() || !*lp_change_share_cmd()) {
1626 DEBUG(10,("_srvsvc_NetShareSetInfo: No change share command\n"));
1627 return WERR_ACCESS_DENIED;
1630 command = talloc_asprintf(p->mem_ctx,
1631 "%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
1632 lp_change_share_cmd(),
1633 get_dyn_CONFIGFILE(),
1636 comment ? comment : "",
1642 DEBUG(10,("_srvsvc_NetShareSetInfo: Running [%s]\n", command ));
1644 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1649 if ( (ret = smbrun(command, NULL)) == 0 ) {
1650 /* Tell everyone we updated smb.conf. */
1651 message_send_all(smbd_messaging_context(),
1652 MSG_SMB_CONF_UPDATED, NULL, 0,
1659 /********* END SeDiskOperatorPrivilege BLOCK *********/
1661 DEBUG(3,("_srvsvc_NetShareSetInfo: Running [%s] returned (%d)\n",
1664 TALLOC_FREE(command);
1667 return WERR_ACCESS_DENIED;
1669 DEBUG(10,("_srvsvc_NetShareSetInfo: No change to share name (%s)\n",
1673 /* Replace SD if changed. */
1678 old_sd = get_share_security(p->mem_ctx, lp_servicename(snum), &sd_size);
1680 if (old_sd && !security_descriptor_equal(old_sd, psd)) {
1681 if (!set_share_security(share_name, psd))
1682 DEBUG(0,("_srvsvc_NetShareSetInfo: Failed to change security info in share %s.\n",
1687 DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
1692 /*******************************************************************
1693 _srvsvc_NetShareAdd.
1694 Call 'add_share_command "sharename" "pathname"
1695 "comment" "max connections = "
1696 ********************************************************************/
1698 WERROR _srvsvc_NetShareAdd(pipes_struct *p,
1699 struct srvsvc_NetShareAdd *r)
1701 char *command = NULL;
1702 char *share_name = NULL;
1703 char *comment = NULL;
1704 char *pathname = NULL;
1709 SEC_DESC *psd = NULL;
1710 SE_PRIV se_diskop = SE_DISK_OPERATOR;
1712 int max_connections = 0;
1713 TALLOC_CTX *ctx = p->mem_ctx;
1715 DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
1717 if (r->out.parm_error) {
1718 *r->out.parm_error = 0;
1721 is_disk_op = user_has_privileges( p->server_info->ptok, &se_diskop );
1723 if (p->server_info->utok.uid != sec_initial_uid() && !is_disk_op )
1724 return WERR_ACCESS_DENIED;
1726 if (!lp_add_share_cmd() || !*lp_add_share_cmd()) {
1727 DEBUG(10,("_srvsvc_NetShareAdd: No add share command\n"));
1728 return WERR_ACCESS_DENIED;
1731 switch (r->in.level) {
1733 /* No path. Not enough info in a level 0 to do anything. */
1734 return WERR_ACCESS_DENIED;
1736 /* Not enough info in a level 1 to do anything. */
1737 return WERR_ACCESS_DENIED;
1739 share_name = talloc_strdup(ctx, r->in.info->info2->name);
1740 comment = talloc_strdup(ctx, r->in.info->info2->comment);
1741 pathname = talloc_strdup(ctx, r->in.info->info2->path);
1742 max_connections = (r->in.info->info2->max_users == (uint32_t)-1) ?
1743 0 : r->in.info->info2->max_users;
1744 type = r->in.info->info2->type;
1747 /* No path. Not enough info in a level 501 to do anything. */
1748 return WERR_ACCESS_DENIED;
1750 share_name = talloc_strdup(ctx, r->in.info->info502->name);
1751 comment = talloc_strdup(ctx, r->in.info->info502->comment);
1752 pathname = talloc_strdup(ctx, r->in.info->info502->path);
1753 max_connections = (r->in.info->info502->max_users == (uint32_t)-1) ?
1754 0 : r->in.info->info502->max_users;
1755 type = r->in.info->info502->type;
1756 psd = r->in.info->info502->sd_buf.sd;
1757 map_generic_share_sd_bits(psd);
1760 /* none of the following contain share names. NetShareAdd does not have a separate parameter for the share name */
1766 return WERR_ACCESS_DENIED;
1768 /* DFS only level. */
1769 return WERR_ACCESS_DENIED;
1771 DEBUG(5,("_srvsvc_NetShareAdd: unsupported switch value %d\n",
1773 return WERR_UNKNOWN_LEVEL;
1776 /* check for invalid share names */
1778 if (!share_name || !validate_net_name(share_name,
1779 INVALID_SHARENAME_CHARS,
1780 strlen(share_name))) {
1781 DEBUG(5,("_srvsvc_NetShareAdd: Bad sharename \"%s\"\n",
1782 share_name ? share_name : ""));
1783 return WERR_INVALID_NAME;
1786 if (strequal(share_name,"IPC$") || strequal(share_name,"global")
1787 || (lp_enable_asu_support() &&
1788 strequal(share_name,"ADMIN$"))) {
1789 return WERR_ACCESS_DENIED;
1792 snum = find_service(share_name);
1794 /* Share already exists. */
1796 return WERR_FILE_EXISTS;
1799 /* We can only add disk shares. */
1800 if (type != STYPE_DISKTREE) {
1801 return WERR_ACCESS_DENIED;
1804 /* Check if the pathname is valid. */
1805 if (!(path = valid_share_pathname(p->mem_ctx, pathname))) {
1806 return WERR_OBJECT_PATH_INVALID;
1809 /* Ensure share name, pathname and comment don't contain '"' characters. */
1810 string_replace(share_name, '"', ' ');
1811 string_replace(path, '"', ' ');
1813 string_replace(comment, '"', ' ');
1816 command = talloc_asprintf(ctx,
1817 "%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
1819 get_dyn_CONFIGFILE(),
1822 comment ? comment : "",
1828 DEBUG(10,("_srvsvc_NetShareAdd: Running [%s]\n", command ));
1830 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1835 /* FIXME: use libnetconf here - gd */
1837 if ( (ret = smbrun(command, NULL)) == 0 ) {
1838 /* Tell everyone we updated smb.conf. */
1839 message_send_all(smbd_messaging_context(),
1840 MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
1846 /********* END SeDiskOperatorPrivilege BLOCK *********/
1848 DEBUG(3,("_srvsvc_NetShareAdd: Running [%s] returned (%d)\n",
1851 TALLOC_FREE(command);
1854 return WERR_ACCESS_DENIED;
1857 if (!set_share_security(share_name, psd)) {
1858 DEBUG(0,("_srvsvc_NetShareAdd: Failed to add security info to share %s.\n",
1864 * We don't call reload_services() here, the message will
1865 * cause this to be done before the next packet is read
1866 * from the client. JRA.
1869 DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
1874 /*******************************************************************
1876 Call "delete share command" with the share name as
1878 ********************************************************************/
1880 WERROR _srvsvc_NetShareDel(pipes_struct *p,
1881 struct srvsvc_NetShareDel *r)
1883 char *command = NULL;
1884 char *share_name = NULL;
1887 SE_PRIV se_diskop = SE_DISK_OPERATOR;
1889 struct share_params *params;
1890 TALLOC_CTX *ctx = p->mem_ctx;
1892 DEBUG(5,("_srvsvc_NetShareDel: %d\n", __LINE__));
1894 share_name = talloc_strdup(p->mem_ctx, r->in.share_name);
1896 return WERR_NET_NAME_NOT_FOUND;
1898 if ( strequal(share_name,"IPC$")
1899 || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") )
1900 || strequal(share_name,"global") )
1902 return WERR_ACCESS_DENIED;
1905 if (!(params = get_share_params(p->mem_ctx, share_name))) {
1906 return WERR_NO_SUCH_SHARE;
1909 snum = find_service(share_name);
1911 /* No change to printer shares. */
1912 if (lp_print_ok(snum))
1913 return WERR_ACCESS_DENIED;
1915 is_disk_op = user_has_privileges( p->server_info->ptok, &se_diskop );
1917 if (p->server_info->utok.uid != sec_initial_uid() && !is_disk_op )
1918 return WERR_ACCESS_DENIED;
1920 if (!lp_delete_share_cmd() || !*lp_delete_share_cmd()) {
1921 DEBUG(10,("_srvsvc_NetShareDel: No delete share command\n"));
1922 return WERR_ACCESS_DENIED;
1925 command = talloc_asprintf(ctx,
1927 lp_delete_share_cmd(),
1928 get_dyn_CONFIGFILE(),
1929 lp_servicename(snum));
1934 DEBUG(10,("_srvsvc_NetShareDel: Running [%s]\n", command ));
1936 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1941 if ( (ret = smbrun(command, NULL)) == 0 ) {
1942 /* Tell everyone we updated smb.conf. */
1943 message_send_all(smbd_messaging_context(),
1944 MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
1950 /********* END SeDiskOperatorPrivilege BLOCK *********/
1952 DEBUG(3,("_srvsvc_NetShareDel: Running [%s] returned (%d)\n", command, ret ));
1955 return WERR_ACCESS_DENIED;
1957 /* Delete the SD in the database. */
1958 delete_share_security(lp_servicename(params->service));
1960 lp_killservice(params->service);
1965 /*******************************************************************
1966 _srvsvc_NetShareDelSticky
1967 ********************************************************************/
1969 WERROR _srvsvc_NetShareDelSticky(pipes_struct *p,
1970 struct srvsvc_NetShareDelSticky *r)
1972 struct srvsvc_NetShareDel q;
1974 DEBUG(5,("_srvsvc_NetShareDelSticky: %d\n", __LINE__));
1976 q.in.server_unc = r->in.server_unc;
1977 q.in.share_name = r->in.share_name;
1978 q.in.reserved = r->in.reserved;
1980 return _srvsvc_NetShareDel(p, &q);
1983 /*******************************************************************
1984 _srvsvc_NetRemoteTOD
1985 ********************************************************************/
1987 WERROR _srvsvc_NetRemoteTOD(pipes_struct *p,
1988 struct srvsvc_NetRemoteTOD *r)
1990 struct srvsvc_NetRemoteTODInfo *tod;
1992 time_t unixdate = time(NULL);
1994 /* We do this call first as if we do it *after* the gmtime call
1995 it overwrites the pointed-to values. JRA */
1997 uint32 zone = get_time_zone(unixdate)/60;
1999 DEBUG(5,("_srvsvc_NetRemoteTOD: %d\n", __LINE__));
2001 if ( !(tod = TALLOC_ZERO_P(p->mem_ctx, struct srvsvc_NetRemoteTODInfo)) )
2006 DEBUG(5,("_srvsvc_NetRemoteTOD: %d\n", __LINE__));
2008 t = gmtime(&unixdate);
2011 tod->elapsed = unixdate;
2013 tod->hours = t->tm_hour;
2014 tod->mins = t->tm_min;
2015 tod->secs = t->tm_sec;
2017 tod->timezone = zone;
2018 tod->tinterval = 10000;
2019 tod->day = t->tm_mday;
2020 tod->month = t->tm_mon + 1;
2021 tod->year = 1900+t->tm_year;
2022 tod->weekday = t->tm_wday;
2024 DEBUG(5,("_srvsvc_NetRemoteTOD: %d\n", __LINE__));
2029 /***********************************************************************************
2030 _srvsvc_NetGetFileSecurity
2031 Win9x NT tools get security descriptor.
2032 ***********************************************************************************/
2034 WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p,
2035 struct srvsvc_NetGetFileSecurity *r)
2037 struct smb_filename *smb_fname = NULL;
2038 SEC_DESC *psd = NULL;
2040 fstring servicename;
2044 connection_struct *conn = NULL;
2045 struct sec_desc_buf *sd_buf = NULL;
2046 files_struct *fsp = NULL;
2048 char *oldcwd = NULL;
2052 fstrcpy(servicename, r->in.share);
2054 snum = find_service(servicename);
2056 DEBUG(10, ("Could not find service %s\n", servicename));
2057 werr = WERR_NET_NAME_NOT_FOUND;
2061 nt_status = create_conn_struct(talloc_tos(), &conn, snum,
2062 lp_pathname(snum), p->server_info,
2064 if (!NT_STATUS_IS_OK(nt_status)) {
2065 DEBUG(10, ("create_conn_struct failed: %s\n",
2066 nt_errstr(nt_status)));
2067 werr = ntstatus_to_werror(nt_status);
2071 nt_status = filename_convert(talloc_tos(),
2076 if (!NT_STATUS_IS_OK(nt_status)) {
2077 werr = ntstatus_to_werror(nt_status);
2081 nt_status = SMB_VFS_CREATE_FILE(
2084 0, /* root_dir_fid */
2085 smb_fname, /* fname */
2086 FILE_READ_ATTRIBUTES, /* access_mask */
2087 FILE_SHARE_READ|FILE_SHARE_WRITE, /* share_access */
2088 FILE_OPEN, /* create_disposition*/
2089 0, /* create_options */
2090 0, /* file_attributes */
2091 INTERNAL_OPEN_ONLY, /* oplock_request */
2092 0, /* allocation_size */
2098 if (!NT_STATUS_IS_OK(nt_status)) {
2099 DEBUG(3,("_srvsvc_NetGetFileSecurity: can't open %s\n",
2100 smb_fname_str_dbg(smb_fname)));
2101 werr = ntstatus_to_werror(nt_status);
2105 nt_status = SMB_VFS_FGET_NT_ACL(fsp,
2106 (OWNER_SECURITY_INFORMATION
2107 |GROUP_SECURITY_INFORMATION
2108 |DACL_SECURITY_INFORMATION), &psd);
2110 if (!NT_STATUS_IS_OK(nt_status)) {
2111 DEBUG(3,("_srvsvc_NetGetFileSecurity: Unable to get NT ACL "
2112 "for file %s\n", smb_fname_str_dbg(smb_fname)));
2113 werr = ntstatus_to_werror(nt_status);
2117 sd_size = ndr_size_security_descriptor(psd, NULL, 0);
2119 sd_buf = TALLOC_ZERO_P(p->mem_ctx, struct sec_desc_buf);
2125 sd_buf->sd_size = sd_size;
2128 *r->out.sd_buf = sd_buf;
2130 psd->dacl->revision = NT4_ACL_REVISION;
2132 close_file(NULL, fsp, NORMAL_CLOSE);
2133 vfs_ChDir(conn, oldcwd);
2134 conn_free_internal(conn);
2141 close_file(NULL, fsp, NORMAL_CLOSE);
2145 vfs_ChDir(conn, oldcwd);
2149 conn_free_internal(conn);
2153 TALLOC_FREE(smb_fname);
2158 /***********************************************************************************
2159 _srvsvc_NetSetFileSecurity
2160 Win9x NT tools set security descriptor.
2161 ***********************************************************************************/
2163 WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
2164 struct srvsvc_NetSetFileSecurity *r)
2166 struct smb_filename *smb_fname = NULL;
2167 fstring servicename;
2168 files_struct *fsp = NULL;
2172 connection_struct *conn = NULL;
2174 char *oldcwd = NULL;
2175 struct security_descriptor *psd = NULL;
2176 uint32_t security_info_sent = 0;
2180 fstrcpy(servicename, r->in.share);
2182 snum = find_service(servicename);
2184 DEBUG(10, ("Could not find service %s\n", servicename));
2185 werr = WERR_NET_NAME_NOT_FOUND;
2189 nt_status = create_conn_struct(talloc_tos(), &conn, snum,
2190 lp_pathname(snum), p->server_info,
2192 if (!NT_STATUS_IS_OK(nt_status)) {
2193 DEBUG(10, ("create_conn_struct failed: %s\n",
2194 nt_errstr(nt_status)));
2195 werr = ntstatus_to_werror(nt_status);
2199 nt_status = filename_convert(talloc_tos(),
2204 if (!NT_STATUS_IS_OK(nt_status)) {
2205 werr = ntstatus_to_werror(nt_status);
2209 nt_status = SMB_VFS_CREATE_FILE(
2212 0, /* root_dir_fid */
2213 smb_fname, /* fname */
2214 FILE_WRITE_ATTRIBUTES, /* access_mask */
2215 FILE_SHARE_READ|FILE_SHARE_WRITE, /* share_access */
2216 FILE_OPEN, /* create_disposition*/
2217 0, /* create_options */
2218 0, /* file_attributes */
2219 INTERNAL_OPEN_ONLY, /* oplock_request */
2220 0, /* allocation_size */
2226 if (!NT_STATUS_IS_OK(nt_status)) {
2227 DEBUG(3,("_srvsvc_NetSetFileSecurity: can't open %s\n",
2228 smb_fname_str_dbg(smb_fname)));
2229 werr = ntstatus_to_werror(nt_status);
2233 psd = r->in.sd_buf->sd;
2234 security_info_sent = r->in.securityinformation;
2236 if (psd->owner_sid==0) {
2237 security_info_sent &= ~OWNER_SECURITY_INFORMATION;
2239 if (psd->group_sid==0) {
2240 security_info_sent &= ~GROUP_SECURITY_INFORMATION;
2243 security_info_sent &= ~SACL_SECURITY_INFORMATION;
2246 security_info_sent &= ~DACL_SECURITY_INFORMATION;
2249 /* Convert all the generic bits. */
2250 security_acl_map_generic(psd->dacl, &file_generic_mapping);
2251 security_acl_map_generic(psd->sacl, &file_generic_mapping);
2253 nt_status = SMB_VFS_FSET_NT_ACL(fsp,
2257 if (!NT_STATUS_IS_OK(nt_status) ) {
2258 DEBUG(3,("_srvsvc_NetSetFileSecurity: Unable to set NT ACL "
2259 "on file %s\n", r->in.share));
2260 werr = WERR_ACCESS_DENIED;
2264 close_file(NULL, fsp, NORMAL_CLOSE);
2265 vfs_ChDir(conn, oldcwd);
2266 conn_free_internal(conn);
2273 close_file(NULL, fsp, NORMAL_CLOSE);
2277 vfs_ChDir(conn, oldcwd);
2281 conn_free_internal(conn);
2285 TALLOC_FREE(smb_fname);
2290 /***********************************************************************************
2291 It may be that we want to limit users to creating shares on certain areas of the UNIX file area.
2292 We could define areas by mapping Windows style disks to points on the UNIX directory hierarchy.
2293 These disks would the disks listed by this function.
2294 Users could then create shares relative to these disks. Watch out for moving these disks around.
2295 "Nigel Williams" <nigel@veritas.com>.
2296 ***********************************************************************************/
2298 static const char *server_disks[] = {"C:"};
2300 static uint32 get_server_disk_count(void)
2302 return sizeof(server_disks)/sizeof(server_disks[0]);
2305 static uint32 init_server_disk_enum(uint32 *resume)
2307 uint32 server_disk_count = get_server_disk_count();
2309 /*resume can be an offset into the list for now*/
2311 if(*resume & 0x80000000)
2314 if(*resume > server_disk_count)
2315 *resume = server_disk_count;
2317 return server_disk_count - *resume;
2320 static const char *next_server_disk_enum(uint32 *resume)
2324 if(init_server_disk_enum(resume) == 0)
2327 disk = server_disks[*resume];
2331 DEBUG(10, ("next_server_disk_enum: reporting disk %s. resume handle %d.\n", disk, *resume));
2336 /********************************************************************
2338 ********************************************************************/
2340 WERROR _srvsvc_NetDiskEnum(pipes_struct *p,
2341 struct srvsvc_NetDiskEnum *r)
2344 const char *disk_name;
2345 TALLOC_CTX *ctx = p->mem_ctx;
2347 uint32_t resume = r->in.resume_handle ? *r->in.resume_handle : 0;
2351 *r->out.totalentries = init_server_disk_enum(&resume);
2353 r->out.info->disks = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetDiskInfo0,
2354 MAX_SERVER_DISK_ENTRIES);
2355 W_ERROR_HAVE_NO_MEMORY(r->out.info->disks);
2357 /*allow one struct srvsvc_NetDiskInfo0 for null terminator*/
2359 r->out.info->count = 0;
2361 for(i = 0; i < MAX_SERVER_DISK_ENTRIES -1 && (disk_name = next_server_disk_enum(&resume)); i++) {
2363 r->out.info->count++;
2365 /*copy disk name into a unicode string*/
2367 r->out.info->disks[i].disk = talloc_strdup(ctx, disk_name);
2368 W_ERROR_HAVE_NO_MEMORY(r->out.info->disks[i].disk);
2371 /* add a terminating null string. Is this there if there is more data to come? */
2373 r->out.info->count++;
2375 r->out.info->disks[i].disk = talloc_strdup(ctx, "");
2376 W_ERROR_HAVE_NO_MEMORY(r->out.info->disks[i].disk);
2378 if (r->out.resume_handle) {
2379 *r->out.resume_handle = resume;
2385 /********************************************************************
2386 _srvsvc_NetNameValidate
2387 ********************************************************************/
2389 WERROR _srvsvc_NetNameValidate(pipes_struct *p,
2390 struct srvsvc_NetNameValidate *r)
2392 switch (r->in.name_type) {
2394 if (!validate_net_name(r->in.name, INVALID_SHARENAME_CHARS,
2395 strlen_m(r->in.name)))
2397 DEBUG(5,("_srvsvc_NetNameValidate: Bad sharename \"%s\"\n",
2399 return WERR_INVALID_NAME;
2404 return WERR_UNKNOWN_LEVEL;
2410 /*******************************************************************
2411 ********************************************************************/
2413 static void enum_file_close_fn( const struct share_mode_entry *e,
2414 const char *sharepath, const char *fname,
2415 void *private_data )
2417 char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
2418 struct srvsvc_NetFileClose *r =
2419 (struct srvsvc_NetFileClose *)private_data;
2420 uint32_t fid = (((uint32_t)(procid_to_pid(&e->pid))<<16) | e->share_file_id);
2422 if (fid != r->in.fid) {
2423 return; /* Not this file. */
2426 if (!process_exists(e->pid) ) {
2430 /* Ok - send the close message. */
2431 DEBUG(10,("enum_file_close_fn: request to close file %s, %s\n",
2433 share_mode_str(talloc_tos(), 0, e) ));
2435 share_mode_entry_to_message(msg, e);
2437 r->out.result = ntstatus_to_werror(
2438 messaging_send_buf(smbd_messaging_context(),
2439 e->pid, MSG_SMB_CLOSE_FILE,
2441 MSG_SMB_SHARE_MODE_ENTRY_SIZE));
2444 /********************************************************************
2445 Close a file given a 32-bit file id.
2446 ********************************************************************/
2448 WERROR _srvsvc_NetFileClose(pipes_struct *p, struct srvsvc_NetFileClose *r)
2450 SE_PRIV se_diskop = SE_DISK_OPERATOR;
2453 DEBUG(5,("_srvsvc_NetFileClose: %d\n", __LINE__));
2455 is_disk_op = user_has_privileges( p->server_info->ptok, &se_diskop );
2457 if (p->server_info->utok.uid != sec_initial_uid() && !is_disk_op) {
2458 return WERR_ACCESS_DENIED;
2461 /* enum_file_close_fn sends the close message to
2462 * the relevent smbd process. */
2464 r->out.result = WERR_BADFILE;
2465 share_mode_forall( enum_file_close_fn, (void *)r);
2466 return r->out.result;
2469 /********************************************************************
2470 ********************************************************************/
2472 WERROR _srvsvc_NetCharDevEnum(pipes_struct *p, struct srvsvc_NetCharDevEnum *r)
2474 p->rng_fault_state = True;
2475 return WERR_NOT_SUPPORTED;
2478 WERROR _srvsvc_NetCharDevGetInfo(pipes_struct *p, struct srvsvc_NetCharDevGetInfo *r)
2480 p->rng_fault_state = True;
2481 return WERR_NOT_SUPPORTED;
2484 WERROR _srvsvc_NetCharDevControl(pipes_struct *p, struct srvsvc_NetCharDevControl *r)
2486 p->rng_fault_state = True;
2487 return WERR_NOT_SUPPORTED;
2490 WERROR _srvsvc_NetCharDevQEnum(pipes_struct *p, struct srvsvc_NetCharDevQEnum *r)
2492 p->rng_fault_state = True;
2493 return WERR_NOT_SUPPORTED;
2496 WERROR _srvsvc_NetCharDevQGetInfo(pipes_struct *p, struct srvsvc_NetCharDevQGetInfo *r)
2498 p->rng_fault_state = True;
2499 return WERR_NOT_SUPPORTED;
2502 WERROR _srvsvc_NetCharDevQSetInfo(pipes_struct *p, struct srvsvc_NetCharDevQSetInfo *r)
2504 p->rng_fault_state = True;
2505 return WERR_NOT_SUPPORTED;
2508 WERROR _srvsvc_NetCharDevQPurge(pipes_struct *p, struct srvsvc_NetCharDevQPurge *r)
2510 p->rng_fault_state = True;
2511 return WERR_NOT_SUPPORTED;
2514 WERROR _srvsvc_NetCharDevQPurgeSelf(pipes_struct *p, struct srvsvc_NetCharDevQPurgeSelf *r)
2516 p->rng_fault_state = True;
2517 return WERR_NOT_SUPPORTED;
2520 WERROR _srvsvc_NetFileGetInfo(pipes_struct *p, struct srvsvc_NetFileGetInfo *r)
2522 p->rng_fault_state = True;
2523 return WERR_NOT_SUPPORTED;
2526 WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r)
2528 p->rng_fault_state = True;
2529 return WERR_NOT_SUPPORTED;
2532 WERROR _srvsvc_NetServerStatisticsGet(pipes_struct *p, struct srvsvc_NetServerStatisticsGet *r)
2534 p->rng_fault_state = True;
2535 return WERR_NOT_SUPPORTED;
2538 WERROR _srvsvc_NetTransportAdd(pipes_struct *p, struct srvsvc_NetTransportAdd *r)
2540 p->rng_fault_state = True;
2541 return WERR_NOT_SUPPORTED;
2544 WERROR _srvsvc_NetTransportEnum(pipes_struct *p, struct srvsvc_NetTransportEnum *r)
2546 p->rng_fault_state = True;
2547 return WERR_NOT_SUPPORTED;
2550 WERROR _srvsvc_NetTransportDel(pipes_struct *p, struct srvsvc_NetTransportDel *r)
2552 p->rng_fault_state = True;
2553 return WERR_NOT_SUPPORTED;
2556 WERROR _srvsvc_NetSetServiceBits(pipes_struct *p, struct srvsvc_NetSetServiceBits *r)
2558 p->rng_fault_state = True;
2559 return WERR_NOT_SUPPORTED;
2562 WERROR _srvsvc_NetPathType(pipes_struct *p, struct srvsvc_NetPathType *r)
2564 p->rng_fault_state = True;
2565 return WERR_NOT_SUPPORTED;
2568 WERROR _srvsvc_NetPathCanonicalize(pipes_struct *p, struct srvsvc_NetPathCanonicalize *r)
2570 p->rng_fault_state = True;
2571 return WERR_NOT_SUPPORTED;
2574 WERROR _srvsvc_NetPathCompare(pipes_struct *p, struct srvsvc_NetPathCompare *r)
2576 p->rng_fault_state = True;
2577 return WERR_NOT_SUPPORTED;
2580 WERROR _srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p, struct srvsvc_NETRPRNAMECANONICALIZE *r)
2582 p->rng_fault_state = True;
2583 return WERR_NOT_SUPPORTED;
2586 WERROR _srvsvc_NetPRNameCompare(pipes_struct *p, struct srvsvc_NetPRNameCompare *r)
2588 p->rng_fault_state = True;
2589 return WERR_NOT_SUPPORTED;
2592 WERROR _srvsvc_NetShareDelStart(pipes_struct *p, struct srvsvc_NetShareDelStart *r)
2594 p->rng_fault_state = True;
2595 return WERR_NOT_SUPPORTED;
2598 WERROR _srvsvc_NetShareDelCommit(pipes_struct *p, struct srvsvc_NetShareDelCommit *r)
2600 p->rng_fault_state = True;
2601 return WERR_NOT_SUPPORTED;
2604 WERROR _srvsvc_NetServerTransportAddEx(pipes_struct *p, struct srvsvc_NetServerTransportAddEx *r)
2606 p->rng_fault_state = True;
2607 return WERR_NOT_SUPPORTED;
2610 WERROR _srvsvc_NetServerSetServiceBitsEx(pipes_struct *p, struct srvsvc_NetServerSetServiceBitsEx *r)
2612 p->rng_fault_state = True;
2613 return WERR_NOT_SUPPORTED;
2616 WERROR _srvsvc_NETRDFSGETVERSION(pipes_struct *p, struct srvsvc_NETRDFSGETVERSION *r)
2618 p->rng_fault_state = True;
2619 return WERR_NOT_SUPPORTED;
2622 WERROR _srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSCREATELOCALPARTITION *r)
2624 p->rng_fault_state = True;
2625 return WERR_NOT_SUPPORTED;
2628 WERROR _srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSDELETELOCALPARTITION *r)
2630 p->rng_fault_state = True;
2631 return WERR_NOT_SUPPORTED;
2634 WERROR _srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r)
2636 p->rng_fault_state = True;
2637 return WERR_NOT_SUPPORTED;
2640 WERROR _srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p, struct srvsvc_NETRDFSSETSERVERINFO *r)
2642 p->rng_fault_state = True;
2643 return WERR_NOT_SUPPORTED;
2646 WERROR _srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSCREATEEXITPOINT *r)
2648 p->rng_fault_state = True;
2649 return WERR_NOT_SUPPORTED;
2652 WERROR _srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSDELETEEXITPOINT *r)
2654 p->rng_fault_state = True;
2655 return WERR_NOT_SUPPORTED;
2658 WERROR _srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p, struct srvsvc_NETRDFSMODIFYPREFIX *r)
2660 p->rng_fault_state = True;
2661 return WERR_NOT_SUPPORTED;
2664 WERROR _srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p, struct srvsvc_NETRDFSFIXLOCALVOLUME *r)
2666 p->rng_fault_state = True;
2667 return WERR_NOT_SUPPORTED;
2670 WERROR _srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r)
2672 p->rng_fault_state = True;
2673 return WERR_NOT_SUPPORTED;
2676 WERROR _srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p, struct srvsvc_NETRSERVERTRANSPORTDELEX *r)
2678 p->rng_fault_state = True;
2679 return WERR_NOT_SUPPORTED;