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
;
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 snprintf( fullpath
, sizeof(fullpath
), "\\PIPE\\%s", prec
.name
);
78 f
= TALLOC_REALLOC_ARRAY( fenum
->ctx
, fenum
->info
, FILE_INFO_3
, i
+1 );
80 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i
+1));
87 (uint32
)((procid_to_pid(&prec
.pid
)<<16) & prec
.pnum
),
88 (FILE_READ_DATA
|FILE_WRITE_DATA
),
89 0, username
, fullpath
);
96 /*******************************************************************
97 ********************************************************************/
99 static WERROR
net_enum_pipes( TALLOC_CTX
*ctx
, const char *username
,
101 uint32
*count
, uint32 resume
)
103 struct file_enum_count fenum
;
106 fenum
.username
= username
;
107 fenum
.count
= *count
;
110 if (connections_traverse(pipe_enum_fn
, &fenum
) == -1) {
111 DEBUG(0,("net_enum_pipes: traverse of connections.tdb "
117 *count
= fenum
.count
;
122 /*******************************************************************
123 ********************************************************************/
125 static void enum_file_fn( const struct share_mode_entry
*e
,
126 const char *sharepath
, const char *fname
,
129 struct file_enum_count
*fenum
=
130 (struct file_enum_count
*)private_data
;
133 int i
= fenum
->count
;
135 struct byte_range_lock
*brl
;
139 const char *username
;
141 /* If the pid was not found delete the entry from connections.tdb */
143 if ( !process_exists(e
->pid
) ) {
147 username
= uidtoname(e
->uid
);
149 if ((fenum
->username
!= NULL
)
150 && !strequal(username
, fenum
->username
)) {
154 f
= TALLOC_REALLOC_ARRAY( fenum
->ctx
, fenum
->info
, FILE_INFO_3
, i
+1 );
156 DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i
+1));
161 /* need to count the number of locks on a file */
166 if ( (brl
= brl_get_locks(NULL
,&fsp
)) != NULL
) {
167 num_locks
= brl
->num_locks
;
171 if ( strcmp( fname
, "." ) == 0 ) {
172 pstr_sprintf( fullpath
, "C:%s", sharepath
);
174 pstr_sprintf( fullpath
, "C:%s/%s", sharepath
, fname
);
176 string_replace( fullpath
, '/', '\\' );
178 /* mask out create (what ever that is) */
179 permissions
= e
->share_access
& (FILE_READ_DATA
|FILE_WRITE_DATA
);
181 /* now fill in the FILE_INFO_3 struct */
182 init_srv_file_info3( &fenum
->info
[i
],
192 /*******************************************************************
193 ********************************************************************/
195 static WERROR
net_enum_files( TALLOC_CTX
*ctx
, const char *username
,
197 uint32
*count
, uint32 resume
)
199 struct file_enum_count f_enum_cnt
;
201 f_enum_cnt
.ctx
= ctx
;
202 f_enum_cnt
.username
= username
;
203 f_enum_cnt
.count
= *count
;
204 f_enum_cnt
.info
= *info
;
206 share_mode_forall( enum_file_fn
, (void *)&f_enum_cnt
);
208 *info
= f_enum_cnt
.info
;
209 *count
= f_enum_cnt
.count
;
214 /*******************************************************************
215 Utility function to get the 'type' of a share from an snum.
216 ********************************************************************/
217 static uint32
get_share_type(int snum
)
219 char *net_name
= lp_servicename(snum
);
220 int len_net_name
= strlen(net_name
);
222 /* work out the share type */
223 uint32 type
= STYPE_DISKTREE
;
225 if (lp_print_ok(snum
))
227 if (strequal(lp_fstype(snum
), "IPC"))
229 if (net_name
[len_net_name
-1] == '$')
230 type
|= STYPE_HIDDEN
;
235 /*******************************************************************
236 Fill in a share info level 0 structure.
237 ********************************************************************/
239 static void init_srv_share_info_0(pipes_struct
*p
, SRV_SHARE_INFO_0
*sh0
, int snum
)
243 pstrcpy(net_name
, lp_servicename(snum
));
245 init_srv_share_info0(&sh0
->info_0
, net_name
);
246 init_srv_share_info0_str(&sh0
->info_0_str
, net_name
);
249 /*******************************************************************
250 Fill in a share info level 1 structure.
251 ********************************************************************/
253 static void init_srv_share_info_1(pipes_struct
*p
, SRV_SHARE_INFO_1
*sh1
, int snum
)
257 char *net_name
= lp_servicename(snum
);
258 pstrcpy(remark
, lp_comment(snum
));
259 standard_sub_conn(p
->conn
, remark
,sizeof(remark
));
261 init_srv_share_info1(&sh1
->info_1
, net_name
, get_share_type(snum
), remark
);
262 init_srv_share_info1_str(&sh1
->info_1_str
, net_name
, remark
);
265 /*******************************************************************
266 Fill in a share info level 2 structure.
267 ********************************************************************/
269 static void init_srv_share_info_2(pipes_struct
*p
, SRV_SHARE_INFO_2
*sh2
, int snum
)
274 int max_connections
= lp_max_connections(snum
);
275 uint32 max_uses
= max_connections
!=0 ? max_connections
: 0xffffffff;
277 char *net_name
= lp_servicename(snum
);
279 pstrcpy(remark
, lp_comment(snum
));
280 standard_sub_conn(p
->conn
, remark
,sizeof(remark
));
282 pstrcat(path
, lp_pathname(snum
));
285 * Change / to \\ so that win2k will see it as a valid path. This was added to
286 * enable use of browsing in win2k add share dialog.
289 string_replace(path
, '/', '\\');
293 count
= count_current_connections( net_name
, False
);
294 init_srv_share_info2(&sh2
->info_2
, net_name
, get_share_type(snum
),
295 remark
, 0, max_uses
, count
, path
, passwd
);
297 init_srv_share_info2_str(&sh2
->info_2_str
, net_name
, remark
, path
, passwd
);
300 /*******************************************************************
301 Map any generic bits to file specific bits.
302 ********************************************************************/
304 static void map_generic_share_sd_bits(SEC_DESC
*psd
)
307 SEC_ACL
*ps_dacl
= NULL
;
316 for (i
= 0; i
< ps_dacl
->num_aces
; i
++) {
317 SEC_ACE
*psa
= &ps_dacl
->aces
[i
];
318 uint32 orig_mask
= psa
->access_mask
;
320 se_map_generic(&psa
->access_mask
, &file_generic_mapping
);
321 psa
->access_mask
|= orig_mask
;
325 /*******************************************************************
326 Fill in a share info level 501 structure.
327 ********************************************************************/
329 static void init_srv_share_info_501(pipes_struct
*p
, SRV_SHARE_INFO_501
*sh501
, int snum
)
333 const char *net_name
= lp_servicename(snum
);
334 pstrcpy(remark
, lp_comment(snum
));
335 standard_sub_conn(p
->conn
, remark
, sizeof(remark
));
337 init_srv_share_info501(&sh501
->info_501
, net_name
, get_share_type(snum
), remark
, (lp_csc_policy(snum
) << 4));
338 init_srv_share_info501_str(&sh501
->info_501_str
, net_name
, remark
);
341 /*******************************************************************
342 Fill in a share info level 502 structure.
343 ********************************************************************/
345 static void init_srv_share_info_502(pipes_struct
*p
, SRV_SHARE_INFO_502
*sh502
, int snum
)
353 TALLOC_CTX
*ctx
= p
->mem_ctx
;
358 pstrcpy(net_name
, lp_servicename(snum
));
359 pstrcpy(remark
, lp_comment(snum
));
360 standard_sub_conn(p
->conn
, remark
,sizeof(remark
));
362 pstrcat(path
, lp_pathname(snum
));
365 * Change / to \\ so that win2k will see it as a valid path. This was added to
366 * enable use of browsing in win2k add share dialog.
369 string_replace(path
, '/', '\\');
373 sd
= get_share_security(ctx
, lp_servicename(snum
), &sd_size
);
375 init_srv_share_info502(&sh502
->info_502
, net_name
, get_share_type(snum
), remark
, 0, 0xffffffff, 1, path
, passwd
, sd
, sd_size
);
376 init_srv_share_info502_str(&sh502
->info_502_str
, net_name
, remark
, path
, passwd
, sd
, sd_size
);
379 /***************************************************************************
380 Fill in a share info level 1004 structure.
381 ***************************************************************************/
383 static void init_srv_share_info_1004(pipes_struct
*p
, SRV_SHARE_INFO_1004
* sh1004
, int snum
)
387 pstrcpy(remark
, lp_comment(snum
));
388 standard_sub_conn(p
->conn
, remark
, sizeof(remark
));
390 ZERO_STRUCTP(sh1004
);
392 init_srv_share_info1004(&sh1004
->info_1004
, remark
);
393 init_srv_share_info1004_str(&sh1004
->info_1004_str
, remark
);
396 /***************************************************************************
397 Fill in a share info level 1005 structure.
398 ***************************************************************************/
400 static void init_srv_share_info_1005(pipes_struct
*p
, SRV_SHARE_INFO_1005
* sh1005
, int snum
)
402 sh1005
->share_info_flags
= 0;
404 if(lp_host_msdfs() && lp_msdfs_root(snum
))
405 sh1005
->share_info_flags
|=
406 SHARE_1005_IN_DFS
| SHARE_1005_DFS_ROOT
;
407 sh1005
->share_info_flags
|=
408 lp_csc_policy(snum
) << SHARE_1005_CSC_POLICY_SHIFT
;
410 /***************************************************************************
411 Fill in a share info level 1006 structure.
412 ***************************************************************************/
414 static void init_srv_share_info_1006(pipes_struct
*p
, SRV_SHARE_INFO_1006
* sh1006
, int snum
)
416 sh1006
->max_uses
= -1;
419 /***************************************************************************
420 Fill in a share info level 1007 structure.
421 ***************************************************************************/
423 static void init_srv_share_info_1007(pipes_struct
*p
, SRV_SHARE_INFO_1007
* sh1007
, int snum
)
425 pstring alternate_directory_name
= "";
428 ZERO_STRUCTP(sh1007
);
430 init_srv_share_info1007(&sh1007
->info_1007
, flags
, alternate_directory_name
);
431 init_srv_share_info1007_str(&sh1007
->info_1007_str
, alternate_directory_name
);
434 /*******************************************************************
435 Fill in a share info level 1501 structure.
436 ********************************************************************/
438 static void init_srv_share_info_1501(pipes_struct
*p
, SRV_SHARE_INFO_1501
*sh1501
, int snum
)
442 TALLOC_CTX
*ctx
= p
->mem_ctx
;
444 ZERO_STRUCTP(sh1501
);
446 sd
= get_share_security(ctx
, lp_servicename(snum
), &sd_size
);
448 sh1501
->sdb
= make_sec_desc_buf(p
->mem_ctx
, sd_size
, sd
);
451 /*******************************************************************
452 True if it ends in '$'.
453 ********************************************************************/
455 static bool is_hidden_share(int snum
)
457 const char *net_name
= lp_servicename(snum
);
459 return (net_name
[strlen(net_name
) - 1] == '$') ? True
: False
;
462 /*******************************************************************
463 Fill in a share info structure.
464 ********************************************************************/
466 static bool init_srv_share_info_ctr(pipes_struct
*p
, SRV_SHARE_INFO_CTR
*ctr
,
467 uint32 info_level
, uint32
*resume_hnd
, uint32
*total_entries
, bool all_shares
)
470 int num_services
= 0;
472 TALLOC_CTX
*ctx
= p
->mem_ctx
;
474 DEBUG(5,("init_srv_share_info_ctr\n"));
478 ctr
->info_level
= ctr
->switch_value
= info_level
;
481 /* Ensure all the usershares are loaded. */
483 num_services
= load_usershare_shares();
484 load_registry_shares();
487 /* Count the number of entries. */
488 for (snum
= 0; snum
< num_services
; snum
++) {
489 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) )
493 *total_entries
= num_entries
;
494 ctr
->num_entries2
= ctr
->num_entries
= num_entries
;
495 ctr
->ptr_share_info
= ctr
->ptr_entries
= 1;
500 switch (info_level
) {
503 SRV_SHARE_INFO_0
*info0
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_0
, num_entries
);
510 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
511 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
512 init_srv_share_info_0(p
, &info0
[i
++], snum
);
516 ctr
->share
.info0
= info0
;
523 SRV_SHARE_INFO_1
*info1
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_1
, num_entries
);
530 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
531 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
532 init_srv_share_info_1(p
, &info1
[i
++], snum
);
536 ctr
->share
.info1
= info1
;
542 SRV_SHARE_INFO_2
*info2
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_2
, num_entries
);
549 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
550 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
551 init_srv_share_info_2(p
, &info2
[i
++], snum
);
555 ctr
->share
.info2
= info2
;
561 SRV_SHARE_INFO_501
*info501
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_501
, num_entries
);
568 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
569 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
570 init_srv_share_info_501(p
, &info501
[i
++], snum
);
574 ctr
->share
.info501
= info501
;
580 SRV_SHARE_INFO_502
*info502
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_502
, num_entries
);
587 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
588 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
589 init_srv_share_info_502(p
, &info502
[i
++], snum
);
593 ctr
->share
.info502
= info502
;
597 /* here for completeness but not currently used with enum (1004 - 1501)*/
601 SRV_SHARE_INFO_1004
*info1004
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_1004
, num_entries
);
608 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
609 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
610 init_srv_share_info_1004(p
, &info1004
[i
++], snum
);
614 ctr
->share
.info1004
= info1004
;
620 SRV_SHARE_INFO_1005
*info1005
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_1005
, num_entries
);
627 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
628 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
629 init_srv_share_info_1005(p
, &info1005
[i
++], snum
);
633 ctr
->share
.info1005
= info1005
;
639 SRV_SHARE_INFO_1006
*info1006
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_1006
, num_entries
);
646 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
647 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
648 init_srv_share_info_1006(p
, &info1006
[i
++], snum
);
652 ctr
->share
.info1006
= info1006
;
658 SRV_SHARE_INFO_1007
*info1007
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_1007
, num_entries
);
665 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
666 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
667 init_srv_share_info_1007(p
, &info1007
[i
++], snum
);
671 ctr
->share
.info1007
= info1007
;
677 SRV_SHARE_INFO_1501
*info1501
= TALLOC_ARRAY(ctx
, SRV_SHARE_INFO_1501
, num_entries
);
684 for (snum
= *resume_hnd
; snum
< num_services
; snum
++) {
685 if (lp_browseable(snum
) && lp_snum_ok(snum
) && (all_shares
|| !is_hidden_share(snum
)) ) {
686 init_srv_share_info_1501(p
, &info1501
[i
++], snum
);
690 ctr
->share
.info1501
= info1501
;
694 DEBUG(5,("init_srv_share_info_ctr: unsupported switch value %d\n", info_level
));
701 /*******************************************************************
702 Inits a SRV_R_NET_SHARE_ENUM structure.
703 ********************************************************************/
705 static void init_srv_r_net_share_enum(pipes_struct
*p
, SRV_R_NET_SHARE_ENUM
*r_n
,
706 uint32 info_level
, uint32 resume_hnd
, bool all
)
708 DEBUG(5,("init_srv_r_net_share_enum: %d\n", __LINE__
));
710 if (init_srv_share_info_ctr(p
, &r_n
->ctr
, info_level
,
711 &resume_hnd
, &r_n
->total_entries
, all
)) {
712 r_n
->status
= WERR_OK
;
714 r_n
->status
= WERR_UNKNOWN_LEVEL
;
717 init_enum_hnd(&r_n
->enum_hnd
, resume_hnd
);
720 /*******************************************************************
721 Inits a SRV_R_NET_SHARE_GET_INFO structure.
722 ********************************************************************/
724 static void init_srv_r_net_share_get_info(pipes_struct
*p
, SRV_R_NET_SHARE_GET_INFO
*r_n
,
725 char *share_name
, uint32 info_level
)
727 WERROR status
= WERR_OK
;
730 DEBUG(5,("init_srv_r_net_share_get_info: %d\n", __LINE__
));
732 r_n
->info
.switch_value
= info_level
;
734 snum
= find_service(share_name
);
737 switch (info_level
) {
739 init_srv_share_info_0(p
, &r_n
->info
.share
.info0
, snum
);
742 init_srv_share_info_1(p
, &r_n
->info
.share
.info1
, snum
);
745 init_srv_share_info_2(p
, &r_n
->info
.share
.info2
, snum
);
748 init_srv_share_info_501(p
, &r_n
->info
.share
.info501
, snum
);
751 init_srv_share_info_502(p
, &r_n
->info
.share
.info502
, snum
);
754 /* here for completeness */
756 init_srv_share_info_1004(p
, &r_n
->info
.share
.info1004
, snum
);
759 init_srv_share_info_1005(p
, &r_n
->info
.share
.info1005
, snum
);
762 /* here for completeness 1006 - 1501 */
764 init_srv_share_info_1006(p
, &r_n
->info
.share
.info1006
, snum
);
767 init_srv_share_info_1007(p
, &r_n
->info
.share
.info1007
, snum
);
770 init_srv_share_info_1501(p
, &r_n
->info
.share
.info1501
, snum
);
773 DEBUG(5,("init_srv_net_share_get_info: unsupported switch value %d\n", info_level
));
774 status
= WERR_UNKNOWN_LEVEL
;
778 status
= WERR_INVALID_NAME
;
781 r_n
->info
.ptr_share_ctr
= W_ERROR_IS_OK(status
) ? 1 : 0;
782 r_n
->status
= status
;
785 /*******************************************************************
786 fill in a sess info level 0 structure.
787 ********************************************************************/
789 static void init_srv_sess_info_0(pipes_struct
*p
, SRV_SESS_INFO_0
*ss0
, uint32
*snum
, uint32
*stot
)
791 struct sessionid
*session_list
;
792 uint32 num_entries
= 0;
793 (*stot
) = list_sessions(p
->mem_ctx
, &session_list
);
802 DEBUG(5,("init_srv_sess_0_ss0\n"));
805 for (; (*snum
) < (*stot
) && num_entries
< MAX_SESS_ENTRIES
; (*snum
)++) {
806 init_srv_sess_info0( &ss0
->info_0
[num_entries
], session_list
[(*snum
)].remote_machine
);
810 ss0
->num_entries_read
= num_entries
;
811 ss0
->ptr_sess_info
= num_entries
> 0 ? 1 : 0;
812 ss0
->num_entries_read2
= num_entries
;
814 if ((*snum
) >= (*stot
)) {
819 ss0
->num_entries_read
= 0;
820 ss0
->ptr_sess_info
= 0;
821 ss0
->num_entries_read2
= 0;
825 /*******************************************************************
826 ********************************************************************/
828 /* global needed to make use of the share_mode_forall() callback */
829 static struct sess_file_count s_file_cnt
;
831 static void sess_file_fn( const struct share_mode_entry
*e
,
832 const char *sharepath
, const char *fname
, void *state
)
834 struct sess_file_count
*sess
= &s_file_cnt
;
836 if ( procid_equal(&e
->pid
, &sess
->pid
) && (sess
->uid
== e
->uid
) ) {
843 /*******************************************************************
844 ********************************************************************/
846 static int net_count_files( uid_t uid
, struct server_id pid
)
848 s_file_cnt
.count
= 0;
849 s_file_cnt
.uid
= uid
;
850 s_file_cnt
.pid
= pid
;
852 share_mode_forall( sess_file_fn
, NULL
);
854 return s_file_cnt
.count
;
857 /*******************************************************************
858 fill in a sess info level 1 structure.
859 ********************************************************************/
861 static void init_srv_sess_info_1(pipes_struct
*p
, SRV_SESS_INFO_1
*ss1
, uint32
*snum
, uint32
*stot
)
863 struct sessionid
*session_list
;
864 uint32 num_entries
= 0;
865 time_t now
= time(NULL
);
868 ss1
->num_entries_read
= 0;
869 ss1
->ptr_sess_info
= 0;
870 ss1
->num_entries_read2
= 0;
882 (*stot
) = list_sessions(p
->mem_ctx
, &session_list
);
885 for (; (*snum
) < (*stot
) && num_entries
< MAX_SESS_ENTRIES
; (*snum
)++) {
888 struct passwd
*pw
= sys_getpwnam(session_list
[*snum
].username
);
892 DEBUG(10,("init_srv_sess_info_1: failed to find owner: %s\n",
893 session_list
[*snum
].username
));
897 connect_time
= (uint32
)(now
- session_list
[*snum
].connect_start
);
898 num_files
= net_count_files(pw
->pw_uid
, session_list
[*snum
].pid
);
899 guest
= strequal( session_list
[*snum
].username
, lp_guestaccount() );
901 init_srv_sess_info1( &ss1
->info_1
[num_entries
],
902 session_list
[*snum
].remote_machine
,
903 session_list
[*snum
].username
,
911 ss1
->num_entries_read
= num_entries
;
912 ss1
->ptr_sess_info
= num_entries
> 0 ? 1 : 0;
913 ss1
->num_entries_read2
= num_entries
;
915 if ((*snum
) >= (*stot
)) {
921 /*******************************************************************
922 makes a SRV_R_NET_SESS_ENUM structure.
923 ********************************************************************/
925 static WERROR
init_srv_sess_info_ctr(pipes_struct
*p
, SRV_SESS_INFO_CTR
*ctr
,
926 int switch_value
, uint32
*resume_hnd
, uint32
*total_entries
)
928 WERROR status
= WERR_OK
;
929 DEBUG(5,("init_srv_sess_info_ctr: %d\n", __LINE__
));
931 ctr
->switch_value
= switch_value
;
933 switch (switch_value
) {
935 init_srv_sess_info_0(p
, &(ctr
->sess
.info0
), resume_hnd
, total_entries
);
936 ctr
->ptr_sess_ctr
= 1;
939 init_srv_sess_info_1(p
, &(ctr
->sess
.info1
), resume_hnd
, total_entries
);
940 ctr
->ptr_sess_ctr
= 1;
943 DEBUG(5,("init_srv_sess_info_ctr: unsupported switch value %d\n", switch_value
));
945 (*total_entries
) = 0;
946 ctr
->ptr_sess_ctr
= 0;
947 status
= WERR_UNKNOWN_LEVEL
;
954 /*******************************************************************
955 makes a SRV_R_NET_SESS_ENUM structure.
956 ********************************************************************/
958 static void init_srv_r_net_sess_enum(pipes_struct
*p
, SRV_R_NET_SESS_ENUM
*r_n
,
959 uint32 resume_hnd
, int sess_level
, int switch_value
)
961 DEBUG(5,("init_srv_r_net_sess_enum: %d\n", __LINE__
));
963 r_n
->sess_level
= sess_level
;
965 if (sess_level
== -1)
966 r_n
->status
= WERR_UNKNOWN_LEVEL
;
968 r_n
->status
= init_srv_sess_info_ctr(p
, r_n
->ctr
, switch_value
, &resume_hnd
, &r_n
->total_entries
);
970 if (!W_ERROR_IS_OK(r_n
->status
))
973 init_enum_hnd(&r_n
->enum_hnd
, resume_hnd
);
976 /*******************************************************************
977 fill in a conn info level 0 structure.
978 ********************************************************************/
980 static void init_srv_conn_info_0(SRV_CONN_INFO_0
*ss0
, uint32
*snum
, uint32
*stot
)
982 uint32 num_entries
= 0;
990 DEBUG(5,("init_srv_conn_0_ss0\n"));
993 for (; (*snum
) < (*stot
) && num_entries
< MAX_CONN_ENTRIES
; (*snum
)++) {
995 init_srv_conn_info0(&ss0
->info_0
[num_entries
], (*stot
));
997 /* move on to creating next connection */
998 /* move on to creating next conn */
1002 ss0
->num_entries_read
= num_entries
;
1003 ss0
->ptr_conn_info
= num_entries
> 0 ? 1 : 0;
1004 ss0
->num_entries_read2
= num_entries
;
1006 if ((*snum
) >= (*stot
)) {
1011 ss0
->num_entries_read
= 0;
1012 ss0
->ptr_conn_info
= 0;
1013 ss0
->num_entries_read2
= 0;
1019 /*******************************************************************
1020 fill in a conn info level 1 structure.
1021 ********************************************************************/
1023 static void init_srv_conn_1_info(CONN_INFO_1
*se1
, CONN_INFO_1_STR
*str1
,
1024 uint32 id
, uint32 type
,
1025 uint32 num_opens
, uint32 num_users
, uint32 open_time
,
1026 const char *usr_name
, const char *net_name
)
1028 init_srv_conn_info1(se1
, id
, type
, num_opens
, num_users
, open_time
, usr_name
, net_name
);
1029 init_srv_conn_info1_str(str1
, usr_name
, net_name
);
1032 /*******************************************************************
1033 fill in a conn info level 1 structure.
1034 ********************************************************************/
1036 static void init_srv_conn_info_1(SRV_CONN_INFO_1
*ss1
, uint32
*snum
, uint32
*stot
)
1038 uint32 num_entries
= 0;
1046 DEBUG(5,("init_srv_conn_1_ss1\n"));
1049 for (; (*snum
) < (*stot
) && num_entries
< MAX_CONN_ENTRIES
; (*snum
)++) {
1050 init_srv_conn_1_info(&ss1
->info_1
[num_entries
],
1051 &ss1
->info_1_str
[num_entries
],
1052 (*stot
), 0x3, 1, 1, 3,"dummy_user", "IPC$");
1054 /* move on to creating next connection */
1055 /* move on to creating next conn */
1059 ss1
->num_entries_read
= num_entries
;
1060 ss1
->ptr_conn_info
= num_entries
> 0 ? 1 : 0;
1061 ss1
->num_entries_read2
= num_entries
;
1064 if ((*snum
) >= (*stot
)) {
1069 ss1
->num_entries_read
= 0;
1070 ss1
->ptr_conn_info
= 0;
1071 ss1
->num_entries_read2
= 0;
1077 /*******************************************************************
1078 makes a SRV_R_NET_CONN_ENUM structure.
1079 ********************************************************************/
1081 static WERROR
init_srv_conn_info_ctr(SRV_CONN_INFO_CTR
*ctr
,
1082 int switch_value
, uint32
*resume_hnd
, uint32
*total_entries
)
1084 WERROR status
= WERR_OK
;
1085 DEBUG(5,("init_srv_conn_info_ctr: %d\n", __LINE__
));
1087 ctr
->switch_value
= switch_value
;
1089 switch (switch_value
) {
1091 init_srv_conn_info_0(&ctr
->conn
.info0
, resume_hnd
, total_entries
);
1092 ctr
->ptr_conn_ctr
= 1;
1095 init_srv_conn_info_1(&ctr
->conn
.info1
, resume_hnd
, total_entries
);
1096 ctr
->ptr_conn_ctr
= 1;
1099 DEBUG(5,("init_srv_conn_info_ctr: unsupported switch value %d\n", switch_value
));
1101 (*total_entries
) = 0;
1102 ctr
->ptr_conn_ctr
= 0;
1103 status
= WERR_UNKNOWN_LEVEL
;
1110 /*******************************************************************
1111 makes a SRV_R_NET_CONN_ENUM structure.
1112 ********************************************************************/
1114 static void init_srv_r_net_conn_enum(SRV_R_NET_CONN_ENUM
*r_n
,
1115 uint32 resume_hnd
, int conn_level
, int switch_value
)
1117 DEBUG(5,("init_srv_r_net_conn_enum: %d\n", __LINE__
));
1119 r_n
->conn_level
= conn_level
;
1120 if (conn_level
== -1)
1121 r_n
->status
= WERR_UNKNOWN_LEVEL
;
1123 r_n
->status
= init_srv_conn_info_ctr(r_n
->ctr
, switch_value
, &resume_hnd
, &r_n
->total_entries
);
1125 if (!W_ERROR_IS_OK(r_n
->status
))
1128 init_enum_hnd(&r_n
->enum_hnd
, resume_hnd
);
1131 /*******************************************************************
1132 makes a SRV_R_NET_FILE_ENUM structure.
1133 ********************************************************************/
1135 static WERROR
net_file_enum_3( const char *username
, SRV_R_NET_FILE_ENUM
*r
,
1138 TALLOC_CTX
*ctx
= talloc_tos();
1139 SRV_FILE_INFO_CTR
*ctr
= &r
->ctr
;
1141 /* TODO -- Windows enumerates
1143 (c) open directories and files */
1145 r
->status
= net_enum_files( ctx
, username
, &ctr
->file
.info3
,
1146 &ctr
->num_entries
, resume_hnd
);
1147 if ( !W_ERROR_IS_OK(r
->status
))
1150 r
->status
= net_enum_pipes( ctx
, username
, &ctr
->file
.info3
,
1151 &ctr
->num_entries
, resume_hnd
);
1152 if ( !W_ERROR_IS_OK(r
->status
))
1155 r
->level
= ctr
->level
= 3;
1156 r
->total_entries
= ctr
->num_entries
;
1157 /* ctr->num_entries = r->total_entries - resume_hnd; */
1158 ctr
->num_entries2
= ctr
->num_entries
;
1159 ctr
->ptr_file_info
= 1;
1161 r
->status
= WERR_OK
;
1164 if ( ctr
->num_entries
> 0 )
1165 ctr
->ptr_entries
= 1;
1167 init_enum_hnd(&r
->enum_hnd
, 0);
1172 /*******************************************************************
1173 *******************************************************************/
1175 WERROR
_srv_net_file_enum(pipes_struct
*p
, SRV_Q_NET_FILE_ENUM
*q_u
, SRV_R_NET_FILE_ENUM
*r_u
)
1177 switch ( q_u
->level
) {
1180 if (!(username
= rpcstr_pull_unistr2_talloc(
1181 p
->mem_ctx
, q_u
->username
))) {
1185 return net_file_enum_3(username
, r_u
,
1186 get_enum_hnd(&q_u
->enum_hnd
));
1189 return WERR_UNKNOWN_LEVEL
;
1195 /*******************************************************************
1197 ********************************************************************/
1199 WERROR
_srv_net_srv_get_info(pipes_struct
*p
, SRV_Q_NET_SRV_GET_INFO
*q_u
, SRV_R_NET_SRV_GET_INFO
*r_u
)
1201 WERROR status
= WERR_OK
;
1202 SRV_INFO_CTR
*ctr
= TALLOC_P(p
->mem_ctx
, SRV_INFO_CTR
);
1209 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__
));
1211 if (!pipe_access_check(p
)) {
1212 DEBUG(3, ("access denied to srv_net_srv_get_info\n"));
1213 return WERR_ACCESS_DENIED
;
1216 switch (q_u
->switch_value
) {
1218 /* Technically level 102 should only be available to
1219 Administrators but there isn't anything super-secret
1220 here, as most of it is made up. */
1223 init_srv_info_102(&ctr
->srv
.sv102
,
1224 500, global_myname(),
1225 string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH
),
1226 lp_major_announce_version(), lp_minor_announce_version(),
1227 lp_default_server_announce(),
1228 0xffffffff, /* users */
1232 3000, /* announce delta */
1233 100000, /* licenses */
1234 "c:\\"); /* user path */
1237 init_srv_info_101(&ctr
->srv
.sv101
,
1238 500, global_myname(),
1239 lp_major_announce_version(), lp_minor_announce_version(),
1240 lp_default_server_announce(),
1241 string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH
));
1244 init_srv_info_100(&ctr
->srv
.sv100
, 500, global_myname());
1247 status
= WERR_UNKNOWN_LEVEL
;
1251 /* set up the net server get info structure */
1252 init_srv_r_net_srv_get_info(r_u
, q_u
->switch_value
, ctr
, status
);
1254 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__
));
1259 /*******************************************************************
1261 ********************************************************************/
1263 WERROR
_srv_net_srv_set_info(pipes_struct
*p
, SRV_Q_NET_SRV_SET_INFO
*q_u
, SRV_R_NET_SRV_SET_INFO
*r_u
)
1265 WERROR status
= WERR_OK
;
1267 DEBUG(5,("srv_net_srv_set_info: %d\n", __LINE__
));
1269 /* Set up the net server set info structure. */
1271 init_srv_r_net_srv_set_info(r_u
, 0x0, status
);
1273 DEBUG(5,("srv_net_srv_set_info: %d\n", __LINE__
));
1278 /*******************************************************************
1280 ********************************************************************/
1282 WERROR
_srv_net_conn_enum(pipes_struct
*p
, SRV_Q_NET_CONN_ENUM
*q_u
, SRV_R_NET_CONN_ENUM
*r_u
)
1284 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__
));
1286 r_u
->ctr
= TALLOC_P(p
->mem_ctx
, SRV_CONN_INFO_CTR
);
1290 ZERO_STRUCTP(r_u
->ctr
);
1293 init_srv_r_net_conn_enum(r_u
,
1294 get_enum_hnd(&q_u
->enum_hnd
),
1296 q_u
->ctr
->switch_value
);
1298 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__
));
1303 /*******************************************************************
1305 ********************************************************************/
1307 WERROR
_srv_net_sess_enum(pipes_struct
*p
, SRV_Q_NET_SESS_ENUM
*q_u
, SRV_R_NET_SESS_ENUM
*r_u
)
1309 DEBUG(5,("_srv_net_sess_enum: %d\n", __LINE__
));
1311 r_u
->ctr
= TALLOC_P(p
->mem_ctx
, SRV_SESS_INFO_CTR
);
1315 ZERO_STRUCTP(r_u
->ctr
);
1318 init_srv_r_net_sess_enum(p
, r_u
,
1319 get_enum_hnd(&q_u
->enum_hnd
),
1321 q_u
->ctr
->switch_value
);
1323 DEBUG(5,("_srv_net_sess_enum: %d\n", __LINE__
));
1328 /*******************************************************************
1330 ********************************************************************/
1332 WERROR
_srv_net_sess_del(pipes_struct
*p
, SRV_Q_NET_SESS_DEL
*q_u
, SRV_R_NET_SESS_DEL
*r_u
)
1334 struct sessionid
*session_list
;
1335 struct current_user user
;
1336 int num_sessions
, snum
;
1339 bool not_root
= False
;
1341 rpcstr_pull_unistr2_fstring(username
, &q_u
->uni_user_name
);
1342 rpcstr_pull_unistr2_fstring(machine
, &q_u
->uni_cli_name
);
1344 /* strip leading backslashes if any */
1345 while (machine
[0] == '\\') {
1346 memmove(machine
, &machine
[1], strlen(machine
));
1349 num_sessions
= list_sessions(p
->mem_ctx
, &session_list
);
1351 DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__
));
1353 r_u
->status
= WERR_ACCESS_DENIED
;
1355 get_current_user(&user
, p
);
1357 /* fail out now if you are not root or not a domain admin */
1359 if ((user
.ut
.uid
!= sec_initial_uid()) &&
1360 ( ! nt_token_check_domain_rid(p
->pipe_user
.nt_user_token
, DOMAIN_GROUP_RID_ADMINS
))) {
1365 for (snum
= 0; snum
< num_sessions
; snum
++) {
1367 if ((strequal(session_list
[snum
].username
, username
) || username
[0] == '\0' ) &&
1368 strequal(session_list
[snum
].remote_machine
, machine
)) {
1372 if (user
.ut
.uid
!= sec_initial_uid()) {
1377 ntstat
= messaging_send(smbd_messaging_context(),
1378 session_list
[snum
].pid
,
1379 MSG_SHUTDOWN
, &data_blob_null
);
1381 if (NT_STATUS_IS_OK(ntstat
))
1382 r_u
->status
= WERR_OK
;
1389 DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__
));
1397 /*******************************************************************
1399 ********************************************************************/
1401 WERROR
_srv_net_share_enum_all(pipes_struct
*p
, SRV_Q_NET_SHARE_ENUM
*q_u
, SRV_R_NET_SHARE_ENUM
*r_u
)
1403 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__
));
1405 if (!pipe_access_check(p
)) {
1406 DEBUG(3, ("access denied to srv_net_share_enum_all\n"));
1407 return WERR_ACCESS_DENIED
;
1410 /* Create the list of shares for the response. */
1411 init_srv_r_net_share_enum(p
, r_u
,
1412 q_u
->ctr
.info_level
,
1413 get_enum_hnd(&q_u
->enum_hnd
), True
);
1415 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__
));
1420 /*******************************************************************
1422 ********************************************************************/
1424 WERROR
_srv_net_share_enum(pipes_struct
*p
, SRV_Q_NET_SHARE_ENUM
*q_u
, SRV_R_NET_SHARE_ENUM
*r_u
)
1426 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__
));
1428 if (!pipe_access_check(p
)) {
1429 DEBUG(3, ("access denied to srv_net_share_enum\n"));
1430 return WERR_ACCESS_DENIED
;
1433 /* Create the list of shares for the response. */
1434 init_srv_r_net_share_enum(p
, r_u
,
1435 q_u
->ctr
.info_level
,
1436 get_enum_hnd(&q_u
->enum_hnd
), False
);
1438 DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__
));
1443 /*******************************************************************
1445 ********************************************************************/
1447 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
)
1451 DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__
));
1453 /* Create the list of shares for the response. */
1454 unistr2_to_ascii(share_name
, &q_u
->uni_share_name
, sizeof(share_name
));
1455 init_srv_r_net_share_get_info(p
, r_u
, share_name
, q_u
->info_level
);
1457 DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__
));
1462 /*******************************************************************
1463 Check a given DOS pathname is valid for a share.
1464 ********************************************************************/
1466 char *valid_share_pathname(char *dos_pathname
)
1470 /* Convert any '\' paths to '/' */
1471 unix_format(dos_pathname
);
1472 unix_clean_name(dos_pathname
);
1474 /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
1476 if (strlen(dos_pathname
) > 2 && ptr
[1] == ':' && ptr
[0] != '/')
1479 /* Only absolute paths allowed. */
1486 /*******************************************************************
1487 Net share set info. Modify share details.
1488 ********************************************************************/
1490 WERROR
_srv_net_share_set_info(pipes_struct
*p
, SRV_Q_NET_SHARE_SET_INFO
*q_u
, SRV_R_NET_SHARE_SET_INFO
*r_u
)
1492 struct current_user user
;
1501 SEC_DESC
*psd
= NULL
;
1502 SE_PRIV se_diskop
= SE_DISK_OPERATOR
;
1503 bool is_disk_op
= False
;
1504 int max_connections
= 0;
1506 DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__
));
1508 unistr2_to_ascii(share_name
, &q_u
->uni_share_name
, sizeof(share_name
));
1510 r_u
->parm_error
= 0;
1512 if ( strequal(share_name
,"IPC$")
1513 || ( lp_enable_asu_support() && strequal(share_name
,"ADMIN$") )
1514 || strequal(share_name
,"global") )
1516 return WERR_ACCESS_DENIED
;
1519 snum
= find_service(share_name
);
1521 /* Does this share exist ? */
1523 return WERR_NET_NAME_NOT_FOUND
;
1525 /* No change to printer shares. */
1526 if (lp_print_ok(snum
))
1527 return WERR_ACCESS_DENIED
;
1529 get_current_user(&user
,p
);
1531 is_disk_op
= user_has_privileges( p
->pipe_user
.nt_user_token
, &se_diskop
);
1533 /* fail out now if you are not root and not a disk op */
1535 if ( user
.ut
.uid
!= sec_initial_uid() && !is_disk_op
)
1536 return WERR_ACCESS_DENIED
;
1538 switch (q_u
->info_level
) {
1540 pstrcpy(pathname
, lp_pathname(snum
));
1541 unistr2_to_ascii(comment
, &q_u
->info
.share
.info2
.info_2_str
.uni_remark
, sizeof(comment
));
1542 type
= q_u
->info
.share
.info2
.info_2
.type
;
1546 unistr2_to_ascii(comment
, &q_u
->info
.share
.info2
.info_2_str
.uni_remark
, sizeof(comment
));
1547 unistr2_to_ascii(pathname
, &q_u
->info
.share
.info2
.info_2_str
.uni_path
, sizeof(pathname
));
1548 type
= q_u
->info
.share
.info2
.info_2
.type
;
1549 max_connections
= (q_u
->info
.share
.info2
.info_2
.max_uses
== 0xffffffff) ? 0 : q_u
->info
.share
.info2
.info_2
.max_uses
;
1553 /* not supported on set but here for completeness */
1555 unistr2_to_ascii(comment
, &q_u
->info
.share
.info501
.info_501_str
.uni_remark
, sizeof(comment
));
1556 type
= q_u
->info
.share
.info501
.info_501
.type
;
1561 unistr2_to_ascii(comment
, &q_u
->info
.share
.info502
.info_502_str
.uni_remark
, sizeof(comment
));
1562 unistr2_to_ascii(pathname
, &q_u
->info
.share
.info502
.info_502_str
.uni_path
, sizeof(pathname
));
1563 type
= q_u
->info
.share
.info502
.info_502
.type
;
1564 psd
= q_u
->info
.share
.info502
.info_502_str
.sd
;
1565 map_generic_share_sd_bits(psd
);
1568 pstrcpy(pathname
, lp_pathname(snum
));
1569 unistr2_to_ascii(comment
, &q_u
->info
.share
.info1004
.info_1004_str
.uni_remark
, sizeof(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 (((q_u
->info
.share
.info1005
.share_info_flags
&
1578 SHARE_1005_CSC_POLICY_MASK
) >>
1579 SHARE_1005_CSC_POLICY_SHIFT
) == lp_csc_policy(snum
))
1582 DEBUG(3, ("_srv_net_share_set_info: 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 pstrcpy(pathname
, lp_pathname(snum
));
1590 fstrcpy(comment
, lp_comment(snum
));
1591 psd
= q_u
->info
.share
.info1501
.sdb
->sd
;
1592 map_generic_share_sd_bits(psd
);
1593 type
= STYPE_DISKTREE
;
1596 DEBUG(5,("_srv_net_share_set_info: unsupported switch value %d\n", q_u
->info_level
));
1597 return WERR_UNKNOWN_LEVEL
;
1600 /* We can only modify disk shares. */
1601 if (type
!= STYPE_DISKTREE
)
1602 return WERR_ACCESS_DENIED
;
1604 /* Check if the pathname is valid. */
1605 if (!(path
= valid_share_pathname( pathname
)))
1606 return WERR_OBJECT_PATH_INVALID
;
1608 /* Ensure share name, pathname and comment don't contain '"' characters. */
1609 string_replace(share_name
, '"', ' ');
1610 string_replace(path
, '"', ' ');
1611 string_replace(comment
, '"', ' ');
1613 DEBUG(10,("_srv_net_share_set_info: change share command = %s\n",
1614 lp_change_share_cmd() ? lp_change_share_cmd() : "NULL" ));
1616 /* Only call modify function if something changed. */
1618 if (strcmp(path
, lp_pathname(snum
)) || strcmp(comment
, lp_comment(snum
))
1619 || (lp_max_connections(snum
) != max_connections
) )
1621 if (!lp_change_share_cmd() || !*lp_change_share_cmd()) {
1622 DEBUG(10,("_srv_net_share_set_info: No change share command\n"));
1623 return WERR_ACCESS_DENIED
;
1626 slprintf(command
, sizeof(command
)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
1627 lp_change_share_cmd(), dyn_CONFIGFILE
, share_name
, path
, comment
, max_connections
);
1629 DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command
));
1631 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1636 if ( (ret
= smbrun(command
, NULL
)) == 0 ) {
1637 /* Tell everyone we updated smb.conf. */
1638 message_send_all(smbd_messaging_context(),
1639 MSG_SMB_CONF_UPDATED
, NULL
, 0,
1646 /********* END SeDiskOperatorPrivilege BLOCK *********/
1648 DEBUG(3,("_srv_net_share_set_info: Running [%s] returned (%d)\n", command
, ret
));
1651 return WERR_ACCESS_DENIED
;
1653 DEBUG(10,("_srv_net_share_set_info: No change to share name (%s)\n", share_name
));
1656 /* Replace SD if changed. */
1661 old_sd
= get_share_security(p
->mem_ctx
, lp_servicename(snum
), &sd_size
);
1663 if (old_sd
&& !sec_desc_equal(old_sd
, psd
)) {
1664 if (!set_share_security(share_name
, psd
))
1665 DEBUG(0,("_srv_net_share_set_info: Failed to change security info in share %s.\n",
1670 DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__
));
1675 /*******************************************************************
1676 Net share add. Call 'add_share_command "sharename" "pathname"
1677 "comment" "max connections = "
1678 ********************************************************************/
1680 WERROR
_srv_net_share_add(pipes_struct
*p
, SRV_Q_NET_SHARE_ADD
*q_u
, SRV_R_NET_SHARE_ADD
*r_u
)
1682 struct current_user user
;
1691 SEC_DESC
*psd
= NULL
;
1692 SE_PRIV se_diskop
= SE_DISK_OPERATOR
;
1694 int max_connections
= 0;
1696 DEBUG(5,("_srv_net_share_add: %d\n", __LINE__
));
1698 r_u
->parm_error
= 0;
1700 get_current_user(&user
,p
);
1702 is_disk_op
= user_has_privileges( p
->pipe_user
.nt_user_token
, &se_diskop
);
1704 if (user
.ut
.uid
!= sec_initial_uid() && !is_disk_op
)
1705 return WERR_ACCESS_DENIED
;
1707 if (!lp_add_share_cmd() || !*lp_add_share_cmd()) {
1708 DEBUG(10,("_srv_net_share_add: No add share command\n"));
1709 return WERR_ACCESS_DENIED
;
1712 switch (q_u
->info_level
) {
1714 /* No path. Not enough info in a level 0 to do anything. */
1715 return WERR_ACCESS_DENIED
;
1717 /* Not enough info in a level 1 to do anything. */
1718 return WERR_ACCESS_DENIED
;
1720 unistr2_to_ascii(share_name
, &q_u
->info
.share
.info2
.info_2_str
.uni_netname
, sizeof(share_name
));
1721 unistr2_to_ascii(comment
, &q_u
->info
.share
.info2
.info_2_str
.uni_remark
, sizeof(share_name
));
1722 unistr2_to_ascii(pathname
, &q_u
->info
.share
.info2
.info_2_str
.uni_path
, sizeof(share_name
));
1723 max_connections
= (q_u
->info
.share
.info2
.info_2
.max_uses
== 0xffffffff) ? 0 : q_u
->info
.share
.info2
.info_2
.max_uses
;
1724 type
= q_u
->info
.share
.info2
.info_2
.type
;
1727 /* No path. Not enough info in a level 501 to do anything. */
1728 return WERR_ACCESS_DENIED
;
1730 unistr2_to_ascii(share_name
, &q_u
->info
.share
.info502
.info_502_str
.uni_netname
, sizeof(share_name
));
1731 unistr2_to_ascii(comment
, &q_u
->info
.share
.info502
.info_502_str
.uni_remark
, sizeof(share_name
));
1732 unistr2_to_ascii(pathname
, &q_u
->info
.share
.info502
.info_502_str
.uni_path
, sizeof(share_name
));
1733 type
= q_u
->info
.share
.info502
.info_502
.type
;
1734 psd
= q_u
->info
.share
.info502
.info_502_str
.sd
;
1735 map_generic_share_sd_bits(psd
);
1738 /* none of the following contain share names. NetShareAdd does not have a separate parameter for the share name */
1744 return WERR_ACCESS_DENIED
;
1746 /* DFS only level. */
1747 return WERR_ACCESS_DENIED
;
1749 DEBUG(5,("_srv_net_share_add: unsupported switch value %d\n", q_u
->info_level
));
1750 return WERR_UNKNOWN_LEVEL
;
1753 /* check for invalid share names */
1755 if ( !validate_net_name( share_name
, INVALID_SHARENAME_CHARS
, sizeof(share_name
) ) ) {
1756 DEBUG(5,("_srv_net_name_validate: Bad sharename \"%s\"\n", share_name
));
1757 return WERR_INVALID_NAME
;
1760 if ( strequal(share_name
,"IPC$") || strequal(share_name
,"global")
1761 || ( lp_enable_asu_support() && strequal(share_name
,"ADMIN$") ) )
1763 return WERR_ACCESS_DENIED
;
1766 snum
= find_service(share_name
);
1768 /* Share already exists. */
1770 return WERR_ALREADY_EXISTS
;
1772 /* We can only add disk shares. */
1773 if (type
!= STYPE_DISKTREE
)
1774 return WERR_ACCESS_DENIED
;
1776 /* Check if the pathname is valid. */
1777 if (!(path
= valid_share_pathname( pathname
)))
1778 return WERR_OBJECT_PATH_INVALID
;
1780 /* Ensure share name, pathname and comment don't contain '"' characters. */
1781 string_replace(share_name
, '"', ' ');
1782 string_replace(path
, '"', ' ');
1783 string_replace(comment
, '"', ' ');
1785 slprintf(command
, sizeof(command
)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
1793 DEBUG(10,("_srv_net_share_add: Running [%s]\n", command
));
1795 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1800 if ( (ret
= smbrun(command
, NULL
)) == 0 ) {
1801 /* Tell everyone we updated smb.conf. */
1802 message_send_all(smbd_messaging_context(),
1803 MSG_SMB_CONF_UPDATED
, NULL
, 0, NULL
);
1809 /********* END SeDiskOperatorPrivilege BLOCK *********/
1811 DEBUG(3,("_srv_net_share_add: Running [%s] returned (%d)\n", command
, ret
));
1814 return WERR_ACCESS_DENIED
;
1817 if (!set_share_security(share_name
, psd
)) {
1818 DEBUG(0,("_srv_net_share_add: Failed to add security info to share %s.\n", share_name
));
1823 * We don't call reload_services() here, the message will
1824 * cause this to be done before the next packet is read
1825 * from the client. JRA.
1828 DEBUG(5,("_srv_net_share_add: %d\n", __LINE__
));
1833 /*******************************************************************
1834 Net share delete. Call "delete share command" with the share name as
1836 ********************************************************************/
1838 WERROR
_srv_net_share_del(pipes_struct
*p
, SRV_Q_NET_SHARE_DEL
*q_u
, SRV_R_NET_SHARE_DEL
*r_u
)
1840 struct current_user user
;
1845 SE_PRIV se_diskop
= SE_DISK_OPERATOR
;
1847 struct share_params
*params
;
1849 DEBUG(5,("_srv_net_share_del: %d\n", __LINE__
));
1851 unistr2_to_ascii(share_name
, &q_u
->uni_share_name
, sizeof(share_name
));
1853 if ( strequal(share_name
,"IPC$")
1854 || ( lp_enable_asu_support() && strequal(share_name
,"ADMIN$") )
1855 || strequal(share_name
,"global") )
1857 return WERR_ACCESS_DENIED
;
1860 if (!(params
= get_share_params(p
->mem_ctx
, share_name
))) {
1861 return WERR_NO_SUCH_SHARE
;
1864 snum
= find_service(share_name
);
1866 /* No change to printer shares. */
1867 if (lp_print_ok(snum
))
1868 return WERR_ACCESS_DENIED
;
1870 get_current_user(&user
,p
);
1872 is_disk_op
= user_has_privileges( p
->pipe_user
.nt_user_token
, &se_diskop
);
1874 if (user
.ut
.uid
!= sec_initial_uid() && !is_disk_op
)
1875 return WERR_ACCESS_DENIED
;
1877 if (!lp_delete_share_cmd() || !*lp_delete_share_cmd()) {
1878 DEBUG(10,("_srv_net_share_del: No delete share command\n"));
1879 return WERR_ACCESS_DENIED
;
1882 slprintf(command
, sizeof(command
)-1, "%s \"%s\" \"%s\"",
1883 lp_delete_share_cmd(), dyn_CONFIGFILE
, lp_servicename(snum
));
1885 DEBUG(10,("_srv_net_share_del: Running [%s]\n", command
));
1887 /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/
1892 if ( (ret
= smbrun(command
, NULL
)) == 0 ) {
1893 /* Tell everyone we updated smb.conf. */
1894 message_send_all(smbd_messaging_context(),
1895 MSG_SMB_CONF_UPDATED
, NULL
, 0, NULL
);
1901 /********* END SeDiskOperatorPrivilege BLOCK *********/
1903 DEBUG(3,("_srv_net_share_del: Running [%s] returned (%d)\n", command
, ret
));
1906 return WERR_ACCESS_DENIED
;
1908 /* Delete the SD in the database. */
1909 delete_share_security(lp_servicename(params
->service
));
1911 lp_killservice(params
->service
);
1916 WERROR
_srv_net_share_del_sticky(pipes_struct
*p
, SRV_Q_NET_SHARE_DEL
*q_u
, SRV_R_NET_SHARE_DEL
*r_u
)
1918 DEBUG(5,("_srv_net_share_del_stick: %d\n", __LINE__
));
1920 return _srv_net_share_del(p
, q_u
, r_u
);
1923 /*******************************************************************
1925 ********************************************************************/
1927 WERROR
_srv_net_remote_tod(pipes_struct
*p
, SRV_Q_NET_REMOTE_TOD
*q_u
, SRV_R_NET_REMOTE_TOD
*r_u
)
1929 TIME_OF_DAY_INFO
*tod
;
1931 time_t unixdate
= time(NULL
);
1933 /* We do this call first as if we do it *after* the gmtime call
1934 it overwrites the pointed-to values. JRA */
1936 uint32 zone
= get_time_zone(unixdate
)/60;
1938 DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__
));
1940 if ( !(tod
= TALLOC_ZERO_P(p
->mem_ctx
, TIME_OF_DAY_INFO
)) )
1944 r_u
->ptr_srv_tod
= 0x1;
1945 r_u
->status
= WERR_OK
;
1947 DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__
));
1949 t
= gmtime(&unixdate
);
1952 init_time_of_day_info(tod
,
1966 DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__
));
1971 /***********************************************************************************
1972 Win9x NT tools get security descriptor.
1973 ***********************************************************************************/
1975 WERROR
_srv_net_file_query_secdesc(pipes_struct
*p
, SRV_Q_NET_FILE_QUERY_SECDESC
*q_u
,
1976 SRV_R_NET_FILE_QUERY_SECDESC
*r_u
)
1978 SEC_DESC
*psd
= NULL
;
1981 pstring filename_in
;
1982 char *filename
= NULL
;
1984 files_struct
*fsp
= NULL
;
1987 struct current_user user
;
1988 connection_struct
*conn
= NULL
;
1989 bool became_user
= False
;
1990 TALLOC_CTX
*ctx
= talloc_tos();
1994 r_u
->status
= WERR_OK
;
1996 unistr2_to_ascii(qualname
, &q_u
->uni_qual_name
, sizeof(qualname
));
1998 /* Null password is ok - we are already an authenticated user... */
1999 null_pw
= data_blob_null
;
2001 get_current_user(&user
, p
);
2004 conn
= make_connection(qualname
, null_pw
, "A:", user
.vuid
, &nt_status
);
2008 DEBUG(3,("_srv_net_file_query_secdesc: Unable to connect to %s\n", qualname
));
2009 r_u
->status
= ntstatus_to_werror(nt_status
);
2013 if (!become_user(conn
, conn
->vuid
)) {
2014 DEBUG(0,("_srv_net_file_query_secdesc: Can't become connected user!\n"));
2015 r_u
->status
= WERR_ACCESS_DENIED
;
2020 unistr2_to_ascii(filename_in
, &q_u
->uni_file_name
, sizeof(filename_in
));
2021 nt_status
= unix_convert(ctx
, conn
, filename_in
, False
, &filename
, NULL
, &st
);
2022 if (!NT_STATUS_IS_OK(nt_status
)) {
2023 DEBUG(3,("_srv_net_file_query_secdesc: bad pathname %s\n", filename
));
2024 r_u
->status
= WERR_ACCESS_DENIED
;
2028 nt_status
= check_name(conn
, filename
);
2029 if (!NT_STATUS_IS_OK(nt_status
)) {
2030 DEBUG(3,("_srv_net_file_query_secdesc: can't access %s\n", filename
));
2031 r_u
->status
= WERR_ACCESS_DENIED
;
2035 nt_status
= open_file_stat(conn
, NULL
, filename
, &st
, &fsp
);
2036 /* Perhaps it is a directory */
2037 if (NT_STATUS_EQUAL(nt_status
, NT_STATUS_FILE_IS_A_DIRECTORY
)) {
2038 nt_status
= open_directory(conn
, NULL
, filename
, &st
,
2039 READ_CONTROL_ACCESS
,
2040 FILE_SHARE_READ
|FILE_SHARE_WRITE
,
2043 FILE_ATTRIBUTE_DIRECTORY
,
2047 if (!NT_STATUS_IS_OK(nt_status
)) {
2048 DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", filename
));
2049 r_u
->status
= ntstatus_to_werror(nt_status
);
2053 sd_size
= SMB_VFS_GET_NT_ACL(fsp
, fsp
->fsp_name
, (OWNER_SECURITY_INFORMATION
|GROUP_SECURITY_INFORMATION
|DACL_SECURITY_INFORMATION
), &psd
);
2056 DEBUG(3,("_srv_net_file_query_secdesc: Unable to get NT ACL for file %s\n", filename
));
2057 r_u
->status
= WERR_ACCESS_DENIED
;
2061 r_u
->ptr_response
= 1;
2062 r_u
->size_response
= sd_size
;
2063 r_u
->ptr_secdesc
= 1;
2064 r_u
->size_secdesc
= sd_size
;
2065 r_u
->sec_desc
= psd
;
2067 psd
->dacl
->revision
= (uint16
) NT4_ACL_REVISION
;
2069 close_file(fsp
, NORMAL_CLOSE
);
2071 close_cnum(conn
, user
.vuid
);
2077 close_file(fsp
, NORMAL_CLOSE
);
2084 close_cnum(conn
, user
.vuid
);
2089 /***********************************************************************************
2090 Win9x NT tools set security descriptor.
2091 ***********************************************************************************/
2093 WERROR
_srv_net_file_set_secdesc(pipes_struct
*p
, SRV_Q_NET_FILE_SET_SECDESC
*q_u
,
2094 SRV_R_NET_FILE_SET_SECDESC
*r_u
)
2096 pstring filename_in
;
2097 char *filename
= NULL
;
2100 files_struct
*fsp
= NULL
;
2103 struct current_user user
;
2104 connection_struct
*conn
= NULL
;
2105 bool became_user
= False
;
2106 TALLOC_CTX
*ctx
= talloc_tos();
2110 r_u
->status
= WERR_OK
;
2112 unistr2_to_ascii(qualname
, &q_u
->uni_qual_name
, sizeof(qualname
));
2114 /* Null password is ok - we are already an authenticated user... */
2115 null_pw
= data_blob_null
;
2117 get_current_user(&user
, p
);
2120 conn
= make_connection(qualname
, null_pw
, "A:", user
.vuid
, &nt_status
);
2124 DEBUG(3,("_srv_net_file_set_secdesc: Unable to connect to %s\n", qualname
));
2125 r_u
->status
= ntstatus_to_werror(nt_status
);
2129 if (!become_user(conn
, conn
->vuid
)) {
2130 DEBUG(0,("_srv_net_file_set_secdesc: Can't become connected user!\n"));
2131 r_u
->status
= WERR_ACCESS_DENIED
;
2136 unistr2_to_ascii(filename_in
, &q_u
->uni_file_name
, sizeof(filename_in
));
2137 nt_status
= unix_convert(ctx
, conn
, filename
, False
, &filename
, NULL
, &st
);
2138 if (!NT_STATUS_IS_OK(nt_status
)) {
2139 DEBUG(3,("_srv_net_file_set_secdesc: bad pathname %s\n", filename
));
2140 r_u
->status
= WERR_ACCESS_DENIED
;
2144 nt_status
= check_name(conn
, filename
);
2145 if (!NT_STATUS_IS_OK(nt_status
)) {
2146 DEBUG(3,("_srv_net_file_set_secdesc: can't access %s\n", filename
));
2147 r_u
->status
= WERR_ACCESS_DENIED
;
2152 nt_status
= open_file_stat(conn
, NULL
, filename
, &st
, &fsp
);
2154 if ( !NT_STATUS_IS_OK(nt_status
) ) {
2155 /* Perhaps it is a directory */
2156 if (NT_STATUS_EQUAL(nt_status
, NT_STATUS_FILE_IS_A_DIRECTORY
))
2157 nt_status
= open_directory(conn
, NULL
, filename
, &st
,
2158 FILE_READ_ATTRIBUTES
,
2159 FILE_SHARE_READ
|FILE_SHARE_WRITE
,
2162 FILE_ATTRIBUTE_DIRECTORY
,
2165 if ( !NT_STATUS_IS_OK(nt_status
) ) {
2166 DEBUG(3,("_srv_net_file_set_secdesc: Unable to open file %s\n", filename
));
2167 r_u
->status
= ntstatus_to_werror(nt_status
);
2172 nt_status
= SMB_VFS_SET_NT_ACL(fsp
, fsp
->fsp_name
, q_u
->sec_info
, q_u
->sec_desc
);
2174 if (!NT_STATUS_IS_OK(nt_status
) ) {
2175 DEBUG(3,("_srv_net_file_set_secdesc: Unable to set NT ACL on file %s\n", filename
));
2176 r_u
->status
= WERR_ACCESS_DENIED
;
2180 close_file(fsp
, NORMAL_CLOSE
);
2182 close_cnum(conn
, user
.vuid
);
2188 close_file(fsp
, NORMAL_CLOSE
);
2196 close_cnum(conn
, user
.vuid
);
2202 /***********************************************************************************
2203 It may be that we want to limit users to creating shares on certain areas of the UNIX file area.
2204 We could define areas by mapping Windows style disks to points on the UNIX directory hierarchy.
2205 These disks would the disks listed by this function.
2206 Users could then create shares relative to these disks. Watch out for moving these disks around.
2207 "Nigel Williams" <nigel@veritas.com>.
2208 ***********************************************************************************/
2210 static const char *server_disks
[] = {"C:"};
2212 static uint32
get_server_disk_count(void)
2214 return sizeof(server_disks
)/sizeof(server_disks
[0]);
2217 static uint32
init_server_disk_enum(uint32
*resume
)
2219 uint32 server_disk_count
= get_server_disk_count();
2221 /*resume can be an offset into the list for now*/
2223 if(*resume
& 0x80000000)
2226 if(*resume
> server_disk_count
)
2227 *resume
= server_disk_count
;
2229 return server_disk_count
- *resume
;
2232 static const char *next_server_disk_enum(uint32
*resume
)
2236 if(init_server_disk_enum(resume
) == 0)
2239 disk
= server_disks
[*resume
];
2243 DEBUG(10, ("next_server_disk_enum: reporting disk %s. resume handle %d.\n", disk
, *resume
));
2248 WERROR
_srv_net_disk_enum(pipes_struct
*p
, SRV_Q_NET_DISK_ENUM
*q_u
, SRV_R_NET_DISK_ENUM
*r_u
)
2251 const char *disk_name
;
2252 TALLOC_CTX
*ctx
= p
->mem_ctx
;
2253 uint32 resume
=get_enum_hnd(&q_u
->enum_hnd
);
2255 r_u
->status
=WERR_OK
;
2257 r_u
->total_entries
= init_server_disk_enum(&resume
);
2259 r_u
->disk_enum_ctr
.unknown
= 0;
2261 if(!(r_u
->disk_enum_ctr
.disk_info
= TALLOC_ARRAY(ctx
, DISK_INFO
, MAX_SERVER_DISK_ENTRIES
))) {
2265 r_u
->disk_enum_ctr
.disk_info_ptr
= r_u
->disk_enum_ctr
.disk_info
? 1 : 0;
2267 /*allow one DISK_INFO for null terminator*/
2269 for(i
= 0; i
< MAX_SERVER_DISK_ENTRIES
-1 && (disk_name
= next_server_disk_enum(&resume
)); i
++) {
2271 r_u
->disk_enum_ctr
.entries_read
++;
2273 /*copy disk name into a unicode string*/
2275 init_unistr3(&r_u
->disk_enum_ctr
.disk_info
[i
].disk_name
, disk_name
);
2278 /* add a terminating null string. Is this there if there is more data to come? */
2280 r_u
->disk_enum_ctr
.entries_read
++;
2282 init_unistr3(&r_u
->disk_enum_ctr
.disk_info
[i
].disk_name
, "");
2284 init_enum_hnd(&r_u
->enum_hnd
, resume
);
2289 /********************************************************************
2290 ********************************************************************/
2292 WERROR
_srv_net_name_validate(pipes_struct
*p
, SRV_Q_NET_NAME_VALIDATE
*q_u
, SRV_R_NET_NAME_VALIDATE
*r_u
)
2296 switch ( q_u
->type
) {
2298 rpcstr_pull(sharename
, q_u
->sharename
.buffer
, sizeof(sharename
), q_u
->sharename
.uni_str_len
*2, 0);
2299 if ( !validate_net_name( sharename
, INVALID_SHARENAME_CHARS
, sizeof(sharename
) ) ) {
2300 DEBUG(5,("_srv_net_name_validate: Bad sharename \"%s\"\n", sharename
));
2301 return WERR_INVALID_NAME
;
2306 return WERR_UNKNOWN_LEVEL
;
2313 /********************************************************************
2314 ********************************************************************/
2316 WERROR
_srvsvc_NetFileClose(pipes_struct
*p
, struct srvsvc_NetFileClose
*r
)
2318 return WERR_ACCESS_DENIED
;
2322 /********************************************************************
2323 ********************************************************************/
2325 WERROR
_srvsvc_NetCharDevEnum(pipes_struct
*p
, struct srvsvc_NetCharDevEnum
*r
)
2327 p
->rng_fault_state
= True
;
2328 return WERR_NOT_SUPPORTED
;
2331 WERROR
_srvsvc_NetCharDevGetInfo(pipes_struct
*p
, struct srvsvc_NetCharDevGetInfo
*r
)
2333 p
->rng_fault_state
= True
;
2334 return WERR_NOT_SUPPORTED
;
2337 WERROR
_srvsvc_NetCharDevControl(pipes_struct
*p
, struct srvsvc_NetCharDevControl
*r
)
2339 p
->rng_fault_state
= True
;
2340 return WERR_NOT_SUPPORTED
;
2343 WERROR
_srvsvc_NetCharDevQEnum(pipes_struct
*p
, struct srvsvc_NetCharDevQEnum
*r
)
2345 p
->rng_fault_state
= True
;
2346 return WERR_NOT_SUPPORTED
;
2349 WERROR
_srvsvc_NetCharDevQGetInfo(pipes_struct
*p
, struct srvsvc_NetCharDevQGetInfo
*r
)
2351 p
->rng_fault_state
= True
;
2352 return WERR_NOT_SUPPORTED
;
2355 WERROR
_srvsvc_NetCharDevQSetInfo(pipes_struct
*p
, struct srvsvc_NetCharDevQSetInfo
*r
)
2357 p
->rng_fault_state
= True
;
2358 return WERR_NOT_SUPPORTED
;
2361 WERROR
_srvsvc_NetCharDevQPurge(pipes_struct
*p
, struct srvsvc_NetCharDevQPurge
*r
)
2363 p
->rng_fault_state
= True
;
2364 return WERR_NOT_SUPPORTED
;
2367 WERROR
_srvsvc_NetCharDevQPurgeSelf(pipes_struct
*p
, struct srvsvc_NetCharDevQPurgeSelf
*r
)
2369 p
->rng_fault_state
= True
;
2370 return WERR_NOT_SUPPORTED
;
2373 WERROR
_srvsvc_NetConnEnum(pipes_struct
*p
, struct srvsvc_NetConnEnum
*r
)
2375 p
->rng_fault_state
= True
;
2376 return WERR_NOT_SUPPORTED
;
2379 WERROR
_srvsvc_NetFileEnum(pipes_struct
*p
, struct srvsvc_NetFileEnum
*r
)
2381 p
->rng_fault_state
= True
;
2382 return WERR_NOT_SUPPORTED
;
2385 WERROR
_srvsvc_NetFileGetInfo(pipes_struct
*p
, struct srvsvc_NetFileGetInfo
*r
)
2387 p
->rng_fault_state
= True
;
2388 return WERR_NOT_SUPPORTED
;
2391 WERROR
_srvsvc_NetSessEnum(pipes_struct
*p
, struct srvsvc_NetSessEnum
*r
)
2393 p
->rng_fault_state
= True
;
2394 return WERR_NOT_SUPPORTED
;
2397 WERROR
_srvsvc_NetSessDel(pipes_struct
*p
, struct srvsvc_NetSessDel
*r
)
2399 p
->rng_fault_state
= True
;
2400 return WERR_NOT_SUPPORTED
;
2403 WERROR
_srvsvc_NetShareAdd(pipes_struct
*p
, struct srvsvc_NetShareAdd
*r
)
2405 p
->rng_fault_state
= True
;
2406 return WERR_NOT_SUPPORTED
;
2409 WERROR
_srvsvc_NetShareEnumAll(pipes_struct
*p
, struct srvsvc_NetShareEnumAll
*r
)
2411 p
->rng_fault_state
= True
;
2412 return WERR_NOT_SUPPORTED
;
2415 WERROR
_srvsvc_NetShareGetInfo(pipes_struct
*p
, struct srvsvc_NetShareGetInfo
*r
)
2417 p
->rng_fault_state
= True
;
2418 return WERR_NOT_SUPPORTED
;
2421 WERROR
_srvsvc_NetShareSetInfo(pipes_struct
*p
, struct srvsvc_NetShareSetInfo
*r
)
2423 p
->rng_fault_state
= True
;
2424 return WERR_NOT_SUPPORTED
;
2427 WERROR
_srvsvc_NetShareDel(pipes_struct
*p
, struct srvsvc_NetShareDel
*r
)
2429 p
->rng_fault_state
= True
;
2430 return WERR_NOT_SUPPORTED
;
2433 WERROR
_srvsvc_NetShareDelSticky(pipes_struct
*p
, struct srvsvc_NetShareDelSticky
*r
)
2435 p
->rng_fault_state
= True
;
2436 return WERR_NOT_SUPPORTED
;
2439 WERROR
_srvsvc_NetShareCheck(pipes_struct
*p
, struct srvsvc_NetShareCheck
*r
)
2441 p
->rng_fault_state
= True
;
2442 return WERR_NOT_SUPPORTED
;
2445 WERROR
_srvsvc_NetSrvGetInfo(pipes_struct
*p
, struct srvsvc_NetSrvGetInfo
*r
)
2447 p
->rng_fault_state
= True
;
2448 return WERR_NOT_SUPPORTED
;
2451 WERROR
_srvsvc_NetSrvSetInfo(pipes_struct
*p
, struct srvsvc_NetSrvSetInfo
*r
)
2453 p
->rng_fault_state
= True
;
2454 return WERR_NOT_SUPPORTED
;
2457 WERROR
_srvsvc_NetDiskEnum(pipes_struct
*p
, struct srvsvc_NetDiskEnum
*r
)
2459 p
->rng_fault_state
= True
;
2460 return WERR_NOT_SUPPORTED
;
2463 WERROR
_srvsvc_NetServerStatisticsGet(pipes_struct
*p
, struct srvsvc_NetServerStatisticsGet
*r
)
2465 p
->rng_fault_state
= True
;
2466 return WERR_NOT_SUPPORTED
;
2469 WERROR
_srvsvc_NetTransportAdd(pipes_struct
*p
, struct srvsvc_NetTransportAdd
*r
)
2471 p
->rng_fault_state
= True
;
2472 return WERR_NOT_SUPPORTED
;
2475 WERROR
_srvsvc_NetTransportEnum(pipes_struct
*p
, struct srvsvc_NetTransportEnum
*r
)
2477 p
->rng_fault_state
= True
;
2478 return WERR_NOT_SUPPORTED
;
2481 WERROR
_srvsvc_NetTransportDel(pipes_struct
*p
, struct srvsvc_NetTransportDel
*r
)
2483 p
->rng_fault_state
= True
;
2484 return WERR_NOT_SUPPORTED
;
2487 WERROR
_srvsvc_NetRemoteTOD(pipes_struct
*p
, struct srvsvc_NetRemoteTOD
*r
)
2489 p
->rng_fault_state
= True
;
2490 return WERR_NOT_SUPPORTED
;
2493 WERROR
_srvsvc_NetSetServiceBits(pipes_struct
*p
, struct srvsvc_NetSetServiceBits
*r
)
2495 p
->rng_fault_state
= True
;
2496 return WERR_NOT_SUPPORTED
;
2499 WERROR
_srvsvc_NetPathType(pipes_struct
*p
, struct srvsvc_NetPathType
*r
)
2501 p
->rng_fault_state
= True
;
2502 return WERR_NOT_SUPPORTED
;
2505 WERROR
_srvsvc_NetPathCanonicalize(pipes_struct
*p
, struct srvsvc_NetPathCanonicalize
*r
)
2507 p
->rng_fault_state
= True
;
2508 return WERR_NOT_SUPPORTED
;
2511 WERROR
_srvsvc_NetPathCompare(pipes_struct
*p
, struct srvsvc_NetPathCompare
*r
)
2513 p
->rng_fault_state
= True
;
2514 return WERR_NOT_SUPPORTED
;
2517 WERROR
_srvsvc_NetNameValidate(pipes_struct
*p
, struct srvsvc_NetNameValidate
*r
)
2519 p
->rng_fault_state
= True
;
2520 return WERR_NOT_SUPPORTED
;
2523 WERROR
_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct
*p
, struct srvsvc_NETRPRNAMECANONICALIZE
*r
)
2525 p
->rng_fault_state
= True
;
2526 return WERR_NOT_SUPPORTED
;
2529 WERROR
_srvsvc_NetPRNameCompare(pipes_struct
*p
, struct srvsvc_NetPRNameCompare
*r
)
2531 p
->rng_fault_state
= True
;
2532 return WERR_NOT_SUPPORTED
;
2535 WERROR
_srvsvc_NetShareEnum(pipes_struct
*p
, struct srvsvc_NetShareEnum
*r
)
2537 p
->rng_fault_state
= True
;
2538 return WERR_NOT_SUPPORTED
;
2541 WERROR
_srvsvc_NetShareDelStart(pipes_struct
*p
, struct srvsvc_NetShareDelStart
*r
)
2543 p
->rng_fault_state
= True
;
2544 return WERR_NOT_SUPPORTED
;
2547 WERROR
_srvsvc_NetShareDelCommit(pipes_struct
*p
, struct srvsvc_NetShareDelCommit
*r
)
2549 p
->rng_fault_state
= True
;
2550 return WERR_NOT_SUPPORTED
;
2553 WERROR
_srvsvc_NetGetFileSecurity(pipes_struct
*p
, struct srvsvc_NetGetFileSecurity
*r
)
2555 p
->rng_fault_state
= True
;
2556 return WERR_NOT_SUPPORTED
;
2559 WERROR
_srvsvc_NetSetFileSecurity(pipes_struct
*p
, struct srvsvc_NetSetFileSecurity
*r
)
2561 p
->rng_fault_state
= True
;
2562 return WERR_NOT_SUPPORTED
;
2565 WERROR
_srvsvc_NetServerTransportAddEx(pipes_struct
*p
, struct srvsvc_NetServerTransportAddEx
*r
)
2567 p
->rng_fault_state
= True
;
2568 return WERR_NOT_SUPPORTED
;
2571 WERROR
_srvsvc_NetServerSetServiceBitsEx(pipes_struct
*p
, struct srvsvc_NetServerSetServiceBitsEx
*r
)
2573 p
->rng_fault_state
= True
;
2574 return WERR_NOT_SUPPORTED
;
2577 WERROR
_srvsvc_NETRDFSGETVERSION(pipes_struct
*p
, struct srvsvc_NETRDFSGETVERSION
*r
)
2579 p
->rng_fault_state
= True
;
2580 return WERR_NOT_SUPPORTED
;
2583 WERROR
_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct
*p
, struct srvsvc_NETRDFSCREATELOCALPARTITION
*r
)
2585 p
->rng_fault_state
= True
;
2586 return WERR_NOT_SUPPORTED
;
2589 WERROR
_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct
*p
, struct srvsvc_NETRDFSDELETELOCALPARTITION
*r
)
2591 p
->rng_fault_state
= True
;
2592 return WERR_NOT_SUPPORTED
;
2595 WERROR
_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct
*p
, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE
*r
)
2597 p
->rng_fault_state
= True
;
2598 return WERR_NOT_SUPPORTED
;
2601 WERROR
_srvsvc_NETRDFSSETSERVERINFO(pipes_struct
*p
, struct srvsvc_NETRDFSSETSERVERINFO
*r
)
2603 p
->rng_fault_state
= True
;
2604 return WERR_NOT_SUPPORTED
;
2607 WERROR
_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct
*p
, struct srvsvc_NETRDFSCREATEEXITPOINT
*r
)
2609 p
->rng_fault_state
= True
;
2610 return WERR_NOT_SUPPORTED
;
2613 WERROR
_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct
*p
, struct srvsvc_NETRDFSDELETEEXITPOINT
*r
)
2615 p
->rng_fault_state
= True
;
2616 return WERR_NOT_SUPPORTED
;
2619 WERROR
_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct
*p
, struct srvsvc_NETRDFSMODIFYPREFIX
*r
)
2621 p
->rng_fault_state
= True
;
2622 return WERR_NOT_SUPPORTED
;
2625 WERROR
_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct
*p
, struct srvsvc_NETRDFSFIXLOCALVOLUME
*r
)
2627 p
->rng_fault_state
= True
;
2628 return WERR_NOT_SUPPORTED
;
2631 WERROR
_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct
*p
, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO
*r
)
2633 p
->rng_fault_state
= True
;
2634 return WERR_NOT_SUPPORTED
;
2637 WERROR
_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct
*p
, struct srvsvc_NETRSERVERTRANSPORTDELEX
*r
)
2639 p
->rng_fault_state
= True
;
2640 return WERR_NOT_SUPPORTED
;