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 =
511 ndr_size_security_descriptor(sh502->sd, 0);
513 prs_set_offset(ps, old_offset + sh502->reserved);
518 if(MARSHALLING(ps)) {
520 sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset;
523 if(!prs_uint32_post("reserved ", ps, depth,
524 &sh502->reserved, reserved_offset, sh502->reserved))
526 if(!prs_uint32_post("reserved ", ps, depth,
527 &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved))
534 /*******************************************************************
535 Inits a SH_INFO_1004_STR structure
536 ********************************************************************/
538 void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark)
540 DEBUG(5,("init_srv_share_info1004_str\n"));
542 init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE);
545 /*******************************************************************
546 Reads or writes a structure.
547 ********************************************************************/
549 static bool srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth)
554 prs_debug(ps, depth, desc, "srv_io_share_info1004_str");
559 if(sh1004->ptrs->ptr_remark)
560 if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth))
566 /*******************************************************************
567 makes a SH_INFO_1004 structure
568 ********************************************************************/
570 void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark)
572 DEBUG(5,("init_srv_share_info1004: %s\n", remark));
574 sh1004->ptr_remark = (remark != NULL) ? 1 : 0;
577 /*******************************************************************
578 Reads or writes a structure.
579 ********************************************************************/
581 static bool srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth)
586 prs_debug(ps, depth, desc, "srv_io_share_info1004");
592 if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark))
598 /*******************************************************************
599 Reads or writes a structure.
600 ********************************************************************/
602 static bool srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth)
607 prs_debug(ps, depth, desc, "srv_io_share_info1005");
613 if(!prs_uint32("share_info_flags", ps, depth,
614 &sh1005->share_info_flags))
620 /*******************************************************************
621 Reads or writes a structure.
622 ********************************************************************/
624 static bool srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth)
629 prs_debug(ps, depth, desc, "srv_io_share_info1006");
635 if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses))
641 /*******************************************************************
642 Inits a SH_INFO_1007_STR structure
643 ********************************************************************/
645 void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name)
647 DEBUG(5,("init_srv_share_info1007_str\n"));
649 init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE);
652 /*******************************************************************
653 Reads or writes a structure.
654 ********************************************************************/
656 static bool srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth)
661 prs_debug(ps, depth, desc, "srv_io_share_info1007_str");
666 if(sh1007->ptrs->ptr_AlternateDirectoryName)
667 if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth))
673 /*******************************************************************
674 makes a SH_INFO_1007 structure
675 ********************************************************************/
677 void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name)
679 DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name));
681 sh1007->flags = flags;
682 sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0;
685 /*******************************************************************
686 Reads or writes a structure.
687 ********************************************************************/
689 static bool srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth)
694 prs_debug(ps, depth, desc, "srv_io_share_info1007");
700 if(!prs_uint32("flags ", ps, depth, &sh1007->flags))
702 if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName))
708 /*******************************************************************
709 Reads or writes a structure.
710 ********************************************************************/
712 static bool srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501,
713 prs_struct* ps, int depth)
718 prs_debug(ps, depth, desc, "srv_io_share_info1501");
724 if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
730 /*******************************************************************
731 Reads or writes a structure.
732 ********************************************************************/
734 static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
739 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
742 if (UNMARSHALLING(ps)) {
743 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
749 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
752 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
754 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
757 if (ctr->ptr_share_info == 0)
760 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
762 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
765 if (ctr->ptr_entries == 0) {
766 if (ctr->num_entries == 0)
772 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
775 if (ctr->num_entries2 != ctr->num_entries)
778 switch (ctr->switch_value) {
782 SRV_SHARE_INFO_0 *info0 = ctr->share.info0;
783 int num_entries = ctr->num_entries;
786 if (UNMARSHALLING(ps) && num_entries) {
787 if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries)))
789 ctr->share.info0 = info0;
792 for (i = 0; i < num_entries; i++) {
793 if(!srv_io_share_info0("", &info0[i].info_0, ps, depth))
797 for (i = 0; i < num_entries; i++) {
798 info0[i].info_0_str.ptrs = &info0[i].info_0;
799 if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth))
808 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
809 int num_entries = ctr->num_entries;
812 if (UNMARSHALLING(ps) && num_entries) {
813 if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries)))
815 ctr->share.info1 = info1;
818 for (i = 0; i < num_entries; i++) {
819 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
823 for (i = 0; i < num_entries; i++) {
824 info1[i].info_1_str.ptrs = &info1[i].info_1;
825 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
834 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
835 int num_entries = ctr->num_entries;
838 if (UNMARSHALLING(ps) && num_entries) {
839 if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries)))
841 ctr->share.info2 = info2;
844 for (i = 0; i < num_entries; i++) {
845 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
849 for (i = 0; i < num_entries; i++) {
850 if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth))
859 SRV_SHARE_INFO_501 *info501 = ctr->share.info501;
860 int num_entries = ctr->num_entries;
863 if (UNMARSHALLING(ps) && num_entries) {
864 if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries)))
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) && num_entries) {
889 if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries)))
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) && num_entries) {
915 if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries)))
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) && num_entries) {
941 if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries)))
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) && num_entries) {
961 if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries)))
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) && num_entries) {
981 if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries)))
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) && num_entries) {
1007 if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries)))
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(5,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(5,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 = ndr_size_security_descriptor(sd, 0);
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( SESS_INFO_0 *ss0, const char *name )
1594 ZERO_STRUCTP( ss0 );
1597 if ( (ss0->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) {
1598 DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
1601 init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE );
1605 /*******************************************************************
1606 Reads or writes a structure.
1607 ********************************************************************/
1609 static bool srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1614 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
1620 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1622 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
1625 if (ss0->ptr_sess_info != 0) {
1627 uint32 num_entries = ss0->num_entries_read;
1629 if (num_entries > MAX_SESS_ENTRIES) {
1630 num_entries = MAX_SESS_ENTRIES; /* report this! */
1633 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1636 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1638 /* first the pointers */
1639 for (i = 0; i < num_entries; i++) {
1640 if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) )
1644 /* now the strings */
1645 for (i = 0; i < num_entries; i++) {
1646 if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename ))
1657 /*******************************************************************
1658 Inits a SESS_INFO_1 structure
1659 ********************************************************************/
1661 void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user,
1662 uint32 num_opens, uint32 open_time, uint32 idle_time,
1665 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1667 ZERO_STRUCTP( ss1 );
1670 if ( (ss1->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) {
1671 DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
1674 init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE );
1678 if ( (ss1->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) {
1679 DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
1682 init_unistr2( ss1->username, user, UNI_STR_TERMINATE );
1685 ss1->num_opens = num_opens;
1686 ss1->open_time = open_time;
1687 ss1->idle_time = idle_time;
1688 ss1->user_flags = user_flags;
1692 /*******************************************************************
1693 Reads or writes a structure.
1694 ********************************************************************/
1696 static bool srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1701 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1707 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1709 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1712 if (ss1->ptr_sess_info != 0) {
1714 uint32 num_entries = ss1->num_entries_read;
1716 if (num_entries > MAX_SESS_ENTRIES) {
1717 num_entries = MAX_SESS_ENTRIES; /* report this! */
1720 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1723 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1725 /* first the pointers and flags */
1727 for (i = 0; i < num_entries; i++) {
1729 if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename ))
1731 if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username ))
1734 if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens))
1736 if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time))
1738 if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time))
1740 if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags))
1744 /* now the strings */
1746 for (i = 0; i < num_entries; i++) {
1747 if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename ))
1749 if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username ))
1760 /*******************************************************************
1761 Reads or writes a structure.
1762 ********************************************************************/
1764 static bool srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1766 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1768 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1771 if(UNMARSHALLING(ps)) {
1772 ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_SESS_INFO_CTR, 1);
1783 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1785 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1788 if (ctr->ptr_sess_ctr != 0) {
1789 switch (ctr->switch_value) {
1791 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1795 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1799 DEBUG(5,("%s no session info at switch_value %d\n",
1800 tab_depth(5,depth), ctr->switch_value));
1808 /*******************************************************************
1809 Reads or writes a structure.
1810 ********************************************************************/
1812 bool srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth)
1817 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1823 if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername,
1824 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
1830 if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier,
1831 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
1837 if(!prs_pointer("username", ps, depth, (void*)&q_u->username,
1838 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
1844 if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level))
1847 if (q_u->sess_level != (uint32)-1) {
1848 if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth))
1852 if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len))
1855 if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth))
1861 /*******************************************************************
1862 Reads or writes a structure.
1863 ********************************************************************/
1865 bool srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1870 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1876 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1879 if (r_n->sess_level != (uint32)-1) {
1880 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1884 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1886 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1888 if(!prs_werror("status", ps, depth, &r_n->status))
1894 /*******************************************************************
1895 Inits a SRV_Q_NET_SESS_DEL structure.
1896 ********************************************************************/
1898 void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name,
1899 const char *cli_name, const char *user_name)
1901 DEBUG(5,("init_q_net_sess_enum\n"));
1903 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1904 init_buf_unistr2(&q_n->uni_cli_name, &q_n->ptr_cli_name, cli_name);
1905 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
1908 /*******************************************************************
1909 Reads or writes a structure.
1910 ********************************************************************/
1912 bool srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth)
1917 prs_debug(ps, depth, desc, "srv_io_q_net_sess_del");
1923 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1925 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1931 if(!prs_uint32("ptr_cli_name", ps, depth, &q_n->ptr_cli_name))
1933 if(!smb_io_unistr2("", &q_n->uni_cli_name, q_n->ptr_cli_name, ps, depth))
1938 if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
1940 if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
1946 /*******************************************************************
1947 Reads or writes a structure.
1948 ********************************************************************/
1950 bool srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth)
1955 prs_debug(ps, depth, desc, "srv_io_r_net_sess_del");
1961 if(!prs_werror("status", ps, depth, &r_n->status))
1967 /*******************************************************************
1968 Inits a CONN_INFO_0 structure
1969 ********************************************************************/
1971 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
1973 DEBUG(5,("init_srv_conn_info0\n"));
1978 /*******************************************************************
1979 Reads or writes a structure.
1980 ********************************************************************/
1982 static bool srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1987 prs_debug(ps, depth, desc, "srv_io_conn_info0");
1993 if(!prs_uint32("id", ps, depth, &ss0->id))
1999 /*******************************************************************
2000 Reads or writes a structure.
2001 ********************************************************************/
2003 static bool srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2008 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
2014 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
2016 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
2019 if (ss0->ptr_conn_info != 0) {
2021 int num_entries = ss0->num_entries_read;
2023 if (num_entries > MAX_CONN_ENTRIES) {
2024 num_entries = MAX_CONN_ENTRIES; /* report this! */
2027 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
2030 for (i = 0; i < num_entries; i++) {
2031 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
2042 /*******************************************************************
2043 Inits a CONN_INFO_1_STR structure
2044 ********************************************************************/
2046 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name)
2048 DEBUG(5,("init_srv_conn_info1_str\n"));
2050 init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE);
2051 init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE);
2054 /*******************************************************************
2055 Reads or writes a structure.
2056 ********************************************************************/
2058 static bool srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
2063 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
2069 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
2071 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
2077 /*******************************************************************
2078 Inits a CONN_INFO_1 structure
2079 ********************************************************************/
2081 void init_srv_conn_info1(CONN_INFO_1 *ss1,
2082 uint32 id, uint32 type,
2083 uint32 num_opens, uint32 num_users, uint32 open_time,
2084 const char *usr_name, const char *net_name)
2086 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
2090 ss1->num_opens = num_opens ;
2091 ss1->num_users = num_users;
2092 ss1->open_time = open_time;
2094 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
2095 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
2098 /*******************************************************************
2099 Reads or writes a structure.
2100 ********************************************************************/
2102 static bool srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2107 prs_debug(ps, depth, desc, "srv_io_conn_info1");
2113 if(!prs_uint32("id ", ps, depth, &ss1->id))
2115 if(!prs_uint32("type ", ps, depth, &ss1->type))
2117 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
2119 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
2121 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
2124 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
2126 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
2132 /*******************************************************************
2133 Reads or writes a structure.
2134 ********************************************************************/
2136 static bool srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2141 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
2147 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
2149 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
2152 if (ss1->ptr_conn_info != 0) {
2154 int num_entries = ss1->num_entries_read;
2156 if (num_entries > MAX_CONN_ENTRIES) {
2157 num_entries = MAX_CONN_ENTRIES; /* report this! */
2160 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
2163 for (i = 0; i < num_entries; i++) {
2164 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
2168 for (i = 0; i < num_entries; i++) {
2169 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
2180 /*******************************************************************
2181 Reads or writes a structure.
2182 ********************************************************************/
2184 static bool srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
2186 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
2188 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
2191 if (UNMARSHALLING(ps)) {
2192 ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_CONN_INFO_CTR, 1);
2203 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2205 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
2208 if (ctr->ptr_conn_ctr != 0) {
2209 switch (ctr->switch_value) {
2211 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
2215 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
2219 DEBUG(5,("%s no connection info at switch_value %d\n",
2220 tab_depth(5,depth), ctr->switch_value));
2228 /*******************************************************************
2229 Reads or writes a structure.
2230 ********************************************************************/
2232 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
2233 const char *srv_name, const char *qual_name,
2234 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
2235 uint32 preferred_len,
2238 DEBUG(5,("init_q_net_conn_enum\n"));
2242 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
2243 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2245 q_n->conn_level = conn_level;
2246 q_n->preferred_len = preferred_len;
2248 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2251 /*******************************************************************
2252 Reads or writes a structure.
2253 ********************************************************************/
2255 bool srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
2260 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
2266 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2268 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
2274 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2276 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2282 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
2285 if (q_n->conn_level != (uint32)-1) {
2286 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
2290 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2293 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2299 /*******************************************************************
2300 Reads or writes a structure.
2301 ********************************************************************/
2303 bool srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
2308 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
2314 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
2317 if (r_n->conn_level != (uint32)-1) {
2318 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
2322 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2324 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2326 if(!prs_werror("status", ps, depth, &r_n->status))
2332 /*******************************************************************
2333 Reads or writes a structure.
2334 ********************************************************************/
2336 static bool srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth)
2341 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
2348 if(!smb_io_unistr2("", sh1->path, True, ps, depth))
2353 if(!smb_io_unistr2("", sh1->user, True, ps, depth))
2360 /*******************************************************************
2361 Inits a FILE_INFO_3 structure
2362 ********************************************************************/
2364 void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks,
2365 const char *user_name, const char *path_name )
2369 fl3->num_locks = num_locks;
2372 if ( (fl3->path = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2374 init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE);
2378 if ( (fl3->user = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2380 init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE);
2386 /*******************************************************************
2387 Reads or writes a structure.
2388 ********************************************************************/
2390 static bool srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
2397 prs_debug(ps, depth, desc, "srv_io_file_info3");
2403 if(!prs_uint32("id ", ps, depth, &fl3->id))
2405 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
2407 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
2410 uni_p = fl3->path ? 1 : 0;
2411 if(!prs_uint32("ptr", ps, depth, &uni_p))
2413 if (UNMARSHALLING(ps)) {
2414 if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) {
2419 uni_p = fl3->user ? 1 : 0;
2420 if(!prs_uint32("ptr", ps, depth, &uni_p))
2422 if (UNMARSHALLING(ps)) {
2423 if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) {
2431 /*******************************************************************
2432 Reads or writes a structure.
2433 ********************************************************************/
2435 static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
2440 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
2443 if (UNMARSHALLING(ps)) {
2450 if(!prs_uint32("level", ps, depth, &ctr->level))
2453 if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info))
2455 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
2457 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
2460 if (ctr->ptr_entries == 0)
2463 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
2466 switch (ctr->level) {
2468 FILE_INFO_3 *info3 = ctr->file.info3;
2469 int num_entries = ctr->num_entries;
2472 if (UNMARSHALLING(ps) && num_entries) {
2473 if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries)))
2475 ctr->file.info3 = info3;
2478 for (i = 0; i < num_entries; i++) {
2479 if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth))
2483 for (i = 0; i < num_entries; i++) {
2484 if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth))
2490 DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(5,depth), ctr->level));
2497 /*******************************************************************
2498 Inits a SRV_Q_NET_FILE_ENUM structure.
2499 ********************************************************************/
2501 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
2502 const char *srv_name, const char *qual_name,
2503 const char *user_name,
2504 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
2505 uint32 preferred_len,
2511 if ( (q_n->servername = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2513 init_buf_unistr2(q_n->servername, &ptr, srv_name);
2517 if ( (q_n->qualifier = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2519 init_buf_unistr2(q_n->qualifier, &ptr, qual_name);
2523 if ( (q_n->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL )
2525 init_buf_unistr2(q_n->username, &ptr, user_name);
2528 q_n->level = q_n->ctr.level = file_level;
2530 q_n->preferred_len = preferred_len;
2531 q_n->ctr.ptr_file_info = 1;
2532 q_n->ctr.num_entries = 0;
2533 q_n->ctr.num_entries2 = 0;
2535 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2538 /*******************************************************************
2539 Reads or writes a structure.
2540 ********************************************************************/
2542 bool srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth)
2547 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
2553 if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername,
2554 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
2559 if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier,
2560 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
2565 if(!prs_pointer("username", ps, depth, (void*)&q_u->username,
2566 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
2571 if(!prs_uint32("level", ps, depth, &q_u->level))
2574 if (q_u->level != (uint32)-1) {
2575 if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth))
2579 if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len))
2582 if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth))
2588 /*******************************************************************
2589 Reads or writes a structure.
2590 ********************************************************************/
2592 bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
2597 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
2603 if(!prs_uint32("level", ps, depth, &r_n->level))
2606 if (r_n->level != 0) {
2607 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
2611 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2613 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2615 if(!prs_werror("status", ps, depth, &r_n->status))
2621 /*******************************************************************
2622 Inits a SRV_INFO_100 structure.
2623 ********************************************************************/
2625 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name)
2627 DEBUG(5,("init_srv_info_100\n"));
2629 sv100->platform_id = platform_id;
2630 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
2633 /*******************************************************************
2634 Reads or writes a SRV_INFO_101 structure.
2635 ********************************************************************/
2637 static bool srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
2642 prs_debug(ps, depth, desc, "srv_io_info_100");
2648 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
2650 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
2653 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
2660 /*******************************************************************
2661 Inits a SRV_INFO_101 structure.
2662 ********************************************************************/
2664 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name,
2665 uint32 ver_major, uint32 ver_minor,
2666 uint32 srv_type, const char *comment)
2668 DEBUG(5,("init_srv_info_101\n"));
2670 sv101->platform_id = platform_id;
2671 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2672 sv101->ver_major = ver_major;
2673 sv101->ver_minor = ver_minor;
2674 sv101->srv_type = srv_type;
2675 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2678 /*******************************************************************
2679 Reads or writes a SRV_INFO_101 structure.
2680 ********************************************************************/
2682 static bool srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2687 prs_debug(ps, depth, desc, "srv_io_info_101");
2693 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2695 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2697 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2699 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2701 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2703 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2709 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2711 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2717 /*******************************************************************
2718 Inits a SRV_INFO_102 structure.
2719 ********************************************************************/
2721 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name,
2722 const char *comment, uint32 ver_major, uint32 ver_minor,
2723 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2724 uint32 announce, uint32 ann_delta, uint32 licenses,
2725 const char *usr_path)
2727 DEBUG(5,("init_srv_info_102\n"));
2729 sv102->platform_id = platform_id;
2730 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2731 sv102->ver_major = ver_major;
2732 sv102->ver_minor = ver_minor;
2733 sv102->srv_type = srv_type;
2734 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2736 /* same as 101 up to here */
2738 sv102->users = users;
2740 sv102->hidden = hidden;
2741 sv102->announce = announce;
2742 sv102->ann_delta = ann_delta;
2743 sv102->licenses = licenses;
2744 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2748 /*******************************************************************
2749 Reads or writes a SRV_INFO_102 structure.
2750 ********************************************************************/
2752 static bool srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2757 prs_debug(ps, depth, desc, "srv_io_info102");
2763 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2765 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2767 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2769 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2771 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2773 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2776 /* same as 101 up to here */
2778 if(!prs_uint32("users ", ps, depth, &sv102->users))
2780 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2782 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2784 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2786 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2788 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2790 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2793 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2797 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2801 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2807 /*******************************************************************
2808 Reads or writes a SRV_INFO_102 structure.
2809 ********************************************************************/
2811 static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2816 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2822 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2824 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2827 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2828 switch (ctr->switch_value) {
2830 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2834 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2838 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2842 DEBUG(5,("%s no server info at switch_value %d\n",
2843 tab_depth(5,depth), ctr->switch_value));
2853 /*******************************************************************
2854 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2855 ********************************************************************/
2857 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2858 const char *server_name, uint32 switch_value)
2860 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2862 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2864 srv->switch_value = switch_value;
2867 /*******************************************************************
2868 Reads or writes a structure.
2869 ********************************************************************/
2871 bool srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2876 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2882 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2884 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2890 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2896 /*******************************************************************
2897 Inits a SRV_R_NET_SRV_GET_INFO structure.
2898 ********************************************************************/
2900 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2901 uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
2903 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2907 if (W_ERROR_IS_OK(status)) {
2908 srv->ctr->switch_value = switch_value;
2909 srv->ctr->ptr_srv_ctr = 1;
2911 srv->ctr->switch_value = 0;
2912 srv->ctr->ptr_srv_ctr = 0;
2915 srv->status = status;
2918 /*******************************************************************
2919 Inits a SRV_R_NET_SRV_SET_INFO structure.
2920 ********************************************************************/
2922 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
2923 uint32 switch_value, WERROR status)
2925 DEBUG(5,("init_srv_r_net_srv_set_info\n"));
2927 srv->switch_value = switch_value;
2928 srv->status = status;
2931 /*******************************************************************
2932 Reads or writes a structure.
2933 ********************************************************************/
2935 bool srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n,
2936 prs_struct *ps, int depth)
2938 prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
2944 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2946 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2952 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2955 if (UNMARSHALLING(ps)) {
2956 q_n->ctr = PRS_ALLOC_MEM(ps, SRV_INFO_CTR, 1);
2962 if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
2968 /*******************************************************************
2969 Reads or writes a structure.
2970 ********************************************************************/
2972 bool srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
2977 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
2983 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
2986 if(!prs_werror("status", ps, depth, &r_n->status))
2992 /*******************************************************************
2993 Reads or writes a structure.
2994 ********************************************************************/
2996 bool srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
2997 prs_struct *ps, int depth)
2999 prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
3005 if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value))
3008 if(!prs_werror("status", ps, depth, &r_n->status))
3014 /*******************************************************************
3015 Reads or writes a structure.
3016 ********************************************************************/
3018 bool srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
3023 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
3029 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3031 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3037 /*******************************************************************
3038 Reads or writes a TIME_OF_DAY_INFO structure.
3039 ********************************************************************/
3041 static bool srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
3046 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
3052 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
3054 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
3056 if(!prs_uint32("hours ", ps, depth, &tod->hours))
3058 if(!prs_uint32("mins ", ps, depth, &tod->mins))
3060 if(!prs_uint32("secs ", ps, depth, &tod->secs))
3062 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
3064 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
3066 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
3068 if(!prs_uint32("day ", ps, depth, &tod->day))
3070 if(!prs_uint32("month ", ps, depth, &tod->month))
3072 if(!prs_uint32("year ", ps, depth, &tod->year))
3074 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
3080 /*******************************************************************
3081 Inits a TIME_OF_DAY_INFO structure.
3082 ********************************************************************/
3084 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
3085 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
3086 uint32 zone, uint32 tintervals, uint32 day,
3087 uint32 month, uint32 year, uint32 weekday)
3089 DEBUG(5,("init_time_of_day_info\n"));
3091 tod->elapsedt = elapsedt;
3098 tod->tintervals = tintervals;
3102 tod->weekday = weekday;
3106 /*******************************************************************
3107 Reads or writes a structure.
3108 ********************************************************************/
3110 bool srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
3115 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
3121 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
3124 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
3127 if(!prs_werror("status", ps, depth, &r_n->status))
3133 /*******************************************************************
3134 initialises a structure.
3135 ********************************************************************/
3137 bool init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n,
3138 const char *srv_name,
3139 uint32 preferred_len,
3145 DEBUG(5,("init_srv_q_net_srv_disk_enum\n"));
3147 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3149 q_n->disk_enum_ctr.level = 0;
3150 q_n->disk_enum_ctr.disk_info_ptr = 0;
3152 q_n->preferred_len = preferred_len;
3153 memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd));
3158 /*******************************************************************
3159 Reads or writes a structure.
3160 ********************************************************************/
3162 bool srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
3167 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
3173 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3176 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3182 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
3185 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
3188 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
3194 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
3196 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
3202 /*******************************************************************
3203 Reads or writes a structure.
3204 ********************************************************************/
3206 bool srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
3210 uint32 entries_read, entries_read2, entries_read3;
3215 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
3218 entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read;
3223 if(!prs_uint32("entries_read", ps, depth, &entries_read))
3225 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
3228 /*this may be max, unknown, actual?*/
3230 if(!prs_uint32("max_elements", ps, depth, &entries_read2))
3232 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
3234 if(!prs_uint32("actual_elements", ps, depth, &entries_read3))
3237 r_n->disk_enum_ctr.entries_read = entries_read3;
3239 if(UNMARSHALLING(ps) && entries_read3) {
3243 if(!(dinfo = PRS_ALLOC_MEM(ps, DISK_INFO, entries_read3)))
3245 r_n->disk_enum_ctr.disk_info = dinfo;
3248 for(i=0; i < entries_read3; i++) {
3250 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
3253 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
3260 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
3263 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
3266 if(!prs_werror("status", ps, depth, &r_n->status))
3272 /*******************************************************************
3273 Reads or writes a structure.
3274 ********************************************************************/
3276 bool srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
3281 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
3287 if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername,
3288 sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
3294 if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth))
3300 if(!prs_uint32("type", ps, depth, &q_n->type))
3303 if(!prs_uint32("flags", ps, depth, &q_n->flags))
3309 /*******************************************************************
3310 Reads or writes a structure.
3311 ********************************************************************/
3313 bool srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
3318 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
3324 if(!prs_werror("status", ps, depth, &r_n->status))
3330 /*******************************************************************
3331 Reads or writes a structure.
3332 ********************************************************************/
3334 bool srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
3339 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
3345 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3348 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3354 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3357 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3363 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3366 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
3369 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
3372 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
3378 /*******************************************************************
3379 Reads or writes a structure.
3380 ********************************************************************/
3382 bool srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
3387 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
3393 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
3396 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
3399 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
3402 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
3405 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
3411 if(!prs_werror("status", ps, depth, &r_n->status))
3417 /*******************************************************************
3418 Reads or writes a structure.
3419 ********************************************************************/
3421 bool srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
3426 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
3432 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3435 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3441 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3444 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3450 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3456 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
3459 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
3462 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
3465 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
3468 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
3474 /*******************************************************************
3475 Reads or writes a structure.
3476 ********************************************************************/
3478 bool srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
3483 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
3489 if(!prs_werror("status", ps, depth, &r_n->status))
3495 /*******************************************************************
3497 ********************************************************************/
3499 void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server)
3501 q_u->ptr_srv_name = 1;
3502 init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE);