2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997,
7 * Copyright (C) Jeremy Allison 1999,
8 * Copyright (C) Nigel Williams 2001,
9 * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002.
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 #define DBGC_CLASS DBGC_RPC_PARSE
31 /*******************************************************************
32 Inits a SH_INFO_0_STR structure
33 ********************************************************************/
35 void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name)
37 DEBUG(5,("init_srv_share_info0_str\n"));
40 init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1);
43 /*******************************************************************
44 Reads or writes a structure.
45 ********************************************************************/
47 static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth)
52 prs_debug(ps, depth, desc, "srv_io_share_info0_str");
57 if(sh0->ptrs->ptr_netname)
58 if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth))
64 /*******************************************************************
65 makes a SH_INFO_0 structure
66 ********************************************************************/
68 void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name)
70 DEBUG(5,("init_srv_share_info0: %s\n", net_name));
72 sh0->ptr_netname = (net_name != NULL) ? 1 : 0;
75 /*******************************************************************
76 Reads or writes a structure.
77 ********************************************************************/
79 static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth)
84 prs_debug(ps, depth, desc, "srv_io_share_info0");
90 if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname))
96 /*******************************************************************
97 Inits a SH_INFO_1_STR structure
98 ********************************************************************/
100 void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
102 DEBUG(5,("init_srv_share_info1_str\n"));
105 init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
107 init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
110 /*******************************************************************
111 Reads or writes a structure.
112 ********************************************************************/
114 static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
119 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
125 if(sh1->ptrs->ptr_netname)
126 if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
132 if(sh1->ptrs->ptr_remark)
133 if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
139 /*******************************************************************
140 makes a SH_INFO_1 structure
141 ********************************************************************/
143 void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
145 DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark));
147 sh1->ptr_netname = (net_name != NULL) ? 1 : 0;
149 sh1->ptr_remark = (remark != NULL) ? 1 : 0;
152 /*******************************************************************
153 Reads or writes a structure.
154 ********************************************************************/
156 static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
161 prs_debug(ps, depth, desc, "srv_io_share_info1");
167 if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname))
169 if(!prs_uint32("type ", ps, depth, &sh1->type))
171 if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark))
177 /*******************************************************************
178 Inits a SH_INFO_2_STR structure
179 ********************************************************************/
181 void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
182 char *net_name, char *remark,
183 char *path, char *passwd)
185 DEBUG(5,("init_srv_share_info2_str\n"));
188 init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
190 init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
192 init_unistr2(&sh2->uni_path, path, strlen(path)+1);
194 init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
197 /*******************************************************************
198 Reads or writes a structure.
199 ********************************************************************/
201 static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
206 if (UNMARSHALLING(ps))
209 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
216 if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
220 if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
224 if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
228 if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
234 /*******************************************************************
235 Inits a SH_INFO_2 structure
236 ********************************************************************/
238 void init_srv_share_info2(SH_INFO_2 *sh2,
239 char *net_name, uint32 type, char *remark,
240 uint32 perms, uint32 max_uses, uint32 num_uses,
241 char *path, char *passwd)
243 DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
245 sh2->ptr_netname = (net_name != NULL) ? 1 : 0;
247 sh2->ptr_remark = (remark != NULL) ? 1 : 0;
249 sh2->max_uses = max_uses;
250 sh2->num_uses = num_uses;
251 sh2->ptr_path = (path != NULL) ? 1 : 0;
252 sh2->ptr_passwd = (passwd != NULL) ? 1 : 0;
255 /*******************************************************************
256 Reads or writes a structure.
257 ********************************************************************/
259 static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
264 prs_debug(ps, depth, desc, "srv_io_share_info2");
270 if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname))
272 if(!prs_uint32("type ", ps, depth, &sh2->type))
274 if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark))
276 if(!prs_uint32("perms ", ps, depth, &sh2->perms))
278 if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses))
280 if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses))
282 if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path))
284 if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd))
290 /*******************************************************************
291 Inits a SH_INFO_501_STR structure
292 ********************************************************************/
294 void init_srv_share_info501_str(SH_INFO_501_STR *sh501,
295 char *net_name, char *remark)
297 DEBUG(5,("init_srv_share_info501_str\n"));
300 init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1);
302 init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1);
305 /*******************************************************************
306 Inits a SH_INFO_2 structure
307 *******************************************************************/
309 void init_srv_share_info501(SH_INFO_501 *sh501, char *net_name, uint32 type, char *remark, uint32 csc_policy)
311 DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type,
312 remark, csc_policy));
316 sh501->ptr_netname = (net_name != NULL) ? 1 : 0;
318 sh501->ptr_remark = (remark != NULL) ? 1 : 0;
319 sh501->csc_policy = csc_policy;
322 /*******************************************************************
323 Reads of writes a structure.
324 *******************************************************************/
326 static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth)
331 prs_debug(ps, depth, desc, "srv_io_share_info501");
337 if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname))
339 if (!prs_uint32("type ", ps, depth, &sh501->type))
341 if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark))
343 if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy))
349 /*******************************************************************
350 Reads or writes a structure.
351 ********************************************************************/
353 static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth)
358 prs_debug(ps, depth, desc, "srv_io_share_info501_str");
363 if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth))
368 if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth))
374 /*******************************************************************
375 Inits a SH_INFO_502 structure
376 ********************************************************************/
378 void init_srv_share_info502(SH_INFO_502 *sh502,
379 const char *net_name, uint32 type, char *remark,
380 uint32 perms, uint32 max_uses, uint32 num_uses,
381 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
383 DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
387 sh502->ptr_netname = (net_name != NULL) ? 1 : 0;
389 sh502->ptr_remark = (remark != NULL) ? 1 : 0;
390 sh502->perms = perms;
391 sh502->max_uses = max_uses;
392 sh502->num_uses = num_uses;
393 sh502->ptr_path = (path != NULL) ? 1 : 0;
394 sh502->ptr_passwd = (passwd != NULL) ? 1 : 0;
395 sh502->reserved = 0; /* actual size within rpc */
396 sh502->sd_size = (uint32)sd_size;
397 sh502->ptr_sd = (psd != NULL) ? 1 : 0;
400 /*******************************************************************
401 Reads or writes a structure.
402 ********************************************************************/
404 static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth)
409 prs_debug(ps, depth, desc, "srv_io_share_info502");
415 if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname))
417 if(!prs_uint32("type ", ps, depth, &sh502->type))
419 if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark))
421 if(!prs_uint32("perms ", ps, depth, &sh502->perms))
423 if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses))
425 if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses))
427 if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path))
429 if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
431 if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset))
433 if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd))
439 /*******************************************************************
440 Inits a SH_INFO_502_STR structure
441 ********************************************************************/
443 void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
444 char *net_name, char *remark,
445 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
447 DEBUG(5,("init_srv_share_info502_str\n"));
450 init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1);
452 init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1);
454 init_unistr2(&sh502str->uni_path, path, strlen(path)+1);
456 init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1);
458 sh502str->reserved = 0;
459 sh502str->sd_size = sd_size;
462 /*******************************************************************
463 Reads or writes a structure.
464 ********************************************************************/
466 static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
471 prs_debug(ps, depth, desc, "srv_io_share_info502_str");
477 if(sh502->ptrs->ptr_netname) {
478 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
485 if(sh502->ptrs->ptr_remark) {
486 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
493 if(sh502->ptrs->ptr_path) {
494 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
501 if(sh502->ptrs->ptr_passwd) {
502 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
509 if(sh502->ptrs->ptr_sd) {
511 uint32 reserved_offset;
513 if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset))
516 old_offset = prs_offset(ps);
518 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
521 if(UNMARSHALLING(ps)) {
523 sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd);
525 prs_set_offset(ps, old_offset + sh502->reserved);
530 if(MARSHALLING(ps)) {
532 sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset;
535 if(!prs_uint32_post("reserved ", ps, depth,
536 &sh502->reserved, reserved_offset, sh502->reserved))
538 if(!prs_uint32_post("reserved ", ps, depth,
539 &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved))
546 /*******************************************************************
547 Inits a SH_INFO_1004_STR structure
548 ********************************************************************/
550 void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark)
552 DEBUG(5,("init_srv_share_info1004_str\n"));
555 init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1);
558 /*******************************************************************
559 Reads or writes a structure.
560 ********************************************************************/
562 static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth)
567 prs_debug(ps, depth, desc, "srv_io_share_info1004_str");
572 if(sh1004->ptrs->ptr_remark)
573 if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth))
579 /*******************************************************************
580 makes a SH_INFO_1004 structure
581 ********************************************************************/
583 void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark)
585 DEBUG(5,("init_srv_share_info1004: %s\n", remark));
587 sh1004->ptr_remark = (remark != NULL) ? 1 : 0;
590 /*******************************************************************
591 Reads or writes a structure.
592 ********************************************************************/
594 static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth)
599 prs_debug(ps, depth, desc, "srv_io_share_info1004");
605 if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark))
611 /*******************************************************************
612 Reads or writes a structure.
613 ********************************************************************/
615 static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth)
620 prs_debug(ps, depth, desc, "srv_io_share_info1005");
626 if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag))
632 /*******************************************************************
633 Reads or writes a structure.
634 ********************************************************************/
636 static BOOL srv_io_share_info1006(char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth)
641 prs_debug(ps, depth, desc, "srv_io_share_info1006");
647 if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses))
653 /*******************************************************************
654 Inits a SH_INFO_1007_STR structure
655 ********************************************************************/
657 void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name)
659 DEBUG(5,("init_srv_share_info1007_str\n"));
661 if(alternate_directory_name)
662 init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1);
665 /*******************************************************************
666 Reads or writes a structure.
667 ********************************************************************/
669 static BOOL srv_io_share_info1007_str(char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth)
674 prs_debug(ps, depth, desc, "srv_io_share_info1007_str");
679 if(sh1007->ptrs->ptr_AlternateDirectoryName)
680 if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth))
686 /*******************************************************************
687 makes a SH_INFO_1007 structure
688 ********************************************************************/
690 void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name)
692 DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name));
694 sh1007->flags = flags;
695 sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0;
698 /*******************************************************************
699 Reads or writes a structure.
700 ********************************************************************/
702 static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth)
707 prs_debug(ps, depth, desc, "srv_io_share_info1007");
713 if(!prs_uint32("flags ", ps, depth, &sh1007->flags))
715 if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName))
721 /*******************************************************************
722 Reads or writes a structure.
723 ********************************************************************/
725 static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501,
726 prs_struct* ps, int depth)
731 prs_debug(ps, depth, desc, "srv_io_share_info1501");
737 if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
743 /*******************************************************************
744 Reads or writes a structure.
745 ********************************************************************/
747 static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
752 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
755 if (UNMARSHALLING(ps)) {
756 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
762 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
765 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
767 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
770 if (ctr->ptr_share_info == 0)
773 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
775 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
778 if (ctr->ptr_entries == 0) {
779 if (ctr->num_entries == 0)
785 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
788 if (ctr->num_entries2 != ctr->num_entries)
791 switch (ctr->switch_value) {
795 SRV_SHARE_INFO_0 *info0 = ctr->share.info0;
796 int num_entries = ctr->num_entries;
799 if (UNMARSHALLING(ps)) {
800 if (!(info0 = (SRV_SHARE_INFO_0 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_0))))
802 ctr->share.info0 = info0;
805 for (i = 0; i < num_entries; i++) {
806 if(!srv_io_share_info0("", &info0[i].info_0, ps, depth))
810 for (i = 0; i < num_entries; i++) {
811 info0[i].info_0_str.ptrs = &info0[i].info_0;
812 if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth))
821 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
822 int num_entries = ctr->num_entries;
825 if (UNMARSHALLING(ps)) {
826 if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1))))
828 ctr->share.info1 = info1;
831 for (i = 0; i < num_entries; i++) {
832 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
836 for (i = 0; i < num_entries; i++) {
837 info1[i].info_1_str.ptrs = &info1[i].info_1;
838 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
847 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
848 int num_entries = ctr->num_entries;
851 if (UNMARSHALLING(ps)) {
852 if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2))))
854 ctr->share.info2 = info2;
857 for (i = 0; i < num_entries; i++) {
858 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
862 for (i = 0; i < num_entries; i++) {
863 if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth))
872 SRV_SHARE_INFO_501 *info501 = ctr->share.info501;
873 int num_entries = ctr->num_entries;
876 if (UNMARSHALLING(ps)) {
877 if (!(info501 = (SRV_SHARE_INFO_501 *) prs_alloc_mem(ps, num_entries *
878 sizeof (SRV_SHARE_INFO_501))))
880 ctr->share.info501 = info501;
883 for (i = 0; i < num_entries; i++) {
884 if (!srv_io_share_info501("", &info501[i].info_501, ps, depth))
888 for (i = 0; i < num_entries; i++) {
889 if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth))
898 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
899 int num_entries = ctr->num_entries;
902 if (UNMARSHALLING(ps)) {
903 if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502))))
905 ctr->share.info502 = info502;
908 for (i = 0; i < num_entries; i++) {
909 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
913 for (i = 0; i < num_entries; i++) {
914 info502[i].info_502_str.ptrs = &info502[i].info_502;
915 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
924 SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004;
925 int num_entries = ctr->num_entries;
928 if (UNMARSHALLING(ps)) {
929 if (!(info1004 = (SRV_SHARE_INFO_1004 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1004))))
931 ctr->share.info1004 = info1004;
934 for (i = 0; i < num_entries; i++) {
935 if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth))
939 for (i = 0; i < num_entries; i++) {
940 info1004[i].info_1004_str.ptrs = &info1004[i].info_1004;
941 if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth))
950 SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005;
951 int num_entries = ctr->num_entries;
954 if (UNMARSHALLING(ps)) {
955 if (!(info1005 = (SRV_SHARE_INFO_1005 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1005))))
957 ctr->share.info1005 = info1005;
960 for (i = 0; i < num_entries; i++) {
961 if(!srv_io_share_info1005("", &info1005[i], ps, depth))
970 SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006;
971 int num_entries = ctr->num_entries;
974 if (UNMARSHALLING(ps)) {
975 if (!(info1006 = (SRV_SHARE_INFO_1006 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1006))))
977 ctr->share.info1006 = info1006;
980 for (i = 0; i < num_entries; i++) {
981 if(!srv_io_share_info1006("", &info1006[i], ps, depth))
990 SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007;
991 int num_entries = ctr->num_entries;
994 if (UNMARSHALLING(ps)) {
995 if (!(info1007 = (SRV_SHARE_INFO_1007 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1007))))
997 ctr->share.info1007 = info1007;
1000 for (i = 0; i < num_entries; i++) {
1001 if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth))
1005 for (i = 0; i < num_entries; i++) {
1006 info1007[i].info_1007_str.ptrs = &info1007[i].info_1007;
1007 if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth))
1016 SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501;
1017 int num_entries = ctr->num_entries;
1020 if (UNMARSHALLING(ps)) {
1021 if (!(info1501 = (SRV_SHARE_INFO_1501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1501))))
1023 ctr->share.info1501 = info1501;
1026 for (i = 0; i < num_entries; i++) {
1027 if(!srv_io_share_info1501("", &info1501[i], ps, depth))
1035 DEBUG(5,("%s no share info at switch_value %d\n",
1036 tab_depth(depth), ctr->switch_value));
1043 /*******************************************************************
1044 Inits a SRV_Q_NET_SHARE_ENUM structure.
1045 ********************************************************************/
1047 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
1048 char *srv_name, uint32 info_level,
1049 uint32 preferred_len, ENUM_HND *hnd)
1052 DEBUG(5,("init_q_net_share_enum\n"));
1054 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1056 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
1057 q_n->ctr.ptr_share_info = 1;
1058 q_n->ctr.num_entries = 0;
1059 q_n->ctr.ptr_entries = 0;
1060 q_n->ctr.num_entries2 = 0;
1061 q_n->preferred_len = preferred_len;
1063 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1066 /*******************************************************************
1067 Reads or writes a structure.
1068 ********************************************************************/
1070 BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
1075 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
1081 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1083 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1086 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
1092 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1095 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1101 /*******************************************************************
1102 Reads or writes a structure.
1103 ********************************************************************/
1105 BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
1110 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
1113 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
1119 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1122 if(r_n->total_entries != 0) {
1123 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1127 if(!prs_werror("status", ps, depth, &r_n->status))
1133 /*******************************************************************
1134 initialises a structure.
1135 ********************************************************************/
1137 BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level)
1140 uint32 ptr_share_name;
1142 DEBUG(5,("init_srv_q_net_share_get_info\n"));
1144 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1145 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1147 q_n->info_level = info_level;
1152 /*******************************************************************
1153 Reads or writes a structure.
1154 ********************************************************************/
1156 BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
1161 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
1167 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1169 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1172 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1178 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1184 /*******************************************************************
1185 Reads or writes a structure.
1186 ********************************************************************/
1188 static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
1193 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
1199 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
1202 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
1205 if (r_n->ptr_share_ctr != 0) {
1206 switch (r_n->switch_value) {
1208 if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth))
1211 /* allow access to pointers in the str part. */
1212 r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0;
1214 if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth))
1219 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
1222 /* allow access to pointers in the str part. */
1223 r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1;
1225 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
1230 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
1233 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth))
1238 if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth))
1240 if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth))
1245 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
1248 /* allow access to pointers in the str part. */
1249 r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
1251 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
1255 if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth))
1258 /* allow access to pointers in the str part. */
1259 r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004;
1261 if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth))
1265 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
1269 if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth))
1273 if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth))
1276 /* allow access to pointers in the str part. */
1277 r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007;
1279 if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth))
1283 if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
1286 DEBUG(5,("%s no share info at switch_value %d\n",
1287 tab_depth(depth), r_n->switch_value));
1295 /*******************************************************************
1296 Reads or writes a structure.
1297 ********************************************************************/
1299 BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
1304 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
1310 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
1316 if(!prs_werror("status", ps, depth, &r_n->status))
1322 /*******************************************************************
1323 intialises a structure.
1324 ********************************************************************/
1326 BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n,
1327 const char *srv_name,
1328 const char *share_name,
1330 const SRV_SHARE_INFO *info)
1333 uint32 ptr_share_name;
1335 DEBUG(5,("init_srv_q_net_share_set_info\n"));
1337 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1338 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1340 q_n->info_level = info_level;
1344 q_n->ptr_parm_error = 1;
1345 q_n->parm_error = 0;
1350 /*******************************************************************
1351 Reads or writes a structure.
1352 ********************************************************************/
1354 BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
1359 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
1365 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1367 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1370 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1376 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1382 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1387 if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error))
1389 if(q_n->ptr_parm_error!=0) {
1390 if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error))
1397 /*******************************************************************
1398 Reads or writes a structure.
1399 ********************************************************************/
1401 BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth)
1406 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
1412 if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error))
1415 if(r_n->ptr_parm_error) {
1417 if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error))
1421 if(!prs_werror("status", ps, depth, &r_n->status))
1428 /*******************************************************************
1429 Reads or writes a structure.
1430 ********************************************************************/
1432 BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
1437 prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
1443 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1445 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1451 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1457 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1463 if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index))
1465 if (q_n->ptr_err_index)
1466 if (!prs_uint32("err_index", ps, depth, &q_n->err_index))
1472 void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname,
1473 char *netname, uint32 type, char *remark,
1474 uint32 perms, uint32 max_uses, uint32 num_uses,
1475 char *path, char *passwd)
1477 q->ptr_srv_name = 1;
1478 init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1);
1479 q->info.switch_value = q->info_level = 2;
1481 q->info.ptr_share_ctr = 1;
1482 init_srv_share_info2(&q->info.share.info2.info_2, netname, type,
1483 remark, perms, max_uses, num_uses, path, passwd);
1484 init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname,
1485 remark, path, passwd);
1486 q->ptr_err_index = 1;
1491 /*******************************************************************
1492 Reads or writes a structure.
1493 ********************************************************************/
1495 BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth)
1500 prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
1506 if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error))
1509 if(r_n->ptr_parm_error) {
1511 if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error))
1515 if(!prs_werror("status", ps, depth, &r_n->status))
1521 /*******************************************************************
1522 initialises a structure.
1523 ********************************************************************/
1525 void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname,
1526 const char *sharename)
1528 del->ptr_srv_name = 1;
1529 init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 );
1530 init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1);
1533 /*******************************************************************
1534 Reads or writes a structure.
1535 ********************************************************************/
1537 BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1542 prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
1548 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1550 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1553 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1558 if(!prs_uint32("reserved", ps, depth, &q_n->reserved))
1564 /*******************************************************************
1565 Reads or writes a structure.
1566 ********************************************************************/
1568 BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1573 prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
1579 if(!prs_werror("status", ps, depth, &q_n->status))
1585 /*******************************************************************
1586 Inits a SESS_INFO_0_STR structure
1587 ********************************************************************/
1589 void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
1591 DEBUG(5,("init_srv_sess_info0_str\n"));
1593 init_unistr2(&ss0->uni_name, name, strlen(name)+1);
1596 /*******************************************************************
1597 Reads or writes a structure.
1598 ********************************************************************/
1600 static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
1605 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
1611 if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth))
1617 /*******************************************************************
1618 Inits a SESS_INFO_0 structure
1619 ********************************************************************/
1621 void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
1623 DEBUG(5,("init_srv_sess_info0: %s\n", name));
1625 ss0->ptr_name = (name != NULL) ? 1 : 0;
1628 /*******************************************************************
1629 Reads or writes a structure.
1630 ********************************************************************/
1632 static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1637 prs_debug(ps, depth, desc, "srv_io_sess_info0");
1643 if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name))
1649 /*******************************************************************
1650 Reads or writes a structure.
1651 ********************************************************************/
1653 static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1658 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
1664 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1666 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
1669 if (ss0->ptr_sess_info != 0) {
1671 int num_entries = ss0->num_entries_read;
1673 if (num_entries > MAX_SESS_ENTRIES) {
1674 num_entries = MAX_SESS_ENTRIES; /* report this! */
1677 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1680 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1682 for (i = 0; i < num_entries; i++) {
1683 if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth))
1687 for (i = 0; i < num_entries; i++) {
1688 if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth))
1699 /*******************************************************************
1700 Inits a SESS_INFO_1_STR structure
1701 ********************************************************************/
1703 void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
1705 DEBUG(5,("init_srv_sess_info1_str\n"));
1707 init_unistr2(&ss1->uni_name, name, strlen(name)+1);
1708 init_unistr2(&ss1->uni_user, user, strlen(user)+1);
1711 /*******************************************************************
1712 Reads or writes a structure.
1713 ********************************************************************/
1715 static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
1720 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
1726 if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth))
1728 if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth))
1734 /*******************************************************************
1735 Inits a SESS_INFO_1 structure
1736 ********************************************************************/
1738 void init_srv_sess_info1(SESS_INFO_1 *ss1,
1739 char *name, char *user,
1740 uint32 num_opens, uint32 open_time, uint32 idle_time,
1743 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1745 ss1->ptr_name = (name != NULL) ? 1 : 0;
1746 ss1->ptr_user = (user != NULL) ? 1 : 0;
1748 ss1->num_opens = num_opens;
1749 ss1->open_time = open_time;
1750 ss1->idle_time = idle_time;
1751 ss1->user_flags = user_flags;
1754 /*******************************************************************
1755 reads or writes a structure.
1756 ********************************************************************/
1758 static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1763 prs_debug(ps, depth, desc, "srv_io_sess_info1");
1769 if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name))
1771 if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user))
1774 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1776 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1778 if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time))
1780 if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags))
1786 /*******************************************************************
1787 Reads or writes a structure.
1788 ********************************************************************/
1790 static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1795 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1801 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1803 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1806 if (ss1->ptr_sess_info != 0) {
1808 int num_entries = ss1->num_entries_read;
1810 if (num_entries > MAX_SESS_ENTRIES) {
1811 num_entries = MAX_SESS_ENTRIES; /* report this! */
1814 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1817 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1819 for (i = 0; i < num_entries; i++) {
1820 if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth))
1824 for (i = 0; i < num_entries; i++) {
1825 if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth))
1836 /*******************************************************************
1837 Reads or writes a structure.
1838 ********************************************************************/
1840 static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1842 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1844 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1847 if(UNMARSHALLING(ps)) {
1848 ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR));
1859 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1861 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1864 if (ctr->ptr_sess_ctr != 0) {
1865 switch (ctr->switch_value) {
1867 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1871 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1875 DEBUG(5,("%s no session info at switch_value %d\n",
1876 tab_depth(depth), ctr->switch_value));
1884 /*******************************************************************
1885 Inits a SRV_Q_NET_SESS_ENUM structure.
1886 ********************************************************************/
1888 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
1889 char *srv_name, char *qual_name,
1890 char *user_name, uint32 sess_level,
1891 SRV_SESS_INFO_CTR *ctr, uint32 preferred_len,
1896 DEBUG(5,("init_q_net_sess_enum\n"));
1898 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1899 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1900 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
1902 q_n->sess_level = sess_level;
1903 q_n->preferred_len = preferred_len;
1905 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1908 /*******************************************************************
1909 Reads or writes a structure.
1910 ********************************************************************/
1912 BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
1917 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1923 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1925 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1931 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1933 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1938 if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
1940 if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
1946 if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level))
1949 if (q_n->sess_level != -1) {
1950 if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth))
1954 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1957 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1963 /*******************************************************************
1964 Reads or writes a structure.
1965 ********************************************************************/
1967 BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1972 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1978 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1981 if (r_n->sess_level != -1) {
1982 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1986 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1988 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1990 if(!prs_werror("status", ps, depth, &r_n->status))
1996 /*******************************************************************
1997 Inits a CONN_INFO_0 structure
1998 ********************************************************************/
2000 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
2002 DEBUG(5,("init_srv_conn_info0\n"));
2007 /*******************************************************************
2008 Reads or writes a structure.
2009 ********************************************************************/
2011 static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2016 prs_debug(ps, depth, desc, "srv_io_conn_info0");
2022 if(!prs_uint32("id", ps, depth, &ss0->id))
2028 /*******************************************************************
2029 Reads or writes a structure.
2030 ********************************************************************/
2032 static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2037 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
2043 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
2045 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
2048 if (ss0->ptr_conn_info != 0) {
2050 int num_entries = ss0->num_entries_read;
2052 if (num_entries > MAX_CONN_ENTRIES) {
2053 num_entries = MAX_CONN_ENTRIES; /* report this! */
2056 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
2059 for (i = 0; i < num_entries; i++) {
2060 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
2071 /*******************************************************************
2072 Inits a CONN_INFO_1_STR structure
2073 ********************************************************************/
2075 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
2077 DEBUG(5,("init_srv_conn_info1_str\n"));
2079 init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1);
2080 init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1);
2083 /*******************************************************************
2084 Reads or writes a structure.
2085 ********************************************************************/
2087 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
2092 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
2098 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
2100 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
2106 /*******************************************************************
2107 Inits a CONN_INFO_1 structure
2108 ********************************************************************/
2110 void init_srv_conn_info1(CONN_INFO_1 *ss1,
2111 uint32 id, uint32 type,
2112 uint32 num_opens, uint32 num_users, uint32 open_time,
2113 char *usr_name, char *net_name)
2115 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
2119 ss1->num_opens = num_opens ;
2120 ss1->num_users = num_users;
2121 ss1->open_time = open_time;
2123 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
2124 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
2127 /*******************************************************************
2128 Reads or writes a structure.
2129 ********************************************************************/
2131 static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2136 prs_debug(ps, depth, desc, "srv_io_conn_info1");
2142 if(!prs_uint32("id ", ps, depth, &ss1->id))
2144 if(!prs_uint32("type ", ps, depth, &ss1->type))
2146 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
2148 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
2150 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
2153 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
2155 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
2161 /*******************************************************************
2162 Reads or writes a structure.
2163 ********************************************************************/
2165 static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2170 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
2176 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
2178 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
2181 if (ss1->ptr_conn_info != 0) {
2183 int num_entries = ss1->num_entries_read;
2185 if (num_entries > MAX_CONN_ENTRIES) {
2186 num_entries = MAX_CONN_ENTRIES; /* report this! */
2189 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
2192 for (i = 0; i < num_entries; i++) {
2193 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
2197 for (i = 0; i < num_entries; i++) {
2198 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
2209 /*******************************************************************
2210 Reads or writes a structure.
2211 ********************************************************************/
2213 static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
2215 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
2217 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
2220 if (UNMARSHALLING(ps)) {
2221 ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR));
2232 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2234 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
2237 if (ctr->ptr_conn_ctr != 0) {
2238 switch (ctr->switch_value) {
2240 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
2244 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
2248 DEBUG(5,("%s no connection info at switch_value %d\n",
2249 tab_depth(depth), ctr->switch_value));
2257 /*******************************************************************
2258 Reads or writes a structure.
2259 ********************************************************************/
2261 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
2262 char *srv_name, char *qual_name,
2263 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
2264 uint32 preferred_len,
2267 DEBUG(5,("init_q_net_conn_enum\n"));
2271 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
2272 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2274 q_n->conn_level = conn_level;
2275 q_n->preferred_len = preferred_len;
2277 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2280 /*******************************************************************
2281 Reads or writes a structure.
2282 ********************************************************************/
2284 BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
2289 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
2295 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2297 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
2303 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2305 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2311 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
2314 if (q_n->conn_level != -1) {
2315 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
2319 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2322 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2328 /*******************************************************************
2329 Reads or writes a structure.
2330 ********************************************************************/
2332 BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
2337 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
2343 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
2346 if (r_n->conn_level != -1) {
2347 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
2351 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2353 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2355 if(!prs_werror("status", ps, depth, &r_n->status))
2361 /*******************************************************************
2362 Inits a FILE_INFO_3_STR structure
2363 ********************************************************************/
2365 void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
2367 DEBUG(5,("init_srv_file_info3_str\n"));
2369 init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1);
2370 init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1);
2373 /*******************************************************************
2374 Reads or writes a structure.
2375 ********************************************************************/
2377 static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
2382 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
2388 if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth))
2390 if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth))
2396 /*******************************************************************
2397 Inits a FILE_INFO_3 structure
2398 ********************************************************************/
2400 void init_srv_file_info3(FILE_INFO_3 *fl3,
2401 uint32 id, uint32 perms, uint32 num_locks,
2402 char *path_name, char *user_name)
2404 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name));
2408 fl3->num_locks = num_locks;
2410 fl3->ptr_path_name = (path_name != NULL) ? 1 : 0;
2411 fl3->ptr_user_name = (user_name != NULL) ? 1 : 0;
2414 /*******************************************************************
2415 Reads or writes a structure.
2416 ********************************************************************/
2418 static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
2423 prs_debug(ps, depth, desc, "srv_io_file_info3");
2429 if(!prs_uint32("id ", ps, depth, &fl3->id))
2431 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
2433 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
2435 if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name))
2437 if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name))
2443 /*******************************************************************
2444 Reads or writes a structure.
2445 ********************************************************************/
2447 static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
2452 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
2455 if (UNMARSHALLING(ps)) {
2456 memset(ctr, '\0', sizeof(SRV_FILE_INFO_CTR));
2462 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2464 if (ctr->switch_value != 3) {
2465 DEBUG(5,("%s File info %d level not supported\n",
2466 tab_depth(depth), ctr->switch_value));
2468 if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info))
2470 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
2472 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
2474 if (ctr->ptr_entries == 0)
2476 if(!prs_uint32("num_entries2", ps, depth,
2477 &ctr->num_entries2))
2480 switch (ctr->switch_value) {
2482 SRV_FILE_INFO_3 *info3 = ctr->file.info3;
2483 int num_entries = ctr->num_entries;
2486 if (UNMARSHALLING(ps)) {
2487 if (!(info3 = (SRV_FILE_INFO_3 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_FILE_INFO_3))))
2489 ctr->file.info3 = info3;
2492 for (i = 0; i < num_entries; i++) {
2493 if(!srv_io_file_info3("", &ctr->file.info3[i].info_3, ps, depth))
2496 for (i = 0; i < num_entries; i++) {
2497 if(!srv_io_file_info3_str("", &ctr->file.info3[i].info_3_str, ps, depth))
2503 DEBUG(5,("%s no file info at switch_value %d\n",
2504 tab_depth(depth), ctr->switch_value));
2511 /*******************************************************************
2512 Inits a SRV_Q_NET_FILE_ENUM structure.
2513 ********************************************************************/
2515 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
2516 const char *srv_name, const char *qual_name,
2517 const char *user_name,
2518 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
2519 uint32 preferred_len,
2522 DEBUG(5,("init_q_net_file_enum\n"));
2524 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
2525 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2526 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
2528 q_n->file_level = q_n->ctr.switch_value = file_level;
2529 q_n->preferred_len = preferred_len;
2530 q_n->ctr.ptr_file_info = 1;
2531 q_n->ctr.num_entries = 0;
2532 q_n->ctr.num_entries2 = 0;
2534 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2537 /*******************************************************************
2538 Reads or writes a structure.
2539 ********************************************************************/
2541 BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
2546 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
2552 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2554 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2560 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2562 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2568 if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
2570 if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
2575 if(!prs_uint32("file_level", ps, depth, &q_n->file_level))
2578 if (q_n->file_level != -1) {
2579 if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth))
2583 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2586 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2592 /*******************************************************************
2593 Reads or writes a structure.
2594 ********************************************************************/
2596 BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
2601 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
2607 if(!prs_uint32("file_level", ps, depth, &r_n->file_level))
2610 if (r_n->file_level != 0) {
2611 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
2615 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2617 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2619 if(!prs_werror("status", ps, depth, &r_n->status))
2625 /*******************************************************************
2626 Initialize a net file close request
2627 ********************************************************************/
2628 void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server,
2631 q_n->ptr_srv_name = 1;
2632 init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1);
2633 q_n->file_id = file_id;
2636 /*******************************************************************
2637 Reads or writes a structure.
2638 ********************************************************************/
2639 BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n,
2640 prs_struct *ps, int depth)
2645 prs_debug(ps, depth, desc, "srv_io_q_net_file_close");
2651 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2653 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2659 if(!prs_uint32("file_id", ps, depth, &q_n->file_id))
2665 /*******************************************************************
2666 Reads or writes a structure.
2667 ********************************************************************/
2669 BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n,
2670 prs_struct *ps, int depth)
2675 prs_debug(ps, depth, desc, "srv_io_r_net_file_close");
2681 if(!prs_werror("status", ps, depth, &q_n->status))
2687 /*******************************************************************
2688 Inits a SRV_INFO_100 structure.
2689 ********************************************************************/
2691 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name)
2693 DEBUG(5,("init_srv_info_100\n"));
2695 sv100->platform_id = platform_id;
2696 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
2699 /*******************************************************************
2700 Reads or writes a SRV_INFO_101 structure.
2701 ********************************************************************/
2703 static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
2708 prs_debug(ps, depth, desc, "srv_io_info_100");
2714 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
2716 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
2719 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
2726 /*******************************************************************
2727 Inits a SRV_INFO_101 structure.
2728 ********************************************************************/
2730 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
2731 uint32 ver_major, uint32 ver_minor,
2732 uint32 srv_type, char *comment)
2734 DEBUG(5,("init_srv_info_101\n"));
2736 sv101->platform_id = platform_id;
2737 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2738 sv101->ver_major = ver_major;
2739 sv101->ver_minor = ver_minor;
2740 sv101->srv_type = srv_type;
2741 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2744 /*******************************************************************
2745 Reads or writes a SRV_INFO_101 structure.
2746 ********************************************************************/
2748 static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2753 prs_debug(ps, depth, desc, "srv_io_info_101");
2759 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2761 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2763 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2765 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2767 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2769 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2775 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2777 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2783 /*******************************************************************
2784 Inits a SRV_INFO_102 structure.
2785 ********************************************************************/
2787 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
2788 char *comment, uint32 ver_major, uint32 ver_minor,
2789 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2790 uint32 announce, uint32 ann_delta, uint32 licenses,
2793 DEBUG(5,("init_srv_info_102\n"));
2795 sv102->platform_id = platform_id;
2796 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2797 sv102->ver_major = ver_major;
2798 sv102->ver_minor = ver_minor;
2799 sv102->srv_type = srv_type;
2800 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2802 /* same as 101 up to here */
2804 sv102->users = users;
2806 sv102->hidden = hidden;
2807 sv102->announce = announce;
2808 sv102->ann_delta = ann_delta;
2809 sv102->licenses = licenses;
2810 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2814 /*******************************************************************
2815 Reads or writes a SRV_INFO_102 structure.
2816 ********************************************************************/
2818 static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2823 prs_debug(ps, depth, desc, "srv_io_info102");
2829 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2831 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2833 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2835 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2837 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2839 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2842 /* same as 101 up to here */
2844 if(!prs_uint32("users ", ps, depth, &sv102->users))
2846 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2848 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2850 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2852 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2854 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2856 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2859 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2863 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2867 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2873 /*******************************************************************
2874 Reads or writes a SRV_INFO_102 structure.
2875 ********************************************************************/
2877 static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2882 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2888 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2890 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2893 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2894 switch (ctr->switch_value) {
2896 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2900 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2904 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2908 DEBUG(5,("%s no server info at switch_value %d\n",
2909 tab_depth(depth), ctr->switch_value));
2919 /*******************************************************************
2920 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2921 ********************************************************************/
2923 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2924 char *server_name, uint32 switch_value)
2926 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2928 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2930 srv->switch_value = switch_value;
2933 /*******************************************************************
2934 Reads or writes a structure.
2935 ********************************************************************/
2937 BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2942 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2948 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2950 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2956 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2962 /*******************************************************************
2963 Inits a SRV_R_NET_SRV_GET_INFO structure.
2964 ********************************************************************/
2966 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2967 uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
2969 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2973 if (W_ERROR_IS_OK(status)) {
2974 srv->ctr->switch_value = switch_value;
2975 srv->ctr->ptr_srv_ctr = 1;
2977 srv->ctr->switch_value = 0;
2978 srv->ctr->ptr_srv_ctr = 0;
2981 srv->status = status;
2984 /*******************************************************************
2985 Inits a SRV_R_NET_SRV_SET_INFO structure.
2986 ********************************************************************/
2988 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
2989 uint32 switch_value, WERROR status)
2991 DEBUG(5,("init_srv_r_net_srv_set_info\n"));
2993 srv->switch_value = switch_value;
2994 srv->status = status;
2997 /*******************************************************************
2998 Reads or writes a structure.
2999 ********************************************************************/
3001 BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n,
3002 prs_struct *ps, int depth)
3004 prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
3010 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3012 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3018 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
3021 if (UNMARSHALLING(ps)) {
3022 q_n->ctr = (SRV_INFO_CTR *)
3023 prs_alloc_mem(ps, sizeof(SRV_INFO_CTR));
3029 if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
3035 /*******************************************************************
3036 Reads or writes a structure.
3037 ********************************************************************/
3039 BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
3044 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
3050 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
3053 if(!prs_werror("status", ps, depth, &r_n->status))
3059 /*******************************************************************
3060 Reads or writes a structure.
3061 ********************************************************************/
3063 BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
3064 prs_struct *ps, int depth)
3066 prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
3072 if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value))
3075 if(!prs_werror("status", ps, depth, &r_n->status))
3081 /*******************************************************************
3082 Reads or writes a structure.
3083 ********************************************************************/
3085 BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
3090 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
3096 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3098 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3104 /*******************************************************************
3105 Reads or writes a TIME_OF_DAY_INFO structure.
3106 ********************************************************************/
3108 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
3113 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
3119 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
3121 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
3123 if(!prs_uint32("hours ", ps, depth, &tod->hours))
3125 if(!prs_uint32("mins ", ps, depth, &tod->mins))
3127 if(!prs_uint32("secs ", ps, depth, &tod->secs))
3129 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
3131 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
3133 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
3135 if(!prs_uint32("day ", ps, depth, &tod->day))
3137 if(!prs_uint32("month ", ps, depth, &tod->month))
3139 if(!prs_uint32("year ", ps, depth, &tod->year))
3141 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
3147 /*******************************************************************
3148 Inits a TIME_OF_DAY_INFO structure.
3149 ********************************************************************/
3151 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
3152 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
3153 uint32 zone, uint32 tintervals, uint32 day,
3154 uint32 month, uint32 year, uint32 weekday)
3156 DEBUG(5,("init_time_of_day_info\n"));
3158 tod->elapsedt = elapsedt;
3165 tod->tintervals = tintervals;
3169 tod->weekday = weekday;
3173 /*******************************************************************
3174 Reads or writes a structure.
3175 ********************************************************************/
3177 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
3182 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
3188 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
3191 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
3194 if(!prs_werror("status", ps, depth, &r_n->status))
3200 /*******************************************************************
3201 initialises a structure.
3202 ********************************************************************/
3204 BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n,
3205 const char *srv_name,
3206 uint32 preferred_len,
3212 DEBUG(5,("init_srv_q_net_srv_disk_enum\n"));
3214 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3216 q_n->disk_enum_ctr.level = 0;
3217 q_n->disk_enum_ctr.disk_info_ptr = 0;
3219 q_n->preferred_len = preferred_len;
3220 memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd));
3225 /*******************************************************************
3226 Reads or writes a structure.
3227 ********************************************************************/
3229 BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
3234 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
3240 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3243 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3249 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
3252 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
3255 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
3261 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
3263 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
3269 /*******************************************************************
3270 Reads or writes a structure.
3271 ********************************************************************/
3273 BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
3277 uint32 entries_read, entries_read2, entries_read3;
3282 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
3285 entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read;
3290 if(!prs_uint32("entries_read", ps, depth, &entries_read))
3292 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
3295 /*this may be max, unknown, actual?*/
3297 if(!prs_uint32("max_elements", ps, depth, &entries_read2))
3299 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
3301 if(!prs_uint32("actual_elements", ps, depth, &entries_read3))
3304 r_n->disk_enum_ctr.entries_read = entries_read3;
3306 if(UNMARSHALLING(ps)) {
3310 if(!(dinfo = (DISK_INFO *)prs_alloc_mem(ps, sizeof(*dinfo) * entries_read3)))
3312 r_n->disk_enum_ctr.disk_info = dinfo;
3315 for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) {
3317 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
3320 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
3327 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
3330 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
3333 if(!prs_werror("status", ps, depth, &r_n->status))
3339 /*******************************************************************
3340 initialises a structure.
3341 ********************************************************************/
3343 BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type)
3345 uint32 ptr_share_name;
3347 DEBUG(5,("init_srv_q_net_name_validate\n"));
3349 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3350 init_buf_unistr2(&q_n->uni_name, &ptr_share_name, share_name);
3358 /*******************************************************************
3359 Reads or writes a structure.
3360 ********************************************************************/
3362 BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
3367 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
3373 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3376 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3382 if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth))
3388 if(!prs_uint32("type", ps, depth, &q_n->type))
3391 if(!prs_uint32("flags", ps, depth, &q_n->flags))
3397 /*******************************************************************
3398 Reads or writes a structure.
3399 ********************************************************************/
3401 BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
3406 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
3412 if(!prs_werror("status", ps, depth, &r_n->status))
3418 /*******************************************************************
3419 Reads or writes a structure.
3420 ********************************************************************/
3422 BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
3427 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
3433 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3436 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3442 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3445 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3451 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3454 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
3457 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
3460 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
3466 /*******************************************************************
3467 Reads or writes a structure.
3468 ********************************************************************/
3470 BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
3475 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
3481 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
3484 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
3487 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
3490 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
3493 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
3499 if(!prs_werror("status", ps, depth, &r_n->status))
3505 /*******************************************************************
3506 Reads or writes a structure.
3507 ********************************************************************/
3509 BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
3514 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
3520 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3523 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3529 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3532 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3538 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3544 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
3547 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
3550 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
3553 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
3556 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
3562 /*******************************************************************
3563 Reads or writes a structure.
3564 ********************************************************************/
3566 BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
3571 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
3577 if(!prs_werror("status", ps, depth, &r_n->status))
3583 /*******************************************************************
3585 ********************************************************************/
3587 void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, char *server)
3589 q_u->ptr_srv_name = 1;
3590 init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1);