3 * Unix SMB/Netbios implementation.
5 * RPC Pipe client / server routines
6 * Copyright (C) Andrew Tridgell 1992-1997,
7 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
8 * Copyright (C) Paul Ashton 1997.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 extern int DEBUGLEVEL
;
30 extern pstring global_myname
;
32 /*******************************************************************
33 fill in a share info level 1 structure.
35 this function breaks the rule that i'd like to be in place, namely
36 it doesn't receive its data as arguments: it has to call lp_xxxx()
37 functions itself. yuck.
39 see ipc.c:fill_share_info()
41 ********************************************************************/
42 static void make_srv_share_1_info(SH_INFO_1
*sh1
,
43 SH_INFO_1_STR
*str1
, int snum
)
50 pstrcpy(net_name
, lp_servicename(snum
));
51 pstrcpy(remark
, lp_comment (snum
));
52 len_net_name
= strlen(net_name
);
54 /* work out the share type */
55 type
= STYPE_DISKTREE
;
57 if (lp_print_ok(snum
)) type
= STYPE_PRINTQ
;
58 if (strequal("IPC$", net_name
)) type
= STYPE_IPC
;
59 if (net_name
[len_net_name
] == '$') type
|= STYPE_HIDDEN
;
61 make_srv_share_info1 (sh1
, net_name
, type
, remark
);
62 make_srv_share_info1_str(str1
, net_name
, remark
);
65 /*******************************************************************
66 fill in a share info level 1 structure.
68 this function breaks the rule that i'd like to be in place, namely
69 it doesn't receive its data as arguments: it has to call lp_xxxx()
70 functions itself. yuck.
72 ********************************************************************/
73 static void make_srv_share_info_1(SRV_SHARE_INFO_1
*sh1
, uint32
*snum
, uint32
*svcs
)
75 uint32 num_entries
= 0;
76 (*svcs
) = lp_numservices();
84 DEBUG(5,("make_srv_share_1_sh1\n"));
86 for (; (*snum
) < (*svcs
) && num_entries
< MAX_SHARE_ENTRIES
; (*snum
)++)
88 if (lp_browseable((*snum
)) && lp_snum_ok((*snum
)))
90 make_srv_share_1_info(&(sh1
->info_1
[num_entries
]),
91 &(sh1
->info_1_str
[num_entries
]), (*snum
));
93 /* move on to creating next share */
98 sh1
->num_entries_read
= num_entries
;
99 sh1
->ptr_share_info
= num_entries
> 0 ? 1 : 0;
100 sh1
->num_entries_read2
= num_entries
;
102 if ((*snum
) >= (*svcs
))
108 /*******************************************************************
109 fill in a share info level 2 structure.
111 this function breaks the rule that i'd like to be in place, namely
112 it doesn't receive its data as arguments: it has to call lp_xxxx()
113 functions itself. yuck.
115 see ipc.c:fill_share_info()
117 ********************************************************************/
118 static void make_srv_share_2_info(SH_INFO_2
*sh2
,
119 SH_INFO_2_STR
*str2
, int snum
)
128 pstrcpy(net_name
, lp_servicename(snum
));
129 pstrcpy(remark
, lp_comment (snum
));
130 pstrcpy(path
, lp_pathname (snum
));
131 pstrcpy(passwd
, "");
132 len_net_name
= strlen(net_name
);
134 /* work out the share type */
135 type
= STYPE_DISKTREE
;
137 if (lp_print_ok(snum
)) type
= STYPE_PRINTQ
;
138 if (strequal("IPC$", net_name
)) type
= STYPE_IPC
;
139 if (net_name
[len_net_name
] == '$') type
|= STYPE_HIDDEN
;
141 make_srv_share_info2 (sh2
, net_name
, type
, remark
, 0, 0xffffffff, 1, path
, passwd
);
142 make_srv_share_info2_str(str2
, net_name
, remark
, path
, passwd
);
145 /*******************************************************************
146 fill in a share info level 2 structure.
148 this function breaks the rule that i'd like to be in place, namely
149 it doesn't receive its data as arguments: it has to call lp_xxxx()
150 functions itself. yuck.
152 ********************************************************************/
153 static void make_srv_share_info_2(SRV_SHARE_INFO_2
*sh2
, uint32
*snum
, uint32
*svcs
)
155 uint32 num_entries
= 0;
156 (*svcs
) = lp_numservices();
164 DEBUG(5,("make_srv_share_2_sh1\n"));
166 for (; (*snum
) < (*svcs
) && num_entries
< MAX_SHARE_ENTRIES
; (*snum
)++)
168 if (lp_browseable((*snum
)) && lp_snum_ok((*snum
)))
170 make_srv_share_2_info(&(sh2
->info_2
[num_entries
]),
171 &(sh2
->info_2_str
[num_entries
]), (*snum
));
173 /* move on to creating next share */
178 sh2
->num_entries_read
= num_entries
;
179 sh2
->ptr_share_info
= num_entries
> 0 ? 1 : 0;
180 sh2
->num_entries_read2
= num_entries
;
182 if ((*snum
) >= (*svcs
))
188 /*******************************************************************
189 makes a SRV_R_NET_SHARE_ENUM structure.
190 ********************************************************************/
191 static uint32
make_srv_share_info_ctr(SRV_SHARE_INFO_CTR
*ctr
,
192 int switch_value
, uint32
*resume_hnd
, uint32
*total_entries
)
195 DEBUG(5,("make_srv_share_info_ctr: %d\n", __LINE__
));
197 ctr
->switch_value
= switch_value
;
199 switch (switch_value
)
203 make_srv_share_info_1(&(ctr
->share
.info1
), resume_hnd
, total_entries
);
204 ctr
->ptr_share_ctr
= 1;
209 make_srv_share_info_2(&(ctr
->share
.info2
), resume_hnd
, total_entries
);
210 ctr
->ptr_share_ctr
= 2;
215 DEBUG(5,("make_srv_share_info_ctr: unsupported switch value %d\n",
218 (*total_entries
) = 0;
219 ctr
->ptr_share_ctr
= 0;
220 status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
228 /*******************************************************************
229 makes a SRV_R_NET_SHARE_ENUM structure.
230 ********************************************************************/
231 static void make_srv_r_net_share_enum(SRV_R_NET_SHARE_ENUM
*r_n
,
232 uint32 resume_hnd
, int share_level
, int switch_value
)
234 DEBUG(5,("make_srv_r_net_share_enum: %d\n", __LINE__
));
236 r_n
->share_level
= share_level
;
237 if (share_level
== 0)
239 r_n
->status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
243 r_n
->status
= make_srv_share_info_ctr(r_n
->ctr
, switch_value
, &resume_hnd
, &(r_n
->total_entries
));
245 if (r_n
->status
!= 0x0)
249 make_enum_hnd(&(r_n
->enum_hnd
), resume_hnd
);
252 /*******************************************************************
254 ********************************************************************/
255 static void srv_reply_net_share_enum(SRV_Q_NET_SHARE_ENUM
*q_n
,
258 SRV_R_NET_SHARE_ENUM r_n
;
259 SRV_SHARE_INFO_CTR ctr
;
263 DEBUG(5,("srv_net_share_enum: %d\n", __LINE__
));
266 make_srv_r_net_share_enum(&r_n
,
267 get_enum_hnd(&q_n
->enum_hnd
),
269 q_n
->ctr
->switch_value
);
271 /* store the response in the SMB stream */
272 srv_io_r_net_share_enum("", &r_n
, rdata
, 0);
274 DEBUG(5,("srv_net_share_enum: %d\n", __LINE__
));
277 /*******************************************************************
278 fill in a sess info level 1 structure.
280 this function breaks the rule that i'd like to be in place, namely
281 it doesn't receive its data as arguments: it has to call lp_xxxx()
282 functions itself. yuck.
284 ********************************************************************/
285 static void make_srv_sess_0_info(SESS_INFO_0
*se0
, SESS_INFO_0_STR
*str0
,
288 make_srv_sess_info0 (se0
, name
);
289 make_srv_sess_info0_str(str0
, name
);
292 /*******************************************************************
293 fill in a sess info level 0 structure.
295 this function breaks the rule that i'd like to be in place, namely
296 it doesn't receive its data as arguments: it has to call lp_xxxx()
297 functions itself. yuck.
299 ********************************************************************/
300 static void make_srv_sess_info_0(SRV_SESS_INFO_0
*ss0
, uint32
*snum
, uint32
*stot
)
302 uint32 num_entries
= 0;
311 DEBUG(5,("make_srv_sess_0_ss0\n"));
315 for (; (*snum
) < (*stot
) && num_entries
< MAX_SESS_ENTRIES
; (*snum
)++)
317 make_srv_sess_0_info(&(ss0
->info_0
[num_entries
]),
318 &(ss0
->info_0_str
[num_entries
]), "MACHINE");
320 /* move on to creating next session */
321 /* move on to creating next sess */
325 ss0
->num_entries_read
= num_entries
;
326 ss0
->ptr_sess_info
= num_entries
> 0 ? 1 : 0;
327 ss0
->num_entries_read2
= num_entries
;
329 if ((*snum
) >= (*stot
))
336 ss0
->num_entries_read
= 0;
337 ss0
->ptr_sess_info
= 0;
338 ss0
->num_entries_read2
= 0;
342 /*******************************************************************
343 fill in a sess info level 1 structure.
345 this function breaks the rule that i'd like to be in place, namely
346 it doesn't receive its data as arguments: it has to call lp_xxxx()
347 functions itself. yuck.
349 ********************************************************************/
350 static void make_srv_sess_1_info(SESS_INFO_1
*se1
, SESS_INFO_1_STR
*str1
,
351 char *name
, char *user
,
353 uint32 open_time
, uint32 idle_time
,
356 make_srv_sess_info1 (se1
, name
, user
, num_opens
, open_time
, idle_time
, usr_flgs
);
357 make_srv_sess_info1_str(str1
, name
, user
);
360 /*******************************************************************
361 fill in a sess info level 1 structure.
363 this function breaks the rule that i'd like to be in place, namely
364 it doesn't receive its data as arguments: it has to call lp_xxxx()
365 functions itself. yuck.
367 ********************************************************************/
368 static void make_srv_sess_info_1(SRV_SESS_INFO_1
*ss1
, uint32
*snum
, uint32
*stot
)
370 uint32 num_entries
= 0;
379 DEBUG(5,("make_srv_sess_1_ss1\n"));
383 for (; (*snum
) < (*stot
) && num_entries
< MAX_SESS_ENTRIES
; (*snum
)++)
385 make_srv_sess_1_info(&(ss1
->info_1
[num_entries
]),
386 &(ss1
->info_1_str
[num_entries
]),
387 "MACHINE", "dummy_user", 1, 10, 5, 0);
389 /* move on to creating next session */
390 /* move on to creating next sess */
394 ss1
->num_entries_read
= num_entries
;
395 ss1
->ptr_sess_info
= num_entries
> 0 ? 1 : 0;
396 ss1
->num_entries_read2
= num_entries
;
398 if ((*snum
) >= (*stot
))
405 ss1
->num_entries_read
= 0;
406 ss1
->ptr_sess_info
= 0;
407 ss1
->num_entries_read2
= 0;
413 /*******************************************************************
414 makes a SRV_R_NET_SESS_ENUM structure.
415 ********************************************************************/
416 static uint32
make_srv_sess_info_ctr(SRV_SESS_INFO_CTR
*ctr
,
417 int switch_value
, uint32
*resume_hnd
, uint32
*total_entries
)
420 DEBUG(5,("make_srv_sess_info_ctr: %d\n", __LINE__
));
422 ctr
->switch_value
= switch_value
;
424 switch (switch_value
)
428 make_srv_sess_info_0(&(ctr
->sess
.info0
), resume_hnd
, total_entries
);
429 ctr
->ptr_sess_ctr
= 1;
434 make_srv_sess_info_1(&(ctr
->sess
.info1
), resume_hnd
, total_entries
);
435 ctr
->ptr_sess_ctr
= 1;
440 DEBUG(5,("make_srv_sess_info_ctr: unsupported switch value %d\n",
443 (*total_entries
) = 0;
444 ctr
->ptr_sess_ctr
= 0;
445 status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
453 /*******************************************************************
454 makes a SRV_R_NET_SESS_ENUM structure.
455 ********************************************************************/
456 static void make_srv_r_net_sess_enum(SRV_R_NET_SESS_ENUM
*r_n
,
457 uint32 resume_hnd
, int sess_level
, int switch_value
)
459 DEBUG(5,("make_srv_r_net_sess_enum: %d\n", __LINE__
));
461 r_n
->sess_level
= sess_level
;
462 if (sess_level
== -1)
464 r_n
->status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
468 r_n
->status
= make_srv_sess_info_ctr(r_n
->ctr
, switch_value
, &resume_hnd
, &r_n
->total_entries
);
470 if (r_n
->status
!= 0x0)
474 make_enum_hnd(&(r_n
->enum_hnd
), resume_hnd
);
477 /*******************************************************************
479 ********************************************************************/
480 static void srv_reply_net_sess_enum(SRV_Q_NET_SESS_ENUM
*q_n
,
483 SRV_R_NET_SESS_ENUM r_n
;
484 SRV_SESS_INFO_CTR ctr
;
488 DEBUG(5,("srv_net_sess_enum: %d\n", __LINE__
));
491 make_srv_r_net_sess_enum(&r_n
,
492 get_enum_hnd(&q_n
->enum_hnd
),
494 q_n
->ctr
->switch_value
);
496 /* store the response in the SMB stream */
497 srv_io_r_net_sess_enum("", &r_n
, rdata
, 0);
499 DEBUG(5,("srv_net_sess_enum: %d\n", __LINE__
));
502 /*******************************************************************
503 fill in a conn info level 0 structure.
505 this function breaks the rule that i'd like to be in place, namely
506 it doesn't receive its data as arguments: it has to call lp_xxxx()
507 functions itself. yuck.
509 ********************************************************************/
510 static void make_srv_conn_info_0(SRV_CONN_INFO_0
*ss0
, uint32
*snum
, uint32
*stot
)
512 uint32 num_entries
= 0;
521 DEBUG(5,("make_srv_conn_0_ss0\n"));
525 for (; (*snum
) < (*stot
) && num_entries
< MAX_CONN_ENTRIES
; (*snum
)++)
527 make_srv_conn_info0(&(ss0
->info_0
[num_entries
]), (*stot
));
529 /* move on to creating next connection */
530 /* move on to creating next conn */
534 ss0
->num_entries_read
= num_entries
;
535 ss0
->ptr_conn_info
= num_entries
> 0 ? 1 : 0;
536 ss0
->num_entries_read2
= num_entries
;
540 if ((*snum
) >= (*stot
))
547 ss0
->num_entries_read
= 0;
548 ss0
->ptr_conn_info
= 0;
549 ss0
->num_entries_read2
= 0;
555 /*******************************************************************
556 fill in a conn info level 1 structure.
558 this function breaks the rule that i'd like to be in place, namely
559 it doesn't receive its data as arguments: it has to call lp_xxxx()
560 functions itself. yuck.
562 ********************************************************************/
563 static void make_srv_conn_1_info(CONN_INFO_1
*se1
, CONN_INFO_1_STR
*str1
,
564 uint32 id
, uint32 type
,
565 uint32 num_opens
, uint32 num_users
, uint32 open_time
,
566 char *usr_name
, char *net_name
)
568 make_srv_conn_info1 (se1
, id
, type
, num_opens
, num_users
, open_time
, usr_name
, net_name
);
569 make_srv_conn_info1_str(str1
, usr_name
, net_name
);
572 /*******************************************************************
573 fill in a conn info level 1 structure.
575 this function breaks the rule that i'd like to be in place, namely
576 it doesn't receive its data as arguments: it has to call lp_xxxx()
577 functions itself. yuck.
579 ********************************************************************/
580 static void make_srv_conn_info_1(SRV_CONN_INFO_1
*ss1
, uint32
*snum
, uint32
*stot
)
582 uint32 num_entries
= 0;
591 DEBUG(5,("make_srv_conn_1_ss1\n"));
595 for (; (*snum
) < (*stot
) && num_entries
< MAX_CONN_ENTRIES
; (*snum
)++)
597 make_srv_conn_1_info(&(ss1
->info_1
[num_entries
]),
598 &(ss1
->info_1_str
[num_entries
]),
599 (*stot
), 0x3, 1, 1, 3,"dummy_user", "IPC$");
601 /* move on to creating next connection */
602 /* move on to creating next conn */
606 ss1
->num_entries_read
= num_entries
;
607 ss1
->ptr_conn_info
= num_entries
> 0 ? 1 : 0;
608 ss1
->num_entries_read2
= num_entries
;
611 if ((*snum
) >= (*stot
))
618 ss1
->num_entries_read
= 0;
619 ss1
->ptr_conn_info
= 0;
620 ss1
->num_entries_read2
= 0;
626 /*******************************************************************
627 makes a SRV_R_NET_CONN_ENUM structure.
628 ********************************************************************/
629 static uint32
make_srv_conn_info_ctr(SRV_CONN_INFO_CTR
*ctr
,
630 int switch_value
, uint32
*resume_hnd
, uint32
*total_entries
)
633 DEBUG(5,("make_srv_conn_info_ctr: %d\n", __LINE__
));
635 ctr
->switch_value
= switch_value
;
637 switch (switch_value
)
641 make_srv_conn_info_0(&(ctr
->conn
.info0
), resume_hnd
, total_entries
);
642 ctr
->ptr_conn_ctr
= 1;
647 make_srv_conn_info_1(&(ctr
->conn
.info1
), resume_hnd
, total_entries
);
648 ctr
->ptr_conn_ctr
= 1;
653 DEBUG(5,("make_srv_conn_info_ctr: unsupported switch value %d\n",
656 (*total_entries
) = 0;
657 ctr
->ptr_conn_ctr
= 0;
658 status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
666 /*******************************************************************
667 makes a SRV_R_NET_CONN_ENUM structure.
668 ********************************************************************/
669 static void make_srv_r_net_conn_enum(SRV_R_NET_CONN_ENUM
*r_n
,
670 uint32 resume_hnd
, int conn_level
, int switch_value
)
672 DEBUG(5,("make_srv_r_net_conn_enum: %d\n", __LINE__
));
674 r_n
->conn_level
= conn_level
;
675 if (conn_level
== -1)
677 r_n
->status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
681 r_n
->status
= make_srv_conn_info_ctr(r_n
->ctr
, switch_value
, &resume_hnd
, &r_n
->total_entries
);
683 if (r_n
->status
!= 0x0)
687 make_enum_hnd(&(r_n
->enum_hnd
), resume_hnd
);
690 /*******************************************************************
692 ********************************************************************/
693 static void srv_reply_net_conn_enum(SRV_Q_NET_CONN_ENUM
*q_n
,
696 SRV_R_NET_CONN_ENUM r_n
;
697 SRV_CONN_INFO_CTR ctr
;
701 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__
));
704 make_srv_r_net_conn_enum(&r_n
,
705 get_enum_hnd(&q_n
->enum_hnd
),
707 q_n
->ctr
->switch_value
);
709 /* store the response in the SMB stream */
710 srv_io_r_net_conn_enum("", &r_n
, rdata
, 0);
712 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__
));
715 /*******************************************************************
716 fill in a file info level 3 structure.
717 ********************************************************************/
718 static void make_srv_file_3_info(FILE_INFO_3
*fl3
, FILE_INFO_3_STR
*str3
,
719 uint32 fnum
, uint32 perms
, uint32 num_locks
,
720 char *path_name
, char *user_name
)
722 make_srv_file_info3 (fl3
, fnum
, perms
, num_locks
, path_name
, user_name
);
723 make_srv_file_info3_str(str3
, path_name
, user_name
);
726 /*******************************************************************
727 fill in a file info level 3 structure.
729 this function breaks the rule that i'd like to be in place, namely
730 it doesn't receive its data as arguments: it has to call lp_xxxx()
731 functions itself. yuck.
733 ********************************************************************/
734 static void make_srv_file_info_3(SRV_FILE_INFO_3
*fl3
, uint32
*fnum
, uint32
*ftot
)
736 uint32 num_entries
= 0;
745 DEBUG(5,("make_srv_file_3_fl3\n"));
747 for (; (*fnum
) < (*ftot
) && num_entries
< MAX_FILE_ENTRIES
; (*fnum
)++)
749 make_srv_file_3_info(&(fl3
->info_3
[num_entries
]),
750 &(fl3
->info_3_str
[num_entries
]),
751 (*fnum
), 0x35, 0, "\\PIPE\\samr", "dummy user");
753 /* move on to creating next file */
757 fl3
->num_entries_read
= num_entries
;
758 fl3
->ptr_file_info
= num_entries
> 0 ? 1 : 0;
759 fl3
->num_entries_read2
= num_entries
;
761 if ((*fnum
) >= (*ftot
))
767 /*******************************************************************
768 makes a SRV_R_NET_FILE_ENUM structure.
769 ********************************************************************/
770 static uint32
make_srv_file_info_ctr(SRV_FILE_INFO_CTR
*ctr
,
771 int switch_value
, uint32
*resume_hnd
, uint32
*total_entries
)
774 DEBUG(5,("make_srv_file_info_ctr: %d\n", __LINE__
));
776 ctr
->switch_value
= switch_value
;
778 switch (switch_value
)
782 make_srv_file_info_3(&(ctr
->file
.info3
), resume_hnd
, total_entries
);
783 ctr
->ptr_file_ctr
= 1;
788 DEBUG(5,("make_srv_file_info_ctr: unsupported switch value %d\n",
791 (*total_entries
) = 0;
792 ctr
->ptr_file_ctr
= 0;
793 status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
801 /*******************************************************************
802 makes a SRV_R_NET_FILE_ENUM structure.
803 ********************************************************************/
804 static void make_srv_r_net_file_enum(SRV_R_NET_FILE_ENUM
*r_n
,
805 uint32 resume_hnd
, int file_level
, int switch_value
)
807 DEBUG(5,("make_srv_r_net_file_enum: %d\n", __LINE__
));
809 r_n
->file_level
= file_level
;
812 r_n
->status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
816 r_n
->status
= make_srv_file_info_ctr(r_n
->ctr
, switch_value
, &resume_hnd
, &(r_n
->total_entries
));
818 if (r_n
->status
!= 0x0)
822 make_enum_hnd(&(r_n
->enum_hnd
), resume_hnd
);
825 /*******************************************************************
827 ********************************************************************/
828 static void srv_reply_net_file_enum(SRV_Q_NET_FILE_ENUM
*q_n
,
831 SRV_R_NET_FILE_ENUM r_n
;
832 SRV_FILE_INFO_CTR ctr
;
836 DEBUG(5,("srv_net_file_enum: %d\n", __LINE__
));
839 make_srv_r_net_file_enum(&r_n
,
840 get_enum_hnd(&q_n
->enum_hnd
),
842 q_n
->ctr
->switch_value
);
844 /* store the response in the SMB stream */
845 srv_io_r_net_file_enum("", &r_n
, rdata
, 0);
847 DEBUG(5,("srv_net_file_enum: %d\n", __LINE__
));
850 /*******************************************************************
852 ********************************************************************/
853 static void srv_reply_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO
*q_n
,
856 SRV_R_NET_SRV_GET_INFO r_n
;
861 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__
));
863 switch (q_n
->switch_value
)
867 make_srv_info_102(&ctr
.srv
.sv102
,
868 500, global_myname
, lp_serverstring(),
869 5, 4, /* major/minor version - NT 5.4 :-) */
870 0x4100b, /* browsing stuff SV_TYPE_XXXX */
871 0xffffffff, /* users */
875 3000, /* announce delta */
876 100000, /* licenses */
877 "c:\\"); /* user path */
882 make_srv_info_101(&ctr
.srv
.sv101
,
884 5, 4, /* major/minor version - NT 5.4 :-) */
885 0x4100b, /* browsing stuff SV_TYPE_XXXX */
891 status
= 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS
;
896 /* set up the net server get info structure */
897 make_srv_r_net_srv_get_info(&r_n
, q_n
->switch_value
, &ctr
, status
);
899 /* store the response in the SMB stream */
900 srv_io_r_net_srv_get_info("", &r_n
, rdata
, 0);
902 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__
));
905 /*******************************************************************
906 ********************************************************************/
907 static void api_srv_net_srv_get_info( uint16 vuid
, prs_struct
*data
,
910 SRV_Q_NET_SRV_GET_INFO q_n
;
912 /* grab the net server get info */
913 srv_io_q_net_srv_get_info("", &q_n
, data
, 0);
915 /* construct reply. always indicate success */
916 srv_reply_net_srv_get_info(&q_n
, rdata
);
920 /*******************************************************************
921 ********************************************************************/
922 static void api_srv_net_file_enum( uint16 vuid
, prs_struct
*data
,
925 SRV_Q_NET_FILE_ENUM q_n
;
926 SRV_FILE_INFO_CTR ctr
;
930 /* grab the net file enum */
931 srv_io_q_net_file_enum("", &q_n
, data
, 0);
933 /* construct reply. always indicate success */
934 srv_reply_net_file_enum(&q_n
, rdata
);
938 /*******************************************************************
939 ********************************************************************/
940 static void api_srv_net_conn_enum( uint16 vuid
, prs_struct
*data
,
943 SRV_Q_NET_CONN_ENUM q_n
;
944 SRV_CONN_INFO_CTR ctr
;
948 /* grab the net server get enum */
949 srv_io_q_net_conn_enum("", &q_n
, data
, 0);
951 /* construct reply. always indicate success */
952 srv_reply_net_conn_enum(&q_n
, rdata
);
956 /*******************************************************************
957 ********************************************************************/
958 static void api_srv_net_sess_enum( uint16 vuid
, prs_struct
*data
,
961 SRV_Q_NET_SESS_ENUM q_n
;
962 SRV_SESS_INFO_CTR ctr
;
966 /* grab the net server get enum */
967 srv_io_q_net_sess_enum("", &q_n
, data
, 0);
969 /* construct reply. always indicate success */
970 srv_reply_net_sess_enum(&q_n
, rdata
);
974 /*******************************************************************
975 ********************************************************************/
976 static void api_srv_net_share_enum( uint16 vuid
, prs_struct
*data
,
979 SRV_Q_NET_SHARE_ENUM q_n
;
980 SRV_SHARE_INFO_CTR ctr
;
984 /* grab the net server get enum */
985 srv_io_q_net_share_enum("", &q_n
, data
, 0);
987 /* construct reply. always indicate success */
988 srv_reply_net_share_enum(&q_n
, rdata
);
991 /*******************************************************************
993 ********************************************************************/
994 static void srv_reply_net_remote_tod(SRV_Q_NET_REMOTE_TOD
*q_n
,
997 SRV_R_NET_REMOTE_TOD r_n
;
998 TIME_OF_DAY_INFO tod
;
1000 time_t unixdate
= time(NULL
);
1003 r_n
.ptr_srv_tod
= 0x1;
1006 DEBUG(5,("srv_reply_net_remote_tod: %d\n", __LINE__
));
1008 t
= gmtime(&unixdate
);
1011 make_time_of_day_info(&tod
,
1018 TimeDiff(unixdate
)/60,
1025 /* store the response in the SMB stream */
1026 srv_io_r_net_remote_tod("", &r_n
, rdata
, 0);
1028 DEBUG(5,("srv_reply_net_remote_tod: %d\n", __LINE__
));
1030 /*******************************************************************
1031 ********************************************************************/
1032 static void api_srv_net_remote_tod( uint16 vuid
, prs_struct
*data
,
1035 SRV_Q_NET_REMOTE_TOD q_n
;
1037 /* grab the net server get enum */
1038 srv_io_q_net_remote_tod("", &q_n
, data
, 0);
1040 /* construct reply. always indicate success */
1041 srv_reply_net_remote_tod(&q_n
, rdata
);
1045 /*******************************************************************
1046 \PIPE\srvsvc commands
1047 ********************************************************************/
1048 struct api_struct api_srv_cmds
[] =
1050 { "SRV_NETCONNENUM" , SRV_NETCONNENUM
, api_srv_net_conn_enum
},
1051 { "SRV_NETSESSENUM" , SRV_NETSESSENUM
, api_srv_net_sess_enum
},
1052 { "SRV_NETSHAREENUM" , SRV_NETSHAREENUM
, api_srv_net_share_enum
},
1053 { "SRV_NETFILEENUM" , SRV_NETFILEENUM
, api_srv_net_file_enum
},
1054 { "SRV_NET_SRV_GET_INFO", SRV_NET_SRV_GET_INFO
, api_srv_net_srv_get_info
},
1055 { "SRV_NET_REMOTE_TOD" , SRV_NET_REMOTE_TOD
, api_srv_net_remote_tod
},
1059 /*******************************************************************
1060 receives a srvsvc pipe and responds.
1061 ********************************************************************/
1062 BOOL
api_srvsvc_rpc(pipes_struct
*p
, prs_struct
*data
)
1064 return api_rpcTNP(p
, "api_srvsvc_rpc", api_srv_cmds
, data
);