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.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 /* This is the implementation of the srvsvc pipe. */
27 extern const struct generic_mapping file_generic_mapping;
30 #define DBGC_CLASS DBGC_RPC_SRV
32 /* Use for enumerating connections, pipes, & files */
34 struct file_enum_count {
41 struct sess_file_count {
47 /****************************************************************************
48 Count the entries belonging to a service in the connection db.
49 ****************************************************************************/
51 static int pipe_enum_fn( struct db_record *rec, void *p)
53 struct pipe_open_rec prec;
54 struct file_enum_count *fenum = (struct file_enum_count *)p;
57 char *fullpath = NULL;
60 if (rec->value.dsize != sizeof(struct pipe_open_rec))
63 memcpy(&prec, rec->value.dptr, sizeof(struct pipe_open_rec));
65 if ( !process_exists(prec.pid) ) {
69 username = uidtoname(prec.uid);
71 if ((fenum->username != NULL)
72 && !strequal(username, fenum->username)) {
76 fullpath = talloc_asprintf(fenum->ctx, "\\PIPE\\%s", prec.name );
81 f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 );
83 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
90 (uint32)((procid_to_pid(&prec.pid)<<16) & prec.pnum),
91 (FILE_READ_DATA|FILE_WRITE_DATA),
92 0, username, fullpath);
94 TALLOC_FREE(fullpath);
100 /*******************************************************************
101 ********************************************************************/
103 static WERROR net_enum_pipes( TALLOC_CTX *ctx, const char *username,
105 uint32 *count, uint32 resume )
107 struct file_enum_count fenum;
110 fenum.username = username;
111 fenum.count = *count;
114 if (connections_traverse(pipe_enum_fn, &fenum) == -1) {
115 DEBUG(0,("net_enum_pipes: traverse of connections.tdb "
121 *count = fenum.count;
126 /*******************************************************************
127 ********************************************************************/
129 static void enum_file_fn( const struct share_mode_entry *e,
130 const char *sharepath, const char *fname,
133 struct file_enum_count *fenum =
134 (struct file_enum_count *)private_data;
137 int i = fenum->count;
139 struct byte_range_lock *brl;
141 char *fullpath = NULL;
143 const char *username;
145 /* If the pid was not found delete the entry from connections.tdb */
147 if ( !process_exists(e->pid) ) {
151 username = uidtoname(e->uid);
153 if ((fenum->username != NULL)
154 && !strequal(username, fenum->username)) {
158 f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 );
160 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
165 /* need to count the number of locks on a file */
170 if ( (brl = brl_get_locks(talloc_tos(), &fsp)) != NULL ) {
171 num_locks = brl->num_locks;
175 if ( strcmp( fname, "." ) == 0 ) {
176 fullpath = talloc_asprintf(fenum->ctx, "C:%s", sharepath );
178 fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s",
184 string_replace( fullpath, '/', '\\' );
186 /* mask out create (what ever that is) */
187 permissions = e->share_access & (FILE_READ_DATA|FILE_WRITE_DATA);
189 /* now fill in the FILE_INFO_3 struct */
190 init_srv_file_info3( &fenum->info[i],
197 TALLOC_FREE(fullpath);
201 /*******************************************************************
202 ********************************************************************/
204 static WERROR net_enum_files( TALLOC_CTX *ctx, const char *username,
206 uint32 *count, uint32 resume )
208 struct file_enum_count f_enum_cnt;
210 f_enum_cnt.ctx = ctx;
211 f_enum_cnt.username = username;
212 f_enum_cnt.count = *count;
213 f_enum_cnt.info = *info;
215 share_mode_forall( enum_file_fn, (void *)&f_enum_cnt );
217 *info = f_enum_cnt.info;
218 *count = f_enum_cnt.count;
223 /*******************************************************************
224 Utility function to get the 'type' of a share from an snum.
225 ********************************************************************/
226 static uint32 get_share_type(int snum)
228 /* work out the share type */
229 uint32 type = STYPE_DISKTREE;
231 if (lp_print_ok(snum))
233 if (strequal(lp_fstype(snum), "IPC"))
235 if (lp_administrative_share(snum))
236 type |= STYPE_HIDDEN;
241 /*******************************************************************
242 Fill in a share info level 0 structure.
243 ********************************************************************/
245 static void init_srv_share_info_0(pipes_struct *p, SRV_SHARE_INFO_0 *sh0, int snum)
247 const char *net_name = lp_servicename(snum);
249 init_srv_share_info0(&sh0->info_0, net_name);
250 init_srv_share_info0_str(&sh0->info_0_str, net_name);
253 /*******************************************************************
254 Fill in a share info level 1 structure.
255 ********************************************************************/
257 static void init_srv_share_info_1(pipes_struct *p, SRV_SHARE_INFO_1 *sh1, int snum)
259 char *net_name = lp_servicename(snum);
260 char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
263 remark = standard_sub_conn(p->mem_ctx,
268 init_srv_share_info1(&sh1->info_1,
270 get_share_type(snum),
271 remark ? remark: "");
272 init_srv_share_info1_str(&sh1->info_1_str,
274 remark ? remark: "");
277 /*******************************************************************
278 Fill in a share info level 2 structure.
279 ********************************************************************/
281 static void init_srv_share_info_2(pipes_struct *p, SRV_SHARE_INFO_2 *sh2, int snum)
285 int max_connections = lp_max_connections(snum);
286 uint32 max_uses = max_connections!=0 ? max_connections : 0xffffffff;
288 char *net_name = lp_servicename(snum);
290 remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
292 remark = standard_sub_conn(p->mem_ctx,
296 path = talloc_asprintf(p->mem_ctx,
297 "C:%s", lp_pathname(snum));
301 * Change / to \\ so that win2k will see it as a valid path.
302 * This was added to enable use of browsing in win2k add
306 string_replace(path, '/', '\\');
309 count = count_current_connections(net_name, false);
310 init_srv_share_info2(&sh2->info_2,
312 get_share_type(snum),
313 remark ? remark : "",
320 init_srv_share_info2_str(&sh2->info_2_str,
322 remark ? remark : "",
327 /*******************************************************************
328 Map any generic bits to file specific bits.
329 ********************************************************************/
331 static void map_generic_share_sd_bits(SEC_DESC *psd)
334 SEC_ACL *ps_dacl = NULL;
343 for (i = 0; i < ps_dacl->num_aces; i++) {
344 SEC_ACE *psa = &ps_dacl->aces[i];
345 uint32 orig_mask = psa->access_mask;
347 se_map_generic(&psa->access_mask, &file_generic_mapping);
348 psa->access_mask |= orig_mask;
352 /*******************************************************************
353 Fill in a share info level 501 structure.
354 ********************************************************************/
356 static void init_srv_share_info_501(pipes_struct *p, SRV_SHARE_INFO_501 *sh501, int snum)
358 const char *net_name = lp_servicename(snum);
359 char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
362 remark = standard_sub_conn(p->mem_ctx, p->conn, remark);
365 init_srv_share_info501(&sh501->info_501, net_name, get_share_type(snum),
366 remark ? remark : "", (lp_csc_policy(snum) << 4));
367 init_srv_share_info501_str(&sh501->info_501_str,
368 net_name, remark ? remark : "");
371 /*******************************************************************
372 Fill in a share info level 502 structure.
373 ********************************************************************/
375 static void init_srv_share_info_502(pipes_struct *p, SRV_SHARE_INFO_502 *sh502, int snum)
377 const char *net_name = lp_servicename(snum);
381 TALLOC_CTX *ctx = p->mem_ctx;
382 char *remark = talloc_strdup(ctx, lp_comment(snum));;
387 remark = standard_sub_conn(ctx, p->conn, remark);
389 path = talloc_asprintf(ctx, "C:%s", lp_pathname(snum));
392 * Change / to \\ so that win2k will see it as a valid path. This was added to
393 * enable use of browsing in win2k add share dialog.
395 string_replace(path, '/', '\\');
398 sd = get_share_security(ctx, lp_servicename(snum), &sd_size);
400 init_srv_share_info502(&sh502->info_502,
402 get_share_type(snum),
403 remark ? remark : "",
411 init_srv_share_info502_str(&sh502->info_502_str,
413 remark ? remark : "",
420 /***************************************************************************
421 Fill in a share info level 1004 structure.
422 ***************************************************************************/
424 static void init_srv_share_info_1004(pipes_struct *p, SRV_SHARE_INFO_1004* sh1004, int snum)
426 char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
429 remark = standard_sub_conn(p->mem_ctx, p->conn, remark);
432 ZERO_STRUCTP(sh1004);
434 init_srv_share_info1004(&sh1004->info_1004, remark ? remark : "");
435 init_srv_share_info1004_str(&sh1004->info_1004_str,
436 remark ? remark : "");
439 /***************************************************************************
440 Fill in a share info level 1005 structure.
441 ***************************************************************************/
443 static void init_srv_share_info_1005(pipes_struct *p, SRV_SHARE_INFO_1005* sh1005, int snum)
445 sh1005->share_info_flags = 0;
447 if(lp_host_msdfs() && lp_msdfs_root(snum))
448 sh1005->share_info_flags |=
449 SHARE_1005_IN_DFS | SHARE_1005_DFS_ROOT;
450 sh1005->share_info_flags |=
451 lp_csc_policy(snum) << SHARE_1005_CSC_POLICY_SHIFT;
453 /***************************************************************************
454 Fill in a share info level 1006 structure.
455 ***************************************************************************/
457 static void init_srv_share_info_1006(pipes_struct *p, SRV_SHARE_INFO_1006* sh1006, int snum)
459 sh1006->max_uses = -1;
462 /***************************************************************************
463 Fill in a share info level 1007 structure.
464 ***************************************************************************/
466 static void init_srv_share_info_1007(pipes_struct *p, SRV_SHARE_INFO_1007* sh1007, int snum)
470 ZERO_STRUCTP(sh1007);
472 init_srv_share_info1007(&sh1007->info_1007, flags, "");
473 init_srv_share_info1007_str(&sh1007->info_1007_str, "");
476 /*******************************************************************
477 Fill in a share info level 1501 structure.
478 ********************************************************************/
480 static void init_srv_share_info_1501(pipes_struct *p, SRV_SHARE_INFO_1501 *sh1501, int snum)
484 TALLOC_CTX *ctx = p->mem_ctx;
486 ZERO_STRUCTP(sh1501);
488 sd = get_share_security(ctx, lp_servicename(snum), &sd_size);
490 sh1501->sdb = make_sec_desc_buf(p->mem_ctx, sd_size, sd);
493 /*******************************************************************
494 True if it ends in '$'.
495 ********************************************************************/
497 static bool is_hidden_share(int snum)
499 const char *net_name = lp_servicename(snum);
501 return (net_name[strlen(net_name) - 1] == '$') ? True : False;
504 /*******************************************************************
505 Fill in a share info structure.
506 ********************************************************************/
508 static bool init_srv_share_info_ctr(pipes_struct *p, SRV_SHARE_INFO_CTR *ctr,
509 uint32 info_level, uint32 *resume_hnd, uint32 *total_entries, bool all_shares)
512 int num_services = 0;
514 TALLOC_CTX *ctx = p->mem_ctx;
516 DEBUG(5,("init_srv_share_info_ctr\n"));
520 ctr->info_level = ctr->switch_value = info_level;
523 /* Ensure all the usershares are loaded. */
525 num_services = load_usershare_shares();
526 load_registry_shares();
529 /* Count the number of entries. */
530 for (snum = 0; snum < num_services; snum++) {
531 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) )
535 *total_entries = num_entries;
536 ctr->num_entries2 = ctr->num_entries = num_entries;
537 ctr->ptr_share_info = ctr->ptr_entries = 1;
542 switch (info_level) {
545 SRV_SHARE_INFO_0 *info0 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_0, num_entries);
552 for (snum = *resume_hnd; snum < num_services; snum++) {
553 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
554 init_srv_share_info_0(p, &info0[i++], snum);
558 ctr->share.info0 = info0;
565 SRV_SHARE_INFO_1 *info1 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1, num_entries);
572 for (snum = *resume_hnd; snum < num_services; snum++) {
573 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
574 init_srv_share_info_1(p, &info1[i++], snum);
578 ctr->share.info1 = info1;
584 SRV_SHARE_INFO_2 *info2 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_2, num_entries);
591 for (snum = *resume_hnd; snum < num_services; snum++) {
592 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
593 init_srv_share_info_2(p, &info2[i++], snum);
597 ctr->share.info2 = info2;
603 SRV_SHARE_INFO_501 *info501 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_501, num_entries);
610 for (snum = *resume_hnd; snum < num_services; snum++) {
611 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
612 init_srv_share_info_501(p, &info501[i++], snum);
616 ctr->share.info501 = info501;
622 SRV_SHARE_INFO_502 *info502 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_502, num_entries);
629 for (snum = *resume_hnd; snum < num_services; snum++) {
630 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
631 init_srv_share_info_502(p, &info502[i++], snum);
635 ctr->share.info502 = info502;
639 /* here for completeness but not currently used with enum (1004 - 1501)*/
643 SRV_SHARE_INFO_1004 *info1004 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1004, num_entries);
650 for (snum = *resume_hnd; snum < num_services; snum++) {
651 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
652 init_srv_share_info_1004(p, &info1004[i++], snum);
656 ctr->share.info1004 = info1004;
662 SRV_SHARE_INFO_1005 *info1005 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1005, num_entries);
669 for (snum = *resume_hnd; snum < num_services; snum++) {
670 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
671 init_srv_share_info_1005(p, &info1005[i++], snum);
675 ctr->share.info1005 = info1005;
681 SRV_SHARE_INFO_1006 *info1006 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1006, num_entries);
688 for (snum = *resume_hnd; snum < num_services; snum++) {
689 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
690 init_srv_share_info_1006(p, &info1006[i++], snum);
694 ctr->share.info1006 = info1006;
700 SRV_SHARE_INFO_1007 *info1007 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1007, num_entries);
707 for (snum = *resume_hnd; snum < num_services; snum++) {
708 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
709 init_srv_share_info_1007(p, &info1007[i++], snum);
713 ctr->share.info1007 = info1007;
719 SRV_SHARE_INFO_1501 *info1501 = TALLOC_ARRAY(ctx, SRV_SHARE_INFO_1501, num_entries);
726 for (snum = *resume_hnd; snum < num_services; snum++) {
727 if (lp_browseable(snum) && lp_snum_ok(snum) && (all_shares || !is_hidden_share(snum)) ) {
728 init_srv_share_info_1501(p, &info1501[i++], snum);
732 ctr->share.info1501 = info1501;
736 DEBUG(5,("init_srv_share_info_ctr: unsupported switch value %d\n", info_level));
743 /*******************************************************************
744 Inits a SRV_R_NET_SHARE_ENUM structure.
745 ********************************************************************/
747 static void init_srv_r_net_share_enum(pipes_struct *p, SRV_R_NET_SHARE_ENUM *r_n,
748 uint32 info_level, uint32 resume_hnd, bool all)
750 DEBUG(5,("init_srv_r_net_share_enum: %d\n", __LINE__));
752 if (init_srv_share_info_ctr(p, &r_n->ctr, info_level,
753 &resume_hnd, &r_n->total_entries, all)) {
754 r_n->status = WERR_OK;
756 r_n->status = WERR_UNKNOWN_LEVEL;
759 init_enum_hnd(&r_n->enum_hnd, resume_hnd);
762 /*******************************************************************
763 Inits a SRV_R_NET_SHARE_GET_INFO structure.
764 ********************************************************************/
766 static void init_srv_r_net_share_get_info(pipes_struct *p, SRV_R_NET_SHARE_GET_INFO *r_n,
767 char *share_name, uint32 info_level)
769 WERROR status = WERR_OK;
772 DEBUG(5,("init_srv_r_net_share_get_info: %d\n", __LINE__));
774 r_n->info.switch_value = info_level;
776 snum = find_service(share_name);
779 switch (info_level) {
781 init_srv_share_info_0(p, &r_n->info.share.info0, snum);
784 init_srv_share_info_1(p, &r_n->info.share.info1, snum);
787 init_srv_share_info_2(p, &r_n->info.share.info2, snum);
790 init_srv_share_info_501(p, &r_n->info.share.info501, snum);
793 init_srv_share_info_502(p, &r_n->info.share.info502, snum);
796 /* here for completeness */
798 init_srv_share_info_1004(p, &r_n->info.share.info1004, snum);
801 init_srv_share_info_1005(p, &r_n->info.share.info1005, snum);
804 /* here for completeness 1006 - 1501 */
806 init_srv_share_info_1006(p, &r_n->info.share.info1006, snum);
809 init_srv_share_info_1007(p, &r_n->info.share.info1007, snum);
812 init_srv_share_info_1501(p, &r_n->info.share.info1501, snum);
815 DEBUG(5,("init_srv_net_share_get_info: unsupported switch value %d\n", info_level));
816 status = WERR_UNKNOWN_LEVEL;
820 status = WERR_INVALID_NAME;
823 r_n->info.ptr_share_ctr = W_ERROR_IS_OK(status) ? 1 : 0;
824 r_n->status = status;
827 /*******************************************************************
828 fill in a sess info level 0 structure.
829 ********************************************************************/
831 static void init_srv_sess_info_0(pipes_struct *p, SRV_SESS_INFO_0 *ss0, uint32 *snum, uint32 *stot)
833 struct sessionid *session_list;
834 uint32 num_entries = 0;
835 (*stot) = list_sessions(p->mem_ctx, &session_list);
844 DEBUG(5,("init_srv_sess_0_ss0\n"));
847 for (; (*snum) < (*stot) && num_entries < MAX_SESS_ENTRIES; (*snum)++) {
848 init_srv_sess_info0( &ss0->info_0[num_entries], session_list[(*snum)].remote_machine);
852 ss0->num_entries_read = num_entries;
853 ss0->ptr_sess_info = num_entries > 0 ? 1 : 0;
854 ss0->num_entries_read2 = num_entries;
856 if ((*snum) >= (*stot)) {
861 ss0->num_entries_read = 0;
862 ss0->ptr_sess_info = 0;
863 ss0->num_entries_read2 = 0;
867 /*******************************************************************
868 ********************************************************************/
870 static void sess_file_fn( const struct share_mode_entry *e,
871 const char *sharepath, const char *fname,
874 struct sess_file_count *sess = (struct sess_file_count *)data;
876 if ( procid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid) ) {
883 /*******************************************************************
884 ********************************************************************/
886 static int net_count_files( uid_t uid, struct server_id pid )
888 struct sess_file_count s_file_cnt;
890 s_file_cnt.count = 0;
891 s_file_cnt.uid = uid;
892 s_file_cnt.pid = pid;
894 share_mode_forall( sess_file_fn, &s_file_cnt );
896 return s_file_cnt.count;
899 /*******************************************************************
900 fill in a sess info level 1 structure.
901 ********************************************************************/
903 static void init_srv_sess_info_1(pipes_struct *p, SRV_SESS_INFO_1 *ss1, uint32 *snum, uint32 *stot)
905 struct sessionid *session_list;
906 uint32 num_entries = 0;
907 time_t now = time(NULL);
910 ss1->num_entries_read = 0;
911 ss1->ptr_sess_info = 0;
912 ss1->num_entries_read2 = 0;
924 (*stot) = list_sessions(p->mem_ctx, &session_list);
927 for (; (*snum) < (*stot) && num_entries < MAX_SESS_ENTRIES; (*snum)++) {
930 struct passwd *pw = sys_getpwnam(session_list[*snum].username);
934 DEBUG(10,("init_srv_sess_info_1: failed to find owner: %s\n",
935 session_list[*snum].username));
939 connect_time = (uint32)(now - session_list[*snum].connect_start);
940 num_files = net_count_files(pw->pw_uid, session_list[*snum].pid);
941 guest = strequal( session_list[*snum].username, lp_guestaccount() );
943 init_srv_sess_info1( &ss1->info_1[num_entries],
944 session_list[*snum].remote_machine,
945 session_list[*snum].username,
953 ss1->num_entries_read = num_entries;
954 ss1->ptr_sess_info = num_entries > 0 ? 1 : 0;
955 ss1->num_entries_read2 = num_entries;
957 if ((*snum) >= (*stot)) {
963 /*******************************************************************
964 makes a SRV_R_NET_SESS_ENUM structure.
965 ********************************************************************/
967 static WERROR init_srv_sess_info_ctr(pipes_struct *p, SRV_SESS_INFO_CTR *ctr,
968 int switch_value, uint32 *resume_hnd, uint32 *total_entries)
970 WERROR status = WERR_OK;
971 DEBUG(5,("init_srv_sess_info_ctr: %d\n", __LINE__));
973 ctr->switch_value = switch_value;
975 switch (switch_value) {
977 init_srv_sess_info_0(p, &(ctr->sess.info0), resume_hnd, total_entries);
978 ctr->ptr_sess_ctr = 1;
981 init_srv_sess_info_1(p, &(ctr->sess.info1), resume_hnd, total_entries);
982 ctr->ptr_sess_ctr = 1;
985 DEBUG(5,("init_srv_sess_info_ctr: unsupported switch value %d\n", switch_value));
987 (*total_entries) = 0;
988 ctr->ptr_sess_ctr = 0;
989 status = WERR_UNKNOWN_LEVEL;
996 /*******************************************************************
997 makes a SRV_R_NET_SESS_ENUM structure.
998 ********************************************************************/
1000 static void init_srv_r_net_sess_enum(pipes_struct *p, SRV_R_NET_SESS_ENUM *r_n,
1001 uint32 resume_hnd, int sess_level, int switch_value)
1003 DEBUG(5,("init_srv_r_net_sess_enum: %d\n", __LINE__));
1005 r_n->sess_level = sess_level;
1007 if (sess_level == -1)
1008 r_n->status = WERR_UNKNOWN_LEVEL;
1010 r_n->status = init_srv_sess_info_ctr(p, r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries);
1012 if (!W_ERROR_IS_OK(r_n->status))
1015 init_enum_hnd(&r_n->enum_hnd, resume_hnd);
1018 /*******************************************************************
1019 fill in a conn info level 0 structure.
1020 ********************************************************************/
1022 static void init_srv_conn_info_0(SRV_CONN_INFO_0 *ss0, uint32 *snum, uint32 *stot)
1024 uint32 num_entries = 0;
1032 DEBUG(5,("init_srv_conn_0_ss0\n"));
1035 for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++) {
1037 init_srv_conn_info0(&ss0->info_0[num_entries], (*stot));
1039 /* move on to creating next connection */
1040 /* move on to creating next conn */
1044 ss0->num_entries_read = num_entries;
1045 ss0->ptr_conn_info = num_entries > 0 ? 1 : 0;
1046 ss0->num_entries_read2 = num_entries;
1048 if ((*snum) >= (*stot)) {
1053 ss0->num_entries_read = 0;
1054 ss0->ptr_conn_info = 0;
1055 ss0->num_entries_read2 = 0;
1061 /*******************************************************************
1062 fill in a conn info level 1 structure.
1063 ********************************************************************/
1065 static void init_srv_conn_1_info(CONN_INFO_1 *se1, CONN_INFO_1_STR *str1,
1066 uint32 id, uint32 type,
1067 uint32 num_opens, uint32 num_users, uint32 open_time,
1068 const char *usr_name, const char *net_name)
1070 init_srv_conn_info1(se1 , id, type, num_opens, num_users, open_time, usr_name, net_name);
1071 init_srv_conn_info1_str(str1, usr_name, net_name);
1074 /*******************************************************************
1075 fill in a conn info level 1 structure.
1076 ********************************************************************/
1078 static void init_srv_conn_info_1(SRV_CONN_INFO_1 *ss1, uint32 *snum, uint32 *stot)
1080 uint32 num_entries = 0;
1088 DEBUG(5,("init_srv_conn_1_ss1\n"));
1091 for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++) {
1092 init_srv_conn_1_info(&ss1->info_1[num_entries],
1093 &ss1->info_1_str[num_entries],
1094 (*stot), 0x3, 1, 1, 3,"dummy_user", "IPC$");
1096 /* move on to creating next connection */
1097 /* move on to creating next conn */
1101 ss1->num_entries_read = num_entries;
1102 ss1->ptr_conn_info = num_entries > 0 ? 1 : 0;
1103 ss1->num_entries_read2 = num_entries;
1106 if ((*snum) >= (*stot)) {
1111 ss1->num_entries_read = 0;
1112 ss1->ptr_conn_info = 0;
1113 ss1->num_entries_read2 = 0;
1119 /*******************************************************************
1120 makes a SRV_R_NET_CONN_ENUM structure.
1121 ********************************************************************/
1123 static WERROR init_srv_conn_info_ctr(SRV_CONN_INFO_CTR *ctr,
1124 int switch_value, uint32 *resume_hnd, uint32 *total_entries)
1126 WERROR status = WERR_OK;
1127 DEBUG(5,("init_srv_conn_info_ctr: %d\n", __LINE__));
1129 ctr->switch_value = switch_value;
1131 switch (switch_value) {
1133 init_srv_conn_info_0(&ctr->conn.info0, resume_hnd, total_entries);
1134 ctr->ptr_conn_ctr = 1;
1137 init_srv_conn_info_1(&ctr->conn.info1, resume_hnd, total_entries);
1138 ctr->ptr_conn_ctr = 1;
1141 DEBUG(5,("init_srv_conn_info_ctr: unsupported switch value %d\n", switch_value));
1143 (*total_entries) = 0;
1144 ctr->ptr_conn_ctr = 0;
1145 status = WERR_UNKNOWN_LEVEL;
1152 /*******************************************************************
1153 makes a SRV_R_NET_CONN_ENUM structure.
1154 ********************************************************************/
1156 static void init_srv_r_net_conn_enum(SRV_R_NET_CONN_ENUM *r_n,
1157 uint32 resume_hnd, int conn_level, int switch_value)
1159 DEBUG(5,("init_srv_r_net_conn_enum: %d\n", __LINE__));
1161 r_n->conn_level = conn_level;
1162 if (conn_level == -1)
1163 r_n->status = WERR_UNKNOWN_LEVEL;
1165 r_n->status = init_srv_conn_info_ctr(r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries);
1167 if (!W_ERROR_IS_OK(r_n->status))
1170 init_enum_hnd(&r_n->enum_hnd, resume_hnd);
1173 /*******************************************************************
1174 makes a SRV_R_NET_FILE_ENUM structure.
1175 ********************************************************************/
1177 static WERROR net_file_enum_3( const char *username, SRV_R_NET_FILE_ENUM *r,
1180 TALLOC_CTX *ctx = talloc_tos();
1181 SRV_FILE_INFO_CTR *ctr = &r->ctr;
1183 /* TODO -- Windows enumerates
1185 (c) open directories and files */
1187 r->status = net_enum_files( ctx, username, &ctr->file.info3,
1188 &ctr->num_entries, resume_hnd );
1189 if ( !W_ERROR_IS_OK(r->status))
1192 r->status = net_enum_pipes( ctx, username, &ctr->file.info3,
1193 &ctr->num_entries, resume_hnd );
1194 if ( !W_ERROR_IS_OK(r->status))
1197 r->level = ctr->level = 3;
1198 r->total_entries = ctr->num_entries;
1199 /* ctr->num_entries = r->total_entries - resume_hnd; */
1200 ctr->num_entries2 = ctr->num_entries;
1201 ctr->ptr_file_info = 1;
1203 r->status = WERR_OK;
1206 if ( ctr->num_entries > 0 )
1207 ctr->ptr_entries = 1;
1209 init_enum_hnd(&r->enum_hnd, 0);
1214 /*******************************************************************
1215 *******************************************************************/
1217 WERROR _srv_net_file_enum(pipes_struct *p, SRV_Q_NET_FILE_ENUM *q_u, SRV_R_NET_FILE_ENUM *r_u)
1219 const char *username = NULL;
1221 switch ( q_u->level ) {
1223 if (q_u->username) {
1224 username = rpcstr_pull_unistr2_talloc(
1225 p->mem_ctx, q_u->username);
1231 return net_file_enum_3(username, r_u,
1232 get_enum_hnd(&q_u->enum_hnd));
1234 return WERR_UNKNOWN_LEVEL;
1240 /*******************************************************************
1241 _srvsvc_NetSrvGetInfo
1242 ********************************************************************/
1244 WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p,
1245 struct srvsvc_NetSrvGetInfo *r)
1247 WERROR status = WERR_OK;
1249 DEBUG(5,("_srvsvc_NetSrvGetInfo: %d\n", __LINE__));
1251 if (!pipe_access_check(p)) {
1252 DEBUG(3, ("access denied to _srvsvc_NetSrvGetInfo\n"));
1253 return WERR_ACCESS_DENIED;
1256 switch (r->in.level) {
1258 /* Technically level 102 should only be available to
1259 Administrators but there isn't anything super-secret
1260 here, as most of it is made up. */
1263 struct srvsvc_NetSrvInfo102 *info102;
1265 info102 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo102);
1270 init_srvsvc_NetSrvInfo102(info102,
1273 lp_major_announce_version(),
1274 lp_minor_announce_version(),
1275 lp_default_server_announce(),
1276 string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH),
1277 0xffffffff, /* users */
1281 3000, /* announce delta */
1282 100000, /* licenses */
1283 "c:\\"); /* user path */
1284 r->out.info->info102 = info102;
1288 struct srvsvc_NetSrvInfo101 *info101;
1290 info101 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo101);
1295 init_srvsvc_NetSrvInfo101(info101,
1298 lp_major_announce_version(),
1299 lp_minor_announce_version(),
1300 lp_default_server_announce(),
1301 string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH));
1302 r->out.info->info101 = info101;
1306 struct srvsvc_NetSrvInfo100 *info100;
1308 info100 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo100);
1313 init_srvsvc_NetSrvInfo100(info100,
1316 r->out.info->info100 = info100;
1321 status = WERR_UNKNOWN_LEVEL;
1325 DEBUG(5,("_srvsvc_NetSrvGetInfo: %d\n", __LINE__));
1330 /*******************************************************************
1331 _srvsvc_NetSrvSetInfo
1332 ********************************************************************/
1334 WERROR _srvsvc_NetSrvSetInfo(pipes_struct *p,
1335 struct srvsvc_NetSrvSetInfo *r)
1337 WERROR status = WERR_OK;
1339 DEBUG(5,("_srvsvc_NetSrvSetInfo: %d\n", __LINE__));
1341 /* Set up the net server set info structure. */
1343 DEBUG(5,("_srvsvc_NetSrvSetInfo: %d\n", __LINE__));
1348 /*******************************************************************
1350 ********************************************************************/
1352 WERROR _srv_net_conn_enum(pipes_struct *p, SRV_Q_NET_CONN_ENUM *q_u, SRV_R_NET_CONN_ENUM *r_u)
1354 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__));
1356 r_u->ctr = TALLOC_P(p->mem_ctx, SRV_CONN_INFO_CTR);
1360 ZERO_STRUCTP(r_u->ctr);
1363 init_srv_r_net_conn_enum(r_u,
1364 get_enum_hnd(&q_u->enum_hnd),
1366 q_u->ctr->switch_value);
1368 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__));
1373 /*******************************************************************
1375 ********************************************************************/
1377 WERROR _srv_net_sess_enum(pipes_struct *p, SRV_Q_NET_SESS_ENUM *q_u, SRV_R_NET_SESS_ENUM *r_u)
1379 DEBUG(5,("_srv_net_sess_enum: %d\n", __LINE__));
1381 r_u->ctr = TALLOC_P(p->mem_ctx, SRV_SESS_INFO_CTR);
1385 ZERO_STRUCTP(r_u->ctr);
1388 init_srv_r_net_sess_enum(p, r_u,
1389 get_enum_hnd(&q_u->enum_hnd),
1391 q_u->ctr->switch_value);
1393 DEBUG(5,("_srv_net_sess_enum: %d\n", __LINE__));
1398 /*******************************************************************
1400 ********************************************************************/
1402 WERROR _srv_net_sess_del(pipes_struct *p, SRV_Q_NET_SESS_DEL *q_u, SRV_R_NET_SESS_DEL *r_u)
1404 struct sessionid *session_list;
1405 struct current_user user;
1406 int num_sessions, snum;
1409 bool not_root = False;
1411 rpcstr_pull_unistr2_fstring(username, &q_u->uni_user_name);
1412 rpcstr_pull_unistr2_fstring(machine, &q_u->uni_cli_name);
1414 /* strip leading backslashes if any */
1415 while (machine[0] == '\\') {
1416 memmove(machine, &machine[1], strlen(machine));
1419 num_sessions = list_sessions(p->mem_ctx, &session_list);
1421 DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__));
1423 r_u->status = WERR_ACCESS_DENIED;
1425 get_current_user(&user, p);
1427 /* fail out now if you are not root or not a domain admin */
1429 if ((user.ut.uid != sec_initial_uid()) &&
1430 ( ! nt_token_check_domain_rid(p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS))) {
1435 for (snum = 0; snum < num_sessions; snum++) {
1437 if ((strequal(session_list[snum].username, username) || username[0] == '\0' ) &&
1438 strequal(session_list[snum].remote_machine, machine)) {
1442 if (user.ut.uid != sec_initial_uid()) {
1447 ntstat = messaging_send(smbd_messaging_context(),
1448 session_list[snum].pid,
1449 MSG_SHUTDOWN, &data_blob_null);
1451 if (NT_STATUS_IS_OK(ntstat))
1452 r_u->status = WERR_OK;
1459 DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__));
1467 /*******************************************************************
1469 ********************************************************************/
1471 WERROR _srv_net_share_enum_all(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
1473 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
1475 if (!pipe_access_check(p)) {
1476 DEBUG(3, ("access denied to srv_net_share_enum_all\n"));
1477 return WERR_ACCESS_DENIED;
1480 /* Create the list of shares for the response. */
1481 init_srv_r_net_share_enum(p, r_u,
1482 q_u->ctr.info_level,
1483 get_enum_hnd(&q_u->enum_hnd), True);
1485 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
1490 /*******************************************************************
1492 ********************************************************************/
1494 WERROR _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
1496 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
1498 if (!pipe_access_check(p)) {
1499 DEBUG(3, ("access denied to srv_net_share_enum\n"));
1500 return WERR_ACCESS_DENIED;
1503 /* Create the list of shares for the response. */
1504 init_srv_r_net_share_enum(p, r_u,
1505 q_u->ctr.info_level,
1506 get_enum_hnd(&q_u->enum_hnd), False);
1508 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
1513 /*******************************************************************
1515 ********************************************************************/
1517 WERROR _srv_net_share_get_info(pipes_struct *p, SRV_Q_NET_SHARE_GET_INFO *q_u, SRV_R_NET_SHARE_GET_INFO *r_u)
1521 DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__));
1523 /* Create the list of shares for the response. */
1524 unistr2_to_ascii(share_name, &q_u->uni_share_name, sizeof(share_name));
1525 init_srv_r_net_share_get_info(p, r_u, share_name, q_u->info_level);
1527 DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__));
1532 /*******************************************************************
1533 Check a given DOS pathname is valid for a share.
1534 ********************************************************************/
1536 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname)
1540 if (!dos_pathname) {
1544 ptr = talloc_strdup(ctx, dos_pathname);
1548 /* Convert any '\' paths to '/' */
1550 ptr = unix_clean_name(ctx, ptr);
1555 /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
1556 if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/')
1559 /* Only absolute paths allowed. */
1566 /*******************************************************************
1567 _srvsvc_NetShareSetInfo. Modify share details.
1568 ********************************************************************/
1570 WERROR _srvsvc_NetShareSetInfo(pipes_struct *p,
1571 struct srvsvc_NetShareSetInfo *r)
1573 struct current_user user;
1574 char *command = NULL;
1575 char *share_name = NULL;
1576 char *comment = NULL;
1577 const char *pathname = NULL;
1582 SEC_DESC *psd = NULL;
1583 SE_PRIV se_diskop = SE_DISK_OPERATOR;
1584 bool is_disk_op = False;
1585 int max_connections = 0;
1586 TALLOC_CTX *ctx = p->mem_ctx;
1587 union srvsvc_NetShareInfo *info = r->in.info;
1589 DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
1591 share_name = talloc_strdup(p->mem_ctx, r->in.share_name);
1596 *r->out.parm_error = 0;
1598 if ( strequal(share_name,"IPC$")
1599 || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") )
1600 || strequal(share_name,"global") )
1602 return WERR_ACCESS_DENIED;
1605 snum = find_service(share_name);
1607 /* Does this share exist ? */
1609 return WERR_NET_NAME_NOT_FOUND;
1611 /* No change to printer shares. */
1612 if (lp_print_ok(snum))
1613 return WERR_ACCESS_DENIED;
1615 get_current_user(&user,p);
1617 is_disk_op = user_has_privileges( p->pipe_user.nt_user_token, &se_diskop );
1619 /* fail out now if you are not root and not a disk op */
1621 if ( user.ut.uid != sec_initial_uid() && !is_disk_op )
1622 return WERR_ACCESS_DENIED;
1624 switch (r->in.level) {
1626 pathname = talloc_strdup(ctx, lp_pathname(snum));
1627 comment = talloc_strdup(ctx, info->info2->comment);
1628 type = info->info2->type;
1632 comment = talloc_strdup(ctx, info->info2->comment);
1633 pathname = info->info2->path;
1634 type = info->info2->type;
1635 max_connections = (info->info2->max_users == 0xffffffff) ?
1636 0 : info->info2->max_users;
1640 /* not supported on set but here for completeness */
1642 comment = talloc_strdup(ctx, info->info501->comment);
1643 type = info->info501->type;
1648 comment = talloc_strdup(ctx, info->info502->comment);
1649 pathname = info->info502->path;
1650 type = info->info502->type;
1651 psd = info->info502->sd;
1652 map_generic_share_sd_bits(psd);
1655 pathname = talloc_strdup(ctx, lp_pathname(snum));
1656 comment = talloc_strdup(ctx, info->info1004->comment);
1657 type = STYPE_DISKTREE;
1660 /* XP re-sets the csc policy even if it wasn't changed by the
1661 user, so we must compare it to see if it's what is set in
1662 smb.conf, so that we can contine other ops like setting
1664 if (((info->info1005->dfs_flags &
1665 SHARE_1005_CSC_POLICY_MASK) >>
1666 SHARE_1005_CSC_POLICY_SHIFT) == lp_csc_policy(snum))
1669 DEBUG(3, ("_srvsvc_NetShareSetInfo: client is trying to change csc policy from the network; must be done with smb.conf\n"));
1670 return WERR_ACCESS_DENIED;
1674 return WERR_ACCESS_DENIED;
1676 pathname = talloc_strdup(ctx, lp_pathname(snum));
1677 comment = talloc_strdup(ctx, lp_comment(snum));
1678 psd = info->info1501->sd;
1679 map_generic_share_sd_bits(psd);
1680 type = STYPE_DISKTREE;
1683 DEBUG(5,("_srvsvc_NetShareSetInfo: unsupported switch value %d\n",
1685 return WERR_UNKNOWN_LEVEL;
1688 /* We can only modify disk shares. */
1689 if (type != STYPE_DISKTREE)
1690 return WERR_ACCESS_DENIED;
1692 /* Check if the pathname is valid. */
1693 if (!(path = valid_share_pathname(p->mem_ctx, pathname )))
1694 return WERR_OBJECT_PATH_INVALID;
1696 /* Ensure share name, pathname and comment don't contain '"' characters. */
1697 string_replace(share_name, '"', ' ');
1698 string_replace(path, '"', ' ');
1700 string_replace(comment, '"', ' ');
1703 DEBUG(10,("_srvsvc_NetShareSetInfo: change share command = %s\n",
1704 lp_change_share_cmd() ? lp_change_share_cmd() : "NULL" ));
1706 /* Only call modify function if something changed. */
1708 if (strcmp(path, lp_pathname(snum)) || strcmp(comment, lp_comment(snum))
1709 || (lp_max_connections(snum) != max_connections)) {
1710 if (!lp_change_share_cmd() || !*lp_change_share_cmd()) {
1711 DEBUG(10,("_srvsvc_NetShareSetInfo: No change share command\n"));
1712 return WERR_ACCESS_DENIED;
1715 command = talloc_asprintf(p->mem_ctx,
1716 "%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
1717 lp_change_share_cmd(),
1718 get_dyn_CONFIGFILE(),
1721 comment ? comment : "",
1727 DEBUG(10,("_srvsvc_NetShareSetInfo: Running [%s]\n", command ));
1729 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1734 if ( (ret = smbrun(command, NULL)) == 0 ) {
1735 /* Tell everyone we updated smb.conf. */
1736 message_send_all(smbd_messaging_context(),
1737 MSG_SMB_CONF_UPDATED, NULL, 0,
1744 /********* END SeDiskOperatorPrivilege BLOCK *********/
1746 DEBUG(3,("_srvsvc_NetShareSetInfo: Running [%s] returned (%d)\n",
1749 TALLOC_FREE(command);
1752 return WERR_ACCESS_DENIED;
1754 DEBUG(10,("_srvsvc_NetShareSetInfo: No change to share name (%s)\n",
1758 /* Replace SD if changed. */
1763 old_sd = get_share_security(p->mem_ctx, lp_servicename(snum), &sd_size);
1765 if (old_sd && !sec_desc_equal(old_sd, psd)) {
1766 if (!set_share_security(share_name, psd))
1767 DEBUG(0,("_srvsvc_NetShareSetInfo: Failed to change security info in share %s.\n",
1772 DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
1777 /*******************************************************************
1778 Net share add. Call 'add_share_command "sharename" "pathname"
1779 "comment" "max connections = "
1780 ********************************************************************/
1782 WERROR _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_SHARE_ADD *r_u)
1784 struct current_user user;
1785 char *command = NULL;
1786 char *share_name = NULL;
1787 char *comment = NULL;
1788 char *pathname = NULL;
1793 SEC_DESC *psd = NULL;
1794 SE_PRIV se_diskop = SE_DISK_OPERATOR;
1796 int max_connections = 0;
1797 TALLOC_CTX *ctx = p->mem_ctx;
1799 DEBUG(5,("_srv_net_share_add: %d\n", __LINE__));
1801 r_u->parm_error = 0;
1803 get_current_user(&user,p);
1805 is_disk_op = user_has_privileges( p->pipe_user.nt_user_token, &se_diskop );
1807 if (user.ut.uid != sec_initial_uid() && !is_disk_op )
1808 return WERR_ACCESS_DENIED;
1810 if (!lp_add_share_cmd() || !*lp_add_share_cmd()) {
1811 DEBUG(10,("_srv_net_share_add: No add share command\n"));
1812 return WERR_ACCESS_DENIED;
1815 switch (q_u->info_level) {
1817 /* No path. Not enough info in a level 0 to do anything. */
1818 return WERR_ACCESS_DENIED;
1820 /* Not enough info in a level 1 to do anything. */
1821 return WERR_ACCESS_DENIED;
1823 share_name = unistr2_to_ascii_talloc(ctx,
1824 &q_u->info.share.info2.info_2_str.uni_netname);
1825 comment = unistr2_to_ascii_talloc(ctx,
1826 &q_u->info.share.info2.info_2_str.uni_remark);
1827 pathname = unistr2_to_ascii_talloc(ctx,
1828 &q_u->info.share.info2.info_2_str.uni_path);
1829 max_connections = (q_u->info.share.info2.info_2.max_uses == 0xffffffff) ? 0 : q_u->info.share.info2.info_2.max_uses;
1830 type = q_u->info.share.info2.info_2.type;
1833 /* No path. Not enough info in a level 501 to do anything. */
1834 return WERR_ACCESS_DENIED;
1836 share_name = unistr2_to_ascii_talloc(ctx,
1837 &q_u->info.share.info502.info_502_str.uni_netname);
1838 comment = unistr2_to_ascii_talloc(ctx,
1839 &q_u->info.share.info502.info_502_str.uni_remark);
1840 pathname = unistr2_to_ascii_talloc(ctx,
1841 &q_u->info.share.info502.info_502_str.uni_path);
1842 type = q_u->info.share.info502.info_502.type;
1843 psd = q_u->info.share.info502.info_502_str.sd;
1844 map_generic_share_sd_bits(psd);
1847 /* none of the following contain share names. NetShareAdd does not have a separate parameter for the share name */
1853 return WERR_ACCESS_DENIED;
1855 /* DFS only level. */
1856 return WERR_ACCESS_DENIED;
1858 DEBUG(5,("_srv_net_share_add: unsupported switch value %d\n", q_u->info_level));
1859 return WERR_UNKNOWN_LEVEL;
1862 /* check for invalid share names */
1864 if (!share_name || !validate_net_name(share_name,
1865 INVALID_SHARENAME_CHARS,
1866 strlen(share_name))) {
1867 DEBUG(5,("_srv_net_name_validate: Bad sharename \"%s\"\n",
1868 share_name ? share_name : ""));
1869 return WERR_INVALID_NAME;
1872 if (strequal(share_name,"IPC$") || strequal(share_name,"global")
1873 || (lp_enable_asu_support() &&
1874 strequal(share_name,"ADMIN$"))) {
1875 return WERR_ACCESS_DENIED;
1878 snum = find_service(share_name);
1880 /* Share already exists. */
1882 return WERR_ALREADY_EXISTS;
1885 /* We can only add disk shares. */
1886 if (type != STYPE_DISKTREE) {
1887 return WERR_ACCESS_DENIED;
1890 /* Check if the pathname is valid. */
1891 if (!(path = valid_share_pathname(p->mem_ctx, pathname))) {
1892 return WERR_OBJECT_PATH_INVALID;
1895 /* Ensure share name, pathname and comment don't contain '"' characters. */
1896 string_replace(share_name, '"', ' ');
1897 string_replace(path, '"', ' ');
1899 string_replace(comment, '"', ' ');
1902 command = talloc_asprintf(ctx,
1903 "%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
1905 get_dyn_CONFIGFILE(),
1908 comment ? comment : "",
1914 DEBUG(10,("_srv_net_share_add: Running [%s]\n", command ));
1916 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1921 if ( (ret = smbrun(command, NULL)) == 0 ) {
1922 /* Tell everyone we updated smb.conf. */
1923 message_send_all(smbd_messaging_context(),
1924 MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
1930 /********* END SeDiskOperatorPrivilege BLOCK *********/
1932 DEBUG(3,("_srv_net_share_add: Running [%s] returned (%d)\n", command, ret ));
1934 TALLOC_FREE(command);
1937 return WERR_ACCESS_DENIED;
1940 if (!set_share_security(share_name, psd)) {
1941 DEBUG(0,("_srv_net_share_add: Failed to add security info to share %s.\n", share_name ));
1946 * We don't call reload_services() here, the message will
1947 * cause this to be done before the next packet is read
1948 * from the client. JRA.
1951 DEBUG(5,("_srv_net_share_add: %d\n", __LINE__));
1956 /*******************************************************************
1957 Net share delete. Call "delete share command" with the share name as
1959 ********************************************************************/
1961 WERROR _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_SHARE_DEL *r_u)
1963 struct current_user user;
1964 char *command = NULL;
1965 char *share_name = NULL;
1968 SE_PRIV se_diskop = SE_DISK_OPERATOR;
1970 struct share_params *params;
1971 TALLOC_CTX *ctx = p->mem_ctx;
1973 DEBUG(5,("_srv_net_share_del: %d\n", __LINE__));
1975 share_name = unistr2_to_ascii_talloc(ctx, &q_u->uni_share_name);
1978 return WERR_NET_NAME_NOT_FOUND;
1980 if ( strequal(share_name,"IPC$")
1981 || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") )
1982 || strequal(share_name,"global") )
1984 return WERR_ACCESS_DENIED;
1987 if (!(params = get_share_params(p->mem_ctx, share_name))) {
1988 return WERR_NO_SUCH_SHARE;
1991 snum = find_service(share_name);
1993 /* No change to printer shares. */
1994 if (lp_print_ok(snum))
1995 return WERR_ACCESS_DENIED;
1997 get_current_user(&user,p);
1999 is_disk_op = user_has_privileges( p->pipe_user.nt_user_token, &se_diskop );
2001 if (user.ut.uid != sec_initial_uid() && !is_disk_op )
2002 return WERR_ACCESS_DENIED;
2004 if (!lp_delete_share_cmd() || !*lp_delete_share_cmd()) {
2005 DEBUG(10,("_srv_net_share_del: No delete share command\n"));
2006 return WERR_ACCESS_DENIED;
2009 command = talloc_asprintf(ctx,
2011 lp_delete_share_cmd(),
2012 get_dyn_CONFIGFILE(),
2013 lp_servicename(snum));
2018 DEBUG(10,("_srv_net_share_del: Running [%s]\n", command ));
2020 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
2025 if ( (ret = smbrun(command, NULL)) == 0 ) {
2026 /* Tell everyone we updated smb.conf. */
2027 message_send_all(smbd_messaging_context(),
2028 MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
2034 /********* END SeDiskOperatorPrivilege BLOCK *********/
2036 DEBUG(3,("_srv_net_share_del: Running [%s] returned (%d)\n", command, ret ));
2039 return WERR_ACCESS_DENIED;
2041 /* Delete the SD in the database. */
2042 delete_share_security(lp_servicename(params->service));
2044 lp_killservice(params->service);
2049 WERROR _srv_net_share_del_sticky(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_SHARE_DEL *r_u)
2051 DEBUG(5,("_srv_net_share_del_stick: %d\n", __LINE__));
2053 return _srv_net_share_del(p, q_u, r_u);
2056 /*******************************************************************
2057 _srvsvc_NetRemoteTOD
2058 ********************************************************************/
2060 WERROR _srvsvc_NetRemoteTOD(pipes_struct *p,
2061 struct srvsvc_NetRemoteTOD *r)
2063 struct srvsvc_NetRemoteTODInfo *tod;
2065 time_t unixdate = time(NULL);
2067 /* We do this call first as if we do it *after* the gmtime call
2068 it overwrites the pointed-to values. JRA */
2070 uint32 zone = get_time_zone(unixdate)/60;
2072 DEBUG(5,("_srvsvc_NetRemoteTOD: %d\n", __LINE__));
2074 if ( !(tod = TALLOC_ZERO_P(p->mem_ctx, struct srvsvc_NetRemoteTODInfo)) )
2079 DEBUG(5,("_srvsvc_NetRemoteTOD: %d\n", __LINE__));
2081 t = gmtime(&unixdate);
2084 init_srvsvc_NetRemoteTODInfo(tod,
2098 DEBUG(5,("_srvsvc_NetRemoteTOD: %d\n", __LINE__));
2103 /***********************************************************************************
2104 Win9x NT tools get security descriptor.
2105 ***********************************************************************************/
2107 WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC *q_u,
2108 SRV_R_NET_FILE_QUERY_SECDESC *r_u)
2110 SEC_DESC *psd = NULL;
2113 char *filename_in = NULL;
2114 char *filename = NULL;
2115 char *qualname = NULL;
2118 struct current_user user;
2119 connection_struct *conn = NULL;
2120 bool became_user = False;
2121 TALLOC_CTX *ctx = p->mem_ctx;
2125 r_u->status = WERR_OK;
2127 qualname = unistr2_to_ascii_talloc(ctx, &q_u->uni_qual_name);
2129 r_u->status = WERR_ACCESS_DENIED;
2133 /* Null password is ok - we are already an authenticated user... */
2134 null_pw = data_blob_null;
2136 get_current_user(&user, p);
2139 conn = make_connection(qualname, null_pw, "A:", user.vuid, &nt_status);
2143 DEBUG(3,("_srv_net_file_query_secdesc: Unable to connect to %s\n", qualname));
2144 r_u->status = ntstatus_to_werror(nt_status);
2148 if (!become_user(conn, conn->vuid)) {
2149 DEBUG(0,("_srv_net_file_query_secdesc: Can't become connected user!\n"));
2150 r_u->status = WERR_ACCESS_DENIED;
2155 filename_in = unistr2_to_ascii_talloc(ctx, &q_u->uni_file_name);
2157 r_u->status = WERR_ACCESS_DENIED;
2161 nt_status = unix_convert(ctx, conn, filename_in, False, &filename, NULL, &st);
2162 if (!NT_STATUS_IS_OK(nt_status)) {
2163 DEBUG(3,("_srv_net_file_query_secdesc: bad pathname %s\n", filename));
2164 r_u->status = WERR_ACCESS_DENIED;
2168 nt_status = check_name(conn, filename);
2169 if (!NT_STATUS_IS_OK(nt_status)) {
2170 DEBUG(3,("_srv_net_file_query_secdesc: can't access %s\n", filename));
2171 r_u->status = WERR_ACCESS_DENIED;
2175 nt_status = SMB_VFS_GET_NT_ACL(conn, filename,
2176 (OWNER_SECURITY_INFORMATION
2177 |GROUP_SECURITY_INFORMATION
2178 |DACL_SECURITY_INFORMATION), &psd);
2180 if (!NT_STATUS_IS_OK(nt_status)) {
2181 DEBUG(3,("_srv_net_file_query_secdesc: Unable to get NT ACL for file %s\n", filename));
2182 r_u->status = ntstatus_to_werror(nt_status);
2186 sd_size = ndr_size_security_descriptor(psd, 0);
2188 r_u->ptr_response = 1;
2189 r_u->size_response = sd_size;
2190 r_u->ptr_secdesc = 1;
2191 r_u->size_secdesc = sd_size;
2192 r_u->sec_desc = psd;
2194 psd->dacl->revision = NT4_ACL_REVISION;
2197 close_cnum(conn, user.vuid);
2206 close_cnum(conn, user.vuid);
2211 /***********************************************************************************
2212 Win9x NT tools set security descriptor.
2213 ***********************************************************************************/
2215 WERROR _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *q_u,
2216 SRV_R_NET_FILE_SET_SECDESC *r_u)
2218 char *filename_in = NULL;
2219 char *filename = NULL;
2220 char *qualname = NULL;
2222 files_struct *fsp = NULL;
2225 struct current_user user;
2226 connection_struct *conn = NULL;
2227 bool became_user = False;
2228 TALLOC_CTX *ctx = p->mem_ctx;
2232 r_u->status = WERR_OK;
2234 qualname = unistr2_to_ascii_talloc(ctx, &q_u->uni_qual_name);
2236 r_u->status = WERR_ACCESS_DENIED;
2240 /* Null password is ok - we are already an authenticated user... */
2241 null_pw = data_blob_null;
2243 get_current_user(&user, p);
2246 conn = make_connection(qualname, null_pw, "A:", user.vuid, &nt_status);
2250 DEBUG(3,("_srv_net_file_set_secdesc: Unable to connect to %s\n", qualname));
2251 r_u->status = ntstatus_to_werror(nt_status);
2255 if (!become_user(conn, conn->vuid)) {
2256 DEBUG(0,("_srv_net_file_set_secdesc: Can't become connected user!\n"));
2257 r_u->status = WERR_ACCESS_DENIED;
2262 filename_in= unistr2_to_ascii_talloc(ctx, &q_u->uni_file_name);
2264 r_u->status = WERR_ACCESS_DENIED;
2268 nt_status = unix_convert(ctx, conn, filename, False, &filename, NULL, &st);
2269 if (!NT_STATUS_IS_OK(nt_status)) {
2270 DEBUG(3,("_srv_net_file_set_secdesc: bad pathname %s\n", filename));
2271 r_u->status = WERR_ACCESS_DENIED;
2275 nt_status = check_name(conn, filename);
2276 if (!NT_STATUS_IS_OK(nt_status)) {
2277 DEBUG(3,("_srv_net_file_set_secdesc: can't access %s\n", filename));
2278 r_u->status = WERR_ACCESS_DENIED;
2282 nt_status = open_file_stat(conn, NULL, filename, &st, &fsp);
2284 if ( !NT_STATUS_IS_OK(nt_status) ) {
2285 /* Perhaps it is a directory */
2286 if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_IS_A_DIRECTORY))
2287 nt_status = open_directory(conn, NULL, filename, &st,
2288 FILE_READ_ATTRIBUTES,
2289 FILE_SHARE_READ|FILE_SHARE_WRITE,
2292 FILE_ATTRIBUTE_DIRECTORY,
2295 if ( !NT_STATUS_IS_OK(nt_status) ) {
2296 DEBUG(3,("_srv_net_file_set_secdesc: Unable to open file %s\n", filename));
2297 r_u->status = ntstatus_to_werror(nt_status);
2302 nt_status = SMB_VFS_SET_NT_ACL(fsp, fsp->fsp_name, q_u->sec_info, q_u->sec_desc);
2304 if (!NT_STATUS_IS_OK(nt_status) ) {
2305 DEBUG(3,("_srv_net_file_set_secdesc: Unable to set NT ACL on file %s\n", filename));
2306 r_u->status = WERR_ACCESS_DENIED;
2310 close_file(fsp, NORMAL_CLOSE);
2312 close_cnum(conn, user.vuid);
2318 close_file(fsp, NORMAL_CLOSE);
2326 close_cnum(conn, user.vuid);
2332 /***********************************************************************************
2333 It may be that we want to limit users to creating shares on certain areas of the UNIX file area.
2334 We could define areas by mapping Windows style disks to points on the UNIX directory hierarchy.
2335 These disks would the disks listed by this function.
2336 Users could then create shares relative to these disks. Watch out for moving these disks around.
2337 "Nigel Williams" <nigel@veritas.com>.
2338 ***********************************************************************************/
2340 static const char *server_disks[] = {"C:"};
2342 static uint32 get_server_disk_count(void)
2344 return sizeof(server_disks)/sizeof(server_disks[0]);
2347 static uint32 init_server_disk_enum(uint32 *resume)
2349 uint32 server_disk_count = get_server_disk_count();
2351 /*resume can be an offset into the list for now*/
2353 if(*resume & 0x80000000)
2356 if(*resume > server_disk_count)
2357 *resume = server_disk_count;
2359 return server_disk_count - *resume;
2362 static const char *next_server_disk_enum(uint32 *resume)
2366 if(init_server_disk_enum(resume) == 0)
2369 disk = server_disks[*resume];
2373 DEBUG(10, ("next_server_disk_enum: reporting disk %s. resume handle %d.\n", disk, *resume));
2378 WERROR _srv_net_disk_enum(pipes_struct *p, SRV_Q_NET_DISK_ENUM *q_u, SRV_R_NET_DISK_ENUM *r_u)
2381 const char *disk_name;
2382 TALLOC_CTX *ctx = p->mem_ctx;
2383 uint32 resume=get_enum_hnd(&q_u->enum_hnd);
2385 r_u->status=WERR_OK;
2387 r_u->total_entries = init_server_disk_enum(&resume);
2389 r_u->disk_enum_ctr.unknown = 0;
2391 if(!(r_u->disk_enum_ctr.disk_info = TALLOC_ARRAY(ctx, DISK_INFO, MAX_SERVER_DISK_ENTRIES))) {
2395 r_u->disk_enum_ctr.disk_info_ptr = r_u->disk_enum_ctr.disk_info ? 1 : 0;
2397 /*allow one DISK_INFO for null terminator*/
2399 for(i = 0; i < MAX_SERVER_DISK_ENTRIES -1 && (disk_name = next_server_disk_enum(&resume)); i++) {
2401 r_u->disk_enum_ctr.entries_read++;
2403 /*copy disk name into a unicode string*/
2405 init_unistr3(&r_u->disk_enum_ctr.disk_info[i].disk_name, disk_name);
2408 /* add a terminating null string. Is this there if there is more data to come? */
2410 r_u->disk_enum_ctr.entries_read++;
2412 init_unistr3(&r_u->disk_enum_ctr.disk_info[i].disk_name, "");
2414 init_enum_hnd(&r_u->enum_hnd, resume);
2419 /********************************************************************
2420 ********************************************************************/
2422 WERROR _srv_net_name_validate(pipes_struct *p, SRV_Q_NET_NAME_VALIDATE *q_u, SRV_R_NET_NAME_VALIDATE *r_u)
2426 switch ( q_u->type ) {
2428 rpcstr_pull(sharename, q_u->sharename.buffer, sizeof(sharename), q_u->sharename.uni_str_len*2, 0);
2429 if ( !validate_net_name( sharename, INVALID_SHARENAME_CHARS, sizeof(sharename) ) ) {
2430 DEBUG(5,("_srv_net_name_validate: Bad sharename \"%s\"\n", sharename));
2431 return WERR_INVALID_NAME;
2436 return WERR_UNKNOWN_LEVEL;
2443 /********************************************************************
2444 ********************************************************************/
2446 WERROR _srvsvc_NetFileClose(pipes_struct *p, struct srvsvc_NetFileClose *r)
2448 return WERR_ACCESS_DENIED;
2452 /********************************************************************
2453 ********************************************************************/
2455 WERROR _srvsvc_NetCharDevEnum(pipes_struct *p, struct srvsvc_NetCharDevEnum *r)
2457 p->rng_fault_state = True;
2458 return WERR_NOT_SUPPORTED;
2461 WERROR _srvsvc_NetCharDevGetInfo(pipes_struct *p, struct srvsvc_NetCharDevGetInfo *r)
2463 p->rng_fault_state = True;
2464 return WERR_NOT_SUPPORTED;
2467 WERROR _srvsvc_NetCharDevControl(pipes_struct *p, struct srvsvc_NetCharDevControl *r)
2469 p->rng_fault_state = True;
2470 return WERR_NOT_SUPPORTED;
2473 WERROR _srvsvc_NetCharDevQEnum(pipes_struct *p, struct srvsvc_NetCharDevQEnum *r)
2475 p->rng_fault_state = True;
2476 return WERR_NOT_SUPPORTED;
2479 WERROR _srvsvc_NetCharDevQGetInfo(pipes_struct *p, struct srvsvc_NetCharDevQGetInfo *r)
2481 p->rng_fault_state = True;
2482 return WERR_NOT_SUPPORTED;
2485 WERROR _srvsvc_NetCharDevQSetInfo(pipes_struct *p, struct srvsvc_NetCharDevQSetInfo *r)
2487 p->rng_fault_state = True;
2488 return WERR_NOT_SUPPORTED;
2491 WERROR _srvsvc_NetCharDevQPurge(pipes_struct *p, struct srvsvc_NetCharDevQPurge *r)
2493 p->rng_fault_state = True;
2494 return WERR_NOT_SUPPORTED;
2497 WERROR _srvsvc_NetCharDevQPurgeSelf(pipes_struct *p, struct srvsvc_NetCharDevQPurgeSelf *r)
2499 p->rng_fault_state = True;
2500 return WERR_NOT_SUPPORTED;
2503 WERROR _srvsvc_NetConnEnum(pipes_struct *p, struct srvsvc_NetConnEnum *r)
2505 p->rng_fault_state = True;
2506 return WERR_NOT_SUPPORTED;
2509 WERROR _srvsvc_NetFileEnum(pipes_struct *p, struct srvsvc_NetFileEnum *r)
2511 p->rng_fault_state = True;
2512 return WERR_NOT_SUPPORTED;
2515 WERROR _srvsvc_NetFileGetInfo(pipes_struct *p, struct srvsvc_NetFileGetInfo *r)
2517 p->rng_fault_state = True;
2518 return WERR_NOT_SUPPORTED;
2521 WERROR _srvsvc_NetSessEnum(pipes_struct *p, struct srvsvc_NetSessEnum *r)
2523 p->rng_fault_state = True;
2524 return WERR_NOT_SUPPORTED;
2527 WERROR _srvsvc_NetSessDel(pipes_struct *p, struct srvsvc_NetSessDel *r)
2529 p->rng_fault_state = True;
2530 return WERR_NOT_SUPPORTED;
2533 WERROR _srvsvc_NetShareAdd(pipes_struct *p, struct srvsvc_NetShareAdd *r)
2535 p->rng_fault_state = True;
2536 return WERR_NOT_SUPPORTED;
2539 WERROR _srvsvc_NetShareEnumAll(pipes_struct *p, struct srvsvc_NetShareEnumAll *r)
2541 p->rng_fault_state = True;
2542 return WERR_NOT_SUPPORTED;
2545 WERROR _srvsvc_NetShareGetInfo(pipes_struct *p, struct srvsvc_NetShareGetInfo *r)
2547 p->rng_fault_state = True;
2548 return WERR_NOT_SUPPORTED;
2551 WERROR _srvsvc_NetShareDel(pipes_struct *p, struct srvsvc_NetShareDel *r)
2553 p->rng_fault_state = True;
2554 return WERR_NOT_SUPPORTED;
2557 WERROR _srvsvc_NetShareDelSticky(pipes_struct *p, struct srvsvc_NetShareDelSticky *r)
2559 p->rng_fault_state = True;
2560 return WERR_NOT_SUPPORTED;
2563 WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r)
2565 p->rng_fault_state = True;
2566 return WERR_NOT_SUPPORTED;
2569 WERROR _srvsvc_NetDiskEnum(pipes_struct *p, struct srvsvc_NetDiskEnum *r)
2571 p->rng_fault_state = True;
2572 return WERR_NOT_SUPPORTED;
2575 WERROR _srvsvc_NetServerStatisticsGet(pipes_struct *p, struct srvsvc_NetServerStatisticsGet *r)
2577 p->rng_fault_state = True;
2578 return WERR_NOT_SUPPORTED;
2581 WERROR _srvsvc_NetTransportAdd(pipes_struct *p, struct srvsvc_NetTransportAdd *r)
2583 p->rng_fault_state = True;
2584 return WERR_NOT_SUPPORTED;
2587 WERROR _srvsvc_NetTransportEnum(pipes_struct *p, struct srvsvc_NetTransportEnum *r)
2589 p->rng_fault_state = True;
2590 return WERR_NOT_SUPPORTED;
2593 WERROR _srvsvc_NetTransportDel(pipes_struct *p, struct srvsvc_NetTransportDel *r)
2595 p->rng_fault_state = True;
2596 return WERR_NOT_SUPPORTED;
2599 WERROR _srvsvc_NetSetServiceBits(pipes_struct *p, struct srvsvc_NetSetServiceBits *r)
2601 p->rng_fault_state = True;
2602 return WERR_NOT_SUPPORTED;
2605 WERROR _srvsvc_NetPathType(pipes_struct *p, struct srvsvc_NetPathType *r)
2607 p->rng_fault_state = True;
2608 return WERR_NOT_SUPPORTED;
2611 WERROR _srvsvc_NetPathCanonicalize(pipes_struct *p, struct srvsvc_NetPathCanonicalize *r)
2613 p->rng_fault_state = True;
2614 return WERR_NOT_SUPPORTED;
2617 WERROR _srvsvc_NetPathCompare(pipes_struct *p, struct srvsvc_NetPathCompare *r)
2619 p->rng_fault_state = True;
2620 return WERR_NOT_SUPPORTED;
2623 WERROR _srvsvc_NetNameValidate(pipes_struct *p, struct srvsvc_NetNameValidate *r)
2625 p->rng_fault_state = True;
2626 return WERR_NOT_SUPPORTED;
2629 WERROR _srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p, struct srvsvc_NETRPRNAMECANONICALIZE *r)
2631 p->rng_fault_state = True;
2632 return WERR_NOT_SUPPORTED;
2635 WERROR _srvsvc_NetPRNameCompare(pipes_struct *p, struct srvsvc_NetPRNameCompare *r)
2637 p->rng_fault_state = True;
2638 return WERR_NOT_SUPPORTED;
2641 WERROR _srvsvc_NetShareEnum(pipes_struct *p, struct srvsvc_NetShareEnum *r)
2643 p->rng_fault_state = True;
2644 return WERR_NOT_SUPPORTED;
2647 WERROR _srvsvc_NetShareDelStart(pipes_struct *p, struct srvsvc_NetShareDelStart *r)
2649 p->rng_fault_state = True;
2650 return WERR_NOT_SUPPORTED;
2653 WERROR _srvsvc_NetShareDelCommit(pipes_struct *p, struct srvsvc_NetShareDelCommit *r)
2655 p->rng_fault_state = True;
2656 return WERR_NOT_SUPPORTED;
2659 WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, struct srvsvc_NetGetFileSecurity *r)
2661 p->rng_fault_state = True;
2662 return WERR_NOT_SUPPORTED;
2665 WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, struct srvsvc_NetSetFileSecurity *r)
2667 p->rng_fault_state = True;
2668 return WERR_NOT_SUPPORTED;
2671 WERROR _srvsvc_NetServerTransportAddEx(pipes_struct *p, struct srvsvc_NetServerTransportAddEx *r)
2673 p->rng_fault_state = True;
2674 return WERR_NOT_SUPPORTED;
2677 WERROR _srvsvc_NetServerSetServiceBitsEx(pipes_struct *p, struct srvsvc_NetServerSetServiceBitsEx *r)
2679 p->rng_fault_state = True;
2680 return WERR_NOT_SUPPORTED;
2683 WERROR _srvsvc_NETRDFSGETVERSION(pipes_struct *p, struct srvsvc_NETRDFSGETVERSION *r)
2685 p->rng_fault_state = True;
2686 return WERR_NOT_SUPPORTED;
2689 WERROR _srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSCREATELOCALPARTITION *r)
2691 p->rng_fault_state = True;
2692 return WERR_NOT_SUPPORTED;
2695 WERROR _srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSDELETELOCALPARTITION *r)
2697 p->rng_fault_state = True;
2698 return WERR_NOT_SUPPORTED;
2701 WERROR _srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r)
2703 p->rng_fault_state = True;
2704 return WERR_NOT_SUPPORTED;
2707 WERROR _srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p, struct srvsvc_NETRDFSSETSERVERINFO *r)
2709 p->rng_fault_state = True;
2710 return WERR_NOT_SUPPORTED;
2713 WERROR _srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSCREATEEXITPOINT *r)
2715 p->rng_fault_state = True;
2716 return WERR_NOT_SUPPORTED;
2719 WERROR _srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSDELETEEXITPOINT *r)
2721 p->rng_fault_state = True;
2722 return WERR_NOT_SUPPORTED;
2725 WERROR _srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p, struct srvsvc_NETRDFSMODIFYPREFIX *r)
2727 p->rng_fault_state = True;
2728 return WERR_NOT_SUPPORTED;
2731 WERROR _srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p, struct srvsvc_NETRDFSFIXLOCALVOLUME *r)
2733 p->rng_fault_state = True;
2734 return WERR_NOT_SUPPORTED;
2737 WERROR _srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r)
2739 p->rng_fault_state = True;
2740 return WERR_NOT_SUPPORTED;
2743 WERROR _srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p, struct srvsvc_NETRSERVERTRANSPORTDELEX *r)
2745 p->rng_fault_state = True;
2746 return WERR_NOT_SUPPORTED;