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;
303 struct connect_record *crec;
304 uint32 session_count;
306 if (!get_session_count(&crec, &session_count))
313 (*stot) = session_count;
315 DEBUG(0,("Session Count : %u\n",session_count));
326 DEBUG(0,("snum ok\n"));
327 for (; (*snum) < (*stot) && num_entries < MAX_SESS_ENTRIES; (*snum)++)
329 make_srv_sess_0_info(&(ss0->info_0 [num_entries]),
330 &(ss0->info_0_str[num_entries]), crec[num_entries].machine);
332 DEBUG(0,("make_srv_sess_0_info\n"));
333 /* move on to creating next session */
334 /* move on to creating next sess */
338 ss0->num_entries_read = num_entries;
339 ss0->ptr_sess_info = num_entries > 0 ? 1 : 0;
340 ss0->num_entries_read2 = num_entries;
342 if ((*snum) >= (*stot))
349 ss0->num_entries_read = 0;
350 ss0->ptr_sess_info = 0;
351 ss0->num_entries_read2 = 0;
356 /*******************************************************************
357 fill in a sess info level 1 structure.
359 this function breaks the rule that i'd like to be in place, namely
360 it doesn't receive its data as arguments: it has to call lp_xxxx()
361 functions itself. yuck.
363 ********************************************************************/
364 static void make_srv_sess_1_info(SESS_INFO_1 *se1, SESS_INFO_1_STR *str1,
365 char *name, char *user,
367 uint32 open_time, uint32 idle_time,
370 make_srv_sess_info1 (se1 , name, user, num_opens, open_time, idle_time, usr_flgs);
371 make_srv_sess_info1_str(str1, name, user);
374 /*******************************************************************
375 fill in a sess info level 1 structure.
377 this function breaks the rule that i'd like to be in place, namely
378 it doesn't receive its data as arguments: it has to call lp_xxxx()
379 functions itself. yuck.
381 ********************************************************************/
382 static void make_srv_sess_info_1(SRV_SESS_INFO_1 *ss1, uint32 *snum, uint32 *stot)
384 uint32 num_entries = 0;
385 struct connect_record *crec;
386 uint32 session_count;
388 if (!get_session_count(&crec, &session_count))
395 (*stot) = session_count;
397 DEBUG(0,("Session Count (info1) : %u\n",session_count));
405 DEBUG(5,("make_srv_sess_1_ss1\n"));
409 for (; (*snum) < (*stot) && num_entries < MAX_SESS_ENTRIES; (*snum)++)
411 DEBUG(0,("sess1 machine: %s, uid : %u\n",crec[num_entries].machine,crec[num_entries].uid));
412 make_srv_sess_1_info(&(ss1->info_1 [num_entries]),
413 &(ss1->info_1_str[num_entries]),
414 crec[num_entries].machine,
415 uidtoname(crec[num_entries].uid), 1, 10, 5, 0);
416 /* What are these on the End ??? */
418 /* move on to creating next session */
419 /* move on to creating next sess */
423 ss1->num_entries_read = num_entries;
424 ss1->ptr_sess_info = num_entries > 0 ? 1 : 0;
425 ss1->num_entries_read2 = num_entries;
427 if ((*snum) >= (*stot))
434 ss1->num_entries_read = 0;
435 ss1->ptr_sess_info = 0;
436 ss1->num_entries_read2 = 0;
443 /*******************************************************************
444 makes a SRV_R_NET_SESS_ENUM structure.
445 ********************************************************************/
446 static uint32 make_srv_sess_info_ctr(SRV_SESS_INFO_CTR *ctr,
447 int switch_value, uint32 *resume_hnd, uint32 *total_entries)
450 DEBUG(5,("make_srv_sess_info_ctr: %d\n", __LINE__));
452 ctr->switch_value = switch_value;
454 switch (switch_value)
458 make_srv_sess_info_0(&(ctr->sess.info0), resume_hnd, total_entries);
459 ctr->ptr_sess_ctr = 1;
464 make_srv_sess_info_1(&(ctr->sess.info1), resume_hnd, total_entries);
465 ctr->ptr_sess_ctr = 1;
470 DEBUG(5,("make_srv_sess_info_ctr: unsupported switch value %d\n",
473 (*total_entries) = 0;
474 ctr->ptr_sess_ctr = 0;
475 status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
483 /*******************************************************************
484 makes a SRV_R_NET_SESS_ENUM structure.
485 ********************************************************************/
486 static void make_srv_r_net_sess_enum(SRV_R_NET_SESS_ENUM *r_n,
487 uint32 resume_hnd, int sess_level, int switch_value)
489 DEBUG(5,("make_srv_r_net_sess_enum: %d\n", __LINE__));
491 r_n->sess_level = sess_level;
492 if (sess_level == -1)
494 r_n->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
498 r_n->status = make_srv_sess_info_ctr(r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries);
500 if (r_n->status != 0x0)
504 make_enum_hnd(&(r_n->enum_hnd), resume_hnd);
507 /*******************************************************************
509 ********************************************************************/
510 static void srv_reply_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
513 SRV_R_NET_SESS_ENUM r_n;
514 SRV_SESS_INFO_CTR ctr;
518 DEBUG(5,("srv_net_sess_enum: %d\n", __LINE__));
521 make_srv_r_net_sess_enum(&r_n,
522 get_enum_hnd(&q_n->enum_hnd),
524 q_n->ctr->switch_value);
526 /* store the response in the SMB stream */
527 srv_io_r_net_sess_enum("", &r_n, rdata, 0);
529 DEBUG(5,("srv_net_sess_enum: %d\n", __LINE__));
532 /*******************************************************************
533 fill in a conn info level 0 structure.
535 this function breaks the rule that i'd like to be in place, namely
536 it doesn't receive its data as arguments: it has to call lp_xxxx()
537 functions itself. yuck.
539 ********************************************************************/
540 static void make_srv_conn_info_0(SRV_CONN_INFO_0 *ss0, uint32 *snum, uint32 *stot)
542 uint32 num_entries = 0;
543 struct connect_record *crec;
544 uint32 connection_count;
546 if (!get_connection_status(&crec, &connection_count))
553 (*stot) = connection_count;
561 DEBUG(0,("make_srv_conn_0_ss0\n"));
565 for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++)
567 make_srv_conn_info0(&(ss0->info_0 [num_entries]), (*snum));
569 /* move on to creating next connection */
570 /* move on to creating next conn */
574 ss0->num_entries_read = num_entries;
575 ss0->ptr_conn_info = num_entries > 0 ? 1 : 0;
576 ss0->num_entries_read2 = num_entries;
580 if ((*snum) >= (*stot))
587 ss0->num_entries_read = 0;
588 ss0->ptr_conn_info = 0;
589 ss0->num_entries_read2 = 0;
597 /*******************************************************************
598 fill in a conn info level 1 structure.
600 this function breaks the rule that i'd like to be in place, namely
601 it doesn't receive its data as arguments: it has to call lp_xxxx()
602 functions itself. yuck.
604 ********************************************************************/
605 static void make_srv_conn_1_info(CONN_INFO_1 *se1, CONN_INFO_1_STR *str1,
606 uint32 id, uint32 type,
607 uint32 num_opens, uint32 num_users, uint32 open_time,
608 char *usr_name, char *net_name)
610 make_srv_conn_info1 (se1 , id, type, num_opens, num_users, open_time, usr_name, net_name);
611 make_srv_conn_info1_str(str1, usr_name, net_name);
614 /*******************************************************************
615 fill in a conn info level 1 structure.
617 this function breaks the rule that i'd like to be in place, namely
618 it doesn't receive its data as arguments: it has to call lp_xxxx()
619 functions itself. yuck.
621 ********************************************************************/
622 static void make_srv_conn_info_1(SRV_CONN_INFO_1 *ss1, uint32 *snum, uint32 *stot)
624 uint32 num_entries = 0;
628 struct connect_record *crec;
629 uint32 connection_count;
631 if (!get_connection_status(&crec, &connection_count))
638 (*stot) = connection_count;
646 current_time=time(NULL);
648 DEBUG(5,("make_srv_conn_1_ss1\n"));
652 for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++)
654 diff = current_time - crec[num_entries].start;
655 make_srv_conn_1_info(&(ss1->info_1 [num_entries]),
656 &(ss1->info_1_str[num_entries]),
657 (*snum), 0, 0, 1, diff,uidtoname(crec[num_entries].uid),
658 crec[num_entries].name);
660 /* FIXME : type of connection + number of locked files */
662 /* move on to creating next connection */
663 /* move on to creating next conn */
667 ss1->num_entries_read = num_entries;
668 ss1->ptr_conn_info = num_entries > 0 ? 1 : 0;
669 ss1->num_entries_read2 = num_entries;
672 if ((*snum) >= (*stot))
679 ss1->num_entries_read = 0;
680 ss1->ptr_conn_info = 0;
681 ss1->num_entries_read2 = 0;
689 /*******************************************************************
690 makes a SRV_R_NET_CONN_ENUM structure.
691 ********************************************************************/
692 static uint32 make_srv_conn_info_ctr(SRV_CONN_INFO_CTR *ctr,
693 int switch_value, uint32 *resume_hnd, uint32 *total_entries)
696 DEBUG(5,("make_srv_conn_info_ctr: %d\n", __LINE__));
698 ctr->switch_value = switch_value;
700 switch (switch_value)
704 make_srv_conn_info_0(&(ctr->conn.info0), resume_hnd, total_entries);
705 ctr->ptr_conn_ctr = 1;
710 make_srv_conn_info_1(&(ctr->conn.info1), resume_hnd, total_entries);
711 ctr->ptr_conn_ctr = 1;
716 DEBUG(5,("make_srv_conn_info_ctr: unsupported switch value %d\n",
719 (*total_entries) = 0;
720 ctr->ptr_conn_ctr = 0;
721 status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
729 /*******************************************************************
730 makes a SRV_R_NET_CONN_ENUM structure.
731 ********************************************************************/
732 static void make_srv_r_net_conn_enum(SRV_R_NET_CONN_ENUM *r_n,
733 uint32 resume_hnd, int conn_level, int switch_value)
735 DEBUG(5,("make_srv_r_net_conn_enum: %d\n", __LINE__));
737 r_n->conn_level = conn_level;
738 if (conn_level == -1)
740 r_n->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
744 r_n->status = make_srv_conn_info_ctr(r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries);
746 if (r_n->status != 0x0)
750 make_enum_hnd(&(r_n->enum_hnd), resume_hnd);
753 /*******************************************************************
755 ********************************************************************/
756 static void srv_reply_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
759 SRV_R_NET_CONN_ENUM r_n;
760 SRV_CONN_INFO_CTR ctr;
764 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__));
767 make_srv_r_net_conn_enum(&r_n,
768 get_enum_hnd(&q_n->enum_hnd),
770 q_n->ctr->switch_value);
772 /* store the response in the SMB stream */
773 srv_io_r_net_conn_enum("", &r_n, rdata, 0);
775 DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__));
778 /*******************************************************************
779 fill in a file info level 3 structure.
780 ********************************************************************/
781 static void make_srv_file_3_info(FILE_INFO_3 *fl3, FILE_INFO_3_STR *str3,
782 uint32 fnum, uint32 perms, uint32 num_locks,
783 char *path_name, char *user_name)
785 make_srv_file_info3 (fl3 , fnum, perms, num_locks, path_name, user_name);
786 make_srv_file_info3_str(str3, path_name, user_name);
789 /*******************************************************************
790 fill in a file info level 3 structure.
792 this function breaks the rule that i'd like to be in place, namely
793 it doesn't receive its data as arguments: it has to call lp_xxxx()
794 functions itself. yuck.
796 ********************************************************************/
797 static void make_srv_file_info_3(SRV_FILE_INFO_3 *fl3, uint32 *fnum, uint32 *ftot)
799 uint32 num_entries = 0;
808 DEBUG(5,("make_srv_file_3_fl3\n"));
810 for (; (*fnum) < (*ftot) && num_entries < MAX_FILE_ENTRIES; (*fnum)++)
812 make_srv_file_3_info(&(fl3->info_3 [num_entries]),
813 &(fl3->info_3_str[num_entries]),
814 (*fnum), 0x35, 0, "\\PIPE\\samr", "dummy user");
816 /* move on to creating next file */
820 fl3->num_entries_read = num_entries;
821 fl3->ptr_file_info = num_entries > 0 ? 1 : 0;
822 fl3->num_entries_read2 = num_entries;
824 if ((*fnum) >= (*ftot))
830 /*******************************************************************
831 makes a SRV_R_NET_FILE_ENUM structure.
832 ********************************************************************/
833 static uint32 make_srv_file_info_ctr(SRV_FILE_INFO_CTR *ctr,
834 int switch_value, uint32 *resume_hnd, uint32 *total_entries)
837 DEBUG(5,("make_srv_file_info_ctr: %d\n", __LINE__));
839 ctr->switch_value = switch_value;
841 switch (switch_value)
845 make_srv_file_info_3(&(ctr->file.info3), resume_hnd, total_entries);
846 ctr->ptr_file_ctr = 1;
851 DEBUG(5,("make_srv_file_info_ctr: unsupported switch value %d\n",
854 (*total_entries) = 0;
855 ctr->ptr_file_ctr = 0;
856 status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
864 /*******************************************************************
865 makes a SRV_R_NET_FILE_ENUM structure.
866 ********************************************************************/
867 static void make_srv_r_net_file_enum(SRV_R_NET_FILE_ENUM *r_n,
868 uint32 resume_hnd, int file_level, int switch_value)
870 DEBUG(5,("make_srv_r_net_file_enum: %d\n", __LINE__));
872 r_n->file_level = file_level;
875 r_n->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
879 r_n->status = make_srv_file_info_ctr(r_n->ctr, switch_value, &resume_hnd, &(r_n->total_entries));
881 if (r_n->status != 0x0)
885 make_enum_hnd(&(r_n->enum_hnd), resume_hnd);
888 /*******************************************************************
890 ********************************************************************/
891 static void srv_reply_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
894 SRV_R_NET_FILE_ENUM r_n;
895 SRV_FILE_INFO_CTR ctr;
899 DEBUG(5,("srv_net_file_enum: %d\n", __LINE__));
902 make_srv_r_net_file_enum(&r_n,
903 get_enum_hnd(&q_n->enum_hnd),
905 q_n->ctr->switch_value);
907 /* store the response in the SMB stream */
908 srv_io_r_net_file_enum("", &r_n, rdata, 0);
910 DEBUG(5,("srv_net_file_enum: %d\n", __LINE__));
913 /*******************************************************************
915 ********************************************************************/
916 static void srv_reply_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *q_n,
919 SRV_R_NET_SRV_GET_INFO r_n;
924 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__));
926 switch (q_n->switch_value)
930 make_srv_info_102(&ctr.srv.sv102,
931 500, /* platform id */
934 lp_major_announce_version(),
935 lp_minor_announce_version(),
936 lp_default_server_announce(),
937 0xffffffff, /* users */
941 3000, /* announce delta */
942 100000, /* licenses */
943 "c:\\"); /* user path */
948 make_srv_info_101(&ctr.srv.sv101,
949 500, /* platform id */
951 lp_major_announce_version(),
952 lp_minor_announce_version(),
953 lp_default_server_announce(),
959 status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
964 /* set up the net server get info structure */
965 make_srv_r_net_srv_get_info(&r_n, q_n->switch_value, &ctr, status);
967 /* store the response in the SMB stream */
968 srv_io_r_net_srv_get_info("", &r_n, rdata, 0);
970 DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__));
973 /*******************************************************************
974 ********************************************************************/
975 static void api_srv_net_srv_get_info( rpcsrv_struct *p, prs_struct *data,
978 SRV_Q_NET_SRV_GET_INFO q_n;
980 /* grab the net server get info */
981 srv_io_q_net_srv_get_info("", &q_n, data, 0);
983 /* construct reply. always indicate success */
984 srv_reply_net_srv_get_info(&q_n, rdata);
988 /*******************************************************************
989 ********************************************************************/
990 static void api_srv_net_file_enum( rpcsrv_struct *p, prs_struct *data,
993 SRV_Q_NET_FILE_ENUM q_n;
994 SRV_FILE_INFO_CTR ctr;
998 /* grab the net file enum */
999 srv_io_q_net_file_enum("", &q_n, data, 0);
1001 /* construct reply. always indicate success */
1002 srv_reply_net_file_enum(&q_n, rdata);
1006 /*******************************************************************
1007 ********************************************************************/
1008 static void api_srv_net_conn_enum( rpcsrv_struct *p, prs_struct *data,
1011 SRV_Q_NET_CONN_ENUM q_n;
1012 SRV_CONN_INFO_CTR ctr;
1016 /* grab the net server get enum */
1017 srv_io_q_net_conn_enum("", &q_n, data, 0);
1019 /* construct reply. always indicate success */
1020 srv_reply_net_conn_enum(&q_n, rdata);
1024 /*******************************************************************
1025 ********************************************************************/
1026 static void api_srv_net_sess_enum( rpcsrv_struct *p, prs_struct *data,
1029 SRV_Q_NET_SESS_ENUM q_n;
1030 SRV_SESS_INFO_CTR ctr;
1034 /* grab the net server get enum */
1035 srv_io_q_net_sess_enum("", &q_n, data, 0);
1037 /* construct reply. always indicate success */
1038 srv_reply_net_sess_enum(&q_n, rdata);
1042 /*******************************************************************
1043 ********************************************************************/
1044 static void api_srv_net_share_enum( rpcsrv_struct *p, prs_struct *data,
1047 SRV_Q_NET_SHARE_ENUM q_n;
1048 SRV_SHARE_INFO_CTR ctr;
1052 /* grab the net server get enum */
1053 srv_io_q_net_share_enum("", &q_n, data, 0);
1055 /* construct reply. always indicate success */
1056 srv_reply_net_share_enum(&q_n, rdata);
1059 /*******************************************************************
1061 ********************************************************************/
1062 static void srv_reply_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_n,
1065 SRV_R_NET_REMOTE_TOD r_n;
1066 TIME_OF_DAY_INFO tod;
1068 time_t unixdate = time(NULL);
1071 r_n.ptr_srv_tod = 0x1;
1074 DEBUG(5,("srv_reply_net_remote_tod: %d\n", __LINE__));
1076 t = gmtime(&unixdate);
1079 make_time_of_day_info(&tod,
1086 TimeDiff(unixdate)/60,
1093 /* store the response in the SMB stream */
1094 srv_io_r_net_remote_tod("", &r_n, rdata, 0);
1096 DEBUG(5,("srv_reply_net_remote_tod: %d\n", __LINE__));
1098 /*******************************************************************
1099 ********************************************************************/
1100 static void api_srv_net_remote_tod( rpcsrv_struct *p, prs_struct *data,
1103 SRV_Q_NET_REMOTE_TOD q_n;
1105 /* grab the net server get enum */
1106 srv_io_q_net_remote_tod("", &q_n, data, 0);
1108 /* construct reply. always indicate success */
1109 srv_reply_net_remote_tod(&q_n, rdata);
1113 /*******************************************************************
1114 \PIPE\srvsvc commands
1115 ********************************************************************/
1116 struct api_struct api_srv_cmds[] =
1118 { "SRV_NETCONNENUM" , SRV_NETCONNENUM , api_srv_net_conn_enum },
1119 { "SRV_NETSESSENUM" , SRV_NETSESSENUM , api_srv_net_sess_enum },
1120 { "SRV_NETSHAREENUM" , SRV_NETSHAREENUM , api_srv_net_share_enum },
1121 { "SRV_NETFILEENUM" , SRV_NETFILEENUM , api_srv_net_file_enum },
1122 { "SRV_NET_SRV_GET_INFO", SRV_NET_SRV_GET_INFO, api_srv_net_srv_get_info },
1123 { "SRV_NET_REMOTE_TOD" , SRV_NET_REMOTE_TOD , api_srv_net_remote_tod },
1127 /*******************************************************************
1128 receives a srvsvc pipe and responds.
1129 ********************************************************************/
1130 BOOL api_srvsvc_rpc(rpcsrv_struct *p, prs_struct *data)
1132 return api_rpcTNP(p, "api_srvsvc_rpc", api_srv_cmds, data);