2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1997,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
7 * Copyright (C) Paul Ashton 1997.
8 * Copyright (C) Jeremy Allison 1999.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 /*******************************************************************
28 Inits a SH_INFO_1_STR structure
29 ********************************************************************/
31 void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
33 DEBUG(5,("init_srv_share_info1_str\n"));
35 init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
36 init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
39 /*******************************************************************
40 Reads or writes a structure.
41 ********************************************************************/
43 static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
48 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
53 if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
58 if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
64 /*******************************************************************
65 makes a SH_INFO_1 structure
66 ********************************************************************/
68 void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
70 DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark));
72 sh1->ptr_netname = (net_name != NULL) ? 1 : 0;
74 sh1->ptr_remark = (remark != NULL) ? 1 : 0;
77 /*******************************************************************
78 Reads or writes a structure.
79 ********************************************************************/
81 static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
86 prs_debug(ps, depth, desc, "srv_io_share_info1");
92 if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname))
94 if(!prs_uint32("type ", ps, depth, &sh1->type))
96 if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark))
102 /*******************************************************************
103 Inits a SH_INFO_2_STR structure
104 ********************************************************************/
106 void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
107 char *net_name, char *remark,
108 char *path, char *passwd)
110 DEBUG(5,("init_srv_share_info2_str\n"));
112 init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
113 init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
114 init_unistr2(&sh2->uni_path, path, strlen(path)+1);
115 init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
118 /*******************************************************************
119 Reads or writes a structure.
120 ********************************************************************/
122 static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
127 if (UNMARSHALLING(ps))
130 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
136 if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
140 if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
144 if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
148 if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
154 /*******************************************************************
155 Inits a SH_INFO_2 structure
156 ********************************************************************/
158 void init_srv_share_info2(SH_INFO_2 *sh2,
159 char *net_name, uint32 type, char *remark,
160 uint32 perms, uint32 max_uses, uint32 num_uses,
161 char *path, char *passwd)
163 DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
165 sh2->ptr_netname = (net_name != NULL) ? 1 : 0;
167 sh2->ptr_remark = (remark != NULL) ? 1 : 0;
169 sh2->max_uses = max_uses;
170 sh2->num_uses = num_uses;
172 sh2->ptr_path = (path != NULL) ? 1 : 0;
173 sh2->ptr_passwd = (passwd != NULL) ? 1 : 0;
176 /*******************************************************************
177 Reads or writes a structure.
178 ********************************************************************/
180 static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
185 prs_debug(ps, depth, desc, "srv_io_share_info2");
191 if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname))
193 if(!prs_uint32("type ", ps, depth, &sh2->type))
195 if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark))
197 if(!prs_uint32("perms ", ps, depth, &sh2->perms))
199 if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses))
201 if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses))
203 if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path))
205 if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd))
211 /*******************************************************************
212 Inits a SH_INFO_502 structure
213 ********************************************************************/
215 void init_srv_share_info502(SH_INFO_502 *sh502,
216 char *net_name, uint32 type, char *remark,
217 uint32 perms, uint32 max_uses, uint32 num_uses,
218 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
220 DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
224 sh502->ptr_netname = (net_name != NULL) ? 1 : 0;
226 sh502->ptr_remark = (remark != NULL) ? 1 : 0;
227 sh502->perms = perms;
228 sh502->max_uses = max_uses;
229 sh502->num_uses = num_uses;
231 sh502->ptr_path = (path != NULL) ? 1 : 0;
232 sh502->ptr_passwd = (passwd != NULL) ? 1 : 0;
233 sh502->sd_size = (uint32)sd_size;
234 sh502->ptr_sd = (psd != NULL) ? 1 : 0;
237 /*******************************************************************
238 Reads or writes a structure.
239 ********************************************************************/
241 static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth)
246 prs_debug(ps, depth, desc, "srv_io_share_info502");
252 if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname))
254 if(!prs_uint32("type ", ps, depth, &sh502->type))
256 if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark))
258 if(!prs_uint32("perms ", ps, depth, &sh502->perms))
260 if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses))
262 if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses))
264 if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path))
266 if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
268 if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size))
270 if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd))
276 /*******************************************************************
277 Inits a SH_INFO_502_STR structure
278 ********************************************************************/
280 void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
282 char *net_name, char *remark,
283 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
285 DEBUG(5,("init_srv_share_info502_str\n"));
287 sh502str->ptrs = ptrs;
289 if(sh502str->ptrs->ptr_netname)
290 init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1);
291 if(sh502str->ptrs->ptr_remark)
292 init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1);
293 if(sh502str->ptrs->ptr_path)
294 init_unistr2(&sh502str->uni_path, path, strlen(path)+1);
295 if(sh502str->ptrs->ptr_passwd)
296 init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1);
297 if(sh502str->ptrs->ptr_sd) {
299 sh502str->sd_size = sd_size;
303 /*******************************************************************
304 Reads or writes a structure.
305 ********************************************************************/
307 static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
312 prs_debug(ps, depth, desc, "srv_io_share_info502_str");
318 if(sh502->ptrs->ptr_netname) {
319 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
326 if(sh502->ptrs->ptr_remark) {
327 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
334 if(sh502->ptrs->ptr_path) {
335 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
342 if(sh502->ptrs->ptr_passwd) {
343 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
350 if(sh502->ptrs->ptr_sd) {
351 if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size))
353 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
360 /*******************************************************************
361 Reads or writes a structure.
362 ********************************************************************/
364 static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005,
365 prs_struct* ps, int depth)
370 prs_debug(ps, depth, desc, "srv_io_share_info1005");
376 if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag))
382 /*******************************************************************
383 Reads or writes a structure.
384 ********************************************************************/
386 static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501,
387 prs_struct* ps, int depth)
392 prs_debug(ps, depth, desc, "srv_io_share_info1501");
398 if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
404 /*******************************************************************
405 Reads or writes a structure.
406 ********************************************************************/
408 static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
413 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
416 if (UNMARSHALLING(ps)) {
417 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
423 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
426 if (ctr->info_level == 0)
429 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
431 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
434 if (ctr->ptr_share_info == 0)
437 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
439 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
442 if (ctr->ptr_entries == 0) {
443 if (ctr->num_entries == 0)
449 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
452 if (ctr->num_entries2 != ctr->num_entries)
455 switch (ctr->switch_value) {
458 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
459 int num_entries = ctr->num_entries;
462 if (UNMARSHALLING(ps)) {
463 if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1))))
465 ctr->share.info1 = info1;
468 for (i = 0; i < num_entries; i++) {
469 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
473 for (i = 0; i < num_entries; i++) {
474 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
483 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
484 int num_entries = ctr->num_entries;
487 if (UNMARSHALLING(ps)) {
488 if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2))))
490 ctr->share.info2 = info2;
493 for (i = 0; i < num_entries; i++) {
494 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
498 for (i = 0; i < num_entries; i++) {
499 if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth))
508 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
509 int num_entries = ctr->num_entries;
512 if (UNMARSHALLING(ps)) {
513 if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502))))
515 ctr->share.info502 = info502;
518 for (i = 0; i < num_entries; i++) {
519 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
523 for (i = 0; i < num_entries; i++) {
524 info502[i].info_502_str.ptrs = &info502[i].info_502;
525 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
533 DEBUG(5,("%s no share info at switch_value %d\n",
534 tab_depth(depth), ctr->switch_value));
541 /*******************************************************************
542 Inits a SRV_Q_NET_SHARE_ENUM structure.
543 ********************************************************************/
545 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
546 char *srv_name, uint32 info_level,
547 uint32 preferred_len, ENUM_HND *hnd)
550 DEBUG(5,("init_q_net_share_enum\n"));
552 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
554 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
555 q_n->ctr.ptr_share_info = 0;
556 q_n->preferred_len = preferred_len;
558 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
561 /*******************************************************************
562 Reads or writes a structure.
563 ********************************************************************/
565 BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
570 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
576 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
578 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
581 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
587 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
590 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
596 /*******************************************************************
597 Reads or writes a structure.
598 ********************************************************************/
600 BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
605 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
608 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
614 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
616 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
618 if(!prs_werror("status", ps, depth, &r_n->status))
624 /*******************************************************************
625 Reads or writes a structure.
626 ********************************************************************/
628 BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
633 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
639 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
641 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
644 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
650 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
656 /*******************************************************************
657 Reads or writes a structure.
658 ********************************************************************/
660 static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
665 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
671 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
674 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
677 if (r_n->ptr_share_ctr != 0) {
678 switch (r_n->switch_value) {
680 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
683 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
688 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
691 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth))
696 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
699 /*allow access to pointers in the str part. */
700 r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
702 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
706 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
710 if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
713 DEBUG(5,("%s no share info at switch_value %d\n",
714 tab_depth(depth), r_n->switch_value));
722 /*******************************************************************
723 Reads or writes a structure.
724 ********************************************************************/
726 BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
731 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
737 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
743 if(!prs_werror("status", ps, depth, &r_n->status))
749 /*******************************************************************
750 Reads or writes a structure.
751 ********************************************************************/
753 BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
758 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
764 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
766 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
769 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
775 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
781 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
787 /*******************************************************************
788 Reads or writes a structure.
789 ********************************************************************/
791 BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
796 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
802 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
804 if(!prs_werror("status", ps, depth, &q_n->status))
810 /*******************************************************************
811 Reads or writes a structure.
812 ********************************************************************/
814 BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
819 prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
825 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
827 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
833 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
839 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
845 /*******************************************************************
846 Reads or writes a structure.
847 ********************************************************************/
849 BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
854 prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
860 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
862 if(!prs_werror("status", ps, depth, &q_n->status))
868 /*******************************************************************
869 Reads or writes a structure.
870 ********************************************************************/
872 BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
877 prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
883 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
885 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
888 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
894 /*******************************************************************
895 Reads or writes a structure.
896 ********************************************************************/
898 BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
903 prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
909 if(!prs_werror("status", ps, depth, &q_n->status))
915 /*******************************************************************
916 Inits a SESS_INFO_0_STR structure
917 ********************************************************************/
919 void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
921 DEBUG(5,("init_srv_sess_info0_str\n"));
923 init_unistr2(&ss0->uni_name, name, strlen(name)+1);
926 /*******************************************************************
927 Reads or writes a structure.
928 ********************************************************************/
930 static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
935 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
941 if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth))
947 /*******************************************************************
948 Inits a SESS_INFO_0 structure
949 ********************************************************************/
951 void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
953 DEBUG(5,("init_srv_sess_info0: %s\n", name));
955 ss0->ptr_name = (name != NULL) ? 1 : 0;
958 /*******************************************************************
959 Reads or writes a structure.
960 ********************************************************************/
962 static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
967 prs_debug(ps, depth, desc, "srv_io_sess_info0");
973 if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name))
979 /*******************************************************************
980 Reads or writes a structure.
981 ********************************************************************/
983 static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
988 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
994 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
996 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
999 if (ss0->ptr_sess_info != 0) {
1001 int num_entries = ss0->num_entries_read;
1003 if (num_entries > MAX_SESS_ENTRIES) {
1004 num_entries = MAX_SESS_ENTRIES; /* report this! */
1007 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1010 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1012 for (i = 0; i < num_entries; i++) {
1013 if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth))
1017 for (i = 0; i < num_entries; i++) {
1018 if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth))
1029 /*******************************************************************
1030 Inits a SESS_INFO_1_STR structure
1031 ********************************************************************/
1033 void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
1035 DEBUG(5,("init_srv_sess_info1_str\n"));
1037 init_unistr2(&ss1->uni_name, name, strlen(name)+1);
1038 init_unistr2(&ss1->uni_user, name, strlen(user)+1);
1041 /*******************************************************************
1042 Reads or writes a structure.
1043 ********************************************************************/
1045 static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
1050 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
1056 if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth))
1058 if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth))
1064 /*******************************************************************
1065 Inits a SESS_INFO_1 structure
1066 ********************************************************************/
1068 void init_srv_sess_info1(SESS_INFO_1 *ss1,
1069 char *name, char *user,
1070 uint32 num_opens, uint32 open_time, uint32 idle_time,
1073 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1075 ss1->ptr_name = (name != NULL) ? 1 : 0;
1076 ss1->ptr_user = (user != NULL) ? 1 : 0;
1078 ss1->num_opens = num_opens;
1079 ss1->open_time = open_time;
1080 ss1->idle_time = idle_time;
1081 ss1->user_flags = user_flags;
1084 /*******************************************************************
1085 reads or writes a structure.
1086 ********************************************************************/
1088 static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1093 prs_debug(ps, depth, desc, "srv_io_sess_info1");
1099 if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name))
1101 if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user))
1104 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1106 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1108 if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time))
1110 if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags))
1116 /*******************************************************************
1117 Reads or writes a structure.
1118 ********************************************************************/
1120 static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1125 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1131 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1133 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1136 if (ss1->ptr_sess_info != 0) {
1138 int num_entries = ss1->num_entries_read;
1140 if (num_entries > MAX_SESS_ENTRIES) {
1141 num_entries = MAX_SESS_ENTRIES; /* report this! */
1144 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1147 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1149 for (i = 0; i < num_entries; i++) {
1150 if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth))
1154 for (i = 0; i < num_entries; i++) {
1155 if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth))
1166 /*******************************************************************
1167 Reads or writes a structure.
1168 ********************************************************************/
1170 static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1172 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1174 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1177 if(UNMARSHALLING(ps)) {
1178 ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR));
1189 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1191 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1194 if (ctr->ptr_sess_ctr != 0) {
1195 switch (ctr->switch_value) {
1197 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1201 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1205 DEBUG(5,("%s no session info at switch_value %d\n",
1206 tab_depth(depth), ctr->switch_value));
1214 /*******************************************************************
1215 Inits a SRV_Q_NET_SESS_ENUM structure.
1216 ********************************************************************/
1218 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
1219 char *srv_name, char *qual_name,
1220 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
1221 uint32 preferred_len,
1226 DEBUG(5,("init_q_net_sess_enum\n"));
1228 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1229 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1231 q_n->sess_level = sess_level;
1232 q_n->preferred_len = preferred_len;
1234 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1237 /*******************************************************************
1238 Reads or writes a structure.
1239 ********************************************************************/
1241 BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
1246 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1252 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1254 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1260 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1262 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1268 if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level))
1271 if (q_n->sess_level != -1) {
1272 if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth))
1276 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1279 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1285 /*******************************************************************
1286 Reads or writes a structure.
1287 ********************************************************************/
1289 BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1294 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1300 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1303 if (r_n->sess_level != -1) {
1304 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1308 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1310 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1312 if(!prs_werror("status", ps, depth, &r_n->status))
1318 /*******************************************************************
1319 Inits a CONN_INFO_0 structure
1320 ********************************************************************/
1322 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
1324 DEBUG(5,("init_srv_conn_info0\n"));
1329 /*******************************************************************
1330 Reads or writes a structure.
1331 ********************************************************************/
1333 static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1338 prs_debug(ps, depth, desc, "srv_io_conn_info0");
1344 if(!prs_uint32("id", ps, depth, &ss0->id))
1350 /*******************************************************************
1351 Reads or writes a structure.
1352 ********************************************************************/
1354 static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1359 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
1365 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1367 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
1370 if (ss0->ptr_conn_info != 0) {
1372 int num_entries = ss0->num_entries_read;
1374 if (num_entries > MAX_CONN_ENTRIES) {
1375 num_entries = MAX_CONN_ENTRIES; /* report this! */
1378 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1381 for (i = 0; i < num_entries; i++) {
1382 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
1393 /*******************************************************************
1394 Inits a CONN_INFO_1_STR structure
1395 ********************************************************************/
1397 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
1399 DEBUG(5,("init_srv_conn_info1_str\n"));
1401 init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1);
1402 init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1);
1405 /*******************************************************************
1406 Reads or writes a structure.
1407 ********************************************************************/
1409 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
1414 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
1420 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
1422 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
1428 /*******************************************************************
1429 Inits a CONN_INFO_1 structure
1430 ********************************************************************/
1432 void init_srv_conn_info1(CONN_INFO_1 *ss1,
1433 uint32 id, uint32 type,
1434 uint32 num_opens, uint32 num_users, uint32 open_time,
1435 char *usr_name, char *net_name)
1437 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
1441 ss1->num_opens = num_opens ;
1442 ss1->num_users = num_users;
1443 ss1->open_time = open_time;
1445 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
1446 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
1449 /*******************************************************************
1450 Reads or writes a structure.
1451 ********************************************************************/
1453 static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1458 prs_debug(ps, depth, desc, "srv_io_conn_info1");
1464 if(!prs_uint32("id ", ps, depth, &ss1->id))
1466 if(!prs_uint32("type ", ps, depth, &ss1->type))
1468 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1470 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
1472 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1475 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
1477 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
1483 /*******************************************************************
1484 Reads or writes a structure.
1485 ********************************************************************/
1487 static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1492 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
1498 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1500 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
1503 if (ss1->ptr_conn_info != 0) {
1505 int num_entries = ss1->num_entries_read;
1507 if (num_entries > MAX_CONN_ENTRIES) {
1508 num_entries = MAX_CONN_ENTRIES; /* report this! */
1511 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1514 for (i = 0; i < num_entries; i++) {
1515 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
1519 for (i = 0; i < num_entries; i++) {
1520 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
1531 /*******************************************************************
1532 Reads or writes a structure.
1533 ********************************************************************/
1535 static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1537 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
1539 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
1542 if (UNMARSHALLING(ps)) {
1543 ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR));
1554 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1556 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
1559 if (ctr->ptr_conn_ctr != 0) {
1560 switch (ctr->switch_value) {
1562 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
1566 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
1570 DEBUG(5,("%s no connection info at switch_value %d\n",
1571 tab_depth(depth), ctr->switch_value));
1579 /*******************************************************************
1580 Reads or writes a structure.
1581 ********************************************************************/
1583 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
1584 char *srv_name, char *qual_name,
1585 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
1586 uint32 preferred_len,
1589 DEBUG(5,("init_q_net_conn_enum\n"));
1593 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
1594 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1596 q_n->conn_level = conn_level;
1597 q_n->preferred_len = preferred_len;
1599 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1602 /*******************************************************************
1603 Reads or writes a structure.
1604 ********************************************************************/
1606 BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
1611 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
1617 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
1619 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
1625 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1627 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1633 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
1636 if (q_n->conn_level != -1) {
1637 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
1641 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1644 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1650 /*******************************************************************
1651 Reads or writes a structure.
1652 ********************************************************************/
1654 BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
1659 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
1665 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
1668 if (r_n->conn_level != -1) {
1669 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
1673 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1675 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1677 if(!prs_werror("status", ps, depth, &r_n->status))
1683 /*******************************************************************
1684 Inits a FILE_INFO_3_STR structure
1685 ********************************************************************/
1687 void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1689 DEBUG(5,("init_srv_file_info3_str\n"));
1691 init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1);
1692 init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1);
1695 /*******************************************************************
1696 Reads or writes a structure.
1697 ********************************************************************/
1699 static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1704 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1710 if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth))
1712 if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth))
1718 /*******************************************************************
1719 Inits a FILE_INFO_3 structure
1720 ********************************************************************/
1722 void init_srv_file_info3(FILE_INFO_3 *fl3,
1723 uint32 id, uint32 perms, uint32 num_locks,
1724 char *path_name, char *user_name)
1726 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name));
1730 fl3->num_locks = num_locks;
1732 fl3->ptr_path_name = (path_name != NULL) ? 1 : 0;
1733 fl3->ptr_user_name = (user_name != NULL) ? 1 : 0;
1736 /*******************************************************************
1737 Reads or writes a structure.
1738 ********************************************************************/
1740 static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1745 prs_debug(ps, depth, desc, "srv_io_file_info3");
1751 if(!prs_uint32("id ", ps, depth, &fl3->id))
1753 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
1755 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
1757 if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name))
1759 if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name))
1765 /*******************************************************************
1766 Reads or writes a structure.
1767 ********************************************************************/
1769 static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1774 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1780 if(!prs_uint32("num_entries_read", ps, depth, &fl3->num_entries_read))
1782 if(!prs_uint32("ptr_file_fl3", ps, depth, &fl3->ptr_file_info))
1785 if (fl3->ptr_file_info != 0) {
1787 int num_entries = fl3->num_entries_read;
1789 if (num_entries > MAX_FILE_ENTRIES) {
1790 num_entries = MAX_FILE_ENTRIES; /* report this! */
1793 if(!prs_uint32("num_entries_read2", ps, depth, &fl3->num_entries_read2))
1796 for (i = 0; i < num_entries; i++) {
1797 if(!srv_io_file_info3("", &fl3->info_3[i], ps, depth))
1801 for (i = 0; i < num_entries; i++) {
1802 if(!srv_io_file_info3_str("", &fl3->info_3_str[i], ps, depth))
1813 /*******************************************************************
1814 Reads or writes a structure.
1815 ********************************************************************/
1817 static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1819 SRV_FILE_INFO_CTR *ctr = *pp_ctr;
1821 if (UNMARSHALLING(ps)) {
1822 ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR));
1830 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1836 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1838 if(!prs_uint32("ptr_file_ctr", ps, depth, &ctr->ptr_file_ctr))
1841 if (ctr->ptr_file_ctr != 0) {
1842 switch (ctr->switch_value) {
1844 if(!srv_io_srv_file_info_3("", &ctr->file.info3, ps, depth))
1848 DEBUG(5,("%s no file info at switch_value %d\n",
1849 tab_depth(depth), ctr->switch_value));
1857 /*******************************************************************
1858 Inits a SRV_Q_NET_FILE_ENUM structure.
1859 ********************************************************************/
1861 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
1862 char *srv_name, char *qual_name,
1863 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1864 uint32 preferred_len,
1867 DEBUG(5,("init_q_net_file_enum\n"));
1871 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1872 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1874 q_n->file_level = file_level;
1875 q_n->preferred_len = preferred_len;
1877 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1880 /*******************************************************************
1881 Reads or writes a structure.
1882 ********************************************************************/
1884 BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1889 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1895 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1897 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1903 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1905 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1911 if(!prs_uint32("file_level", ps, depth, &q_n->file_level))
1914 if (q_n->file_level != -1) {
1915 if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth))
1919 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1922 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1928 /*******************************************************************
1929 Reads or writes a structure.
1930 ********************************************************************/
1932 BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1937 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1943 if(!prs_uint32("file_level", ps, depth, &r_n->file_level))
1946 if (r_n->file_level != 0) {
1947 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
1951 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1953 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1955 if(!prs_werror("status", ps, depth, &r_n->status))
1961 /*******************************************************************
1962 Inits a SRV_INFO_100 structure.
1963 ********************************************************************/
1965 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name)
1967 DEBUG(5,("init_srv_info_100\n"));
1969 sv100->platform_id = platform_id;
1970 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
1973 /*******************************************************************
1974 Reads or writes a SRV_INFO_101 structure.
1975 ********************************************************************/
1977 static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
1982 prs_debug(ps, depth, desc, "srv_io_info_100");
1988 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
1990 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
1993 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
2000 /*******************************************************************
2001 Inits a SRV_INFO_101 structure.
2002 ********************************************************************/
2004 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
2005 uint32 ver_major, uint32 ver_minor,
2006 uint32 srv_type, char *comment)
2008 DEBUG(5,("init_srv_info_101\n"));
2010 sv101->platform_id = platform_id;
2011 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2012 sv101->ver_major = ver_major;
2013 sv101->ver_minor = ver_minor;
2014 sv101->srv_type = srv_type;
2015 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2018 /*******************************************************************
2019 Reads or writes a SRV_INFO_101 structure.
2020 ********************************************************************/
2022 static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2027 prs_debug(ps, depth, desc, "srv_io_info_101");
2033 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2035 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2037 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2039 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2041 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2043 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2049 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2051 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2057 /*******************************************************************
2058 Inits a SRV_INFO_102 structure.
2059 ********************************************************************/
2061 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
2062 char *comment, uint32 ver_major, uint32 ver_minor,
2063 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2064 uint32 announce, uint32 ann_delta, uint32 licenses,
2067 DEBUG(5,("init_srv_info_102\n"));
2069 sv102->platform_id = platform_id;
2070 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2071 sv102->ver_major = ver_major;
2072 sv102->ver_minor = ver_minor;
2073 sv102->srv_type = srv_type;
2074 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2076 /* same as 101 up to here */
2078 sv102->users = users;
2080 sv102->hidden = hidden;
2081 sv102->announce = announce;
2082 sv102->ann_delta =ann_delta;
2083 sv102->licenses = licenses;
2084 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2088 /*******************************************************************
2089 Reads or writes a SRV_INFO_102 structure.
2090 ********************************************************************/
2092 static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2097 prs_debug(ps, depth, desc, "srv_io_info102");
2103 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2105 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2107 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2109 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2111 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2113 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2116 /* same as 101 up to here */
2118 if(!prs_uint32("users ", ps, depth, &sv102->users))
2120 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2122 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2124 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2126 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2128 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2130 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2133 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2137 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2141 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2147 /*******************************************************************
2148 Reads or writes a SRV_INFO_102 structure.
2149 ********************************************************************/
2151 static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2156 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2162 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2164 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2167 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2168 switch (ctr->switch_value) {
2170 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2174 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2178 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2182 DEBUG(5,("%s no server info at switch_value %d\n",
2183 tab_depth(depth), ctr->switch_value));
2193 /*******************************************************************
2194 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2195 ********************************************************************/
2197 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2198 char *server_name, uint32 switch_value)
2200 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2202 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2204 srv->switch_value = switch_value;
2207 /*******************************************************************
2208 Reads or writes a structure.
2209 ********************************************************************/
2211 BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2216 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2222 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2224 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2230 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2236 /*******************************************************************
2237 Inits a SRV_R_NET_SRV_GET_INFO structure.
2238 ********************************************************************/
2240 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2241 uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
2243 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2247 if (W_ERROR_IS_OK(status)) {
2248 srv->ctr->switch_value = switch_value;
2249 srv->ctr->ptr_srv_ctr = 1;
2251 srv->ctr->switch_value = 0;
2252 srv->ctr->ptr_srv_ctr = 0;
2255 srv->status = status;
2258 /*******************************************************************
2259 Inits a SRV_R_NET_SRV_SET_INFO structure.
2260 ********************************************************************/
2262 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
2263 uint32 switch_value, WERROR status)
2265 DEBUG(5,("init_srv_r_net_srv_set_info\n"));
2267 srv->switch_value = switch_value;
2268 srv->status = status;
2271 /*******************************************************************
2272 Reads or writes a structure.
2273 ********************************************************************/
2275 BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n,
2276 prs_struct *ps, int depth)
2278 prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
2284 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2286 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2292 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2295 if (UNMARSHALLING(ps)) {
2296 q_n->ctr = (SRV_INFO_CTR *)
2297 prs_alloc_mem(ps, sizeof(SRV_INFO_CTR));
2303 if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
2309 /*******************************************************************
2310 Reads or writes a structure.
2311 ********************************************************************/
2313 BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
2318 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
2324 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
2327 if(!prs_werror("status", ps, depth, &r_n->status))
2333 /*******************************************************************
2334 Reads or writes a structure.
2335 ********************************************************************/
2337 BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
2338 prs_struct *ps, int depth)
2340 prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
2346 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value))
2349 if(!prs_werror("status", ps, depth, &r_n->status))
2355 /*******************************************************************
2356 Reads or writes a structure.
2357 ********************************************************************/
2359 BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
2364 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
2370 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2372 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2378 /*******************************************************************
2379 Reads or writes a TIME_OF_DAY_INFO structure.
2380 ********************************************************************/
2382 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
2387 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
2393 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
2395 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
2397 if(!prs_uint32("hours ", ps, depth, &tod->hours))
2399 if(!prs_uint32("mins ", ps, depth, &tod->mins))
2401 if(!prs_uint32("secs ", ps, depth, &tod->secs))
2403 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
2405 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
2407 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
2409 if(!prs_uint32("day ", ps, depth, &tod->day))
2411 if(!prs_uint32("month ", ps, depth, &tod->month))
2413 if(!prs_uint32("year ", ps, depth, &tod->year))
2415 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
2421 /*******************************************************************
2422 Inits a TIME_OF_DAY_INFO structure.
2423 ********************************************************************/
2425 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
2426 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
2427 uint32 zone, uint32 tintervals, uint32 day,
2428 uint32 month, uint32 year, uint32 weekday)
2430 DEBUG(5,("init_time_of_day_info\n"));
2432 tod->elapsedt = elapsedt;
2439 tod->tintervals = tintervals;
2443 tod->weekday = weekday;
2447 /*******************************************************************
2448 Reads or writes a structure.
2449 ********************************************************************/
2451 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
2456 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
2462 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
2465 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
2468 if(!prs_werror("status", ps, depth, &r_n->status))
2474 /*******************************************************************
2475 Reads or writes a structure.
2476 ********************************************************************/
2478 BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
2483 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
2489 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2492 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2498 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
2501 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
2504 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
2510 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2512 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2518 /*******************************************************************
2519 Reads or writes a structure.
2520 ********************************************************************/
2522 BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
2529 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
2535 if(!prs_uint32("entries_read", ps, depth, &r_n->disk_enum_ctr.entries_read))
2537 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
2540 /*this may be max, unknown, actual?*/
2542 if(!prs_uint32("max_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
2544 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
2546 if(!prs_uint32("actual_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
2549 for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) {
2551 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
2554 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
2561 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2564 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2567 if(!prs_werror("status", ps, depth, &r_n->status))
2573 /*******************************************************************
2574 Reads or writes a structure.
2575 ********************************************************************/
2577 BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
2582 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
2588 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2591 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2597 if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth))
2603 if(!prs_uint32("type", ps, depth, &q_n->type))
2606 if(!prs_uint32("flags", ps, depth, &q_n->flags))
2612 /*******************************************************************
2613 Reads or writes a structure.
2614 ********************************************************************/
2616 BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
2621 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
2627 if(!prs_werror("status", ps, depth, &r_n->status))
2633 /*******************************************************************
2634 Reads or writes a structure.
2635 ********************************************************************/
2637 BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
2642 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
2648 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2651 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2657 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2660 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
2666 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
2669 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
2672 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
2675 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
2681 /*******************************************************************
2682 Reads or writes a structure.
2683 ********************************************************************/
2685 BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
2690 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
2696 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
2699 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
2702 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
2705 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
2708 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
2714 if(!prs_werror("status", ps, depth, &r_n->status))
2720 /*******************************************************************
2721 Reads or writes a structure.
2722 ********************************************************************/
2724 BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
2729 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
2735 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2738 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2744 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2747 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
2753 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
2759 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
2762 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
2765 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
2768 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
2771 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
2777 /*******************************************************************
2778 Reads or writes a structure.
2779 ********************************************************************/
2781 BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
2786 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
2792 if(!prs_werror("status", ps, depth, &r_n->status))