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, const char *net_name)
37 DEBUG(5,("init_srv_share_info0_str\n"));
39 init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE);
42 /*******************************************************************
43 Reads or writes a structure.
44 ********************************************************************/
46 static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth)
51 prs_debug(ps, depth, desc, "srv_io_share_info0_str");
56 if(sh0->ptrs->ptr_netname)
57 if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth))
63 /*******************************************************************
64 makes a SH_INFO_0 structure
65 ********************************************************************/
67 void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name)
69 DEBUG(5,("init_srv_share_info0: %s\n", net_name));
71 sh0->ptr_netname = (net_name != NULL) ? 1 : 0;
74 /*******************************************************************
75 Reads or writes a structure.
76 ********************************************************************/
78 static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth)
83 prs_debug(ps, depth, desc, "srv_io_share_info0");
89 if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname))
95 /*******************************************************************
96 Inits a SH_INFO_1_STR structure
97 ********************************************************************/
99 void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark)
101 DEBUG(5,("init_srv_share_info1_str\n"));
103 init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE);
104 init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE);
107 /*******************************************************************
108 Reads or writes a structure.
109 ********************************************************************/
111 static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
116 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
122 if(sh1->ptrs->ptr_netname)
123 if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
129 if(sh1->ptrs->ptr_remark)
130 if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
136 /*******************************************************************
137 makes a SH_INFO_1 structure
138 ********************************************************************/
140 void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark)
142 DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark));
144 sh1->ptr_netname = (net_name != NULL) ? 1 : 0;
146 sh1->ptr_remark = (remark != NULL) ? 1 : 0;
149 /*******************************************************************
150 Reads or writes a structure.
151 ********************************************************************/
153 static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
158 prs_debug(ps, depth, desc, "srv_io_share_info1");
164 if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname))
166 if(!prs_uint32("type ", ps, depth, &sh1->type))
168 if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark))
174 /*******************************************************************
175 Inits a SH_INFO_2_STR structure
176 ********************************************************************/
178 void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
179 const char *net_name, const char *remark,
180 const char *path, const char *passwd)
182 DEBUG(5,("init_srv_share_info2_str\n"));
184 init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE);
185 init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE);
186 init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE);
187 init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE);
190 /*******************************************************************
191 Reads or writes a structure.
192 ********************************************************************/
194 static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
199 if (UNMARSHALLING(ps))
202 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
209 if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
213 if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
217 if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
221 if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
227 /*******************************************************************
228 Inits a SH_INFO_2 structure
229 ********************************************************************/
231 void init_srv_share_info2(SH_INFO_2 *sh2,
232 const char *net_name, uint32 type, const char *remark,
233 uint32 perms, uint32 max_uses, uint32 num_uses,
234 const char *path, const char *passwd)
236 DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
238 sh2->ptr_netname = (net_name != NULL) ? 1 : 0;
240 sh2->ptr_remark = (remark != NULL) ? 1 : 0;
242 sh2->max_uses = max_uses;
243 sh2->num_uses = num_uses;
244 sh2->ptr_path = (path != NULL) ? 1 : 0;
245 sh2->ptr_passwd = (passwd != NULL) ? 1 : 0;
248 /*******************************************************************
249 Reads or writes a structure.
250 ********************************************************************/
252 static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
257 prs_debug(ps, depth, desc, "srv_io_share_info2");
263 if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname))
265 if(!prs_uint32("type ", ps, depth, &sh2->type))
267 if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark))
269 if(!prs_uint32("perms ", ps, depth, &sh2->perms))
271 if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses))
273 if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses))
275 if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path))
277 if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd))
283 /*******************************************************************
284 Inits a SH_INFO_501_STR structure
285 ********************************************************************/
287 void init_srv_share_info501_str(SH_INFO_501_STR *sh501,
288 const char *net_name, const char *remark)
290 DEBUG(5,("init_srv_share_info501_str\n"));
292 init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE);
293 init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE);
296 /*******************************************************************
297 Inits a SH_INFO_2 structure
298 *******************************************************************/
300 void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy)
302 DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type,
303 remark, csc_policy));
307 sh501->ptr_netname = (net_name != NULL) ? 1 : 0;
309 sh501->ptr_remark = (remark != NULL) ? 1 : 0;
310 sh501->csc_policy = csc_policy;
313 /*******************************************************************
314 Reads of writes a structure.
315 *******************************************************************/
317 static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth)
322 prs_debug(ps, depth, desc, "srv_io_share_info501");
328 if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname))
330 if (!prs_uint32("type ", ps, depth, &sh501->type))
332 if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark))
334 if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy))
340 /*******************************************************************
341 Reads or writes a structure.
342 ********************************************************************/
344 static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth)
349 prs_debug(ps, depth, desc, "srv_io_share_info501_str");
354 if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth))
359 if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth))
365 /*******************************************************************
366 Inits a SH_INFO_502 structure
367 ********************************************************************/
369 void init_srv_share_info502(SH_INFO_502 *sh502,
370 const char *net_name, uint32 type, const char *remark,
371 uint32 perms, uint32 max_uses, uint32 num_uses,
372 const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size)
374 DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
378 sh502->ptr_netname = (net_name != NULL) ? 1 : 0;
380 sh502->ptr_remark = (remark != NULL) ? 1 : 0;
381 sh502->perms = perms;
382 sh502->max_uses = max_uses;
383 sh502->num_uses = num_uses;
384 sh502->ptr_path = (path != NULL) ? 1 : 0;
385 sh502->ptr_passwd = (passwd != NULL) ? 1 : 0;
386 sh502->reserved = 0; /* actual size within rpc */
387 sh502->sd_size = (uint32)sd_size;
388 sh502->ptr_sd = (psd != NULL) ? 1 : 0;
391 /*******************************************************************
392 Reads or writes a structure.
393 ********************************************************************/
395 static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth)
400 prs_debug(ps, depth, desc, "srv_io_share_info502");
406 if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname))
408 if(!prs_uint32("type ", ps, depth, &sh502->type))
410 if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark))
412 if(!prs_uint32("perms ", ps, depth, &sh502->perms))
414 if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses))
416 if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses))
418 if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path))
420 if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
422 if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset))
424 if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd))
430 /*******************************************************************
431 Inits a SH_INFO_502_STR structure
432 ********************************************************************/
434 void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
435 const char *net_name, const char *remark,
436 const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size)
438 DEBUG(5,("init_srv_share_info502_str\n"));
440 init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE);
441 init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE);
442 init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE);
443 init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE);
445 sh502str->reserved = 0;
446 sh502str->sd_size = sd_size;
449 /*******************************************************************
450 Reads or writes a structure.
451 ********************************************************************/
453 static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
458 prs_debug(ps, depth, desc, "srv_io_share_info502_str");
464 if(sh502->ptrs->ptr_netname) {
465 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
472 if(sh502->ptrs->ptr_remark) {
473 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
480 if(sh502->ptrs->ptr_path) {
481 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
488 if(sh502->ptrs->ptr_passwd) {
489 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
496 if(sh502->ptrs->ptr_sd) {
498 uint32 reserved_offset;
500 if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset))
503 old_offset = prs_offset(ps);
505 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
508 if(UNMARSHALLING(ps)) {
510 sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd);
512 prs_set_offset(ps, old_offset + sh502->reserved);
517 if(MARSHALLING(ps)) {
519 sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset;
522 if(!prs_uint32_post("reserved ", ps, depth,
523 &sh502->reserved, reserved_offset, sh502->reserved))
525 if(!prs_uint32_post("reserved ", ps, depth,
526 &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved))
533 /*******************************************************************
534 Inits a SH_INFO_1004_STR structure
535 ********************************************************************/
537 void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark)
539 DEBUG(5,("init_srv_share_info1004_str\n"));
541 init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE);
544 /*******************************************************************
545 Reads or writes a structure.
546 ********************************************************************/
548 static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth)
553 prs_debug(ps, depth, desc, "srv_io_share_info1004_str");
558 if(sh1004->ptrs->ptr_remark)
559 if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth))
565 /*******************************************************************
566 makes a SH_INFO_1004 structure
567 ********************************************************************/
569 void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark)
571 DEBUG(5,("init_srv_share_info1004: %s\n", remark));
573 sh1004->ptr_remark = (remark != NULL) ? 1 : 0;
576 /*******************************************************************
577 Reads or writes a structure.
578 ********************************************************************/
580 static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth)
585 prs_debug(ps, depth, desc, "srv_io_share_info1004");
591 if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark))
597 /*******************************************************************
598 Reads or writes a structure.
599 ********************************************************************/
601 static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth)
606 prs_debug(ps, depth, desc, "srv_io_share_info1005");
612 if(!prs_uint32("share_info_flags", ps, depth,
613 &sh1005->share_info_flags))
619 /*******************************************************************
620 Reads or writes a structure.
621 ********************************************************************/
623 static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth)
628 prs_debug(ps, depth, desc, "srv_io_share_info1006");
634 if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses))
640 /*******************************************************************
641 Inits a SH_INFO_1007_STR structure
642 ********************************************************************/
644 void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name)
646 DEBUG(5,("init_srv_share_info1007_str\n"));
648 init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE);
651 /*******************************************************************
652 Reads or writes a structure.
653 ********************************************************************/
655 static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth)
660 prs_debug(ps, depth, desc, "srv_io_share_info1007_str");
665 if(sh1007->ptrs->ptr_AlternateDirectoryName)
666 if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth))
672 /*******************************************************************
673 makes a SH_INFO_1007 structure
674 ********************************************************************/
676 void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name)
678 DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name));
680 sh1007->flags = flags;
681 sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0;
684 /*******************************************************************
685 Reads or writes a structure.
686 ********************************************************************/
688 static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth)
693 prs_debug(ps, depth, desc, "srv_io_share_info1007");
699 if(!prs_uint32("flags ", ps, depth, &sh1007->flags))
701 if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName))
707 /*******************************************************************
708 Reads or writes a structure.
709 ********************************************************************/
711 static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501,
712 prs_struct* ps, int depth)
717 prs_debug(ps, depth, desc, "srv_io_share_info1501");
723 if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
729 /*******************************************************************
730 Reads or writes a structure.
731 ********************************************************************/
733 static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
738 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
741 if (UNMARSHALLING(ps)) {
742 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
748 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
751 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
753 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
756 if (ctr->ptr_share_info == 0)
759 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
761 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
764 if (ctr->ptr_entries == 0) {
765 if (ctr->num_entries == 0)
771 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
774 if (ctr->num_entries2 != ctr->num_entries)
777 switch (ctr->switch_value) {
781 SRV_SHARE_INFO_0 *info0 = ctr->share.info0;
782 int num_entries = ctr->num_entries;
785 if (UNMARSHALLING(ps)) {
786 if (!(info0 = (SRV_SHARE_INFO_0 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_0))))
788 ctr->share.info0 = info0;
791 for (i = 0; i < num_entries; i++) {
792 if(!srv_io_share_info0("", &info0[i].info_0, ps, depth))
796 for (i = 0; i < num_entries; i++) {
797 info0[i].info_0_str.ptrs = &info0[i].info_0;
798 if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth))
807 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
808 int num_entries = ctr->num_entries;
811 if (UNMARSHALLING(ps)) {
812 if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1))))
814 ctr->share.info1 = info1;
817 for (i = 0; i < num_entries; i++) {
818 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
822 for (i = 0; i < num_entries; i++) {
823 info1[i].info_1_str.ptrs = &info1[i].info_1;
824 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
833 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
834 int num_entries = ctr->num_entries;
837 if (UNMARSHALLING(ps)) {
838 if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2))))
840 ctr->share.info2 = info2;
843 for (i = 0; i < num_entries; i++) {
844 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
848 for (i = 0; i < num_entries; i++) {
849 if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth))
858 SRV_SHARE_INFO_501 *info501 = ctr->share.info501;
859 int num_entries = ctr->num_entries;
862 if (UNMARSHALLING(ps)) {
863 if (!(info501 = (SRV_SHARE_INFO_501 *) prs_alloc_mem(ps, num_entries *
864 sizeof (SRV_SHARE_INFO_501))))
866 ctr->share.info501 = info501;
869 for (i = 0; i < num_entries; i++) {
870 if (!srv_io_share_info501("", &info501[i].info_501, ps, depth))
874 for (i = 0; i < num_entries; i++) {
875 if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth))
884 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
885 int num_entries = ctr->num_entries;
888 if (UNMARSHALLING(ps)) {
889 if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502))))
891 ctr->share.info502 = info502;
894 for (i = 0; i < num_entries; i++) {
895 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
899 for (i = 0; i < num_entries; i++) {
900 info502[i].info_502_str.ptrs = &info502[i].info_502;
901 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
910 SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004;
911 int num_entries = ctr->num_entries;
914 if (UNMARSHALLING(ps)) {
915 if (!(info1004 = (SRV_SHARE_INFO_1004 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1004))))
917 ctr->share.info1004 = info1004;
920 for (i = 0; i < num_entries; i++) {
921 if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth))
925 for (i = 0; i < num_entries; i++) {
926 info1004[i].info_1004_str.ptrs = &info1004[i].info_1004;
927 if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth))
936 SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005;
937 int num_entries = ctr->num_entries;
940 if (UNMARSHALLING(ps)) {
941 if (!(info1005 = (SRV_SHARE_INFO_1005 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1005))))
943 ctr->share.info1005 = info1005;
946 for (i = 0; i < num_entries; i++) {
947 if(!srv_io_share_info1005("", &info1005[i], ps, depth))
956 SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006;
957 int num_entries = ctr->num_entries;
960 if (UNMARSHALLING(ps)) {
961 if (!(info1006 = (SRV_SHARE_INFO_1006 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1006))))
963 ctr->share.info1006 = info1006;
966 for (i = 0; i < num_entries; i++) {
967 if(!srv_io_share_info1006("", &info1006[i], ps, depth))
976 SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007;
977 int num_entries = ctr->num_entries;
980 if (UNMARSHALLING(ps)) {
981 if (!(info1007 = (SRV_SHARE_INFO_1007 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1007))))
983 ctr->share.info1007 = info1007;
986 for (i = 0; i < num_entries; i++) {
987 if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth))
991 for (i = 0; i < num_entries; i++) {
992 info1007[i].info_1007_str.ptrs = &info1007[i].info_1007;
993 if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth))
1002 SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501;
1003 int num_entries = ctr->num_entries;
1006 if (UNMARSHALLING(ps)) {
1007 if (!(info1501 = (SRV_SHARE_INFO_1501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1501))))
1009 ctr->share.info1501 = info1501;
1012 for (i = 0; i < num_entries; i++) {
1013 if(!srv_io_share_info1501("", &info1501[i], ps, depth))
1021 DEBUG(5,("%s no share info at switch_value %d\n",
1022 tab_depth(depth), ctr->switch_value));
1029 /*******************************************************************
1030 Inits a SRV_Q_NET_SHARE_ENUM structure.
1031 ********************************************************************/
1033 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
1034 const char *srv_name, uint32 info_level,
1035 uint32 preferred_len, ENUM_HND *hnd)
1038 DEBUG(5,("init_q_net_share_enum\n"));
1040 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1042 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
1043 q_n->ctr.ptr_share_info = 1;
1044 q_n->ctr.num_entries = 0;
1045 q_n->ctr.ptr_entries = 0;
1046 q_n->ctr.num_entries2 = 0;
1047 q_n->preferred_len = preferred_len;
1049 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1052 /*******************************************************************
1053 Reads or writes a structure.
1054 ********************************************************************/
1056 BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
1061 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
1067 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1069 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1072 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
1078 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1081 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1087 /*******************************************************************
1088 Reads or writes a structure.
1089 ********************************************************************/
1091 BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
1096 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
1099 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
1105 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1108 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1111 if(!prs_werror("status", ps, depth, &r_n->status))
1117 /*******************************************************************
1118 initialises a structure.
1119 ********************************************************************/
1121 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)
1124 uint32 ptr_share_name;
1126 DEBUG(5,("init_srv_q_net_share_get_info\n"));
1128 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1129 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1131 q_n->info_level = info_level;
1136 /*******************************************************************
1137 Reads or writes a structure.
1138 ********************************************************************/
1140 BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
1145 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
1151 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1153 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1156 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1162 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1168 /*******************************************************************
1169 Reads or writes a structure.
1170 ********************************************************************/
1172 static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
1177 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
1183 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
1186 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
1189 if (r_n->ptr_share_ctr != 0) {
1190 switch (r_n->switch_value) {
1192 if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth))
1195 /* allow access to pointers in the str part. */
1196 r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0;
1198 if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth))
1203 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
1206 /* allow access to pointers in the str part. */
1207 r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1;
1209 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
1214 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
1217 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth))
1222 if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth))
1224 if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth))
1229 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
1232 /* allow access to pointers in the str part. */
1233 r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
1235 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
1239 if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth))
1242 /* allow access to pointers in the str part. */
1243 r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004;
1245 if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth))
1249 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
1253 if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth))
1257 if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth))
1260 /* allow access to pointers in the str part. */
1261 r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007;
1263 if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth))
1267 if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
1270 DEBUG(5,("%s no share info at switch_value %d\n",
1271 tab_depth(depth), r_n->switch_value));
1279 /*******************************************************************
1280 Reads or writes a structure.
1281 ********************************************************************/
1283 BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
1288 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
1294 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
1300 if(!prs_werror("status", ps, depth, &r_n->status))
1306 /*******************************************************************
1307 intialises a structure.
1308 ********************************************************************/
1310 BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n,
1311 const char *srv_name,
1312 const char *share_name,
1314 const SRV_SHARE_INFO *info)
1317 uint32 ptr_share_name;
1319 DEBUG(5,("init_srv_q_net_share_set_info\n"));
1321 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1322 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1324 q_n->info_level = info_level;
1328 q_n->ptr_parm_error = 1;
1329 q_n->parm_error = 0;
1334 /*******************************************************************
1335 Reads or writes a structure.
1336 ********************************************************************/
1338 BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
1343 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
1349 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1351 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1354 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1360 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1366 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1371 if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error))
1373 if(q_n->ptr_parm_error!=0) {
1374 if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error))
1381 /*******************************************************************
1382 Reads or writes a structure.
1383 ********************************************************************/
1385 BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth)
1390 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
1396 if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error))
1399 if(r_n->ptr_parm_error) {
1401 if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error))
1405 if(!prs_werror("status", ps, depth, &r_n->status))
1412 /*******************************************************************
1413 Reads or writes a structure.
1414 ********************************************************************/
1416 BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
1421 prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
1427 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1429 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1435 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1441 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1447 if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index))
1449 if (q_n->ptr_err_index)
1450 if (!prs_uint32("err_index", ps, depth, &q_n->err_index))
1456 void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname,
1457 const char *netname, uint32 type, const char *remark,
1458 uint32 perms, uint32 max_uses, uint32 num_uses,
1459 const char *path, const char *passwd,
1460 int level, SEC_DESC *sd)
1464 size_t sd_size = sec_desc_size(sd);
1465 q->ptr_srv_name = 1;
1466 init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
1467 q->info.switch_value = q->info_level = level;
1468 q->info.ptr_share_ctr = 1;
1469 init_srv_share_info502(&q->info.share.info502.info_502, netname, type,
1470 remark, perms, max_uses, num_uses, path, passwd, sd, sd_size);
1471 init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname,
1472 remark, path, passwd, sd, sd_size);
1473 q->ptr_err_index = 1;
1479 q->ptr_srv_name = 1;
1480 init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
1481 q->info.switch_value = q->info_level = level;
1482 q->info.ptr_share_ctr = 1;
1483 init_srv_share_info2(&q->info.share.info2.info_2, netname, type,
1484 remark, perms, max_uses, num_uses, path, passwd);
1485 init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname,
1486 remark, path, passwd);
1487 q->ptr_err_index = 1;
1494 /*******************************************************************
1495 Reads or writes a structure.
1496 ********************************************************************/
1498 BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth)
1503 prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
1509 if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error))
1512 if(r_n->ptr_parm_error) {
1514 if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error))
1518 if(!prs_werror("status", ps, depth, &r_n->status))
1524 /*******************************************************************
1525 initialises a structure.
1526 ********************************************************************/
1528 void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname,
1529 const char *sharename)
1531 del->ptr_srv_name = 1;
1532 init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE);
1533 init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE);
1536 /*******************************************************************
1537 Reads or writes a structure.
1538 ********************************************************************/
1540 BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1545 prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
1551 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1553 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1556 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1561 if(!prs_uint32("reserved", ps, depth, &q_n->reserved))
1567 /*******************************************************************
1568 Reads or writes a structure.
1569 ********************************************************************/
1571 BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1576 prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
1582 if(!prs_werror("status", ps, depth, &q_n->status))
1588 /*******************************************************************
1589 Inits a SESS_INFO_0_STR structure
1590 ********************************************************************/
1592 void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name)
1594 DEBUG(5,("init_srv_sess_info0_str\n"));
1596 init_unistr2(&ss0->uni_name, name, UNI_STR_TERMINATE);
1599 /*******************************************************************
1600 Reads or writes a structure.
1601 ********************************************************************/
1603 static BOOL srv_io_sess_info0_str(const char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
1608 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
1614 if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth))
1620 /*******************************************************************
1621 Inits a SESS_INFO_0 structure
1622 ********************************************************************/
1624 void init_srv_sess_info0(SESS_INFO_0 *ss0, const char *name)
1626 DEBUG(5,("init_srv_sess_info0: %s\n", name));
1628 ss0->ptr_name = (name != NULL) ? 1 : 0;
1631 /*******************************************************************
1632 Reads or writes a structure.
1633 ********************************************************************/
1635 static BOOL srv_io_sess_info0(const char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1640 prs_debug(ps, depth, desc, "srv_io_sess_info0");
1646 if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name))
1652 /*******************************************************************
1653 Reads or writes a structure.
1654 ********************************************************************/
1656 static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1661 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
1667 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1669 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
1672 if (ss0->ptr_sess_info != 0) {
1674 uint32 num_entries = ss0->num_entries_read;
1676 if (num_entries > MAX_SESS_ENTRIES) {
1677 num_entries = MAX_SESS_ENTRIES; /* report this! */
1680 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1683 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1685 for (i = 0; i < num_entries; i++) {
1686 if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth))
1690 for (i = 0; i < num_entries; i++) {
1691 if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth))
1702 /*******************************************************************
1703 Inits a SESS_INFO_1_STR structure
1704 ********************************************************************/
1706 void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char *user)
1708 DEBUG(5,("init_srv_sess_info1_str\n"));
1710 init_unistr2(&ss1->uni_name, name, UNI_STR_TERMINATE);
1711 init_unistr2(&ss1->uni_user, user, UNI_STR_TERMINATE);
1714 /*******************************************************************
1715 Reads or writes a structure.
1716 ********************************************************************/
1718 static BOOL srv_io_sess_info1_str(const char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
1723 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
1729 if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth))
1731 if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth))
1737 /*******************************************************************
1738 Inits a SESS_INFO_1 structure
1739 ********************************************************************/
1741 void init_srv_sess_info1(SESS_INFO_1 *ss1,
1742 const char *name, const char *user,
1743 uint32 num_opens, uint32 open_time, uint32 idle_time,
1746 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1748 ss1->ptr_name = (name != NULL) ? 1 : 0;
1749 ss1->ptr_user = (user != NULL) ? 1 : 0;
1751 ss1->num_opens = num_opens;
1752 ss1->open_time = open_time;
1753 ss1->idle_time = idle_time;
1754 ss1->user_flags = user_flags;
1757 /*******************************************************************
1758 reads or writes a structure.
1759 ********************************************************************/
1761 static BOOL srv_io_sess_info1(const char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1766 prs_debug(ps, depth, desc, "srv_io_sess_info1");
1772 if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name))
1774 if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user))
1777 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1779 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1781 if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time))
1783 if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags))
1789 /*******************************************************************
1790 Reads or writes a structure.
1791 ********************************************************************/
1793 static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1798 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1804 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1806 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1809 if (ss1->ptr_sess_info != 0) {
1811 uint32 num_entries = ss1->num_entries_read;
1813 if (num_entries > MAX_SESS_ENTRIES) {
1814 num_entries = MAX_SESS_ENTRIES; /* report this! */
1817 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1820 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1822 for (i = 0; i < num_entries; i++) {
1823 if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth))
1827 for (i = 0; i < num_entries; i++) {
1828 if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth))
1839 /*******************************************************************
1840 Reads or writes a structure.
1841 ********************************************************************/
1843 static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1845 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1847 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1850 if(UNMARSHALLING(ps)) {
1851 ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR));
1862 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1864 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1867 if (ctr->ptr_sess_ctr != 0) {
1868 switch (ctr->switch_value) {
1870 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1874 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1878 DEBUG(5,("%s no session info at switch_value %d\n",
1879 tab_depth(depth), ctr->switch_value));
1887 /*******************************************************************
1888 Inits a SRV_Q_NET_SESS_ENUM structure.
1889 ********************************************************************/
1891 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
1892 const char *srv_name, const char *qual_name,
1893 const char *user_name, uint32 sess_level,
1894 SRV_SESS_INFO_CTR *ctr, uint32 preferred_len,
1899 DEBUG(5,("init_q_net_sess_enum\n"));
1901 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1902 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1903 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
1905 q_n->sess_level = sess_level;
1906 q_n->preferred_len = preferred_len;
1908 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1911 /*******************************************************************
1912 Reads or writes a structure.
1913 ********************************************************************/
1915 BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
1920 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1926 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1928 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1934 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1936 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1941 if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
1943 if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
1949 if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level))
1952 if (q_n->sess_level != (uint32)-1) {
1953 if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth))
1957 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1960 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1966 /*******************************************************************
1967 Reads or writes a structure.
1968 ********************************************************************/
1970 BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1975 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1981 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1984 if (r_n->sess_level != (uint32)-1) {
1985 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1989 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1991 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1993 if(!prs_werror("status", ps, depth, &r_n->status))
1999 /*******************************************************************
2000 Inits a CONN_INFO_0 structure
2001 ********************************************************************/
2003 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
2005 DEBUG(5,("init_srv_conn_info0\n"));
2010 /*******************************************************************
2011 Reads or writes a structure.
2012 ********************************************************************/
2014 static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2019 prs_debug(ps, depth, desc, "srv_io_conn_info0");
2025 if(!prs_uint32("id", ps, depth, &ss0->id))
2031 /*******************************************************************
2032 Reads or writes a structure.
2033 ********************************************************************/
2035 static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2040 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
2046 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
2048 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
2051 if (ss0->ptr_conn_info != 0) {
2053 int num_entries = ss0->num_entries_read;
2055 if (num_entries > MAX_CONN_ENTRIES) {
2056 num_entries = MAX_CONN_ENTRIES; /* report this! */
2059 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
2062 for (i = 0; i < num_entries; i++) {
2063 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
2074 /*******************************************************************
2075 Inits a CONN_INFO_1_STR structure
2076 ********************************************************************/
2078 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name)
2080 DEBUG(5,("init_srv_conn_info1_str\n"));
2082 init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE);
2083 init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE);
2086 /*******************************************************************
2087 Reads or writes a structure.
2088 ********************************************************************/
2090 static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
2095 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
2101 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
2103 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
2109 /*******************************************************************
2110 Inits a CONN_INFO_1 structure
2111 ********************************************************************/
2113 void init_srv_conn_info1(CONN_INFO_1 *ss1,
2114 uint32 id, uint32 type,
2115 uint32 num_opens, uint32 num_users, uint32 open_time,
2116 const char *usr_name, const char *net_name)
2118 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
2122 ss1->num_opens = num_opens ;
2123 ss1->num_users = num_users;
2124 ss1->open_time = open_time;
2126 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
2127 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
2130 /*******************************************************************
2131 Reads or writes a structure.
2132 ********************************************************************/
2134 static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2139 prs_debug(ps, depth, desc, "srv_io_conn_info1");
2145 if(!prs_uint32("id ", ps, depth, &ss1->id))
2147 if(!prs_uint32("type ", ps, depth, &ss1->type))
2149 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
2151 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
2153 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
2156 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
2158 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
2164 /*******************************************************************
2165 Reads or writes a structure.
2166 ********************************************************************/
2168 static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2173 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
2179 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
2181 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
2184 if (ss1->ptr_conn_info != 0) {
2186 int num_entries = ss1->num_entries_read;
2188 if (num_entries > MAX_CONN_ENTRIES) {
2189 num_entries = MAX_CONN_ENTRIES; /* report this! */
2192 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
2195 for (i = 0; i < num_entries; i++) {
2196 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
2200 for (i = 0; i < num_entries; i++) {
2201 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
2212 /*******************************************************************
2213 Reads or writes a structure.
2214 ********************************************************************/
2216 static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
2218 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
2220 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
2223 if (UNMARSHALLING(ps)) {
2224 ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR));
2235 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2237 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
2240 if (ctr->ptr_conn_ctr != 0) {
2241 switch (ctr->switch_value) {
2243 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
2247 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
2251 DEBUG(5,("%s no connection info at switch_value %d\n",
2252 tab_depth(depth), ctr->switch_value));
2260 /*******************************************************************
2261 Reads or writes a structure.
2262 ********************************************************************/
2264 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
2265 const char *srv_name, const char *qual_name,
2266 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
2267 uint32 preferred_len,
2270 DEBUG(5,("init_q_net_conn_enum\n"));
2274 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
2275 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2277 q_n->conn_level = conn_level;
2278 q_n->preferred_len = preferred_len;
2280 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2283 /*******************************************************************
2284 Reads or writes a structure.
2285 ********************************************************************/
2287 BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
2292 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
2298 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2300 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
2306 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2308 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2314 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
2317 if (q_n->conn_level != (uint32)-1) {
2318 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
2322 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2325 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2331 /*******************************************************************
2332 Reads or writes a structure.
2333 ********************************************************************/
2335 BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
2340 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
2346 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
2349 if (r_n->conn_level != (uint32)-1) {
2350 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
2354 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2356 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2358 if(!prs_werror("status", ps, depth, &r_n->status))
2364 /*******************************************************************
2365 Inits a FILE_INFO_3_STR structure
2366 ********************************************************************/
2368 void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const char *path_name)
2370 DEBUG(5,("init_srv_file_info3_str\n"));
2372 init_unistr2(&fi3->uni_path_name, path_name, UNI_STR_TERMINATE);
2373 init_unistr2(&fi3->uni_user_name, user_name, UNI_STR_TERMINATE);
2376 /*******************************************************************
2377 Reads or writes a structure.
2378 ********************************************************************/
2380 static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
2385 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
2391 if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth))
2393 if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth))
2399 /*******************************************************************
2400 Inits a FILE_INFO_3 structure
2401 ********************************************************************/
2403 void init_srv_file_info3(FILE_INFO_3 *fl3,
2404 uint32 id, uint32 perms, uint32 num_locks,
2405 const char *path_name, const char *user_name)
2407 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name));
2411 fl3->num_locks = num_locks;
2413 fl3->ptr_path_name = (path_name != NULL) ? 1 : 0;
2414 fl3->ptr_user_name = (user_name != NULL) ? 1 : 0;
2417 /*******************************************************************
2418 Reads or writes a structure.
2419 ********************************************************************/
2421 static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
2426 prs_debug(ps, depth, desc, "srv_io_file_info3");
2432 if(!prs_uint32("id ", ps, depth, &fl3->id))
2434 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
2436 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
2438 if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name))
2440 if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name))
2446 /*******************************************************************
2447 Reads or writes a structure.
2448 ********************************************************************/
2450 static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
2455 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
2458 if (UNMARSHALLING(ps)) {
2459 memset(ctr, '\0', sizeof(SRV_FILE_INFO_CTR));
2465 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2467 if (ctr->switch_value != 3) {
2468 DEBUG(5,("%s File info %d level not supported\n",
2469 tab_depth(depth), ctr->switch_value));
2471 if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info))
2473 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
2475 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
2477 if (ctr->ptr_entries == 0)
2479 if(!prs_uint32("num_entries2", ps, depth,
2480 &ctr->num_entries2))
2483 switch (ctr->switch_value) {
2485 SRV_FILE_INFO_3 *info3 = ctr->file.info3;
2486 int num_entries = ctr->num_entries;
2489 if (UNMARSHALLING(ps)) {
2490 if (!(info3 = (SRV_FILE_INFO_3 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_FILE_INFO_3))))
2492 ctr->file.info3 = info3;
2495 for (i = 0; i < num_entries; i++) {
2496 if(!srv_io_file_info3("", &ctr->file.info3[i].info_3, ps, depth))
2499 for (i = 0; i < num_entries; i++) {
2500 if(!srv_io_file_info3_str("", &ctr->file.info3[i].info_3_str, ps, depth))
2506 DEBUG(5,("%s no file info at switch_value %d\n",
2507 tab_depth(depth), ctr->switch_value));
2514 /*******************************************************************
2515 Inits a SRV_Q_NET_FILE_ENUM structure.
2516 ********************************************************************/
2518 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
2519 const char *srv_name, const char *qual_name,
2520 const char *user_name,
2521 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
2522 uint32 preferred_len,
2525 DEBUG(5,("init_q_net_file_enum\n"));
2527 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
2528 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2529 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
2531 q_n->file_level = q_n->ctr.switch_value = file_level;
2532 q_n->preferred_len = preferred_len;
2533 q_n->ctr.ptr_file_info = 1;
2534 q_n->ctr.num_entries = 0;
2535 q_n->ctr.num_entries2 = 0;
2537 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2540 /*******************************************************************
2541 Reads or writes a structure.
2542 ********************************************************************/
2544 BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
2549 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
2555 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2557 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2563 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2565 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2571 if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
2573 if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
2578 if(!prs_uint32("file_level", ps, depth, &q_n->file_level))
2581 if (q_n->file_level != (uint32)-1) {
2582 if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth))
2586 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2589 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2595 /*******************************************************************
2596 Reads or writes a structure.
2597 ********************************************************************/
2599 BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
2604 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
2610 if(!prs_uint32("file_level", ps, depth, &r_n->file_level))
2613 if (r_n->file_level != 0) {
2614 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
2618 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2620 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2622 if(!prs_werror("status", ps, depth, &r_n->status))
2628 /*******************************************************************
2629 Initialize a net file close request
2630 ********************************************************************/
2631 void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server,
2634 q_n->ptr_srv_name = 1;
2635 init_unistr2(&q_n->uni_srv_name, server, UNI_STR_TERMINATE);
2636 q_n->file_id = file_id;
2639 /*******************************************************************
2640 Reads or writes a structure.
2641 ********************************************************************/
2642 BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_n,
2643 prs_struct *ps, int depth)
2648 prs_debug(ps, depth, desc, "srv_io_q_net_file_close");
2654 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2656 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2662 if(!prs_uint32("file_id", ps, depth, &q_n->file_id))
2668 /*******************************************************************
2669 Reads or writes a structure.
2670 ********************************************************************/
2672 BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *q_n,
2673 prs_struct *ps, int depth)
2678 prs_debug(ps, depth, desc, "srv_io_r_net_file_close");
2684 if(!prs_werror("status", ps, depth, &q_n->status))
2690 /*******************************************************************
2691 Inits a SRV_INFO_100 structure.
2692 ********************************************************************/
2694 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name)
2696 DEBUG(5,("init_srv_info_100\n"));
2698 sv100->platform_id = platform_id;
2699 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
2702 /*******************************************************************
2703 Reads or writes a SRV_INFO_101 structure.
2704 ********************************************************************/
2706 static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
2711 prs_debug(ps, depth, desc, "srv_io_info_100");
2717 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
2719 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
2722 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
2729 /*******************************************************************
2730 Inits a SRV_INFO_101 structure.
2731 ********************************************************************/
2733 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name,
2734 uint32 ver_major, uint32 ver_minor,
2735 uint32 srv_type, const char *comment)
2737 DEBUG(5,("init_srv_info_101\n"));
2739 sv101->platform_id = platform_id;
2740 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2741 sv101->ver_major = ver_major;
2742 sv101->ver_minor = ver_minor;
2743 sv101->srv_type = srv_type;
2744 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2747 /*******************************************************************
2748 Reads or writes a SRV_INFO_101 structure.
2749 ********************************************************************/
2751 static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2756 prs_debug(ps, depth, desc, "srv_io_info_101");
2762 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2764 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2766 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2768 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2770 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2772 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2778 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2780 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2786 /*******************************************************************
2787 Inits a SRV_INFO_102 structure.
2788 ********************************************************************/
2790 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name,
2791 const char *comment, uint32 ver_major, uint32 ver_minor,
2792 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2793 uint32 announce, uint32 ann_delta, uint32 licenses,
2794 const char *usr_path)
2796 DEBUG(5,("init_srv_info_102\n"));
2798 sv102->platform_id = platform_id;
2799 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2800 sv102->ver_major = ver_major;
2801 sv102->ver_minor = ver_minor;
2802 sv102->srv_type = srv_type;
2803 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2805 /* same as 101 up to here */
2807 sv102->users = users;
2809 sv102->hidden = hidden;
2810 sv102->announce = announce;
2811 sv102->ann_delta = ann_delta;
2812 sv102->licenses = licenses;
2813 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2817 /*******************************************************************
2818 Reads or writes a SRV_INFO_102 structure.
2819 ********************************************************************/
2821 static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2826 prs_debug(ps, depth, desc, "srv_io_info102");
2832 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2834 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2836 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2838 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2840 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2842 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2845 /* same as 101 up to here */
2847 if(!prs_uint32("users ", ps, depth, &sv102->users))
2849 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2851 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2853 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2855 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2857 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2859 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2862 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2866 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2870 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2876 /*******************************************************************
2877 Reads or writes a SRV_INFO_102 structure.
2878 ********************************************************************/
2880 static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2885 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2891 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2893 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2896 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2897 switch (ctr->switch_value) {
2899 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2903 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2907 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2911 DEBUG(5,("%s no server info at switch_value %d\n",
2912 tab_depth(depth), ctr->switch_value));
2922 /*******************************************************************
2923 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2924 ********************************************************************/
2926 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2927 const char *server_name, uint32 switch_value)
2929 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2931 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2933 srv->switch_value = switch_value;
2936 /*******************************************************************
2937 Reads or writes a structure.
2938 ********************************************************************/
2940 BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2945 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2951 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2953 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2959 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2965 /*******************************************************************
2966 Inits a SRV_R_NET_SRV_GET_INFO structure.
2967 ********************************************************************/
2969 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2970 uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
2972 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2976 if (W_ERROR_IS_OK(status)) {
2977 srv->ctr->switch_value = switch_value;
2978 srv->ctr->ptr_srv_ctr = 1;
2980 srv->ctr->switch_value = 0;
2981 srv->ctr->ptr_srv_ctr = 0;
2984 srv->status = status;
2987 /*******************************************************************
2988 Inits a SRV_R_NET_SRV_SET_INFO structure.
2989 ********************************************************************/
2991 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
2992 uint32 switch_value, WERROR status)
2994 DEBUG(5,("init_srv_r_net_srv_set_info\n"));
2996 srv->switch_value = switch_value;
2997 srv->status = status;
3000 /*******************************************************************
3001 Reads or writes a structure.
3002 ********************************************************************/
3004 BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n,
3005 prs_struct *ps, int depth)
3007 prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
3013 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3015 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3021 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
3024 if (UNMARSHALLING(ps)) {
3025 q_n->ctr = (SRV_INFO_CTR *)
3026 prs_alloc_mem(ps, sizeof(SRV_INFO_CTR));
3032 if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
3038 /*******************************************************************
3039 Reads or writes a structure.
3040 ********************************************************************/
3042 BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
3047 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
3053 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
3056 if(!prs_werror("status", ps, depth, &r_n->status))
3062 /*******************************************************************
3063 Reads or writes a structure.
3064 ********************************************************************/
3066 BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
3067 prs_struct *ps, int depth)
3069 prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
3075 if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value))
3078 if(!prs_werror("status", ps, depth, &r_n->status))
3084 /*******************************************************************
3085 Reads or writes a structure.
3086 ********************************************************************/
3088 BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
3093 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
3099 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3101 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3107 /*******************************************************************
3108 Reads or writes a TIME_OF_DAY_INFO structure.
3109 ********************************************************************/
3111 static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
3116 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
3122 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
3124 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
3126 if(!prs_uint32("hours ", ps, depth, &tod->hours))
3128 if(!prs_uint32("mins ", ps, depth, &tod->mins))
3130 if(!prs_uint32("secs ", ps, depth, &tod->secs))
3132 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
3134 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
3136 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
3138 if(!prs_uint32("day ", ps, depth, &tod->day))
3140 if(!prs_uint32("month ", ps, depth, &tod->month))
3142 if(!prs_uint32("year ", ps, depth, &tod->year))
3144 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
3150 /*******************************************************************
3151 Inits a TIME_OF_DAY_INFO structure.
3152 ********************************************************************/
3154 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
3155 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
3156 uint32 zone, uint32 tintervals, uint32 day,
3157 uint32 month, uint32 year, uint32 weekday)
3159 DEBUG(5,("init_time_of_day_info\n"));
3161 tod->elapsedt = elapsedt;
3168 tod->tintervals = tintervals;
3172 tod->weekday = weekday;
3176 /*******************************************************************
3177 Reads or writes a structure.
3178 ********************************************************************/
3180 BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
3185 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
3191 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
3194 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
3197 if(!prs_werror("status", ps, depth, &r_n->status))
3203 /*******************************************************************
3204 initialises a structure.
3205 ********************************************************************/
3207 BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n,
3208 const char *srv_name,
3209 uint32 preferred_len,
3215 DEBUG(5,("init_srv_q_net_srv_disk_enum\n"));
3217 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3219 q_n->disk_enum_ctr.level = 0;
3220 q_n->disk_enum_ctr.disk_info_ptr = 0;
3222 q_n->preferred_len = preferred_len;
3223 memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd));
3228 /*******************************************************************
3229 Reads or writes a structure.
3230 ********************************************************************/
3232 BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
3237 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
3243 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3246 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3252 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
3255 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
3258 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
3264 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
3266 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
3272 /*******************************************************************
3273 Reads or writes a structure.
3274 ********************************************************************/
3276 BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
3280 uint32 entries_read, entries_read2, entries_read3;
3285 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
3288 entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read;
3293 if(!prs_uint32("entries_read", ps, depth, &entries_read))
3295 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
3298 /*this may be max, unknown, actual?*/
3300 if(!prs_uint32("max_elements", ps, depth, &entries_read2))
3302 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
3304 if(!prs_uint32("actual_elements", ps, depth, &entries_read3))
3307 r_n->disk_enum_ctr.entries_read = entries_read3;
3309 if(UNMARSHALLING(ps)) {
3313 if(!(dinfo = (DISK_INFO *)prs_alloc_mem(ps, sizeof(*dinfo) * entries_read3)))
3315 r_n->disk_enum_ctr.disk_info = dinfo;
3318 for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) {
3320 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
3323 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
3330 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
3333 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
3336 if(!prs_werror("status", ps, depth, &r_n->status))
3342 /*******************************************************************
3343 initialises a structure.
3344 ********************************************************************/
3346 BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type)
3348 uint32 ptr_share_name;
3350 DEBUG(5,("init_srv_q_net_name_validate\n"));
3352 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3353 init_buf_unistr2(&q_n->uni_name, &ptr_share_name, share_name);
3361 /*******************************************************************
3362 Reads or writes a structure.
3363 ********************************************************************/
3365 BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
3370 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
3376 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3379 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3385 if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth))
3391 if(!prs_uint32("type", ps, depth, &q_n->type))
3394 if(!prs_uint32("flags", ps, depth, &q_n->flags))
3400 /*******************************************************************
3401 Reads or writes a structure.
3402 ********************************************************************/
3404 BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
3409 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
3415 if(!prs_werror("status", ps, depth, &r_n->status))
3421 /*******************************************************************
3422 Reads or writes a structure.
3423 ********************************************************************/
3425 BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
3430 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
3436 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3439 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3445 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3448 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3454 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3457 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
3460 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
3463 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
3469 /*******************************************************************
3470 Reads or writes a structure.
3471 ********************************************************************/
3473 BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
3478 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
3484 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
3487 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
3490 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
3493 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
3496 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
3502 if(!prs_werror("status", ps, depth, &r_n->status))
3508 /*******************************************************************
3509 Reads or writes a structure.
3510 ********************************************************************/
3512 BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
3517 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
3523 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3526 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3532 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3535 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3541 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3547 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
3550 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
3553 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
3556 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
3559 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
3565 /*******************************************************************
3566 Reads or writes a structure.
3567 ********************************************************************/
3569 BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
3574 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
3580 if(!prs_werror("status", ps, depth, &r_n->status))
3586 /*******************************************************************
3588 ********************************************************************/
3590 void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server)
3592 q_u->ptr_srv_name = 1;
3593 init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE);