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.
10 * Copyright (C) Gerald (Jerry) Carter 2006.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <http://www.gnu.org/licenses/>.
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) && num_entries) {
786 if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries)))
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) && num_entries) {
812 if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries)))
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) && num_entries) {
838 if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries)))
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) && num_entries) {
863 if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries)))
865 ctr->share.info501 = info501;
868 for (i = 0; i < num_entries; i++) {
869 if (!srv_io_share_info501("", &info501[i].info_501, ps, depth))
873 for (i = 0; i < num_entries; i++) {
874 if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth))
883 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
884 int num_entries = ctr->num_entries;
887 if (UNMARSHALLING(ps) && num_entries) {
888 if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries)))
890 ctr->share.info502 = info502;
893 for (i = 0; i < num_entries; i++) {
894 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
898 for (i = 0; i < num_entries; i++) {
899 info502[i].info_502_str.ptrs = &info502[i].info_502;
900 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
909 SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004;
910 int num_entries = ctr->num_entries;
913 if (UNMARSHALLING(ps) && num_entries) {
914 if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries)))
916 ctr->share.info1004 = info1004;
919 for (i = 0; i < num_entries; i++) {
920 if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth))
924 for (i = 0; i < num_entries; i++) {
925 info1004[i].info_1004_str.ptrs = &info1004[i].info_1004;
926 if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth))
935 SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005;
936 int num_entries = ctr->num_entries;
939 if (UNMARSHALLING(ps) && num_entries) {
940 if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries)))
942 ctr->share.info1005 = info1005;
945 for (i = 0; i < num_entries; i++) {
946 if(!srv_io_share_info1005("", &info1005[i], ps, depth))
955 SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006;
956 int num_entries = ctr->num_entries;
959 if (UNMARSHALLING(ps) && num_entries) {
960 if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries)))
962 ctr->share.info1006 = info1006;
965 for (i = 0; i < num_entries; i++) {
966 if(!srv_io_share_info1006("", &info1006[i], ps, depth))
975 SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007;
976 int num_entries = ctr->num_entries;
979 if (UNMARSHALLING(ps) && num_entries) {
980 if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries)))
982 ctr->share.info1007 = info1007;
985 for (i = 0; i < num_entries; i++) {
986 if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth))
990 for (i = 0; i < num_entries; i++) {
991 info1007[i].info_1007_str.ptrs = &info1007[i].info_1007;
992 if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth))
1001 SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501;
1002 int num_entries = ctr->num_entries;
1005 if (UNMARSHALLING(ps) && num_entries) {
1006 if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries)))
1008 ctr->share.info1501 = info1501;
1011 for (i = 0; i < num_entries; i++) {
1012 if(!srv_io_share_info1501("", &info1501[i], ps, depth))
1020 DEBUG(5,("%s no share info at switch_value %d\n",
1021 tab_depth(depth), ctr->switch_value));
1028 /*******************************************************************
1029 Inits a SRV_Q_NET_SHARE_ENUM structure.
1030 ********************************************************************/
1032 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
1033 const char *srv_name, uint32 info_level,
1034 uint32 preferred_len, ENUM_HND *hnd)
1037 DEBUG(5,("init_q_net_share_enum\n"));
1039 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1041 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
1042 q_n->ctr.ptr_share_info = 1;
1043 q_n->ctr.num_entries = 0;
1044 q_n->ctr.ptr_entries = 0;
1045 q_n->ctr.num_entries2 = 0;
1046 q_n->preferred_len = preferred_len;
1048 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1051 /*******************************************************************
1052 Reads or writes a structure.
1053 ********************************************************************/
1055 BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
1060 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
1066 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1068 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1071 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
1077 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1080 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1086 /*******************************************************************
1087 Reads or writes a structure.
1088 ********************************************************************/
1090 BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
1095 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
1098 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
1104 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1107 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1110 if(!prs_werror("status", ps, depth, &r_n->status))
1116 /*******************************************************************
1117 initialises a structure.
1118 ********************************************************************/
1120 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)
1123 uint32 ptr_share_name;
1125 DEBUG(5,("init_srv_q_net_share_get_info\n"));
1127 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1128 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1130 q_n->info_level = info_level;
1135 /*******************************************************************
1136 Reads or writes a structure.
1137 ********************************************************************/
1139 BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
1144 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
1150 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1152 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1155 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1161 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1167 /*******************************************************************
1168 Reads or writes a structure.
1169 ********************************************************************/
1171 static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
1176 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
1182 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
1185 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
1188 if (r_n->ptr_share_ctr != 0) {
1189 switch (r_n->switch_value) {
1191 if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth))
1194 /* allow access to pointers in the str part. */
1195 r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0;
1197 if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth))
1202 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
1205 /* allow access to pointers in the str part. */
1206 r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1;
1208 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
1213 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
1216 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth))
1221 if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth))
1223 if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth))
1228 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
1231 /* allow access to pointers in the str part. */
1232 r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
1234 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
1238 if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth))
1241 /* allow access to pointers in the str part. */
1242 r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004;
1244 if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth))
1248 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
1252 if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth))
1256 if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth))
1259 /* allow access to pointers in the str part. */
1260 r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007;
1262 if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth))
1266 if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
1269 DEBUG(5,("%s no share info at switch_value %d\n",
1270 tab_depth(depth), r_n->switch_value));
1278 /*******************************************************************
1279 Reads or writes a structure.
1280 ********************************************************************/
1282 BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
1287 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
1293 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
1299 if(!prs_werror("status", ps, depth, &r_n->status))
1305 /*******************************************************************
1306 intialises a structure.
1307 ********************************************************************/
1309 BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n,
1310 const char *srv_name,
1311 const char *share_name,
1313 const SRV_SHARE_INFO *info)
1316 uint32 ptr_share_name;
1318 DEBUG(5,("init_srv_q_net_share_set_info\n"));
1320 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1321 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1323 q_n->info_level = info_level;
1327 q_n->ptr_parm_error = 1;
1328 q_n->parm_error = 0;
1333 /*******************************************************************
1334 Reads or writes a structure.
1335 ********************************************************************/
1337 BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
1342 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
1348 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1350 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1353 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1359 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1365 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1370 if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error))
1372 if(q_n->ptr_parm_error!=0) {
1373 if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error))
1380 /*******************************************************************
1381 Reads or writes a structure.
1382 ********************************************************************/
1384 BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth)
1389 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
1395 if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error))
1398 if(r_n->ptr_parm_error) {
1400 if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error))
1404 if(!prs_werror("status", ps, depth, &r_n->status))
1411 /*******************************************************************
1412 Reads or writes a structure.
1413 ********************************************************************/
1415 BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
1420 prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
1426 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1428 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1434 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1440 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1446 if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index))
1448 if (q_n->ptr_err_index)
1449 if (!prs_uint32("err_index", ps, depth, &q_n->err_index))
1455 void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname,
1456 const char *netname, uint32 type, const char *remark,
1457 uint32 perms, uint32 max_uses, uint32 num_uses,
1458 const char *path, const char *passwd,
1459 int level, SEC_DESC *sd)
1463 size_t sd_size = sec_desc_size(sd);
1464 q->ptr_srv_name = 1;
1465 init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
1466 q->info.switch_value = q->info_level = level;
1467 q->info.ptr_share_ctr = 1;
1468 init_srv_share_info502(&q->info.share.info502.info_502, netname, type,
1469 remark, perms, max_uses, num_uses, path, passwd, sd, sd_size);
1470 init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname,
1471 remark, path, passwd, sd, sd_size);
1472 q->ptr_err_index = 1;
1478 q->ptr_srv_name = 1;
1479 init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
1480 q->info.switch_value = q->info_level = level;
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;
1493 /*******************************************************************
1494 Reads or writes a structure.
1495 ********************************************************************/
1497 BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth)
1502 prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
1508 if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error))
1511 if(r_n->ptr_parm_error) {
1513 if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error))
1517 if(!prs_werror("status", ps, depth, &r_n->status))
1523 /*******************************************************************
1524 initialises a structure.
1525 ********************************************************************/
1527 void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname,
1528 const char *sharename)
1530 del->ptr_srv_name = 1;
1531 init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE);
1532 init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE);
1535 /*******************************************************************
1536 Reads or writes a structure.
1537 ********************************************************************/
1539 BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1544 prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
1550 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1552 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1555 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1560 if(!prs_uint32("reserved", ps, depth, &q_n->reserved))
1566 /*******************************************************************
1567 Reads or writes a structure.
1568 ********************************************************************/
1570 BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1575 prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
1581 if(!prs_werror("status", ps, depth, &q_n->status))
1587 /*******************************************************************
1588 Inits a SESS_INFO_0_STR structure
1589 ********************************************************************/
1591 void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name )
1593 ZERO_STRUCTP( ss0 );
1596 if ( (ss0->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) {
1597 DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
1600 init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE );
1604 /*******************************************************************
1605 Reads or writes a structure.
1606 ********************************************************************/
1608 static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1613 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
1619 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1621 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
1624 if (ss0->ptr_sess_info != 0) {
1626 uint32 num_entries = ss0->num_entries_read;
1628 if (num_entries > MAX_SESS_ENTRIES) {
1629 num_entries = MAX_SESS_ENTRIES; /* report this! */
1632 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1635 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1637 /* first the pointers */
1638 for (i = 0; i < num_entries; i++) {
1639 if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) )
1643 /* now the strings */
1644 for (i = 0; i < num_entries; i++) {
1645 if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename ))
1656 /*******************************************************************
1657 Inits a SESS_INFO_1 structure
1658 ********************************************************************/
1660 void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user,
1661 uint32 num_opens, uint32 open_time, uint32 idle_time,
1664 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1666 ZERO_STRUCTP( ss1 );
1669 if ( (ss1->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) {
1670 DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
1673 init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE );
1677 if ( (ss1->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) {
1678 DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
1681 init_unistr2( ss1->username, user, UNI_STR_TERMINATE );
1684 ss1->num_opens = num_opens;
1685 ss1->open_time = open_time;
1686 ss1->idle_time = idle_time;
1687 ss1->user_flags = user_flags;
1691 /*******************************************************************
1692 Reads or writes a structure.
1693 ********************************************************************/
1695 static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1700 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1706 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1708 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1711 if (ss1->ptr_sess_info != 0) {
1713 uint32 num_entries = ss1->num_entries_read;
1715 if (num_entries > MAX_SESS_ENTRIES) {
1716 num_entries = MAX_SESS_ENTRIES; /* report this! */
1719 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1722 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1724 /* first the pointers and flags */
1726 for (i = 0; i < num_entries; i++) {
1728 if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename ))
1730 if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username ))
1733 if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens))
1735 if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time))
1737 if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time))
1739 if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags))
1743 /* now the strings */
1745 for (i = 0; i < num_entries; i++) {
1746 if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename ))
1748 if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username ))
1759 /*******************************************************************
1760 Reads or writes a structure.
1761 ********************************************************************/
1763 static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1765 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1767 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1770 if(UNMARSHALLING(ps)) {
1771 ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_SESS_INFO_CTR, 1);
1782 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1784 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1787 if (ctr->ptr_sess_ctr != 0) {
1788 switch (ctr->switch_value) {
1790 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1794 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1798 DEBUG(5,("%s no session info at switch_value %d\n",
1799 tab_depth(depth), ctr->switch_value));
1807 /*******************************************************************
1808 Reads or writes a structure.
1809 ********************************************************************/
1811 BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth)
1816 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1822 if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername,
1823 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
1829 if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier,
1830 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
1836 if(!prs_pointer("username", ps, depth, (void*)&q_u->username,
1837 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
1843 if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level))
1846 if (q_u->sess_level != (uint32)-1) {
1847 if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth))
1851 if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len))
1854 if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth))
1860 /*******************************************************************
1861 Reads or writes a structure.
1862 ********************************************************************/
1864 BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1869 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1875 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1878 if (r_n->sess_level != (uint32)-1) {
1879 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1883 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1885 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1887 if(!prs_werror("status", ps, depth, &r_n->status))
1893 /*******************************************************************
1894 Inits a SRV_Q_NET_SESS_DEL structure.
1895 ********************************************************************/
1897 void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name,
1898 const char *cli_name, const char *user_name)
1900 DEBUG(5,("init_q_net_sess_enum\n"));
1902 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1903 init_buf_unistr2(&q_n->uni_cli_name, &q_n->ptr_cli_name, cli_name);
1904 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
1907 /*******************************************************************
1908 Reads or writes a structure.
1909 ********************************************************************/
1911 BOOL srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth)
1916 prs_debug(ps, depth, desc, "srv_io_q_net_sess_del");
1922 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1924 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1930 if(!prs_uint32("ptr_cli_name", ps, depth, &q_n->ptr_cli_name))
1932 if(!smb_io_unistr2("", &q_n->uni_cli_name, q_n->ptr_cli_name, ps, depth))
1937 if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
1939 if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
1945 /*******************************************************************
1946 Reads or writes a structure.
1947 ********************************************************************/
1949 BOOL srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth)
1954 prs_debug(ps, depth, desc, "srv_io_r_net_sess_del");
1960 if(!prs_werror("status", ps, depth, &r_n->status))
1966 /*******************************************************************
1967 Inits a CONN_INFO_0 structure
1968 ********************************************************************/
1970 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
1972 DEBUG(5,("init_srv_conn_info0\n"));
1977 /*******************************************************************
1978 Reads or writes a structure.
1979 ********************************************************************/
1981 static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1986 prs_debug(ps, depth, desc, "srv_io_conn_info0");
1992 if(!prs_uint32("id", ps, depth, &ss0->id))
1998 /*******************************************************************
1999 Reads or writes a structure.
2000 ********************************************************************/
2002 static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2007 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
2013 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
2015 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
2018 if (ss0->ptr_conn_info != 0) {
2020 int num_entries = ss0->num_entries_read;
2022 if (num_entries > MAX_CONN_ENTRIES) {
2023 num_entries = MAX_CONN_ENTRIES; /* report this! */
2026 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
2029 for (i = 0; i < num_entries; i++) {
2030 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
2041 /*******************************************************************
2042 Inits a CONN_INFO_1_STR structure
2043 ********************************************************************/
2045 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name)
2047 DEBUG(5,("init_srv_conn_info1_str\n"));
2049 init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE);
2050 init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE);
2053 /*******************************************************************
2054 Reads or writes a structure.
2055 ********************************************************************/
2057 static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
2062 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
2068 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
2070 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
2076 /*******************************************************************
2077 Inits a CONN_INFO_1 structure
2078 ********************************************************************/
2080 void init_srv_conn_info1(CONN_INFO_1 *ss1,
2081 uint32 id, uint32 type,
2082 uint32 num_opens, uint32 num_users, uint32 open_time,
2083 const char *usr_name, const char *net_name)
2085 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
2089 ss1->num_opens = num_opens ;
2090 ss1->num_users = num_users;
2091 ss1->open_time = open_time;
2093 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
2094 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
2097 /*******************************************************************
2098 Reads or writes a structure.
2099 ********************************************************************/
2101 static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2106 prs_debug(ps, depth, desc, "srv_io_conn_info1");
2112 if(!prs_uint32("id ", ps, depth, &ss1->id))
2114 if(!prs_uint32("type ", ps, depth, &ss1->type))
2116 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
2118 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
2120 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
2123 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
2125 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
2131 /*******************************************************************
2132 Reads or writes a structure.
2133 ********************************************************************/
2135 static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2140 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
2146 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
2148 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
2151 if (ss1->ptr_conn_info != 0) {
2153 int num_entries = ss1->num_entries_read;
2155 if (num_entries > MAX_CONN_ENTRIES) {
2156 num_entries = MAX_CONN_ENTRIES; /* report this! */
2159 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
2162 for (i = 0; i < num_entries; i++) {
2163 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
2167 for (i = 0; i < num_entries; i++) {
2168 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
2179 /*******************************************************************
2180 Reads or writes a structure.
2181 ********************************************************************/
2183 static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
2185 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
2187 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
2190 if (UNMARSHALLING(ps)) {
2191 ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_CONN_INFO_CTR, 1);
2202 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2204 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
2207 if (ctr->ptr_conn_ctr != 0) {
2208 switch (ctr->switch_value) {
2210 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
2214 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
2218 DEBUG(5,("%s no connection info at switch_value %d\n",
2219 tab_depth(depth), ctr->switch_value));
2227 /*******************************************************************
2228 Reads or writes a structure.
2229 ********************************************************************/
2231 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
2232 const char *srv_name, const char *qual_name,
2233 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
2234 uint32 preferred_len,
2237 DEBUG(5,("init_q_net_conn_enum\n"));
2241 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
2242 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2244 q_n->conn_level = conn_level;
2245 q_n->preferred_len = preferred_len;
2247 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2250 /*******************************************************************
2251 Reads or writes a structure.
2252 ********************************************************************/
2254 BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
2259 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
2265 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2267 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
2273 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2275 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2281 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
2284 if (q_n->conn_level != (uint32)-1) {
2285 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
2289 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2292 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2298 /*******************************************************************
2299 Reads or writes a structure.
2300 ********************************************************************/
2302 BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
2307 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
2313 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
2316 if (r_n->conn_level != (uint32)-1) {
2317 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
2321 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2323 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2325 if(!prs_werror("status", ps, depth, &r_n->status))
2331 /*******************************************************************
2332 Reads or writes a structure.
2333 ********************************************************************/
2335 static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth)
2340 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
2347 if(!smb_io_unistr2("", sh1->path, True, ps, depth))
2352 if(!smb_io_unistr2("", sh1->user, True, ps, depth))
2359 /*******************************************************************
2360 Inits a FILE_INFO_3 structure
2361 ********************************************************************/
2363 void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks,
2364 const char *user_name, const char *path_name )
2368 fl3->num_locks = num_locks;
2371 if ( (fl3->path = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2373 init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE);
2377 if ( (fl3->user = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2379 init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE);
2385 /*******************************************************************
2386 Reads or writes a structure.
2387 ********************************************************************/
2389 static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
2396 prs_debug(ps, depth, desc, "srv_io_file_info3");
2402 if(!prs_uint32("id ", ps, depth, &fl3->id))
2404 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
2406 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
2409 uni_p = fl3->path ? 1 : 0;
2410 if(!prs_uint32("ptr", ps, depth, &uni_p))
2412 if (UNMARSHALLING(ps)) {
2413 if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) {
2418 uni_p = fl3->user ? 1 : 0;
2419 if(!prs_uint32("ptr", ps, depth, &uni_p))
2421 if (UNMARSHALLING(ps)) {
2422 if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) {
2430 /*******************************************************************
2431 Reads or writes a structure.
2432 ********************************************************************/
2434 static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
2439 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
2442 if (UNMARSHALLING(ps)) {
2449 if(!prs_uint32("level", ps, depth, &ctr->level))
2452 if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info))
2454 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
2456 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
2459 if (ctr->ptr_entries == 0)
2462 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
2465 switch (ctr->level) {
2467 FILE_INFO_3 *info3 = ctr->file.info3;
2468 int num_entries = ctr->num_entries;
2471 if (UNMARSHALLING(ps) && num_entries) {
2472 if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries)))
2474 ctr->file.info3 = info3;
2477 for (i = 0; i < num_entries; i++) {
2478 if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth))
2482 for (i = 0; i < num_entries; i++) {
2483 if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth))
2489 DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level));
2496 /*******************************************************************
2497 Inits a SRV_Q_NET_FILE_ENUM structure.
2498 ********************************************************************/
2500 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
2501 const char *srv_name, const char *qual_name,
2502 const char *user_name,
2503 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
2504 uint32 preferred_len,
2510 if ( (q_n->servername = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2512 init_buf_unistr2(q_n->servername, &ptr, srv_name);
2516 if ( (q_n->qualifier = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2518 init_buf_unistr2(q_n->qualifier, &ptr, qual_name);
2522 if ( (q_n->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2524 init_buf_unistr2(q_n->username, &ptr, user_name);
2527 q_n->level = q_n->ctr.level = 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(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth)
2546 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
2552 if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername,
2553 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
2558 if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier,
2559 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
2564 if(!prs_pointer("username", ps, depth, (void*)&q_u->username,
2565 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
2570 if(!prs_uint32("level", ps, depth, &q_u->level))
2573 if (q_u->level != (uint32)-1) {
2574 if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth))
2578 if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len))
2581 if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth))
2587 /*******************************************************************
2588 Reads or writes a structure.
2589 ********************************************************************/
2591 BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
2596 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
2602 if(!prs_uint32("level", ps, depth, &r_n->level))
2605 if (r_n->level != 0) {
2606 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
2610 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2612 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2614 if(!prs_werror("status", ps, depth, &r_n->status))
2620 /*******************************************************************
2621 Inits a SRV_INFO_100 structure.
2622 ********************************************************************/
2624 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name)
2626 DEBUG(5,("init_srv_info_100\n"));
2628 sv100->platform_id = platform_id;
2629 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
2632 /*******************************************************************
2633 Reads or writes a SRV_INFO_101 structure.
2634 ********************************************************************/
2636 static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
2641 prs_debug(ps, depth, desc, "srv_io_info_100");
2647 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
2649 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
2652 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
2659 /*******************************************************************
2660 Inits a SRV_INFO_101 structure.
2661 ********************************************************************/
2663 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name,
2664 uint32 ver_major, uint32 ver_minor,
2665 uint32 srv_type, const char *comment)
2667 DEBUG(5,("init_srv_info_101\n"));
2669 sv101->platform_id = platform_id;
2670 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2671 sv101->ver_major = ver_major;
2672 sv101->ver_minor = ver_minor;
2673 sv101->srv_type = srv_type;
2674 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2677 /*******************************************************************
2678 Reads or writes a SRV_INFO_101 structure.
2679 ********************************************************************/
2681 static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2686 prs_debug(ps, depth, desc, "srv_io_info_101");
2692 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2694 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2696 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2698 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2700 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2702 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2708 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2710 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2716 /*******************************************************************
2717 Inits a SRV_INFO_102 structure.
2718 ********************************************************************/
2720 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name,
2721 const char *comment, uint32 ver_major, uint32 ver_minor,
2722 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2723 uint32 announce, uint32 ann_delta, uint32 licenses,
2724 const char *usr_path)
2726 DEBUG(5,("init_srv_info_102\n"));
2728 sv102->platform_id = platform_id;
2729 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2730 sv102->ver_major = ver_major;
2731 sv102->ver_minor = ver_minor;
2732 sv102->srv_type = srv_type;
2733 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2735 /* same as 101 up to here */
2737 sv102->users = users;
2739 sv102->hidden = hidden;
2740 sv102->announce = announce;
2741 sv102->ann_delta = ann_delta;
2742 sv102->licenses = licenses;
2743 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2747 /*******************************************************************
2748 Reads or writes a SRV_INFO_102 structure.
2749 ********************************************************************/
2751 static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2756 prs_debug(ps, depth, desc, "srv_io_info102");
2762 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2764 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2766 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2768 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2770 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2772 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2775 /* same as 101 up to here */
2777 if(!prs_uint32("users ", ps, depth, &sv102->users))
2779 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2781 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2783 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2785 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2787 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2789 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2792 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2796 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2800 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2806 /*******************************************************************
2807 Reads or writes a SRV_INFO_102 structure.
2808 ********************************************************************/
2810 static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2815 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2821 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2823 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2826 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2827 switch (ctr->switch_value) {
2829 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2833 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2837 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2841 DEBUG(5,("%s no server info at switch_value %d\n",
2842 tab_depth(depth), ctr->switch_value));
2852 /*******************************************************************
2853 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2854 ********************************************************************/
2856 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2857 const char *server_name, uint32 switch_value)
2859 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2861 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2863 srv->switch_value = switch_value;
2866 /*******************************************************************
2867 Reads or writes a structure.
2868 ********************************************************************/
2870 BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2875 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2881 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2883 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2889 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2895 /*******************************************************************
2896 Inits a SRV_R_NET_SRV_GET_INFO structure.
2897 ********************************************************************/
2899 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2900 uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
2902 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2906 if (W_ERROR_IS_OK(status)) {
2907 srv->ctr->switch_value = switch_value;
2908 srv->ctr->ptr_srv_ctr = 1;
2910 srv->ctr->switch_value = 0;
2911 srv->ctr->ptr_srv_ctr = 0;
2914 srv->status = status;
2917 /*******************************************************************
2918 Inits a SRV_R_NET_SRV_SET_INFO structure.
2919 ********************************************************************/
2921 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
2922 uint32 switch_value, WERROR status)
2924 DEBUG(5,("init_srv_r_net_srv_set_info\n"));
2926 srv->switch_value = switch_value;
2927 srv->status = status;
2930 /*******************************************************************
2931 Reads or writes a structure.
2932 ********************************************************************/
2934 BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n,
2935 prs_struct *ps, int depth)
2937 prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
2943 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2945 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2951 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2954 if (UNMARSHALLING(ps)) {
2955 q_n->ctr = PRS_ALLOC_MEM(ps, SRV_INFO_CTR, 1);
2961 if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
2967 /*******************************************************************
2968 Reads or writes a structure.
2969 ********************************************************************/
2971 BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
2976 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
2982 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
2985 if(!prs_werror("status", ps, depth, &r_n->status))
2991 /*******************************************************************
2992 Reads or writes a structure.
2993 ********************************************************************/
2995 BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
2996 prs_struct *ps, int depth)
2998 prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
3004 if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value))
3007 if(!prs_werror("status", ps, depth, &r_n->status))
3013 /*******************************************************************
3014 Reads or writes a structure.
3015 ********************************************************************/
3017 BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
3022 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
3028 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3030 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3036 /*******************************************************************
3037 Reads or writes a TIME_OF_DAY_INFO structure.
3038 ********************************************************************/
3040 static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
3045 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
3051 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
3053 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
3055 if(!prs_uint32("hours ", ps, depth, &tod->hours))
3057 if(!prs_uint32("mins ", ps, depth, &tod->mins))
3059 if(!prs_uint32("secs ", ps, depth, &tod->secs))
3061 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
3063 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
3065 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
3067 if(!prs_uint32("day ", ps, depth, &tod->day))
3069 if(!prs_uint32("month ", ps, depth, &tod->month))
3071 if(!prs_uint32("year ", ps, depth, &tod->year))
3073 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
3079 /*******************************************************************
3080 Inits a TIME_OF_DAY_INFO structure.
3081 ********************************************************************/
3083 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
3084 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
3085 uint32 zone, uint32 tintervals, uint32 day,
3086 uint32 month, uint32 year, uint32 weekday)
3088 DEBUG(5,("init_time_of_day_info\n"));
3090 tod->elapsedt = elapsedt;
3097 tod->tintervals = tintervals;
3101 tod->weekday = weekday;
3105 /*******************************************************************
3106 Reads or writes a structure.
3107 ********************************************************************/
3109 BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
3114 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
3120 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
3123 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
3126 if(!prs_werror("status", ps, depth, &r_n->status))
3132 /*******************************************************************
3133 initialises a structure.
3134 ********************************************************************/
3136 BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n,
3137 const char *srv_name,
3138 uint32 preferred_len,
3144 DEBUG(5,("init_srv_q_net_srv_disk_enum\n"));
3146 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3148 q_n->disk_enum_ctr.level = 0;
3149 q_n->disk_enum_ctr.disk_info_ptr = 0;
3151 q_n->preferred_len = preferred_len;
3152 memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd));
3157 /*******************************************************************
3158 Reads or writes a structure.
3159 ********************************************************************/
3161 BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
3166 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
3172 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3175 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3181 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
3184 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
3187 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
3193 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
3195 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
3201 /*******************************************************************
3202 Reads or writes a structure.
3203 ********************************************************************/
3205 BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
3209 uint32 entries_read, entries_read2, entries_read3;
3214 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
3217 entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read;
3222 if(!prs_uint32("entries_read", ps, depth, &entries_read))
3224 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
3227 /*this may be max, unknown, actual?*/
3229 if(!prs_uint32("max_elements", ps, depth, &entries_read2))
3231 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
3233 if(!prs_uint32("actual_elements", ps, depth, &entries_read3))
3236 r_n->disk_enum_ctr.entries_read = entries_read3;
3238 if(UNMARSHALLING(ps) && entries_read3) {
3242 if(!(dinfo = PRS_ALLOC_MEM(ps, DISK_INFO, entries_read3)))
3244 r_n->disk_enum_ctr.disk_info = dinfo;
3247 for(i=0; i < entries_read3; i++) {
3249 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
3252 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
3259 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
3262 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
3265 if(!prs_werror("status", ps, depth, &r_n->status))
3271 /*******************************************************************
3272 Reads or writes a structure.
3273 ********************************************************************/
3275 BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
3280 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
3286 if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername,
3287 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
3293 if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth))
3299 if(!prs_uint32("type", ps, depth, &q_n->type))
3302 if(!prs_uint32("flags", ps, depth, &q_n->flags))
3308 /*******************************************************************
3309 Reads or writes a structure.
3310 ********************************************************************/
3312 BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
3317 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
3323 if(!prs_werror("status", ps, depth, &r_n->status))
3329 /*******************************************************************
3330 Reads or writes a structure.
3331 ********************************************************************/
3333 BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
3338 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
3344 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3347 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3353 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3356 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3362 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3365 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
3368 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
3371 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
3377 /*******************************************************************
3378 Reads or writes a structure.
3379 ********************************************************************/
3381 BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
3386 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
3392 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
3395 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
3398 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
3401 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
3404 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
3410 if(!prs_werror("status", ps, depth, &r_n->status))
3416 /*******************************************************************
3417 Reads or writes a structure.
3418 ********************************************************************/
3420 BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
3425 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
3431 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3434 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3440 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3443 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3449 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3455 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
3458 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
3461 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
3464 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
3467 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
3473 /*******************************************************************
3474 Reads or writes a structure.
3475 ********************************************************************/
3477 BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
3482 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
3488 if(!prs_werror("status", ps, depth, &r_n->status))
3494 /*******************************************************************
3496 ********************************************************************/
3498 void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server)
3500 q_u->ptr_srv_name = 1;
3501 init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE);