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.
9 * Copyright (C) Jeremy Allison 1999.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 extern int DEBUGLEVEL;
31 /*******************************************************************
32 Inits a SH_INFO_1_STR structure
33 ********************************************************************/
35 void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
37 DEBUG(5,("init_srv_share_info1_str\n"));
39 init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
40 init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
43 /*******************************************************************
44 Reads or writes a structure.
45 ********************************************************************/
47 static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
52 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
57 if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
62 if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
68 /*******************************************************************
69 makes a SH_INFO_1 structure
70 ********************************************************************/
72 void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
74 DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark));
76 sh1->ptr_netname = (net_name != NULL) ? 1 : 0;
78 sh1->ptr_remark = (remark != NULL) ? 1 : 0;
81 /*******************************************************************
82 Reads or writes a structure.
83 ********************************************************************/
85 static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
90 prs_debug(ps, depth, desc, "srv_io_share_info1");
96 if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname))
98 if(!prs_uint32("type ", ps, depth, &sh1->type))
100 if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark))
106 /*******************************************************************
107 Inits a SH_INFO_2_STR structure
108 ********************************************************************/
110 void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
111 char *net_name, char *remark,
112 char *path, char *passwd)
114 DEBUG(5,("init_srv_share_info2_str\n"));
116 init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
117 init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
118 init_unistr2(&sh2->uni_path, path, strlen(path)+1);
119 init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
122 /*******************************************************************
123 Reads or writes a structure.
124 ********************************************************************/
126 static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
131 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
136 if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
141 if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
146 if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
151 if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
157 /*******************************************************************
158 Inits a SH_INFO_2 structure
159 ********************************************************************/
161 void init_srv_share_info2(SH_INFO_2 *sh2,
162 char *net_name, uint32 type, char *remark,
163 uint32 perms, uint32 max_uses, uint32 num_uses,
164 char *path, char *passwd)
166 DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
168 sh2->ptr_netname = (net_name != NULL) ? 1 : 0;
170 sh2->ptr_remark = (remark != NULL) ? 1 : 0;
172 sh2->max_uses = max_uses;
173 sh2->num_uses = num_uses;
175 sh2->ptr_path = (path != NULL) ? 1 : 0;
176 sh2->ptr_passwd = (passwd != NULL) ? 1 : 0;
179 /*******************************************************************
180 Reads or writes a structure.
181 ********************************************************************/
183 static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
188 prs_debug(ps, depth, desc, "srv_io_share_info2");
194 if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname))
196 if(!prs_uint32("type ", ps, depth, &sh2->type))
198 if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark))
200 if(!prs_uint32("perms ", ps, depth, &sh2->perms))
202 if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses))
204 if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses))
206 if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path))
208 if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd))
214 /*******************************************************************
215 Inits a SH_INFO_502 structure
216 ********************************************************************/
218 void init_srv_share_info502(SH_INFO_502 *sh502,
219 char *net_name, uint32 type, char *remark,
220 uint32 perms, uint32 max_uses, uint32 num_uses,
221 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
223 DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
227 sh502->ptr_netname = (net_name != NULL) ? 1 : 0;
229 sh502->ptr_remark = (remark != NULL) ? 1 : 0;
230 sh502->perms = perms;
231 sh502->max_uses = max_uses;
232 sh502->num_uses = num_uses;
234 sh502->ptr_path = (path != NULL) ? 1 : 0;
235 sh502->ptr_passwd = (passwd != NULL) ? 1 : 0;
236 sh502->sd_size = (uint32)sd_size;
237 sh502->ptr_sd = (psd != NULL) ? 1 : 0;
240 /*******************************************************************
241 Reads or writes a structure.
242 ********************************************************************/
244 static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth)
249 prs_debug(ps, depth, desc, "srv_io_share_info502");
255 if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname))
257 if(!prs_uint32("type ", ps, depth, &sh502->type))
259 if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark))
261 if(!prs_uint32("perms ", ps, depth, &sh502->perms))
263 if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses))
265 if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses))
267 if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path))
269 if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
271 if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size))
273 if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd))
279 /*******************************************************************
280 Inits a SH_INFO_502_STR structure
281 ********************************************************************/
283 void init_srv_share_info502_str(SH_INFO_502_STR *sh502,
284 char *net_name, char *remark,
285 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
287 DEBUG(5,("init_srv_share_info502_str\n"));
289 init_unistr2(&sh502->uni_netname, net_name, strlen(net_name)+1);
290 init_unistr2(&sh502->uni_remark, remark, strlen(remark)+1);
291 init_unistr2(&sh502->uni_path, path, strlen(path)+1);
292 init_unistr2(&sh502->uni_passwd, passwd, strlen(passwd)+1);
294 sh502->sd_size = sd_size;
297 /*******************************************************************
298 Reads or writes a structure.
299 ********************************************************************/
301 static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
306 prs_debug(ps, depth, desc, "srv_io_share_info502_str");
311 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
316 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
321 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
326 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
332 if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size))
334 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
340 /*******************************************************************
341 Reads or writes a structure.
342 ********************************************************************/
343 static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005,
344 prs_struct* ps, int depth)
349 prs_debug(ps, depth, desc, "srv_io_share_info1005");
355 if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag))
361 /*******************************************************************
362 Reads or writes a structure.
363 ********************************************************************/
365 static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
370 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
373 if (UNMARSHALLING(ps)) {
374 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
380 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
383 if (ctr->info_level == 0)
386 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
388 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
391 if (ctr->ptr_share_info == 0)
394 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
396 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
399 if (ctr->ptr_entries == 0) {
400 if (ctr->num_entries == 0)
406 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
409 if (ctr->num_entries2 != ctr->num_entries)
412 switch (ctr->switch_value) {
415 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
416 int num_entries = ctr->num_entries;
419 if (UNMARSHALLING(ps)) {
420 if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1))))
422 ctr->share.info1 = info1;
425 for (i = 0; i < num_entries; i++) {
426 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
430 for (i = 0; i < num_entries; i++) {
431 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
440 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
441 int num_entries = ctr->num_entries;
444 if (UNMARSHALLING(ps)) {
445 if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2))))
447 ctr->share.info2 = info2;
450 for (i = 0; i < num_entries; i++) {
451 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
455 for (i = 0; i < num_entries; i++) {
456 if(!srv_io_share_info2_str("", &info2[i].info_2_str, ps, depth))
465 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
466 int num_entries = ctr->num_entries;
469 if (UNMARSHALLING(ps)) {
470 if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502))))
472 ctr->share.info502 = info502;
475 for (i = 0; i < num_entries; i++) {
476 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
480 for (i = 0; i < num_entries; i++) {
481 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
489 DEBUG(5,("%s no share info at switch_value %d\n",
490 tab_depth(depth), ctr->switch_value));
497 /*******************************************************************
498 Inits a SRV_Q_NET_SHARE_ENUM structure.
499 ********************************************************************/
501 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
502 char *srv_name, uint32 info_level,
503 uint32 preferred_len, ENUM_HND *hnd)
506 DEBUG(5,("init_q_net_share_enum\n"));
508 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
510 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
511 q_n->ctr.ptr_share_info = 0;
512 q_n->preferred_len = preferred_len;
514 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
517 /*******************************************************************
518 Reads or writes a structure.
519 ********************************************************************/
521 BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
526 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
532 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
534 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
537 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
543 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
546 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
552 /*******************************************************************
553 Reads or writes a structure.
554 ********************************************************************/
556 BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
561 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
564 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
570 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
572 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
574 if(!prs_uint32("status ", ps, depth, &r_n->status))
580 /*******************************************************************
581 Reads or writes a structure.
582 ********************************************************************/
584 BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
589 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
595 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
597 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
600 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
606 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
612 /*******************************************************************
613 Reads or writes a structure.
614 ********************************************************************/
616 static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
621 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
627 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
630 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
633 if (r_n->ptr_share_ctr != 0) {
634 switch (r_n->switch_value) {
636 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
639 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
644 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
647 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2_str, ps, depth))
652 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
655 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
659 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
662 DEBUG(5,("%s no share info at switch_value %d\n",
663 tab_depth(depth), r_n->switch_value));
671 /*******************************************************************
672 Reads or writes a structure.
673 ********************************************************************/
675 BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
680 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
686 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
692 if(!prs_uint32("status", ps, depth, &r_n->status))
698 /*******************************************************************
699 Reads or writes a structure.
700 ********************************************************************/
702 BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
707 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
713 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
715 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
718 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
724 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
730 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
736 /*******************************************************************
737 Reads or writes a structure.
738 ********************************************************************/
740 BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
745 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
751 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
753 if(!prs_uint32("status ", ps, depth, &q_n->status))
759 /*******************************************************************
760 Inits a SESS_INFO_0_STR structure
761 ********************************************************************/
763 void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
765 DEBUG(5,("init_srv_sess_info0_str\n"));
767 init_unistr2(&ss0->uni_name, name, strlen(name)+1);
770 /*******************************************************************
771 Reads or writes a structure.
772 ********************************************************************/
774 static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
779 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
785 if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth))
791 /*******************************************************************
792 Inits a SESS_INFO_0 structure
793 ********************************************************************/
795 void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
797 DEBUG(5,("init_srv_sess_info0: %s\n", name));
799 ss0->ptr_name = (name != NULL) ? 1 : 0;
802 /*******************************************************************
803 Reads or writes a structure.
804 ********************************************************************/
806 static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
811 prs_debug(ps, depth, desc, "srv_io_sess_info0");
817 if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name))
823 /*******************************************************************
824 Reads or writes a structure.
825 ********************************************************************/
827 static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
832 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
838 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
840 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
843 if (ss0->ptr_sess_info != 0) {
845 int num_entries = ss0->num_entries_read;
847 if (num_entries > MAX_SESS_ENTRIES) {
848 num_entries = MAX_SESS_ENTRIES; /* report this! */
851 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
854 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
856 for (i = 0; i < num_entries; i++) {
857 if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth))
861 for (i = 0; i < num_entries; i++) {
862 if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth))
873 /*******************************************************************
874 Inits a SESS_INFO_1_STR structure
875 ********************************************************************/
877 void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
879 DEBUG(5,("init_srv_sess_info1_str\n"));
881 init_unistr2(&ss1->uni_name, name, strlen(name)+1);
882 init_unistr2(&ss1->uni_user, name, strlen(user)+1);
885 /*******************************************************************
886 Reads or writes a structure.
887 ********************************************************************/
889 static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
894 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
900 if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth))
902 if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth))
908 /*******************************************************************
909 Inits a SESS_INFO_1 structure
910 ********************************************************************/
912 void init_srv_sess_info1(SESS_INFO_1 *ss1,
913 char *name, char *user,
914 uint32 num_opens, uint32 open_time, uint32 idle_time,
917 DEBUG(5,("init_srv_sess_info1: %s\n", name));
919 ss1->ptr_name = (name != NULL) ? 1 : 0;
920 ss1->ptr_user = (user != NULL) ? 1 : 0;
922 ss1->num_opens = num_opens;
923 ss1->open_time = open_time;
924 ss1->idle_time = idle_time;
925 ss1->user_flags = user_flags;
928 /*******************************************************************
929 reads or writes a structure.
930 ********************************************************************/
932 static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
937 prs_debug(ps, depth, desc, "srv_io_sess_info1");
943 if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name))
945 if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user))
948 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
950 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
952 if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time))
954 if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags))
960 /*******************************************************************
961 Reads or writes a structure.
962 ********************************************************************/
964 static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
969 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
975 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
977 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
980 if (ss1->ptr_sess_info != 0) {
982 int num_entries = ss1->num_entries_read;
984 if (num_entries > MAX_SESS_ENTRIES) {
985 num_entries = MAX_SESS_ENTRIES; /* report this! */
988 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
991 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
993 for (i = 0; i < num_entries; i++) {
994 if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth))
998 for (i = 0; i < num_entries; i++) {
999 if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth))
1010 /*******************************************************************
1011 Reads or writes a structure.
1012 ********************************************************************/
1014 static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1016 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1018 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1021 if(UNMARSHALLING(ps)) {
1022 ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR));
1033 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1035 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1038 if (ctr->ptr_sess_ctr != 0) {
1039 switch (ctr->switch_value) {
1041 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1045 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1049 DEBUG(5,("%s no session info at switch_value %d\n",
1050 tab_depth(depth), ctr->switch_value));
1058 /*******************************************************************
1059 Inits a SRV_Q_NET_SESS_ENUM structure.
1060 ********************************************************************/
1062 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
1063 char *srv_name, char *qual_name,
1064 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
1065 uint32 preferred_len,
1070 DEBUG(5,("init_q_net_sess_enum\n"));
1072 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1073 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1075 q_n->sess_level = sess_level;
1076 q_n->preferred_len = preferred_len;
1078 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1081 /*******************************************************************
1082 Reads or writes a structure.
1083 ********************************************************************/
1085 BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
1090 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1096 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1098 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1104 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1106 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1112 if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level))
1115 if (q_n->sess_level != -1) {
1116 if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth))
1120 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1123 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1129 /*******************************************************************
1130 Reads or writes a structure.
1131 ********************************************************************/
1133 BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1138 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1144 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1147 if (r_n->sess_level != -1) {
1148 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1152 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1154 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1156 if(!prs_uint32("status ", ps, depth, &r_n->status))
1162 /*******************************************************************
1163 Inits a CONN_INFO_0 structure
1164 ********************************************************************/
1166 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
1168 DEBUG(5,("init_srv_conn_info0\n"));
1173 /*******************************************************************
1174 Reads or writes a structure.
1175 ********************************************************************/
1177 static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1182 prs_debug(ps, depth, desc, "srv_io_conn_info0");
1188 if(!prs_uint32("id", ps, depth, &ss0->id))
1194 /*******************************************************************
1195 Reads or writes a structure.
1196 ********************************************************************/
1198 static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1203 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
1209 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1211 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
1214 if (ss0->ptr_conn_info != 0) {
1216 int num_entries = ss0->num_entries_read;
1218 if (num_entries > MAX_CONN_ENTRIES) {
1219 num_entries = MAX_CONN_ENTRIES; /* report this! */
1222 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1225 for (i = 0; i < num_entries; i++) {
1226 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
1237 /*******************************************************************
1238 Inits a CONN_INFO_1_STR structure
1239 ********************************************************************/
1241 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
1243 DEBUG(5,("init_srv_conn_info1_str\n"));
1245 init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1);
1246 init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1);
1249 /*******************************************************************
1250 Reads or writes a structure.
1251 ********************************************************************/
1253 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
1258 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
1264 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
1266 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
1272 /*******************************************************************
1273 Inits a CONN_INFO_1 structure
1274 ********************************************************************/
1276 void init_srv_conn_info1(CONN_INFO_1 *ss1,
1277 uint32 id, uint32 type,
1278 uint32 num_opens, uint32 num_users, uint32 open_time,
1279 char *usr_name, char *net_name)
1281 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
1285 ss1->num_opens = num_opens ;
1286 ss1->num_users = num_users;
1287 ss1->open_time = open_time;
1289 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
1290 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
1293 /*******************************************************************
1294 Reads or writes a structure.
1295 ********************************************************************/
1297 static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1302 prs_debug(ps, depth, desc, "srv_io_conn_info1");
1308 if(!prs_uint32("id ", ps, depth, &ss1->id))
1310 if(!prs_uint32("type ", ps, depth, &ss1->type))
1312 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1314 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
1316 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1319 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
1321 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
1327 /*******************************************************************
1328 Reads or writes a structure.
1329 ********************************************************************/
1331 static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1336 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
1342 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1344 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
1347 if (ss1->ptr_conn_info != 0) {
1349 int num_entries = ss1->num_entries_read;
1351 if (num_entries > MAX_CONN_ENTRIES) {
1352 num_entries = MAX_CONN_ENTRIES; /* report this! */
1355 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1358 for (i = 0; i < num_entries; i++) {
1359 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
1363 for (i = 0; i < num_entries; i++) {
1364 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
1375 /*******************************************************************
1376 Reads or writes a structure.
1377 ********************************************************************/
1379 static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1381 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
1383 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
1386 if (UNMARSHALLING(ps)) {
1387 ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR));
1398 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1400 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
1403 if (ctr->ptr_conn_ctr != 0) {
1404 switch (ctr->switch_value) {
1406 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
1410 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
1414 DEBUG(5,("%s no connection info at switch_value %d\n",
1415 tab_depth(depth), ctr->switch_value));
1423 /*******************************************************************
1424 Reads or writes a structure.
1425 ********************************************************************/
1427 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
1428 char *srv_name, char *qual_name,
1429 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
1430 uint32 preferred_len,
1433 DEBUG(5,("init_q_net_conn_enum\n"));
1437 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
1438 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1440 q_n->conn_level = conn_level;
1441 q_n->preferred_len = preferred_len;
1443 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1446 /*******************************************************************
1447 Reads or writes a structure.
1448 ********************************************************************/
1450 BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
1455 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
1461 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
1463 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
1469 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1471 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1477 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
1480 if (q_n->conn_level != -1) {
1481 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
1485 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1488 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1494 /*******************************************************************
1495 Reads or writes a structure.
1496 ********************************************************************/
1498 BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
1503 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
1509 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
1512 if (r_n->conn_level != -1) {
1513 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
1517 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1519 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1521 if(!prs_uint32("status ", ps, depth, &r_n->status))
1527 /*******************************************************************
1528 Inits a FILE_INFO_3_STR structure
1529 ********************************************************************/
1531 void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1533 DEBUG(5,("init_srv_file_info3_str\n"));
1535 init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1);
1536 init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1);
1539 /*******************************************************************
1540 Reads or writes a structure.
1541 ********************************************************************/
1543 static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1548 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1554 if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth))
1556 if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth))
1562 /*******************************************************************
1563 Inits a FILE_INFO_3 structure
1564 ********************************************************************/
1566 void init_srv_file_info3(FILE_INFO_3 *fl3,
1567 uint32 id, uint32 perms, uint32 num_locks,
1568 char *path_name, char *user_name)
1570 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name));
1574 fl3->num_locks = num_locks;
1576 fl3->ptr_path_name = (path_name != NULL) ? 1 : 0;
1577 fl3->ptr_user_name = (user_name != NULL) ? 1 : 0;
1580 /*******************************************************************
1581 Reads or writes a structure.
1582 ********************************************************************/
1584 static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1589 prs_debug(ps, depth, desc, "srv_io_file_info3");
1595 if(!prs_uint32("id ", ps, depth, &fl3->id))
1597 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
1599 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
1601 if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name))
1603 if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name))
1609 /*******************************************************************
1610 Reads or writes a structure.
1611 ********************************************************************/
1613 static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1618 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1624 if(!prs_uint32("num_entries_read", ps, depth, &fl3->num_entries_read))
1626 if(!prs_uint32("ptr_file_fl3", ps, depth, &fl3->ptr_file_info))
1629 if (fl3->ptr_file_info != 0) {
1631 int num_entries = fl3->num_entries_read;
1633 if (num_entries > MAX_FILE_ENTRIES) {
1634 num_entries = MAX_FILE_ENTRIES; /* report this! */
1637 if(!prs_uint32("num_entries_read2", ps, depth, &fl3->num_entries_read2))
1640 for (i = 0; i < num_entries; i++) {
1641 if(!srv_io_file_info3("", &fl3->info_3[i], ps, depth))
1645 for (i = 0; i < num_entries; i++) {
1646 if(!srv_io_file_info3_str("", &fl3->info_3_str[i], ps, depth))
1657 /*******************************************************************
1658 Reads or writes a structure.
1659 ********************************************************************/
1661 static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1663 SRV_FILE_INFO_CTR *ctr = *pp_ctr;
1665 if (UNMARSHALLING(ps)) {
1666 ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR));
1674 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1680 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1682 if(!prs_uint32("ptr_file_ctr", ps, depth, &ctr->ptr_file_ctr))
1685 if (ctr->ptr_file_ctr != 0) {
1686 switch (ctr->switch_value) {
1688 if(!srv_io_srv_file_info_3("", &ctr->file.info3, ps, depth))
1692 DEBUG(5,("%s no file info at switch_value %d\n",
1693 tab_depth(depth), ctr->switch_value));
1701 /*******************************************************************
1702 Inits a SRV_Q_NET_FILE_ENUM structure.
1703 ********************************************************************/
1705 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
1706 char *srv_name, char *qual_name,
1707 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1708 uint32 preferred_len,
1711 DEBUG(5,("init_q_net_file_enum\n"));
1715 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1716 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1718 q_n->file_level = file_level;
1719 q_n->preferred_len = preferred_len;
1721 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1724 /*******************************************************************
1725 Reads or writes a structure.
1726 ********************************************************************/
1728 BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1733 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1739 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1741 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1747 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1749 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1755 if(!prs_uint32("file_level", ps, depth, &q_n->file_level))
1758 if (q_n->file_level != -1) {
1759 if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth))
1763 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1766 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1772 /*******************************************************************
1773 Reads or writes a structure.
1774 ********************************************************************/
1776 BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1781 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1787 if(!prs_uint32("file_level", ps, depth, &r_n->file_level))
1790 if (r_n->file_level != 0) {
1791 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
1795 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1797 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1799 if(!prs_uint32("status ", ps, depth, &r_n->status))
1805 /*******************************************************************
1806 Inits a SRV_INFO_100 structure.
1807 ********************************************************************/
1809 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name)
1811 DEBUG(5,("init_srv_info_100\n"));
1813 sv100->platform_id = platform_id;
1814 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
1817 /*******************************************************************
1818 Reads or writes a SRV_INFO_101 structure.
1819 ********************************************************************/
1821 static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
1826 prs_debug(ps, depth, desc, "srv_io_info_100");
1832 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
1834 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
1837 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
1844 /*******************************************************************
1845 Inits a SRV_INFO_101 structure.
1846 ********************************************************************/
1848 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
1849 uint32 ver_major, uint32 ver_minor,
1850 uint32 srv_type, char *comment)
1852 DEBUG(5,("init_srv_info_101\n"));
1854 sv101->platform_id = platform_id;
1855 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
1856 sv101->ver_major = ver_major;
1857 sv101->ver_minor = ver_minor;
1858 sv101->srv_type = srv_type;
1859 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
1862 /*******************************************************************
1863 Reads or writes a SRV_INFO_101 structure.
1864 ********************************************************************/
1866 static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
1871 prs_debug(ps, depth, desc, "srv_io_info_101");
1877 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
1879 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
1881 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
1883 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
1885 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
1887 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
1893 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
1895 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
1901 /*******************************************************************
1902 Inits a SRV_INFO_102 structure.
1903 ********************************************************************/
1905 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
1906 char *comment, uint32 ver_major, uint32 ver_minor,
1907 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
1908 uint32 announce, uint32 ann_delta, uint32 licenses,
1911 DEBUG(5,("init_srv_info_102\n"));
1913 sv102->platform_id = platform_id;
1914 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
1915 sv102->ver_major = ver_major;
1916 sv102->ver_minor = ver_minor;
1917 sv102->srv_type = srv_type;
1918 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
1920 /* same as 101 up to here */
1922 sv102->users = users;
1924 sv102->hidden = hidden;
1925 sv102->announce = announce;
1926 sv102->ann_delta =ann_delta;
1927 sv102->licenses = licenses;
1928 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
1932 /*******************************************************************
1933 Reads or writes a SRV_INFO_102 structure.
1934 ********************************************************************/
1936 static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
1941 prs_debug(ps, depth, desc, "srv_io_info102");
1947 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
1949 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
1951 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
1953 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
1955 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
1957 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
1960 /* same as 101 up to here */
1962 if(!prs_uint32("users ", ps, depth, &sv102->users))
1964 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
1966 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
1968 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
1970 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
1972 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
1974 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
1977 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
1981 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
1985 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
1991 /*******************************************************************
1992 Reads or writes a SRV_INFO_102 structure.
1993 ********************************************************************/
1995 static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2000 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2006 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2008 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2011 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2012 switch (ctr->switch_value) {
2014 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2018 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2022 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2026 DEBUG(5,("%s no server info at switch_value %d\n",
2027 tab_depth(depth), ctr->switch_value));
2037 /*******************************************************************
2038 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2039 ********************************************************************/
2041 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2042 char *server_name, uint32 switch_value)
2044 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2046 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2048 srv->switch_value = switch_value;
2051 /*******************************************************************
2052 Reads or writes a structure.
2053 ********************************************************************/
2055 BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2060 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2066 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2068 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2074 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2080 /*******************************************************************
2081 Inits a SRV_R_NET_SRV_GET_INFO structure.
2082 ********************************************************************/
2084 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2085 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
2087 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2091 if (status == 0x0) {
2092 srv->ctr->switch_value = switch_value;
2093 srv->ctr->ptr_srv_ctr = 1;
2095 srv->ctr->switch_value = 0;
2096 srv->ctr->ptr_srv_ctr = 0;
2099 srv->status = status;
2102 /*******************************************************************
2103 Reads or writes a structure.
2104 ********************************************************************/
2106 BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
2111 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
2117 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
2120 if(!prs_uint32("status ", ps, depth, &r_n->status))
2127 /*******************************************************************
2128 Reads or writes a structure.
2129 ********************************************************************/
2131 BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
2136 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
2142 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2144 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2150 /*******************************************************************
2151 Reads or writes a TIME_OF_DAY_INFO structure.
2152 ********************************************************************/
2154 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
2159 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
2165 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
2167 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
2169 if(!prs_uint32("hours ", ps, depth, &tod->hours))
2171 if(!prs_uint32("mins ", ps, depth, &tod->mins))
2173 if(!prs_uint32("secs ", ps, depth, &tod->secs))
2175 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
2177 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
2179 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
2181 if(!prs_uint32("day ", ps, depth, &tod->day))
2183 if(!prs_uint32("month ", ps, depth, &tod->month))
2185 if(!prs_uint32("year ", ps, depth, &tod->year))
2187 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
2193 /*******************************************************************
2194 Inits a TIME_OF_DAY_INFO structure.
2195 ********************************************************************/
2197 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
2198 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
2199 uint32 zone, uint32 tintervals, uint32 day,
2200 uint32 month, uint32 year, uint32 weekday)
2202 DEBUG(5,("init_time_of_day_info\n"));
2204 tod->elapsedt = elapsedt;
2211 tod->tintervals = tintervals;
2215 tod->weekday = weekday;
2219 /*******************************************************************
2220 Reads or writes a structure.
2221 ********************************************************************/
2223 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
2228 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
2234 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
2237 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
2240 if(!prs_uint32("status ", ps, depth, &r_n->status))