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 *sh502str,
285 char *net_name, char *remark,
286 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
288 DEBUG(5,("init_srv_share_info502_str\n"));
290 sh502str->ptrs = ptrs;
292 if(sh502str->ptrs->ptr_netname)
293 init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1);
294 if(sh502str->ptrs->ptr_remark)
295 init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1);
296 if(sh502str->ptrs->ptr_path)
297 init_unistr2(&sh502str->uni_path, path, strlen(path)+1);
298 if(sh502str->ptrs->ptr_passwd)
299 init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1);
300 if(sh502str->ptrs->ptr_sd) {
302 sh502str->sd_size = sd_size;
306 /*******************************************************************
307 Reads or writes a structure.
308 ********************************************************************/
310 static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
315 prs_debug(ps, depth, desc, "srv_io_share_info502_str");
321 if(sh502->ptrs->ptr_netname) {
322 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
329 if(sh502->ptrs->ptr_remark) {
330 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
337 if(sh502->ptrs->ptr_path) {
338 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
345 if(sh502->ptrs->ptr_passwd) {
346 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
353 if(sh502->ptrs->ptr_sd) {
354 if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size))
356 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
363 /*******************************************************************
364 Reads or writes a structure.
365 ********************************************************************/
367 static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005,
368 prs_struct* ps, int depth)
373 prs_debug(ps, depth, desc, "srv_io_share_info1005");
379 if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag))
385 /*******************************************************************
386 Reads or writes a structure.
387 ********************************************************************/
389 static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501,
390 prs_struct* ps, int depth)
395 prs_debug(ps, depth, desc, "srv_io_share_info1501");
401 if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
407 /*******************************************************************
408 Reads or writes a structure.
409 ********************************************************************/
411 static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
416 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
419 if (UNMARSHALLING(ps)) {
420 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
426 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
429 if (ctr->info_level == 0)
432 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
434 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
437 if (ctr->ptr_share_info == 0)
440 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
442 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
445 if (ctr->ptr_entries == 0) {
446 if (ctr->num_entries == 0)
452 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
455 if (ctr->num_entries2 != ctr->num_entries)
458 switch (ctr->switch_value) {
461 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
462 int num_entries = ctr->num_entries;
465 if (UNMARSHALLING(ps)) {
466 if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1))))
468 ctr->share.info1 = info1;
471 for (i = 0; i < num_entries; i++) {
472 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
476 for (i = 0; i < num_entries; i++) {
477 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
486 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
487 int num_entries = ctr->num_entries;
490 if (UNMARSHALLING(ps)) {
491 if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2))))
493 ctr->share.info2 = info2;
496 for (i = 0; i < num_entries; i++) {
497 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
501 for (i = 0; i < num_entries; i++) {
502 if(!srv_io_share_info2_str("", &info2[i].info_2_str, ps, depth))
511 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
512 int num_entries = ctr->num_entries;
515 if (UNMARSHALLING(ps)) {
516 if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502))))
518 ctr->share.info502 = info502;
521 for (i = 0; i < num_entries; i++) {
522 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
526 for (i = 0; i < num_entries; i++) {
527 info502[i].info_502_str.ptrs = &info502[i].info_502;
528 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
536 DEBUG(5,("%s no share info at switch_value %d\n",
537 tab_depth(depth), ctr->switch_value));
544 /*******************************************************************
545 Inits a SRV_Q_NET_SHARE_ENUM structure.
546 ********************************************************************/
548 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
549 char *srv_name, uint32 info_level,
550 uint32 preferred_len, ENUM_HND *hnd)
553 DEBUG(5,("init_q_net_share_enum\n"));
555 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
557 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
558 q_n->ctr.ptr_share_info = 0;
559 q_n->preferred_len = preferred_len;
561 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
564 /*******************************************************************
565 Reads or writes a structure.
566 ********************************************************************/
568 BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
573 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
579 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
581 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
584 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
590 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
593 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
599 /*******************************************************************
600 Reads or writes a structure.
601 ********************************************************************/
603 BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
608 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
611 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
617 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
619 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
621 if(!prs_uint32("status ", ps, depth, &r_n->status))
627 /*******************************************************************
628 Reads or writes a structure.
629 ********************************************************************/
631 BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
636 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
642 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
644 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
647 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
653 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
659 /*******************************************************************
660 Reads or writes a structure.
661 ********************************************************************/
663 static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
668 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
674 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
677 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
680 if (r_n->ptr_share_ctr != 0) {
681 switch (r_n->switch_value) {
683 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
686 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
691 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
694 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2_str, ps, depth))
699 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
702 /*allow access to pointers in the str part. */
703 r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
705 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
709 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
713 if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
716 DEBUG(5,("%s no share info at switch_value %d\n",
717 tab_depth(depth), r_n->switch_value));
725 /*******************************************************************
726 Reads or writes a structure.
727 ********************************************************************/
729 BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
734 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
740 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
746 if(!prs_uint32("status", ps, depth, &r_n->status))
752 /*******************************************************************
753 Reads or writes a structure.
754 ********************************************************************/
756 BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
761 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
767 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
769 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
772 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
778 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
784 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
790 /*******************************************************************
791 Reads or writes a structure.
792 ********************************************************************/
794 BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
799 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
805 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
807 if(!prs_uint32("status ", ps, depth, &q_n->status))
813 /*******************************************************************
814 Reads or writes a structure.
815 ********************************************************************/
817 BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
822 prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
828 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
830 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
836 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
842 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
848 /*******************************************************************
849 Reads or writes a structure.
850 ********************************************************************/
852 BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
857 prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
863 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
865 if(!prs_uint32("status ", ps, depth, &q_n->status))
871 /*******************************************************************
872 Reads or writes a structure.
873 ********************************************************************/
875 BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
880 prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
886 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
888 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
891 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
897 /*******************************************************************
898 Reads or writes a structure.
899 ********************************************************************/
901 BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
906 prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
912 if(!prs_uint32("status ", ps, depth, &q_n->status))
918 /*******************************************************************
919 Inits a SESS_INFO_0_STR structure
920 ********************************************************************/
922 void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
924 DEBUG(5,("init_srv_sess_info0_str\n"));
926 init_unistr2(&ss0->uni_name, name, strlen(name)+1);
929 /*******************************************************************
930 Reads or writes a structure.
931 ********************************************************************/
933 static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
938 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
944 if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth))
950 /*******************************************************************
951 Inits a SESS_INFO_0 structure
952 ********************************************************************/
954 void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
956 DEBUG(5,("init_srv_sess_info0: %s\n", name));
958 ss0->ptr_name = (name != NULL) ? 1 : 0;
961 /*******************************************************************
962 Reads or writes a structure.
963 ********************************************************************/
965 static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
970 prs_debug(ps, depth, desc, "srv_io_sess_info0");
976 if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name))
982 /*******************************************************************
983 Reads or writes a structure.
984 ********************************************************************/
986 static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
991 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
997 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
999 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
1002 if (ss0->ptr_sess_info != 0) {
1004 int num_entries = ss0->num_entries_read;
1006 if (num_entries > MAX_SESS_ENTRIES) {
1007 num_entries = MAX_SESS_ENTRIES; /* report this! */
1010 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1013 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1015 for (i = 0; i < num_entries; i++) {
1016 if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth))
1020 for (i = 0; i < num_entries; i++) {
1021 if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth))
1032 /*******************************************************************
1033 Inits a SESS_INFO_1_STR structure
1034 ********************************************************************/
1036 void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
1038 DEBUG(5,("init_srv_sess_info1_str\n"));
1040 init_unistr2(&ss1->uni_name, name, strlen(name)+1);
1041 init_unistr2(&ss1->uni_user, name, strlen(user)+1);
1044 /*******************************************************************
1045 Reads or writes a structure.
1046 ********************************************************************/
1048 static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
1053 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
1059 if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth))
1061 if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth))
1067 /*******************************************************************
1068 Inits a SESS_INFO_1 structure
1069 ********************************************************************/
1071 void init_srv_sess_info1(SESS_INFO_1 *ss1,
1072 char *name, char *user,
1073 uint32 num_opens, uint32 open_time, uint32 idle_time,
1076 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1078 ss1->ptr_name = (name != NULL) ? 1 : 0;
1079 ss1->ptr_user = (user != NULL) ? 1 : 0;
1081 ss1->num_opens = num_opens;
1082 ss1->open_time = open_time;
1083 ss1->idle_time = idle_time;
1084 ss1->user_flags = user_flags;
1087 /*******************************************************************
1088 reads or writes a structure.
1089 ********************************************************************/
1091 static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1096 prs_debug(ps, depth, desc, "srv_io_sess_info1");
1102 if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name))
1104 if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user))
1107 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1109 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1111 if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time))
1113 if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags))
1119 /*******************************************************************
1120 Reads or writes a structure.
1121 ********************************************************************/
1123 static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1128 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1134 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1136 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1139 if (ss1->ptr_sess_info != 0) {
1141 int num_entries = ss1->num_entries_read;
1143 if (num_entries > MAX_SESS_ENTRIES) {
1144 num_entries = MAX_SESS_ENTRIES; /* report this! */
1147 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1150 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1152 for (i = 0; i < num_entries; i++) {
1153 if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth))
1157 for (i = 0; i < num_entries; i++) {
1158 if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth))
1169 /*******************************************************************
1170 Reads or writes a structure.
1171 ********************************************************************/
1173 static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1175 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1177 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1180 if(UNMARSHALLING(ps)) {
1181 ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR));
1192 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1194 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1197 if (ctr->ptr_sess_ctr != 0) {
1198 switch (ctr->switch_value) {
1200 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1204 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1208 DEBUG(5,("%s no session info at switch_value %d\n",
1209 tab_depth(depth), ctr->switch_value));
1217 /*******************************************************************
1218 Inits a SRV_Q_NET_SESS_ENUM structure.
1219 ********************************************************************/
1221 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
1222 char *srv_name, char *qual_name,
1223 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
1224 uint32 preferred_len,
1229 DEBUG(5,("init_q_net_sess_enum\n"));
1231 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1232 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1234 q_n->sess_level = sess_level;
1235 q_n->preferred_len = preferred_len;
1237 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1240 /*******************************************************************
1241 Reads or writes a structure.
1242 ********************************************************************/
1244 BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
1249 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1255 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1257 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1263 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1265 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1271 if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level))
1274 if (q_n->sess_level != -1) {
1275 if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth))
1279 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1282 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1288 /*******************************************************************
1289 Reads or writes a structure.
1290 ********************************************************************/
1292 BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1297 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1303 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1306 if (r_n->sess_level != -1) {
1307 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1311 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1313 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1315 if(!prs_uint32("status ", ps, depth, &r_n->status))
1321 /*******************************************************************
1322 Inits a CONN_INFO_0 structure
1323 ********************************************************************/
1325 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
1327 DEBUG(5,("init_srv_conn_info0\n"));
1332 /*******************************************************************
1333 Reads or writes a structure.
1334 ********************************************************************/
1336 static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1341 prs_debug(ps, depth, desc, "srv_io_conn_info0");
1347 if(!prs_uint32("id", ps, depth, &ss0->id))
1353 /*******************************************************************
1354 Reads or writes a structure.
1355 ********************************************************************/
1357 static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1362 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
1368 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1370 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
1373 if (ss0->ptr_conn_info != 0) {
1375 int num_entries = ss0->num_entries_read;
1377 if (num_entries > MAX_CONN_ENTRIES) {
1378 num_entries = MAX_CONN_ENTRIES; /* report this! */
1381 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1384 for (i = 0; i < num_entries; i++) {
1385 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
1396 /*******************************************************************
1397 Inits a CONN_INFO_1_STR structure
1398 ********************************************************************/
1400 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
1402 DEBUG(5,("init_srv_conn_info1_str\n"));
1404 init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1);
1405 init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1);
1408 /*******************************************************************
1409 Reads or writes a structure.
1410 ********************************************************************/
1412 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
1417 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
1423 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
1425 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
1431 /*******************************************************************
1432 Inits a CONN_INFO_1 structure
1433 ********************************************************************/
1435 void init_srv_conn_info1(CONN_INFO_1 *ss1,
1436 uint32 id, uint32 type,
1437 uint32 num_opens, uint32 num_users, uint32 open_time,
1438 char *usr_name, char *net_name)
1440 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
1444 ss1->num_opens = num_opens ;
1445 ss1->num_users = num_users;
1446 ss1->open_time = open_time;
1448 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
1449 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
1452 /*******************************************************************
1453 Reads or writes a structure.
1454 ********************************************************************/
1456 static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1461 prs_debug(ps, depth, desc, "srv_io_conn_info1");
1467 if(!prs_uint32("id ", ps, depth, &ss1->id))
1469 if(!prs_uint32("type ", ps, depth, &ss1->type))
1471 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1473 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
1475 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1478 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
1480 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
1486 /*******************************************************************
1487 Reads or writes a structure.
1488 ********************************************************************/
1490 static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1495 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
1501 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1503 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
1506 if (ss1->ptr_conn_info != 0) {
1508 int num_entries = ss1->num_entries_read;
1510 if (num_entries > MAX_CONN_ENTRIES) {
1511 num_entries = MAX_CONN_ENTRIES; /* report this! */
1514 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1517 for (i = 0; i < num_entries; i++) {
1518 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
1522 for (i = 0; i < num_entries; i++) {
1523 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
1534 /*******************************************************************
1535 Reads or writes a structure.
1536 ********************************************************************/
1538 static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1540 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
1542 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
1545 if (UNMARSHALLING(ps)) {
1546 ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR));
1557 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1559 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
1562 if (ctr->ptr_conn_ctr != 0) {
1563 switch (ctr->switch_value) {
1565 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
1569 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
1573 DEBUG(5,("%s no connection info at switch_value %d\n",
1574 tab_depth(depth), ctr->switch_value));
1582 /*******************************************************************
1583 Reads or writes a structure.
1584 ********************************************************************/
1586 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
1587 char *srv_name, char *qual_name,
1588 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
1589 uint32 preferred_len,
1592 DEBUG(5,("init_q_net_conn_enum\n"));
1596 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
1597 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1599 q_n->conn_level = conn_level;
1600 q_n->preferred_len = preferred_len;
1602 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1605 /*******************************************************************
1606 Reads or writes a structure.
1607 ********************************************************************/
1609 BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
1614 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
1620 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
1622 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
1628 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1630 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1636 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
1639 if (q_n->conn_level != -1) {
1640 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
1644 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1647 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1653 /*******************************************************************
1654 Reads or writes a structure.
1655 ********************************************************************/
1657 BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
1662 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
1668 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
1671 if (r_n->conn_level != -1) {
1672 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
1676 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1678 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1680 if(!prs_uint32("status ", ps, depth, &r_n->status))
1686 /*******************************************************************
1687 Inits a FILE_INFO_3_STR structure
1688 ********************************************************************/
1690 void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1692 DEBUG(5,("init_srv_file_info3_str\n"));
1694 init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1);
1695 init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1);
1698 /*******************************************************************
1699 Reads or writes a structure.
1700 ********************************************************************/
1702 static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1707 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1713 if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth))
1715 if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth))
1721 /*******************************************************************
1722 Inits a FILE_INFO_3 structure
1723 ********************************************************************/
1725 void init_srv_file_info3(FILE_INFO_3 *fl3,
1726 uint32 id, uint32 perms, uint32 num_locks,
1727 char *path_name, char *user_name)
1729 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name));
1733 fl3->num_locks = num_locks;
1735 fl3->ptr_path_name = (path_name != NULL) ? 1 : 0;
1736 fl3->ptr_user_name = (user_name != NULL) ? 1 : 0;
1739 /*******************************************************************
1740 Reads or writes a structure.
1741 ********************************************************************/
1743 static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1748 prs_debug(ps, depth, desc, "srv_io_file_info3");
1754 if(!prs_uint32("id ", ps, depth, &fl3->id))
1756 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
1758 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
1760 if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name))
1762 if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name))
1768 /*******************************************************************
1769 Reads or writes a structure.
1770 ********************************************************************/
1772 static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1777 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1783 if(!prs_uint32("num_entries_read", ps, depth, &fl3->num_entries_read))
1785 if(!prs_uint32("ptr_file_fl3", ps, depth, &fl3->ptr_file_info))
1788 if (fl3->ptr_file_info != 0) {
1790 int num_entries = fl3->num_entries_read;
1792 if (num_entries > MAX_FILE_ENTRIES) {
1793 num_entries = MAX_FILE_ENTRIES; /* report this! */
1796 if(!prs_uint32("num_entries_read2", ps, depth, &fl3->num_entries_read2))
1799 for (i = 0; i < num_entries; i++) {
1800 if(!srv_io_file_info3("", &fl3->info_3[i], ps, depth))
1804 for (i = 0; i < num_entries; i++) {
1805 if(!srv_io_file_info3_str("", &fl3->info_3_str[i], ps, depth))
1816 /*******************************************************************
1817 Reads or writes a structure.
1818 ********************************************************************/
1820 static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1822 SRV_FILE_INFO_CTR *ctr = *pp_ctr;
1824 if (UNMARSHALLING(ps)) {
1825 ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR));
1833 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1839 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1841 if(!prs_uint32("ptr_file_ctr", ps, depth, &ctr->ptr_file_ctr))
1844 if (ctr->ptr_file_ctr != 0) {
1845 switch (ctr->switch_value) {
1847 if(!srv_io_srv_file_info_3("", &ctr->file.info3, ps, depth))
1851 DEBUG(5,("%s no file info at switch_value %d\n",
1852 tab_depth(depth), ctr->switch_value));
1860 /*******************************************************************
1861 Inits a SRV_Q_NET_FILE_ENUM structure.
1862 ********************************************************************/
1864 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
1865 char *srv_name, char *qual_name,
1866 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1867 uint32 preferred_len,
1870 DEBUG(5,("init_q_net_file_enum\n"));
1874 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1875 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1877 q_n->file_level = file_level;
1878 q_n->preferred_len = preferred_len;
1880 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1883 /*******************************************************************
1884 Reads or writes a structure.
1885 ********************************************************************/
1887 BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1892 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1898 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1900 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1906 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1908 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1914 if(!prs_uint32("file_level", ps, depth, &q_n->file_level))
1917 if (q_n->file_level != -1) {
1918 if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth))
1922 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1925 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1931 /*******************************************************************
1932 Reads or writes a structure.
1933 ********************************************************************/
1935 BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1940 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1946 if(!prs_uint32("file_level", ps, depth, &r_n->file_level))
1949 if (r_n->file_level != 0) {
1950 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
1954 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1956 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1958 if(!prs_uint32("status ", ps, depth, &r_n->status))
1964 /*******************************************************************
1965 Inits a SRV_INFO_100 structure.
1966 ********************************************************************/
1968 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name)
1970 DEBUG(5,("init_srv_info_100\n"));
1972 sv100->platform_id = platform_id;
1973 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
1976 /*******************************************************************
1977 Reads or writes a SRV_INFO_101 structure.
1978 ********************************************************************/
1980 static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
1985 prs_debug(ps, depth, desc, "srv_io_info_100");
1991 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
1993 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
1996 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
2003 /*******************************************************************
2004 Inits a SRV_INFO_101 structure.
2005 ********************************************************************/
2007 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
2008 uint32 ver_major, uint32 ver_minor,
2009 uint32 srv_type, char *comment)
2011 DEBUG(5,("init_srv_info_101\n"));
2013 sv101->platform_id = platform_id;
2014 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2015 sv101->ver_major = ver_major;
2016 sv101->ver_minor = ver_minor;
2017 sv101->srv_type = srv_type;
2018 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2021 /*******************************************************************
2022 Reads or writes a SRV_INFO_101 structure.
2023 ********************************************************************/
2025 static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2030 prs_debug(ps, depth, desc, "srv_io_info_101");
2036 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2038 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2040 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2042 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2044 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2046 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2052 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2054 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2060 /*******************************************************************
2061 Inits a SRV_INFO_102 structure.
2062 ********************************************************************/
2064 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
2065 char *comment, uint32 ver_major, uint32 ver_minor,
2066 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2067 uint32 announce, uint32 ann_delta, uint32 licenses,
2070 DEBUG(5,("init_srv_info_102\n"));
2072 sv102->platform_id = platform_id;
2073 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2074 sv102->ver_major = ver_major;
2075 sv102->ver_minor = ver_minor;
2076 sv102->srv_type = srv_type;
2077 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2079 /* same as 101 up to here */
2081 sv102->users = users;
2083 sv102->hidden = hidden;
2084 sv102->announce = announce;
2085 sv102->ann_delta =ann_delta;
2086 sv102->licenses = licenses;
2087 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2091 /*******************************************************************
2092 Reads or writes a SRV_INFO_102 structure.
2093 ********************************************************************/
2095 static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2100 prs_debug(ps, depth, desc, "srv_io_info102");
2106 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2108 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2110 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2112 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2114 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2116 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2119 /* same as 101 up to here */
2121 if(!prs_uint32("users ", ps, depth, &sv102->users))
2123 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2125 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2127 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2129 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2131 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2133 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2136 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2140 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2144 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2150 /*******************************************************************
2151 Reads or writes a SRV_INFO_102 structure.
2152 ********************************************************************/
2154 static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2159 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2165 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2167 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2170 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2171 switch (ctr->switch_value) {
2173 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2177 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2181 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2185 DEBUG(5,("%s no server info at switch_value %d\n",
2186 tab_depth(depth), ctr->switch_value));
2196 /*******************************************************************
2197 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2198 ********************************************************************/
2200 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2201 char *server_name, uint32 switch_value)
2203 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2205 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2207 srv->switch_value = switch_value;
2210 /*******************************************************************
2211 Reads or writes a structure.
2212 ********************************************************************/
2214 BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2219 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2225 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2227 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2233 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2239 /*******************************************************************
2240 Inits a SRV_R_NET_SRV_GET_INFO structure.
2241 ********************************************************************/
2243 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2244 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
2246 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2250 if (status == 0x0) {
2251 srv->ctr->switch_value = switch_value;
2252 srv->ctr->ptr_srv_ctr = 1;
2254 srv->ctr->switch_value = 0;
2255 srv->ctr->ptr_srv_ctr = 0;
2258 srv->status = status;
2261 /*******************************************************************
2262 Reads or writes a structure.
2263 ********************************************************************/
2265 BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
2270 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
2276 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
2279 if(!prs_uint32("status ", ps, depth, &r_n->status))
2286 /*******************************************************************
2287 Reads or writes a structure.
2288 ********************************************************************/
2290 BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
2295 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
2301 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2303 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2309 /*******************************************************************
2310 Reads or writes a TIME_OF_DAY_INFO structure.
2311 ********************************************************************/
2313 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
2318 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
2324 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
2326 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
2328 if(!prs_uint32("hours ", ps, depth, &tod->hours))
2330 if(!prs_uint32("mins ", ps, depth, &tod->mins))
2332 if(!prs_uint32("secs ", ps, depth, &tod->secs))
2334 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
2336 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
2338 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
2340 if(!prs_uint32("day ", ps, depth, &tod->day))
2342 if(!prs_uint32("month ", ps, depth, &tod->month))
2344 if(!prs_uint32("year ", ps, depth, &tod->year))
2346 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
2352 /*******************************************************************
2353 Inits a TIME_OF_DAY_INFO structure.
2354 ********************************************************************/
2356 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
2357 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
2358 uint32 zone, uint32 tintervals, uint32 day,
2359 uint32 month, uint32 year, uint32 weekday)
2361 DEBUG(5,("init_time_of_day_info\n"));
2363 tod->elapsedt = elapsedt;
2370 tod->tintervals = tintervals;
2374 tod->weekday = weekday;
2378 /*******************************************************************
2379 Reads or writes a structure.
2380 ********************************************************************/
2382 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
2387 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
2393 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
2396 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
2399 if(!prs_uint32("status ", ps, depth, &r_n->status))
2405 /*******************************************************************
2406 Reads or writes a structure.
2407 ********************************************************************/
2409 BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
2414 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
2420 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2423 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2429 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
2432 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
2435 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
2441 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2443 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2449 /*******************************************************************
2450 Reads or writes a structure.
2451 ********************************************************************/
2453 BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
2460 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
2466 if(!prs_uint32("entries_read", ps, depth, &r_n->disk_enum_ctr.entries_read))
2468 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
2471 /*this may be max, unknown, actual?*/
2473 if(!prs_uint32("max_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
2475 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
2477 if(!prs_uint32("actual_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
2480 for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) {
2482 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
2485 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
2492 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2495 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2498 if(!prs_uint32("status", ps, depth, &r_n->status))
2504 /*******************************************************************
2505 Reads or writes a structure.
2506 ********************************************************************/
2508 BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
2513 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
2519 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2522 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2528 if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth))
2534 if(!prs_uint32("type", ps, depth, &q_n->type))
2537 if(!prs_uint32("flags", ps, depth, &q_n->flags))
2543 /*******************************************************************
2544 Reads or writes a structure.
2545 ********************************************************************/
2547 BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
2552 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
2558 if(!prs_uint32("status", ps, depth, &r_n->status))
2564 /*******************************************************************
2565 Reads or writes a structure.
2566 ********************************************************************/
2568 BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
2573 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
2579 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2582 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2588 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2591 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
2597 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
2600 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
2603 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
2606 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
2612 /*******************************************************************
2613 Reads or writes a structure.
2614 ********************************************************************/
2616 BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
2621 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
2627 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
2630 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
2633 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
2636 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
2639 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
2645 if(!prs_uint32("status", ps, depth, &r_n->status))
2651 /*******************************************************************
2652 Reads or writes a structure.
2653 ********************************************************************/
2655 BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
2660 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
2666 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2669 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2675 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2678 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
2684 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
2687 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
2690 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
2693 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
2696 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
2699 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
2705 /*******************************************************************
2706 Reads or writes a structure.
2707 ********************************************************************/
2709 BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
2714 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
2720 if(!prs_uint32("status", ps, depth, &r_n->status))