2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997,
7 * Copyright (C) Jeremy Allison 1999,
8 * Copyright (C) Nigel Williams 2001,
9 * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #define DBGC_CLASS DBGC_RPC_PARSE
31 /*******************************************************************
32 Inits a SH_INFO_0_STR structure
33 ********************************************************************/
35 void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name)
37 DEBUG(5,("init_srv_share_info0_str\n"));
40 init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1);
43 /*******************************************************************
44 Reads or writes a structure.
45 ********************************************************************/
47 static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth)
52 prs_debug(ps, depth, desc, "srv_io_share_info0_str");
57 if(sh0->ptrs->ptr_netname)
58 if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth))
64 /*******************************************************************
65 makes a SH_INFO_0 structure
66 ********************************************************************/
68 void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name)
70 DEBUG(5,("init_srv_share_info0: %s\n", net_name));
72 sh0->ptr_netname = (net_name != NULL) ? 1 : 0;
75 /*******************************************************************
76 Reads or writes a structure.
77 ********************************************************************/
79 static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth)
84 prs_debug(ps, depth, desc, "srv_io_share_info0");
90 if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname))
96 /*******************************************************************
97 Inits a SH_INFO_1_STR structure
98 ********************************************************************/
100 void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark)
102 DEBUG(5,("init_srv_share_info1_str\n"));
105 init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
107 init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
110 /*******************************************************************
111 Reads or writes a structure.
112 ********************************************************************/
114 static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
119 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
125 if(sh1->ptrs->ptr_netname)
126 if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
132 if(sh1->ptrs->ptr_remark)
133 if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
139 /*******************************************************************
140 makes a SH_INFO_1 structure
141 ********************************************************************/
143 void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark)
145 DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark));
147 sh1->ptr_netname = (net_name != NULL) ? 1 : 0;
149 sh1->ptr_remark = (remark != NULL) ? 1 : 0;
152 /*******************************************************************
153 Reads or writes a structure.
154 ********************************************************************/
156 static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
161 prs_debug(ps, depth, desc, "srv_io_share_info1");
167 if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname))
169 if(!prs_uint32("type ", ps, depth, &sh1->type))
171 if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark))
177 /*******************************************************************
178 Inits a SH_INFO_2_STR structure
179 ********************************************************************/
181 void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
182 const char *net_name, const char *remark,
183 const char *path, const char *passwd)
185 DEBUG(5,("init_srv_share_info2_str\n"));
188 init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
190 init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
192 init_unistr2(&sh2->uni_path, path, strlen(path)+1);
194 init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
197 /*******************************************************************
198 Reads or writes a structure.
199 ********************************************************************/
201 static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
206 if (UNMARSHALLING(ps))
209 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
216 if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
220 if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
224 if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
228 if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
234 /*******************************************************************
235 Inits a SH_INFO_2 structure
236 ********************************************************************/
238 void init_srv_share_info2(SH_INFO_2 *sh2,
239 const char *net_name, uint32 type, const char *remark,
240 uint32 perms, uint32 max_uses, uint32 num_uses,
241 const char *path, const char *passwd)
243 DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
245 sh2->ptr_netname = (net_name != NULL) ? 1 : 0;
247 sh2->ptr_remark = (remark != NULL) ? 1 : 0;
249 sh2->max_uses = max_uses;
250 sh2->num_uses = num_uses;
251 sh2->ptr_path = (path != NULL) ? 1 : 0;
252 sh2->ptr_passwd = (passwd != NULL) ? 1 : 0;
255 /*******************************************************************
256 Reads or writes a structure.
257 ********************************************************************/
259 static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
264 prs_debug(ps, depth, desc, "srv_io_share_info2");
270 if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname))
272 if(!prs_uint32("type ", ps, depth, &sh2->type))
274 if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark))
276 if(!prs_uint32("perms ", ps, depth, &sh2->perms))
278 if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses))
280 if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses))
282 if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path))
284 if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd))
290 /*******************************************************************
291 Inits a SH_INFO_501_STR structure
292 ********************************************************************/
294 void init_srv_share_info501_str(SH_INFO_501_STR *sh501,
295 const char *net_name, const char *remark)
297 DEBUG(5,("init_srv_share_info501_str\n"));
300 init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1);
302 init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1);
305 /*******************************************************************
306 Inits a SH_INFO_2 structure
307 *******************************************************************/
309 void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy)
311 DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type,
312 remark, csc_policy));
316 sh501->ptr_netname = (net_name != NULL) ? 1 : 0;
318 sh501->ptr_remark = (remark != NULL) ? 1 : 0;
319 sh501->csc_policy = csc_policy;
322 /*******************************************************************
323 Reads of writes a structure.
324 *******************************************************************/
326 static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth)
331 prs_debug(ps, depth, desc, "srv_io_share_info501");
337 if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname))
339 if (!prs_uint32("type ", ps, depth, &sh501->type))
341 if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark))
343 if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy))
349 /*******************************************************************
350 Reads or writes a structure.
351 ********************************************************************/
353 static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth)
358 prs_debug(ps, depth, desc, "srv_io_share_info501_str");
363 if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth))
368 if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth))
374 /*******************************************************************
375 Inits a SH_INFO_502 structure
376 ********************************************************************/
378 void init_srv_share_info502(SH_INFO_502 *sh502,
379 const char *net_name, uint32 type, const char *remark,
380 uint32 perms, uint32 max_uses, uint32 num_uses,
381 const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size)
383 DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
387 sh502->ptr_netname = (net_name != NULL) ? 1 : 0;
389 sh502->ptr_remark = (remark != NULL) ? 1 : 0;
390 sh502->perms = perms;
391 sh502->max_uses = max_uses;
392 sh502->num_uses = num_uses;
393 sh502->ptr_path = (path != NULL) ? 1 : 0;
394 sh502->ptr_passwd = (passwd != NULL) ? 1 : 0;
395 sh502->reserved = 0; /* actual size within rpc */
396 sh502->sd_size = (uint32)sd_size;
397 sh502->ptr_sd = (psd != NULL) ? 1 : 0;
400 /*******************************************************************
401 Reads or writes a structure.
402 ********************************************************************/
404 static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth)
409 prs_debug(ps, depth, desc, "srv_io_share_info502");
415 if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname))
417 if(!prs_uint32("type ", ps, depth, &sh502->type))
419 if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark))
421 if(!prs_uint32("perms ", ps, depth, &sh502->perms))
423 if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses))
425 if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses))
427 if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path))
429 if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
431 if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset))
433 if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd))
439 /*******************************************************************
440 Inits a SH_INFO_502_STR structure
441 ********************************************************************/
443 void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
444 const char *net_name, const char *remark,
445 const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size)
447 DEBUG(5,("init_srv_share_info502_str\n"));
450 init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1);
452 init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1);
454 init_unistr2(&sh502str->uni_path, path, strlen(path)+1);
456 init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1);
458 sh502str->reserved = 0;
459 sh502str->sd_size = sd_size;
462 /*******************************************************************
463 Reads or writes a structure.
464 ********************************************************************/
466 static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
471 prs_debug(ps, depth, desc, "srv_io_share_info502_str");
477 if(sh502->ptrs->ptr_netname) {
478 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
485 if(sh502->ptrs->ptr_remark) {
486 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
493 if(sh502->ptrs->ptr_path) {
494 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
501 if(sh502->ptrs->ptr_passwd) {
502 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
509 if(sh502->ptrs->ptr_sd) {
511 uint32 reserved_offset;
513 if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset))
516 old_offset = prs_offset(ps);
518 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
521 if(UNMARSHALLING(ps)) {
523 sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd);
525 prs_set_offset(ps, old_offset + sh502->reserved);
530 if(MARSHALLING(ps)) {
532 sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset;
535 if(!prs_uint32_post("reserved ", ps, depth,
536 &sh502->reserved, reserved_offset, sh502->reserved))
538 if(!prs_uint32_post("reserved ", ps, depth,
539 &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved))
546 /*******************************************************************
547 Inits a SH_INFO_1004_STR structure
548 ********************************************************************/
550 void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark)
552 DEBUG(5,("init_srv_share_info1004_str\n"));
555 init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1);
558 /*******************************************************************
559 Reads or writes a structure.
560 ********************************************************************/
562 static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth)
567 prs_debug(ps, depth, desc, "srv_io_share_info1004_str");
572 if(sh1004->ptrs->ptr_remark)
573 if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth))
579 /*******************************************************************
580 makes a SH_INFO_1004 structure
581 ********************************************************************/
583 void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark)
585 DEBUG(5,("init_srv_share_info1004: %s\n", remark));
587 sh1004->ptr_remark = (remark != NULL) ? 1 : 0;
590 /*******************************************************************
591 Reads or writes a structure.
592 ********************************************************************/
594 static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth)
599 prs_debug(ps, depth, desc, "srv_io_share_info1004");
605 if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark))
611 /*******************************************************************
612 Reads or writes a structure.
613 ********************************************************************/
615 static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth)
620 prs_debug(ps, depth, desc, "srv_io_share_info1005");
626 if(!prs_uint32("share_info_flags", ps, depth,
627 &sh1005->share_info_flags))
633 /*******************************************************************
634 Reads or writes a structure.
635 ********************************************************************/
637 static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth)
642 prs_debug(ps, depth, desc, "srv_io_share_info1006");
648 if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses))
654 /*******************************************************************
655 Inits a SH_INFO_1007_STR structure
656 ********************************************************************/
658 void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name)
660 DEBUG(5,("init_srv_share_info1007_str\n"));
662 if(alternate_directory_name)
663 init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1);
666 /*******************************************************************
667 Reads or writes a structure.
668 ********************************************************************/
670 static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth)
675 prs_debug(ps, depth, desc, "srv_io_share_info1007_str");
680 if(sh1007->ptrs->ptr_AlternateDirectoryName)
681 if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth))
687 /*******************************************************************
688 makes a SH_INFO_1007 structure
689 ********************************************************************/
691 void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name)
693 DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name));
695 sh1007->flags = flags;
696 sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0;
699 /*******************************************************************
700 Reads or writes a structure.
701 ********************************************************************/
703 static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth)
708 prs_debug(ps, depth, desc, "srv_io_share_info1007");
714 if(!prs_uint32("flags ", ps, depth, &sh1007->flags))
716 if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName))
722 /*******************************************************************
723 Reads or writes a structure.
724 ********************************************************************/
726 static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501,
727 prs_struct* ps, int depth)
732 prs_debug(ps, depth, desc, "srv_io_share_info1501");
738 if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
744 /*******************************************************************
745 Reads or writes a structure.
746 ********************************************************************/
748 static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
753 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
756 if (UNMARSHALLING(ps)) {
757 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
763 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
766 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
768 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
771 if (ctr->ptr_share_info == 0)
774 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
776 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
779 if (ctr->ptr_entries == 0) {
780 if (ctr->num_entries == 0)
786 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
789 if (ctr->num_entries2 != ctr->num_entries)
792 switch (ctr->switch_value) {
796 SRV_SHARE_INFO_0 *info0 = ctr->share.info0;
797 int num_entries = ctr->num_entries;
800 if (UNMARSHALLING(ps)) {
801 if (!(info0 = (SRV_SHARE_INFO_0 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_0))))
803 ctr->share.info0 = info0;
806 for (i = 0; i < num_entries; i++) {
807 if(!srv_io_share_info0("", &info0[i].info_0, ps, depth))
811 for (i = 0; i < num_entries; i++) {
812 info0[i].info_0_str.ptrs = &info0[i].info_0;
813 if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth))
822 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
823 int num_entries = ctr->num_entries;
826 if (UNMARSHALLING(ps)) {
827 if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1))))
829 ctr->share.info1 = info1;
832 for (i = 0; i < num_entries; i++) {
833 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
837 for (i = 0; i < num_entries; i++) {
838 info1[i].info_1_str.ptrs = &info1[i].info_1;
839 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
848 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
849 int num_entries = ctr->num_entries;
852 if (UNMARSHALLING(ps)) {
853 if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2))))
855 ctr->share.info2 = info2;
858 for (i = 0; i < num_entries; i++) {
859 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
863 for (i = 0; i < num_entries; i++) {
864 if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth))
873 SRV_SHARE_INFO_501 *info501 = ctr->share.info501;
874 int num_entries = ctr->num_entries;
877 if (UNMARSHALLING(ps)) {
878 if (!(info501 = (SRV_SHARE_INFO_501 *) prs_alloc_mem(ps, num_entries *
879 sizeof (SRV_SHARE_INFO_501))))
881 ctr->share.info501 = info501;
884 for (i = 0; i < num_entries; i++) {
885 if (!srv_io_share_info501("", &info501[i].info_501, ps, depth))
889 for (i = 0; i < num_entries; i++) {
890 if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth))
899 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
900 int num_entries = ctr->num_entries;
903 if (UNMARSHALLING(ps)) {
904 if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502))))
906 ctr->share.info502 = info502;
909 for (i = 0; i < num_entries; i++) {
910 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
914 for (i = 0; i < num_entries; i++) {
915 info502[i].info_502_str.ptrs = &info502[i].info_502;
916 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
925 SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004;
926 int num_entries = ctr->num_entries;
929 if (UNMARSHALLING(ps)) {
930 if (!(info1004 = (SRV_SHARE_INFO_1004 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1004))))
932 ctr->share.info1004 = info1004;
935 for (i = 0; i < num_entries; i++) {
936 if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth))
940 for (i = 0; i < num_entries; i++) {
941 info1004[i].info_1004_str.ptrs = &info1004[i].info_1004;
942 if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth))
951 SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005;
952 int num_entries = ctr->num_entries;
955 if (UNMARSHALLING(ps)) {
956 if (!(info1005 = (SRV_SHARE_INFO_1005 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1005))))
958 ctr->share.info1005 = info1005;
961 for (i = 0; i < num_entries; i++) {
962 if(!srv_io_share_info1005("", &info1005[i], ps, depth))
971 SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006;
972 int num_entries = ctr->num_entries;
975 if (UNMARSHALLING(ps)) {
976 if (!(info1006 = (SRV_SHARE_INFO_1006 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1006))))
978 ctr->share.info1006 = info1006;
981 for (i = 0; i < num_entries; i++) {
982 if(!srv_io_share_info1006("", &info1006[i], ps, depth))
991 SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007;
992 int num_entries = ctr->num_entries;
995 if (UNMARSHALLING(ps)) {
996 if (!(info1007 = (SRV_SHARE_INFO_1007 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1007))))
998 ctr->share.info1007 = info1007;
1001 for (i = 0; i < num_entries; i++) {
1002 if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth))
1006 for (i = 0; i < num_entries; i++) {
1007 info1007[i].info_1007_str.ptrs = &info1007[i].info_1007;
1008 if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth))
1017 SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501;
1018 int num_entries = ctr->num_entries;
1021 if (UNMARSHALLING(ps)) {
1022 if (!(info1501 = (SRV_SHARE_INFO_1501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1501))))
1024 ctr->share.info1501 = info1501;
1027 for (i = 0; i < num_entries; i++) {
1028 if(!srv_io_share_info1501("", &info1501[i], ps, depth))
1036 DEBUG(5,("%s no share info at switch_value %d\n",
1037 tab_depth(depth), ctr->switch_value));
1044 /*******************************************************************
1045 Inits a SRV_Q_NET_SHARE_ENUM structure.
1046 ********************************************************************/
1048 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
1049 const char *srv_name, uint32 info_level,
1050 uint32 preferred_len, ENUM_HND *hnd)
1053 DEBUG(5,("init_q_net_share_enum\n"));
1055 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1057 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
1058 q_n->ctr.ptr_share_info = 1;
1059 q_n->ctr.num_entries = 0;
1060 q_n->ctr.ptr_entries = 0;
1061 q_n->ctr.num_entries2 = 0;
1062 q_n->preferred_len = preferred_len;
1064 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1067 /*******************************************************************
1068 Reads or writes a structure.
1069 ********************************************************************/
1071 BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
1076 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
1082 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1084 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1087 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
1093 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1096 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1102 /*******************************************************************
1103 Reads or writes a structure.
1104 ********************************************************************/
1106 BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
1111 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
1114 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
1120 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1123 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1126 if(!prs_werror("status", ps, depth, &r_n->status))
1132 /*******************************************************************
1133 initialises a structure.
1134 ********************************************************************/
1136 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)
1139 uint32 ptr_share_name;
1141 DEBUG(5,("init_srv_q_net_share_get_info\n"));
1143 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1144 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1146 q_n->info_level = info_level;
1151 /*******************************************************************
1152 Reads or writes a structure.
1153 ********************************************************************/
1155 BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
1160 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
1166 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1168 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1171 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1177 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1183 /*******************************************************************
1184 Reads or writes a structure.
1185 ********************************************************************/
1187 static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
1192 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
1198 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
1201 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
1204 if (r_n->ptr_share_ctr != 0) {
1205 switch (r_n->switch_value) {
1207 if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth))
1210 /* allow access to pointers in the str part. */
1211 r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0;
1213 if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth))
1218 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
1221 /* allow access to pointers in the str part. */
1222 r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1;
1224 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
1229 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
1232 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth))
1237 if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth))
1239 if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth))
1244 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
1247 /* allow access to pointers in the str part. */
1248 r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
1250 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
1254 if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth))
1257 /* allow access to pointers in the str part. */
1258 r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004;
1260 if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth))
1264 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
1268 if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth))
1272 if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth))
1275 /* allow access to pointers in the str part. */
1276 r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007;
1278 if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth))
1282 if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
1285 DEBUG(5,("%s no share info at switch_value %d\n",
1286 tab_depth(depth), r_n->switch_value));
1294 /*******************************************************************
1295 Reads or writes a structure.
1296 ********************************************************************/
1298 BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
1303 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
1309 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
1315 if(!prs_werror("status", ps, depth, &r_n->status))
1321 /*******************************************************************
1322 intialises a structure.
1323 ********************************************************************/
1325 BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n,
1326 const char *srv_name,
1327 const char *share_name,
1329 const SRV_SHARE_INFO *info)
1332 uint32 ptr_share_name;
1334 DEBUG(5,("init_srv_q_net_share_set_info\n"));
1336 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1337 init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name);
1339 q_n->info_level = info_level;
1343 q_n->ptr_parm_error = 1;
1344 q_n->parm_error = 0;
1349 /*******************************************************************
1350 Reads or writes a structure.
1351 ********************************************************************/
1353 BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
1358 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
1364 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1366 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1369 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1375 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1381 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1386 if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error))
1388 if(q_n->ptr_parm_error!=0) {
1389 if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error))
1396 /*******************************************************************
1397 Reads or writes a structure.
1398 ********************************************************************/
1400 BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth)
1405 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
1411 if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error))
1414 if(r_n->ptr_parm_error) {
1416 if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error))
1420 if(!prs_werror("status", ps, depth, &r_n->status))
1427 /*******************************************************************
1428 Reads or writes a structure.
1429 ********************************************************************/
1431 BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
1436 prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
1442 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1444 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1450 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
1456 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
1462 if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index))
1464 if (q_n->ptr_err_index)
1465 if (!prs_uint32("err_index", ps, depth, &q_n->err_index))
1471 void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname,
1472 const char *netname, uint32 type, const char *remark,
1473 uint32 perms, uint32 max_uses, uint32 num_uses,
1474 const char *path, const char *passwd)
1476 q->ptr_srv_name = 1;
1477 init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1);
1478 q->info.switch_value = q->info_level = 2;
1480 q->info.ptr_share_ctr = 1;
1481 init_srv_share_info2(&q->info.share.info2.info_2, netname, type,
1482 remark, perms, max_uses, num_uses, path, passwd);
1483 init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname,
1484 remark, path, passwd);
1485 q->ptr_err_index = 1;
1490 /*******************************************************************
1491 Reads or writes a structure.
1492 ********************************************************************/
1494 BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth)
1499 prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
1505 if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error))
1508 if(r_n->ptr_parm_error) {
1510 if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error))
1514 if(!prs_werror("status", ps, depth, &r_n->status))
1520 /*******************************************************************
1521 initialises a structure.
1522 ********************************************************************/
1524 void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname,
1525 const char *sharename)
1527 del->ptr_srv_name = 1;
1528 init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 );
1529 init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1);
1532 /*******************************************************************
1533 Reads or writes a structure.
1534 ********************************************************************/
1536 BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1541 prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
1547 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1549 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1552 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
1557 if(!prs_uint32("reserved", ps, depth, &q_n->reserved))
1563 /*******************************************************************
1564 Reads or writes a structure.
1565 ********************************************************************/
1567 BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
1572 prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
1578 if(!prs_werror("status", ps, depth, &q_n->status))
1584 /*******************************************************************
1585 Inits a SESS_INFO_0_STR structure
1586 ********************************************************************/
1588 void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name)
1590 DEBUG(5,("init_srv_sess_info0_str\n"));
1592 init_unistr2(&ss0->uni_name, name, strlen(name)+1);
1595 /*******************************************************************
1596 Reads or writes a structure.
1597 ********************************************************************/
1599 static BOOL srv_io_sess_info0_str(const char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
1604 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
1610 if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth))
1616 /*******************************************************************
1617 Inits a SESS_INFO_0 structure
1618 ********************************************************************/
1620 void init_srv_sess_info0(SESS_INFO_0 *ss0, const char *name)
1622 DEBUG(5,("init_srv_sess_info0: %s\n", name));
1624 ss0->ptr_name = (name != NULL) ? 1 : 0;
1627 /*******************************************************************
1628 Reads or writes a structure.
1629 ********************************************************************/
1631 static BOOL srv_io_sess_info0(const char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1636 prs_debug(ps, depth, desc, "srv_io_sess_info0");
1642 if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name))
1648 /*******************************************************************
1649 Reads or writes a structure.
1650 ********************************************************************/
1652 static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
1657 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
1663 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1665 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
1668 if (ss0->ptr_sess_info != 0) {
1670 uint32 num_entries = ss0->num_entries_read;
1672 if (num_entries > MAX_SESS_ENTRIES) {
1673 num_entries = MAX_SESS_ENTRIES; /* report this! */
1676 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1679 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1681 for (i = 0; i < num_entries; i++) {
1682 if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth))
1686 for (i = 0; i < num_entries; i++) {
1687 if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth))
1698 /*******************************************************************
1699 Inits a SESS_INFO_1_STR structure
1700 ********************************************************************/
1702 void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char *user)
1704 DEBUG(5,("init_srv_sess_info1_str\n"));
1706 init_unistr2(&ss1->uni_name, name, strlen(name)+1);
1707 init_unistr2(&ss1->uni_user, user, strlen(user)+1);
1710 /*******************************************************************
1711 Reads or writes a structure.
1712 ********************************************************************/
1714 static BOOL srv_io_sess_info1_str(const char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
1719 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
1725 if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth))
1727 if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth))
1733 /*******************************************************************
1734 Inits a SESS_INFO_1 structure
1735 ********************************************************************/
1737 void init_srv_sess_info1(SESS_INFO_1 *ss1,
1738 const char *name, const char *user,
1739 uint32 num_opens, uint32 open_time, uint32 idle_time,
1742 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1744 ss1->ptr_name = (name != NULL) ? 1 : 0;
1745 ss1->ptr_user = (user != NULL) ? 1 : 0;
1747 ss1->num_opens = num_opens;
1748 ss1->open_time = open_time;
1749 ss1->idle_time = idle_time;
1750 ss1->user_flags = user_flags;
1753 /*******************************************************************
1754 reads or writes a structure.
1755 ********************************************************************/
1757 static BOOL srv_io_sess_info1(const char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1762 prs_debug(ps, depth, desc, "srv_io_sess_info1");
1768 if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name))
1770 if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user))
1773 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1775 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1777 if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time))
1779 if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags))
1785 /*******************************************************************
1786 Reads or writes a structure.
1787 ********************************************************************/
1789 static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1794 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1800 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1802 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1805 if (ss1->ptr_sess_info != 0) {
1807 uint32 num_entries = ss1->num_entries_read;
1809 if (num_entries > MAX_SESS_ENTRIES) {
1810 num_entries = MAX_SESS_ENTRIES; /* report this! */
1813 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1816 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1818 for (i = 0; i < num_entries; i++) {
1819 if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth))
1823 for (i = 0; i < num_entries; i++) {
1824 if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth))
1835 /*******************************************************************
1836 Reads or writes a structure.
1837 ********************************************************************/
1839 static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1841 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1843 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1846 if(UNMARSHALLING(ps)) {
1847 ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR));
1858 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1860 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1863 if (ctr->ptr_sess_ctr != 0) {
1864 switch (ctr->switch_value) {
1866 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1870 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1874 DEBUG(5,("%s no session info at switch_value %d\n",
1875 tab_depth(depth), ctr->switch_value));
1883 /*******************************************************************
1884 Inits a SRV_Q_NET_SESS_ENUM structure.
1885 ********************************************************************/
1887 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
1888 const char *srv_name, const char *qual_name,
1889 const char *user_name, uint32 sess_level,
1890 SRV_SESS_INFO_CTR *ctr, uint32 preferred_len,
1895 DEBUG(5,("init_q_net_sess_enum\n"));
1897 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1898 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1899 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
1901 q_n->sess_level = sess_level;
1902 q_n->preferred_len = preferred_len;
1904 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1907 /*******************************************************************
1908 Reads or writes a structure.
1909 ********************************************************************/
1911 BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
1916 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
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_qual_name", ps, depth, &q_n->ptr_qual_name))
1932 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_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 if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level))
1948 if (q_n->sess_level != (uint32)-1) {
1949 if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth))
1953 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1956 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1962 /*******************************************************************
1963 Reads or writes a structure.
1964 ********************************************************************/
1966 BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1971 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1977 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1980 if (r_n->sess_level != (uint32)-1) {
1981 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1985 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1987 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1989 if(!prs_werror("status", ps, depth, &r_n->status))
1995 /*******************************************************************
1996 Inits a CONN_INFO_0 structure
1997 ********************************************************************/
1999 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
2001 DEBUG(5,("init_srv_conn_info0\n"));
2006 /*******************************************************************
2007 Reads or writes a structure.
2008 ********************************************************************/
2010 static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2015 prs_debug(ps, depth, desc, "srv_io_conn_info0");
2021 if(!prs_uint32("id", ps, depth, &ss0->id))
2027 /*******************************************************************
2028 Reads or writes a structure.
2029 ********************************************************************/
2031 static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
2036 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
2042 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
2044 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
2047 if (ss0->ptr_conn_info != 0) {
2049 int num_entries = ss0->num_entries_read;
2051 if (num_entries > MAX_CONN_ENTRIES) {
2052 num_entries = MAX_CONN_ENTRIES; /* report this! */
2055 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
2058 for (i = 0; i < num_entries; i++) {
2059 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
2070 /*******************************************************************
2071 Inits a CONN_INFO_1_STR structure
2072 ********************************************************************/
2074 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name)
2076 DEBUG(5,("init_srv_conn_info1_str\n"));
2078 init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1);
2079 init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1);
2082 /*******************************************************************
2083 Reads or writes a structure.
2084 ********************************************************************/
2086 static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
2091 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
2097 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
2099 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
2105 /*******************************************************************
2106 Inits a CONN_INFO_1 structure
2107 ********************************************************************/
2109 void init_srv_conn_info1(CONN_INFO_1 *ss1,
2110 uint32 id, uint32 type,
2111 uint32 num_opens, uint32 num_users, uint32 open_time,
2112 const char *usr_name, const char *net_name)
2114 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
2118 ss1->num_opens = num_opens ;
2119 ss1->num_users = num_users;
2120 ss1->open_time = open_time;
2122 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
2123 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
2126 /*******************************************************************
2127 Reads or writes a structure.
2128 ********************************************************************/
2130 static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2135 prs_debug(ps, depth, desc, "srv_io_conn_info1");
2141 if(!prs_uint32("id ", ps, depth, &ss1->id))
2143 if(!prs_uint32("type ", ps, depth, &ss1->type))
2145 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
2147 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
2149 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
2152 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
2154 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
2160 /*******************************************************************
2161 Reads or writes a structure.
2162 ********************************************************************/
2164 static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
2169 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
2175 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
2177 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
2180 if (ss1->ptr_conn_info != 0) {
2182 int num_entries = ss1->num_entries_read;
2184 if (num_entries > MAX_CONN_ENTRIES) {
2185 num_entries = MAX_CONN_ENTRIES; /* report this! */
2188 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
2191 for (i = 0; i < num_entries; i++) {
2192 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
2196 for (i = 0; i < num_entries; i++) {
2197 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
2208 /*******************************************************************
2209 Reads or writes a structure.
2210 ********************************************************************/
2212 static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
2214 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
2216 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
2219 if (UNMARSHALLING(ps)) {
2220 ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR));
2231 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2233 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
2236 if (ctr->ptr_conn_ctr != 0) {
2237 switch (ctr->switch_value) {
2239 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
2243 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
2247 DEBUG(5,("%s no connection info at switch_value %d\n",
2248 tab_depth(depth), ctr->switch_value));
2256 /*******************************************************************
2257 Reads or writes a structure.
2258 ********************************************************************/
2260 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
2261 const char *srv_name, const char *qual_name,
2262 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
2263 uint32 preferred_len,
2266 DEBUG(5,("init_q_net_conn_enum\n"));
2270 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
2271 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2273 q_n->conn_level = conn_level;
2274 q_n->preferred_len = preferred_len;
2276 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2279 /*******************************************************************
2280 Reads or writes a structure.
2281 ********************************************************************/
2283 BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
2288 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
2294 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2296 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
2302 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2304 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2310 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
2313 if (q_n->conn_level != (uint32)-1) {
2314 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
2318 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2321 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2327 /*******************************************************************
2328 Reads or writes a structure.
2329 ********************************************************************/
2331 BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
2336 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
2342 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
2345 if (r_n->conn_level != (uint32)-1) {
2346 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
2350 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2352 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2354 if(!prs_werror("status", ps, depth, &r_n->status))
2360 /*******************************************************************
2361 Inits a FILE_INFO_3_STR structure
2362 ********************************************************************/
2364 void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const char *path_name)
2366 DEBUG(5,("init_srv_file_info3_str\n"));
2368 init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1);
2369 init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1);
2372 /*******************************************************************
2373 Reads or writes a structure.
2374 ********************************************************************/
2376 static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
2381 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
2387 if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth))
2389 if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth))
2395 /*******************************************************************
2396 Inits a FILE_INFO_3 structure
2397 ********************************************************************/
2399 void init_srv_file_info3(FILE_INFO_3 *fl3,
2400 uint32 id, uint32 perms, uint32 num_locks,
2401 const char *path_name, const char *user_name)
2403 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name));
2407 fl3->num_locks = num_locks;
2409 fl3->ptr_path_name = (path_name != NULL) ? 1 : 0;
2410 fl3->ptr_user_name = (user_name != NULL) ? 1 : 0;
2413 /*******************************************************************
2414 Reads or writes a structure.
2415 ********************************************************************/
2417 static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
2422 prs_debug(ps, depth, desc, "srv_io_file_info3");
2428 if(!prs_uint32("id ", ps, depth, &fl3->id))
2430 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
2432 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
2434 if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name))
2436 if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name))
2442 /*******************************************************************
2443 Reads or writes a structure.
2444 ********************************************************************/
2446 static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
2451 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
2454 if (UNMARSHALLING(ps)) {
2455 memset(ctr, '\0', sizeof(SRV_FILE_INFO_CTR));
2461 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2463 if (ctr->switch_value != 3) {
2464 DEBUG(5,("%s File info %d level not supported\n",
2465 tab_depth(depth), ctr->switch_value));
2467 if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info))
2469 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
2471 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
2473 if (ctr->ptr_entries == 0)
2475 if(!prs_uint32("num_entries2", ps, depth,
2476 &ctr->num_entries2))
2479 switch (ctr->switch_value) {
2481 SRV_FILE_INFO_3 *info3 = ctr->file.info3;
2482 int num_entries = ctr->num_entries;
2485 if (UNMARSHALLING(ps)) {
2486 if (!(info3 = (SRV_FILE_INFO_3 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_FILE_INFO_3))))
2488 ctr->file.info3 = info3;
2491 for (i = 0; i < num_entries; i++) {
2492 if(!srv_io_file_info3("", &ctr->file.info3[i].info_3, ps, depth))
2495 for (i = 0; i < num_entries; i++) {
2496 if(!srv_io_file_info3_str("", &ctr->file.info3[i].info_3_str, ps, depth))
2502 DEBUG(5,("%s no file info at switch_value %d\n",
2503 tab_depth(depth), ctr->switch_value));
2510 /*******************************************************************
2511 Inits a SRV_Q_NET_FILE_ENUM structure.
2512 ********************************************************************/
2514 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
2515 const char *srv_name, const char *qual_name,
2516 const char *user_name,
2517 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
2518 uint32 preferred_len,
2521 DEBUG(5,("init_q_net_file_enum\n"));
2523 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
2524 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
2525 init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
2527 q_n->file_level = q_n->ctr.switch_value = file_level;
2528 q_n->preferred_len = preferred_len;
2529 q_n->ctr.ptr_file_info = 1;
2530 q_n->ctr.num_entries = 0;
2531 q_n->ctr.num_entries2 = 0;
2533 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
2536 /*******************************************************************
2537 Reads or writes a structure.
2538 ********************************************************************/
2540 BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
2545 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
2551 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2553 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2559 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2561 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
2567 if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
2569 if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
2574 if(!prs_uint32("file_level", ps, depth, &q_n->file_level))
2577 if (q_n->file_level != (uint32)-1) {
2578 if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth))
2582 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2585 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2591 /*******************************************************************
2592 Reads or writes a structure.
2593 ********************************************************************/
2595 BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
2600 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
2606 if(!prs_uint32("file_level", ps, depth, &r_n->file_level))
2609 if (r_n->file_level != 0) {
2610 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
2614 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2616 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2618 if(!prs_werror("status", ps, depth, &r_n->status))
2624 /*******************************************************************
2625 Initialize a net file close request
2626 ********************************************************************/
2627 void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server,
2630 q_n->ptr_srv_name = 1;
2631 init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1);
2632 q_n->file_id = file_id;
2635 /*******************************************************************
2636 Reads or writes a structure.
2637 ********************************************************************/
2638 BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_n,
2639 prs_struct *ps, int depth)
2644 prs_debug(ps, depth, desc, "srv_io_q_net_file_close");
2650 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2652 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2658 if(!prs_uint32("file_id", ps, depth, &q_n->file_id))
2664 /*******************************************************************
2665 Reads or writes a structure.
2666 ********************************************************************/
2668 BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *q_n,
2669 prs_struct *ps, int depth)
2674 prs_debug(ps, depth, desc, "srv_io_r_net_file_close");
2680 if(!prs_werror("status", ps, depth, &q_n->status))
2686 /*******************************************************************
2687 Inits a SRV_INFO_100 structure.
2688 ********************************************************************/
2690 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name)
2692 DEBUG(5,("init_srv_info_100\n"));
2694 sv100->platform_id = platform_id;
2695 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
2698 /*******************************************************************
2699 Reads or writes a SRV_INFO_101 structure.
2700 ********************************************************************/
2702 static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
2707 prs_debug(ps, depth, desc, "srv_io_info_100");
2713 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
2715 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
2718 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
2725 /*******************************************************************
2726 Inits a SRV_INFO_101 structure.
2727 ********************************************************************/
2729 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name,
2730 uint32 ver_major, uint32 ver_minor,
2731 uint32 srv_type, const char *comment)
2733 DEBUG(5,("init_srv_info_101\n"));
2735 sv101->platform_id = platform_id;
2736 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2737 sv101->ver_major = ver_major;
2738 sv101->ver_minor = ver_minor;
2739 sv101->srv_type = srv_type;
2740 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2743 /*******************************************************************
2744 Reads or writes a SRV_INFO_101 structure.
2745 ********************************************************************/
2747 static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2752 prs_debug(ps, depth, desc, "srv_io_info_101");
2758 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2760 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2762 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2764 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2766 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2768 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2774 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2776 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2782 /*******************************************************************
2783 Inits a SRV_INFO_102 structure.
2784 ********************************************************************/
2786 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name,
2787 const char *comment, uint32 ver_major, uint32 ver_minor,
2788 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2789 uint32 announce, uint32 ann_delta, uint32 licenses,
2790 const char *usr_path)
2792 DEBUG(5,("init_srv_info_102\n"));
2794 sv102->platform_id = platform_id;
2795 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2796 sv102->ver_major = ver_major;
2797 sv102->ver_minor = ver_minor;
2798 sv102->srv_type = srv_type;
2799 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2801 /* same as 101 up to here */
2803 sv102->users = users;
2805 sv102->hidden = hidden;
2806 sv102->announce = announce;
2807 sv102->ann_delta = ann_delta;
2808 sv102->licenses = licenses;
2809 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2813 /*******************************************************************
2814 Reads or writes a SRV_INFO_102 structure.
2815 ********************************************************************/
2817 static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2822 prs_debug(ps, depth, desc, "srv_io_info102");
2828 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2830 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2832 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2834 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2836 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2838 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2841 /* same as 101 up to here */
2843 if(!prs_uint32("users ", ps, depth, &sv102->users))
2845 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2847 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2849 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2851 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2853 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2855 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2858 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2862 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2866 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2872 /*******************************************************************
2873 Reads or writes a SRV_INFO_102 structure.
2874 ********************************************************************/
2876 static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2881 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2887 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2889 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2892 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2893 switch (ctr->switch_value) {
2895 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2899 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2903 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2907 DEBUG(5,("%s no server info at switch_value %d\n",
2908 tab_depth(depth), ctr->switch_value));
2918 /*******************************************************************
2919 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2920 ********************************************************************/
2922 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2923 const char *server_name, uint32 switch_value)
2925 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2927 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2929 srv->switch_value = switch_value;
2932 /*******************************************************************
2933 Reads or writes a structure.
2934 ********************************************************************/
2936 BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2941 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2947 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2949 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2955 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2961 /*******************************************************************
2962 Inits a SRV_R_NET_SRV_GET_INFO structure.
2963 ********************************************************************/
2965 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2966 uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
2968 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2972 if (W_ERROR_IS_OK(status)) {
2973 srv->ctr->switch_value = switch_value;
2974 srv->ctr->ptr_srv_ctr = 1;
2976 srv->ctr->switch_value = 0;
2977 srv->ctr->ptr_srv_ctr = 0;
2980 srv->status = status;
2983 /*******************************************************************
2984 Inits a SRV_R_NET_SRV_SET_INFO structure.
2985 ********************************************************************/
2987 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
2988 uint32 switch_value, WERROR status)
2990 DEBUG(5,("init_srv_r_net_srv_set_info\n"));
2992 srv->switch_value = switch_value;
2993 srv->status = status;
2996 /*******************************************************************
2997 Reads or writes a structure.
2998 ********************************************************************/
3000 BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n,
3001 prs_struct *ps, int depth)
3003 prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
3009 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3011 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3017 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
3020 if (UNMARSHALLING(ps)) {
3021 q_n->ctr = (SRV_INFO_CTR *)
3022 prs_alloc_mem(ps, sizeof(SRV_INFO_CTR));
3028 if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
3034 /*******************************************************************
3035 Reads or writes a structure.
3036 ********************************************************************/
3038 BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
3043 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
3049 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
3052 if(!prs_werror("status", ps, depth, &r_n->status))
3058 /*******************************************************************
3059 Reads or writes a structure.
3060 ********************************************************************/
3062 BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
3063 prs_struct *ps, int depth)
3065 prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
3071 if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value))
3074 if(!prs_werror("status", ps, depth, &r_n->status))
3080 /*******************************************************************
3081 Reads or writes a structure.
3082 ********************************************************************/
3084 BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
3089 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
3095 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
3097 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3103 /*******************************************************************
3104 Reads or writes a TIME_OF_DAY_INFO structure.
3105 ********************************************************************/
3107 static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
3112 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
3118 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
3120 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
3122 if(!prs_uint32("hours ", ps, depth, &tod->hours))
3124 if(!prs_uint32("mins ", ps, depth, &tod->mins))
3126 if(!prs_uint32("secs ", ps, depth, &tod->secs))
3128 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
3130 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
3132 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
3134 if(!prs_uint32("day ", ps, depth, &tod->day))
3136 if(!prs_uint32("month ", ps, depth, &tod->month))
3138 if(!prs_uint32("year ", ps, depth, &tod->year))
3140 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
3146 /*******************************************************************
3147 Inits a TIME_OF_DAY_INFO structure.
3148 ********************************************************************/
3150 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
3151 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
3152 uint32 zone, uint32 tintervals, uint32 day,
3153 uint32 month, uint32 year, uint32 weekday)
3155 DEBUG(5,("init_time_of_day_info\n"));
3157 tod->elapsedt = elapsedt;
3164 tod->tintervals = tintervals;
3168 tod->weekday = weekday;
3172 /*******************************************************************
3173 Reads or writes a structure.
3174 ********************************************************************/
3176 BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
3181 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
3187 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
3190 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
3193 if(!prs_werror("status", ps, depth, &r_n->status))
3199 /*******************************************************************
3200 initialises a structure.
3201 ********************************************************************/
3203 BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n,
3204 const char *srv_name,
3205 uint32 preferred_len,
3211 DEBUG(5,("init_srv_q_net_srv_disk_enum\n"));
3213 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3215 q_n->disk_enum_ctr.level = 0;
3216 q_n->disk_enum_ctr.disk_info_ptr = 0;
3218 q_n->preferred_len = preferred_len;
3219 memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd));
3224 /*******************************************************************
3225 Reads or writes a structure.
3226 ********************************************************************/
3228 BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
3233 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
3239 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3242 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3248 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
3251 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
3254 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
3260 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
3262 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
3268 /*******************************************************************
3269 Reads or writes a structure.
3270 ********************************************************************/
3272 BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
3276 uint32 entries_read, entries_read2, entries_read3;
3281 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
3284 entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read;
3289 if(!prs_uint32("entries_read", ps, depth, &entries_read))
3291 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
3294 /*this may be max, unknown, actual?*/
3296 if(!prs_uint32("max_elements", ps, depth, &entries_read2))
3298 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
3300 if(!prs_uint32("actual_elements", ps, depth, &entries_read3))
3303 r_n->disk_enum_ctr.entries_read = entries_read3;
3305 if(UNMARSHALLING(ps)) {
3309 if(!(dinfo = (DISK_INFO *)prs_alloc_mem(ps, sizeof(*dinfo) * entries_read3)))
3311 r_n->disk_enum_ctr.disk_info = dinfo;
3314 for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) {
3316 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
3319 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
3326 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
3329 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
3332 if(!prs_werror("status", ps, depth, &r_n->status))
3338 /*******************************************************************
3339 initialises a structure.
3340 ********************************************************************/
3342 BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type)
3344 uint32 ptr_share_name;
3346 DEBUG(5,("init_srv_q_net_name_validate\n"));
3348 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
3349 init_buf_unistr2(&q_n->uni_name, &ptr_share_name, share_name);
3357 /*******************************************************************
3358 Reads or writes a structure.
3359 ********************************************************************/
3361 BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
3366 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
3372 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3375 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3381 if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth))
3387 if(!prs_uint32("type", ps, depth, &q_n->type))
3390 if(!prs_uint32("flags", ps, depth, &q_n->flags))
3396 /*******************************************************************
3397 Reads or writes a structure.
3398 ********************************************************************/
3400 BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
3405 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
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_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
3426 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_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))
3453 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
3456 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
3459 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
3465 /*******************************************************************
3466 Reads or writes a structure.
3467 ********************************************************************/
3469 BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
3474 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
3480 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
3483 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
3486 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
3489 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
3492 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
3498 if(!prs_werror("status", ps, depth, &r_n->status))
3504 /*******************************************************************
3505 Reads or writes a structure.
3506 ********************************************************************/
3508 BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
3513 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
3519 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
3522 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
3528 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
3531 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
3537 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
3543 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
3546 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
3549 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
3552 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
3555 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
3561 /*******************************************************************
3562 Reads or writes a structure.
3563 ********************************************************************/
3565 BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
3570 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
3576 if(!prs_werror("status", ps, depth, &r_n->status))
3582 /*******************************************************************
3584 ********************************************************************/
3586 void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server)
3588 q_u->ptr_srv_name = 1;
3589 init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1);