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.
28 extern int DEBUGLEVEL;
31 /*******************************************************************
32 makes a SH_INFO_1_STR structure
33 ********************************************************************/
34 void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
36 if (sh1 == NULL) return;
38 DEBUG(5,("make_srv_share_info1_str\n"));
40 make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name));
41 make_unistr2(&(sh1->uni_remark ), remark , strlen(remark ));
44 /*******************************************************************
45 reads or writes a structure.
46 ********************************************************************/
47 static void srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
49 if (sh1 == NULL) return;
51 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
56 smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth);
57 smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth);
60 /*******************************************************************
61 makes a SH_INFO_1 structure
62 ********************************************************************/
63 void make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
65 if (sh1 == NULL) return;
67 DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark));
69 sh1->ptr_netname = net_name != NULL ? 1 : 0;
71 sh1->ptr_remark = remark != NULL ? 1 : 0;
74 /*******************************************************************
75 reads or writes a structure.
76 ********************************************************************/
77 static void srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
79 if (sh1 == NULL) return;
81 prs_debug(ps, depth, desc, "srv_io_share_info1");
86 prs_uint32("ptr_netname", ps, depth, &(sh1->ptr_netname));
87 prs_uint32("type ", ps, depth, &(sh1->type ));
88 prs_uint32("ptr_remark ", ps, depth, &(sh1->ptr_remark));
91 /*******************************************************************
92 reads or writes a structure.
93 ********************************************************************/
94 static void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth)
96 if (ctr == NULL) return;
98 prs_debug(ps, depth, desc, "srv_io_share_1_ctr");
103 prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
104 prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
106 if (ctr->ptr_share_info != 0)
109 int num_entries = ctr->num_entries_read;
110 if (num_entries > MAX_SHARE_ENTRIES)
112 num_entries = MAX_SHARE_ENTRIES; /* report this! */
115 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
117 SMB_ASSERT_ARRAY(ctr->info_1, num_entries);
119 for (i = 0; i < num_entries; i++)
122 srv_io_share_info1("", &(ctr->info_1[i]), ps, depth);
125 for (i = 0; i < num_entries; i++)
128 srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth);
135 /*******************************************************************
136 makes a SH_INFO_2_STR structure
137 ********************************************************************/
138 void make_srv_share_info2_str(SH_INFO_2_STR *sh2,
139 char *net_name, char *remark,
140 char *path, char *passwd)
142 if (sh2 == NULL) return;
144 DEBUG(5,("make_srv_share_info2_str\n"));
146 make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1);
147 make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1);
148 make_unistr2(&(sh2->uni_path ), path , strlen(path )+1);
149 make_unistr2(&(sh2->uni_passwd ), passwd , strlen(passwd )+1);
152 /*******************************************************************
153 reads or writes a structure.
154 ********************************************************************/
155 static void srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
157 if (sh2 == NULL) return;
159 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
164 smb_io_unistr2("", &(sh2->uni_netname), True, ps, depth);
165 smb_io_unistr2("", &(sh2->uni_remark ), True, ps, depth);
166 smb_io_unistr2("", &(sh2->uni_path ), True, ps, depth);
167 smb_io_unistr2("", &(sh2->uni_passwd ), True, ps, depth);
170 /*******************************************************************
171 makes a SH_INFO_2 structure
172 ********************************************************************/
173 void make_srv_share_info2(SH_INFO_2 *sh2,
174 char *net_name, uint32 type, char *remark,
175 uint32 perms, uint32 max_uses, uint32 num_uses,
176 char *path, char *passwd)
178 if (sh2 == NULL) return;
180 DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark));
182 sh2->ptr_netname = net_name != NULL ? 1 : 0;
184 sh2->ptr_remark = remark != NULL ? 1 : 0;
186 sh2->max_uses = max_uses;
187 sh2->num_uses = num_uses;
189 sh2->ptr_path = path != NULL ? 1 : 0;
190 sh2->ptr_passwd = passwd != NULL ? 1 : 0;
193 /*******************************************************************
194 reads or writes a structure.
195 ********************************************************************/
196 static void srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
198 if (sh2 == NULL) return;
200 prs_debug(ps, depth, desc, "srv_io_share_info2");
205 prs_uint32("ptr_netname", ps, depth, &(sh2->ptr_netname));
206 prs_uint32("type ", ps, depth, &(sh2->type ));
207 prs_uint32("ptr_remark ", ps, depth, &(sh2->ptr_remark ));
208 prs_uint32("perms ", ps, depth, &(sh2->perms ));
209 prs_uint32("max_uses ", ps, depth, &(sh2->max_uses ));
210 prs_uint32("num_uses ", ps, depth, &(sh2->num_uses ));
211 prs_uint32("ptr_path ", ps, depth, &(sh2->ptr_path ));
212 prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd ));
215 /*******************************************************************
216 reads or writes a structure.
217 ********************************************************************/
218 static void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth)
220 if (ctr == NULL) return;
222 prs_debug(ps, depth, desc, "srv_io_share_2_ctr");
227 prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
228 prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
230 if (ctr->ptr_share_info != 0)
233 int num_entries = ctr->num_entries_read;
234 if (num_entries > MAX_SHARE_ENTRIES)
236 num_entries = MAX_SHARE_ENTRIES; /* report this! */
239 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
241 SMB_ASSERT_ARRAY(ctr->info_2, num_entries);
243 for (i = 0; i < num_entries; i++)
246 srv_io_share_info2("", &(ctr->info_2[i]), ps, depth);
249 for (i = 0; i < num_entries; i++)
252 srv_io_share_info2_str("", &(ctr->info_2_str[i]), ps, depth);
259 /*******************************************************************
260 reads or writes a structure.
261 ********************************************************************/
262 static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
264 if (ctr == NULL) return;
266 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
271 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
272 prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr));
274 if (ctr->ptr_share_ctr != 0)
276 switch (ctr->switch_value)
280 srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth);
285 srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth);
290 DEBUG(5,("%s no share info at switch_value %d\n",
291 tab_depth(depth), ctr->switch_value));
298 /*******************************************************************
299 reads or writes a structure.
300 ********************************************************************/
301 void srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
303 if (q_n == NULL) return;
305 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
310 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
311 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
315 prs_uint32("share_level", ps, depth, &(q_n->share_level ));
317 if (q_n->share_level != -1)
319 srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth);
322 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
324 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
327 /*******************************************************************
328 reads or writes a structure.
329 ********************************************************************/
330 void srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
332 if (r_n == NULL) return;
334 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
339 prs_uint32("share_level", ps, depth, &(r_n->share_level));
341 if (r_n->share_level != 0)
343 srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth);
346 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
347 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
348 prs_uint32("status ", ps, depth, &(r_n->status));
351 /*******************************************************************
352 makes a SESS_INFO_0_STR structure
353 ********************************************************************/
354 void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
356 if (ss0 == NULL) return;
358 DEBUG(5,("make_srv_sess_info0_str\n"));
360 make_unistr2(&(ss0->uni_name), name, strlen(name));
363 /*******************************************************************
364 reads or writes a structure.
365 ********************************************************************/
366 static void srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
368 if (ss0 == NULL) return;
370 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
375 smb_io_unistr2("", &(ss0->uni_name), True, ps, depth);
378 /*******************************************************************
379 makes a SESS_INFO_0 structure
380 ********************************************************************/
381 void make_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
383 if (ss0 == NULL) return;
385 DEBUG(5,("make_srv_sess_info0: %s\n", name));
387 ss0->ptr_name = name != NULL ? 1 : 0;
390 /*******************************************************************
391 reads or writes a structure.
392 ********************************************************************/
393 static void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
395 if (ss0 == NULL) return;
397 prs_debug(ps, depth, desc, "srv_io_sess_info0");
402 prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name));
405 /*******************************************************************
406 reads or writes a structure.
407 ********************************************************************/
408 static void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
410 if (ss0 == NULL) return;
412 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
417 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
418 prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info));
420 if (ss0->ptr_sess_info != 0)
423 int num_entries = ss0->num_entries_read;
424 if (num_entries > MAX_SESS_ENTRIES)
426 num_entries = MAX_SESS_ENTRIES; /* report this! */
429 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
431 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
433 for (i = 0; i < num_entries; i++)
436 srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth);
439 for (i = 0; i < num_entries; i++)
442 srv_io_sess_info0_str("", &(ss0->info_0_str[i]), ps, depth);
449 /*******************************************************************
450 makes a SESS_INFO_1_STR structure
451 ********************************************************************/
452 void make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
454 if (ss1 == NULL) return;
456 DEBUG(5,("make_srv_sess_info1_str\n"));
458 make_unistr2(&(ss1->uni_name), name, strlen(name));
459 make_unistr2(&(ss1->uni_user), name, strlen(user));
462 /*******************************************************************
463 reads or writes a structure.
464 ********************************************************************/
465 static void srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
467 if (ss1 == NULL) return;
469 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
474 smb_io_unistr2("", &(ss1->uni_name), True, ps, depth);
475 smb_io_unistr2("", &(ss1->uni_user), True, ps, depth);
478 /*******************************************************************
479 makes a SESS_INFO_1 structure
480 ********************************************************************/
481 void make_srv_sess_info1(SESS_INFO_1 *ss1,
482 char *name, char *user,
483 uint32 num_opens, uint32 open_time, uint32 idle_time,
486 if (ss1 == NULL) return;
488 DEBUG(5,("make_srv_sess_info1: %s\n", name));
490 ss1->ptr_name = name != NULL ? 1 : 0;
491 ss1->ptr_user = user != NULL ? 1 : 0;
493 ss1->num_opens = num_opens;
494 ss1->open_time = open_time;
495 ss1->idle_time = idle_time;
496 ss1->user_flags = user_flags;
499 /*******************************************************************
500 reads or writes a structure.
501 ********************************************************************/
502 static void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
504 if (ss1 == NULL) return;
506 prs_debug(ps, depth, desc, "srv_io_sess_info1");
511 prs_uint32("ptr_name ", ps, depth, &(ss1->ptr_name ));
512 prs_uint32("ptr_user ", ps, depth, &(ss1->ptr_user ));
514 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
515 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
516 prs_uint32("idle_time ", ps, depth, &(ss1->idle_time ));
517 prs_uint32("user_flags", ps, depth, &(ss1->user_flags));
520 /*******************************************************************
521 reads or writes a structure.
522 ********************************************************************/
523 static void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
525 if (ss1 == NULL) return;
527 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
532 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
533 prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info));
535 if (ss1->ptr_sess_info != 0)
538 int num_entries = ss1->num_entries_read;
539 if (num_entries > MAX_SESS_ENTRIES)
541 num_entries = MAX_SESS_ENTRIES; /* report this! */
544 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
546 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
548 for (i = 0; i < num_entries; i++)
551 srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth);
554 for (i = 0; i < num_entries; i++)
557 srv_io_sess_info1_str("", &(ss1->info_1_str[i]), ps, depth);
564 /*******************************************************************
565 reads or writes a structure.
566 ********************************************************************/
567 static void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth)
569 if (ctr == NULL) return;
571 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
576 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
577 prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr));
579 if (ctr->ptr_sess_ctr != 0)
581 switch (ctr->switch_value)
585 srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth);
590 srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth);
595 DEBUG(5,("%s no session info at switch_value %d\n",
596 tab_depth(depth), ctr->switch_value));
603 /*******************************************************************
604 reads or writes a structure.
605 ********************************************************************/
606 void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
608 if (q_n == NULL) return;
610 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
615 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
616 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
620 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
621 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
625 prs_uint32("sess_level", ps, depth, &(q_n->sess_level ));
627 if (q_n->sess_level != -1)
629 srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth);
632 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
634 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
637 /*******************************************************************
638 reads or writes a structure.
639 ********************************************************************/
640 void srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
642 if (r_n == NULL) return;
644 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
649 prs_uint32("sess_level", ps, depth, &(r_n->sess_level));
651 if (r_n->sess_level != -1)
653 srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth);
656 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
657 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
658 prs_uint32("status ", ps, depth, &(r_n->status));
661 /*******************************************************************
662 makes a CONN_INFO_0 structure
663 ********************************************************************/
664 void make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
666 if (ss0 == NULL) return;
668 DEBUG(5,("make_srv_conn_info0\n"));
673 /*******************************************************************
674 reads or writes a structure.
675 ********************************************************************/
676 static void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
678 if (ss0 == NULL) return;
680 prs_debug(ps, depth, desc, "srv_io_conn_info0");
685 prs_uint32("id", ps, depth, &(ss0->id));
688 /*******************************************************************
689 reads or writes a structure.
690 ********************************************************************/
691 static void srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
693 if (ss0 == NULL) return;
695 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
700 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
701 prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info));
703 if (ss0->ptr_conn_info != 0)
706 int num_entries = ss0->num_entries_read;
707 if (num_entries > MAX_CONN_ENTRIES)
709 num_entries = MAX_CONN_ENTRIES; /* report this! */
712 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
714 for (i = 0; i < num_entries; i++)
717 srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth);
724 /*******************************************************************
725 makes a CONN_INFO_1_STR structure
726 ********************************************************************/
727 void make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
729 if (ss1 == NULL) return;
731 DEBUG(5,("make_srv_conn_info1_str\n"));
733 make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name));
734 make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name));
737 /*******************************************************************
738 reads or writes a structure.
739 ********************************************************************/
740 static void srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
742 if (ss1 == NULL) return;
744 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
749 smb_io_unistr2("", &(ss1->uni_usr_name), True, ps, depth);
750 smb_io_unistr2("", &(ss1->uni_net_name), True, ps, depth);
753 /*******************************************************************
754 makes a CONN_INFO_1 structure
755 ********************************************************************/
756 void make_srv_conn_info1(CONN_INFO_1 *ss1,
757 uint32 id, uint32 type,
758 uint32 num_opens, uint32 num_users, uint32 open_time,
759 char *usr_name, char *net_name)
761 if (ss1 == NULL) return;
763 DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name));
767 ss1->num_opens = num_opens ;
768 ss1->num_users = num_users;
769 ss1->open_time = open_time;
771 ss1->ptr_usr_name = usr_name != NULL ? 1 : 0;
772 ss1->ptr_net_name = net_name != NULL ? 1 : 0;
775 /*******************************************************************
776 reads or writes a structure.
777 ********************************************************************/
778 static void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
780 if (ss1 == NULL) return;
782 prs_debug(ps, depth, desc, "srv_io_conn_info1");
787 prs_uint32("id ", ps, depth, &(ss1->id ));
788 prs_uint32("type ", ps, depth, &(ss1->type ));
789 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
790 prs_uint32("num_users ", ps, depth, &(ss1->num_users ));
791 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
793 prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name));
794 prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name));
797 /*******************************************************************
798 reads or writes a structure.
799 ********************************************************************/
800 static void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
802 if (ss1 == NULL) return;
804 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
809 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
810 prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info));
812 if (ss1->ptr_conn_info != 0)
815 int num_entries = ss1->num_entries_read;
816 if (num_entries > MAX_CONN_ENTRIES)
818 num_entries = MAX_CONN_ENTRIES; /* report this! */
821 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
823 for (i = 0; i < num_entries; i++)
826 srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth);
829 for (i = 0; i < num_entries; i++)
832 srv_io_conn_info1_str("", &(ss1->info_1_str[i]), ps, depth);
839 /*******************************************************************
840 reads or writes a structure.
841 ********************************************************************/
842 static void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth)
844 if (ctr == NULL) return;
846 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
851 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
852 prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr));
854 if (ctr->ptr_conn_ctr != 0)
856 switch (ctr->switch_value)
860 srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth);
865 srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth);
870 DEBUG(5,("%s no connection info at switch_value %d\n",
871 tab_depth(depth), ctr->switch_value));
878 /*******************************************************************
879 reads or writes a structure.
880 ********************************************************************/
881 void srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
883 if (q_n == NULL) return;
885 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
890 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
891 smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth);
895 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
896 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
900 prs_uint32("conn_level", ps, depth, &(q_n->conn_level ));
902 if (q_n->conn_level != -1)
904 srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth);
907 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
909 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
912 /*******************************************************************
913 reads or writes a structure.
914 ********************************************************************/
915 void srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
917 if (r_n == NULL) return;
919 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
924 prs_uint32("conn_level", ps, depth, &(r_n->conn_level));
926 if (r_n->conn_level != -1)
928 srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth);
931 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
932 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
933 prs_uint32("status ", ps, depth, &(r_n->status));
936 /*******************************************************************
937 makes a FILE_INFO_3_STR structure
938 ********************************************************************/
939 void make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
941 if (fi3 == NULL) return;
943 DEBUG(5,("make_srv_file_info3_str\n"));
945 make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1);
946 make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1);
949 /*******************************************************************
950 reads or writes a structure.
951 ********************************************************************/
952 static void srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
954 if (sh1 == NULL) return;
956 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
961 smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth);
962 smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth);
965 /*******************************************************************
966 makes a FILE_INFO_3 structure
967 ********************************************************************/
968 void make_srv_file_info3(FILE_INFO_3 *fl3,
969 uint32 id, uint32 perms, uint32 num_locks,
970 char *path_name, char *user_name)
972 if (fl3 == NULL) return;
974 DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name));
978 fl3->num_locks = num_locks;
980 fl3->ptr_path_name = path_name != NULL ? 1 : 0;
981 fl3->ptr_user_name = user_name != NULL ? 1 : 0;
984 /*******************************************************************
985 reads or writes a structure.
986 ********************************************************************/
987 static void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
989 if (fl3 == NULL) return;
991 prs_debug(ps, depth, desc, "srv_io_file_info3");
996 prs_uint32("id ", ps, depth, &(fl3->id ));
997 prs_uint32("perms ", ps, depth, &(fl3->perms ));
998 prs_uint32("num_locks ", ps, depth, &(fl3->num_locks ));
999 prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name));
1000 prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name));
1003 /*******************************************************************
1004 reads or writes a structure.
1005 ********************************************************************/
1006 static void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1008 if (fl3 == NULL) return;
1010 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1015 prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read));
1016 prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info));
1017 if (fl3->ptr_file_info != 0)
1020 int num_entries = fl3->num_entries_read;
1021 if (num_entries > MAX_FILE_ENTRIES)
1023 num_entries = MAX_FILE_ENTRIES; /* report this! */
1026 prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2));
1028 for (i = 0; i < num_entries; i++)
1031 srv_io_file_info3("", &(fl3->info_3[i]), ps, depth);
1034 for (i = 0; i < num_entries; i++)
1037 srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth);
1044 /*******************************************************************
1045 reads or writes a structure.
1046 ********************************************************************/
1047 static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
1049 if (ctr == NULL) return;
1051 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1056 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1057 prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr));
1059 if (ctr->ptr_file_ctr != 0)
1061 switch (ctr->switch_value)
1065 srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth);
1070 DEBUG(5,("%s no file info at switch_value %d\n",
1071 tab_depth(depth), ctr->switch_value));
1078 /*******************************************************************
1079 reads or writes a structure.
1080 ********************************************************************/
1081 void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1083 if (q_n == NULL) return;
1085 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1090 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
1091 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1095 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1096 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
1100 prs_uint32("file_level", ps, depth, &(q_n->file_level ));
1102 if (q_n->file_level != -1)
1104 srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth);
1107 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1109 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1112 /*******************************************************************
1113 reads or writes a structure.
1114 ********************************************************************/
1115 void srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1117 if (r_n == NULL) return;
1119 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1124 prs_uint32("file_level", ps, depth, &(r_n->file_level));
1126 if (r_n->file_level != 0)
1128 srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth);
1131 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1132 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1133 prs_uint32("status ", ps, depth, &(r_n->status));
1136 /*******************************************************************
1137 makes a SRV_INFO_101 structure.
1138 ********************************************************************/
1139 void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
1140 uint32 ver_major, uint32 ver_minor,
1141 uint32 srv_type, char *comment)
1143 if (sv101 == NULL) return;
1145 DEBUG(5,("make_srv_info_101\n"));
1147 sv101->platform_id = platform_id;
1148 make_buf_unistr2(&(sv101->uni_name ), &(sv101->ptr_name ) , name );
1149 sv101->ver_major = ver_major;
1150 sv101->ver_minor = ver_minor;
1151 sv101->srv_type = srv_type;
1152 make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment );
1156 /*******************************************************************
1157 reads or writes a SRV_INFO_101 structure.
1158 ********************************************************************/
1159 static void srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
1161 if (sv101 == NULL) return;
1163 prs_debug(ps, depth, desc, "srv_io_info_101");
1168 prs_uint32("platform_id ", ps, depth, &(sv101->platform_id ));
1169 prs_uint32("ptr_name ", ps, depth, &(sv101->ptr_name ));
1170 prs_uint32("ver_major ", ps, depth, &(sv101->ver_major ));
1171 prs_uint32("ver_minor ", ps, depth, &(sv101->ver_minor ));
1172 prs_uint32("srv_type ", ps, depth, &(sv101->srv_type ));
1173 prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment ));
1177 smb_io_unistr2("uni_name ", &(sv101->uni_name ), True, ps, depth);
1178 smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth);
1181 /*******************************************************************
1182 makes a SRV_INFO_102 structure.
1183 ********************************************************************/
1184 void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
1185 char *comment, uint32 ver_major, uint32 ver_minor,
1186 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
1187 uint32 announce, uint32 ann_delta, uint32 licenses,
1190 if (sv102 == NULL) return;
1192 DEBUG(5,("make_srv_info_102\n"));
1194 sv102->platform_id = platform_id;
1195 make_buf_unistr2(&(sv102->uni_name ), &(sv102->ptr_name ), name );
1196 sv102->ver_major = ver_major;
1197 sv102->ver_minor = ver_minor;
1198 sv102->srv_type = srv_type;
1199 make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment );
1201 /* same as 101 up to here */
1203 sv102->users = users;
1205 sv102->hidden = hidden;
1206 sv102->announce = announce;
1207 sv102->ann_delta =ann_delta;
1208 sv102->licenses = licenses;
1209 make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path);
1213 /*******************************************************************
1214 reads or writes a SRV_INFO_102 structure.
1215 ********************************************************************/
1216 static void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
1218 if (sv102 == NULL) return;
1220 prs_debug(ps, depth, desc, "srv_io_info102");
1225 prs_uint32("platform_id ", ps, depth, &(sv102->platform_id ));
1226 prs_uint32("ptr_name ", ps, depth, &(sv102->ptr_name ));
1227 prs_uint32("ver_major ", ps, depth, &(sv102->ver_major ));
1228 prs_uint32("ver_minor ", ps, depth, &(sv102->ver_minor ));
1229 prs_uint32("srv_type ", ps, depth, &(sv102->srv_type ));
1230 prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment ));
1232 /* same as 101 up to here */
1234 prs_uint32("users ", ps, depth, &(sv102->users ));
1235 prs_uint32("disc ", ps, depth, &(sv102->disc ));
1236 prs_uint32("hidden ", ps, depth, &(sv102->hidden ));
1237 prs_uint32("announce ", ps, depth, &(sv102->announce ));
1238 prs_uint32("ann_delta ", ps, depth, &(sv102->ann_delta ));
1239 prs_uint32("licenses ", ps, depth, &(sv102->licenses ));
1240 prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path));
1242 smb_io_unistr2("uni_name ", &(sv102->uni_name ), True, ps, depth);
1244 smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth);
1246 smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth);
1249 /*******************************************************************
1250 reads or writes a SRV_INFO_102 structure.
1251 ********************************************************************/
1252 static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
1254 if (ctr == NULL) return;
1256 prs_debug(ps, depth, desc, "srv_io_info_ctr");
1261 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1262 prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr ));
1264 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL)
1266 switch (ctr->switch_value)
1270 srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth);
1275 srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth);
1280 DEBUG(5,("%s no server info at switch_value %d\n",
1281 tab_depth(depth), ctr->switch_value));
1289 /*******************************************************************
1290 reads or writes a structure.
1291 ********************************************************************/
1292 void srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
1294 if (q_n == NULL) return;
1296 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
1301 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1302 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1306 prs_uint32("switch_value ", ps, depth, &(q_n->switch_value));
1309 /*******************************************************************
1310 makes a SRV_R_NET_SRV_GET_INFO structure.
1311 ********************************************************************/
1312 void make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
1313 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
1315 if (srv == NULL) return;
1317 DEBUG(5,("make_srv_r_net_srv_get_info\n"));
1323 srv->ctr->switch_value = switch_value;
1324 srv->ctr->ptr_srv_ctr = 1;
1328 srv->ctr->switch_value = 0;
1329 srv->ctr->ptr_srv_ctr = 0;
1332 srv->status = status;
1335 /*******************************************************************
1336 reads or writes a structure.
1337 ********************************************************************/
1338 void srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
1340 if (r_n == NULL) return;
1342 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
1347 srv_io_info_ctr("ctr", r_n->ctr, ps, depth);
1349 prs_uint32("status ", ps, depth, &(r_n->status ));
1353 /*******************************************************************
1354 reads or writes a structure.
1355 ********************************************************************/
1356 void srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
1358 if (q_n == NULL) return;
1360 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
1365 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1366 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1369 /*******************************************************************
1370 reads or writes a TIME_OF_DAY_INFO structure.
1371 ********************************************************************/
1372 static void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
1374 if (tod == NULL) return;
1376 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
1381 prs_uint32("elapsedt ", ps, depth, &(tod->elapsedt ));
1382 prs_uint32("msecs ", ps, depth, &(tod->msecs ));
1383 prs_uint32("hours ", ps, depth, &(tod->hours ));
1384 prs_uint32("mins ", ps, depth, &(tod->mins ));
1385 prs_uint32("secs ", ps, depth, &(tod->secs ));
1386 prs_uint32("hunds ", ps, depth, &(tod->hunds ));
1387 prs_uint32("timezone ", ps, depth, &(tod->zone ));
1388 prs_uint32("tintervals ", ps, depth, &(tod->tintervals));
1389 prs_uint32("day ", ps, depth, &(tod->day ));
1390 prs_uint32("month ", ps, depth, &(tod->month ));
1391 prs_uint32("year ", ps, depth, &(tod->year ));
1392 prs_uint32("weekday ", ps, depth, &(tod->weekday ));
1396 /*******************************************************************
1397 makes a TIME_OF_DAY_INFO structure.
1398 ********************************************************************/
1399 void make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
1400 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
1401 uint32 zone, uint32 tintervals, uint32 day,
1402 uint32 month, uint32 year, uint32 weekday)
1404 if (tod == NULL) return;
1406 DEBUG(5,("make_time_of_day_info\n"));
1408 tod->elapsedt = elapsedt;
1415 tod->tintervals = tintervals;
1419 tod->weekday = weekday;
1423 /*******************************************************************
1424 reads or writes a structure.
1425 ********************************************************************/
1426 void srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
1428 if (r_n == NULL) return;
1430 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
1435 prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod));
1437 srv_io_time_of_day_info("tod", r_n->tod, ps, depth);
1439 prs_uint32("status ", ps, depth, &(r_n->status));