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.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /*******************************************************************
27 Inits a SH_INFO_1_STR structure
28 ********************************************************************/
30 void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
32 DEBUG(5,("init_srv_share_info1_str\n"));
34 init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
35 init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
38 /*******************************************************************
39 Reads or writes a structure.
40 ********************************************************************/
42 static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
47 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
52 if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
57 if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
63 /*******************************************************************
64 makes a SH_INFO_1 structure
65 ********************************************************************/
67 void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
69 DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark));
71 sh1->ptr_netname = (net_name != NULL) ? 1 : 0;
73 sh1->ptr_remark = (remark != NULL) ? 1 : 0;
76 /*******************************************************************
77 Reads or writes a structure.
78 ********************************************************************/
80 static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
85 prs_debug(ps, depth, desc, "srv_io_share_info1");
91 if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname))
93 if(!prs_uint32("type ", ps, depth, &sh1->type))
95 if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark))
101 /*******************************************************************
102 Inits a SH_INFO_2_STR structure
103 ********************************************************************/
105 void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
106 char *net_name, char *remark,
107 char *path, char *passwd)
109 DEBUG(5,("init_srv_share_info2_str\n"));
111 init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
112 init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
113 init_unistr2(&sh2->uni_path, path, strlen(path)+1);
114 init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
117 /*******************************************************************
118 Reads or writes a structure.
119 ********************************************************************/
121 static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
126 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
131 if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
136 if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
141 if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
146 if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
152 /*******************************************************************
153 Inits a SH_INFO_2 structure
154 ********************************************************************/
156 void init_srv_share_info2(SH_INFO_2 *sh2,
157 char *net_name, uint32 type, char *remark,
158 uint32 perms, uint32 max_uses, uint32 num_uses,
159 char *path, char *passwd)
161 DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
163 sh2->ptr_netname = (net_name != NULL) ? 1 : 0;
165 sh2->ptr_remark = (remark != NULL) ? 1 : 0;
167 sh2->max_uses = max_uses;
168 sh2->num_uses = num_uses;
170 sh2->ptr_path = (path != NULL) ? 1 : 0;
171 sh2->ptr_passwd = (passwd != NULL) ? 1 : 0;
174 /*******************************************************************
175 Reads or writes a structure.
176 ********************************************************************/
178 static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
183 prs_debug(ps, depth, desc, "srv_io_share_info2");
189 if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname))
191 if(!prs_uint32("type ", ps, depth, &sh2->type))
193 if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark))
195 if(!prs_uint32("perms ", ps, depth, &sh2->perms))
197 if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses))
199 if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses))
201 if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path))
203 if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd))
209 /*******************************************************************
210 Inits a SH_INFO_502 structure
211 ********************************************************************/
213 void init_srv_share_info502(SH_INFO_502 *sh502,
214 char *net_name, uint32 type, char *remark,
215 uint32 perms, uint32 max_uses, uint32 num_uses,
216 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
218 DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
222 sh502->ptr_netname = (net_name != NULL) ? 1 : 0;
224 sh502->ptr_remark = (remark != NULL) ? 1 : 0;
225 sh502->perms = perms;
226 sh502->max_uses = max_uses;
227 sh502->num_uses = num_uses;
229 sh502->ptr_path = (path != NULL) ? 1 : 0;
230 sh502->ptr_passwd = (passwd != NULL) ? 1 : 0;
231 sh502->sd_size = (uint32)sd_size;
232 sh502->ptr_sd = (psd != NULL) ? 1 : 0;
235 /*******************************************************************
236 Reads or writes a structure.
237 ********************************************************************/
239 static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth)
244 prs_debug(ps, depth, desc, "srv_io_share_info502");
250 if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname))
252 if(!prs_uint32("type ", ps, depth, &sh502->type))
254 if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark))
256 if(!prs_uint32("perms ", ps, depth, &sh502->perms))
258 if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses))
260 if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses))
262 if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path))
264 if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
266 if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size))
268 if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd))
274 /*******************************************************************
275 Inits a SH_INFO_502_STR structure
276 ********************************************************************/
278 void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
280 char *net_name, char *remark,
281 char *path, char *passwd, SEC_DESC *psd, size_t sd_size)
283 DEBUG(5,("init_srv_share_info502_str\n"));
285 sh502str->ptrs = ptrs;
287 if(sh502str->ptrs->ptr_netname)
288 init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1);
289 if(sh502str->ptrs->ptr_remark)
290 init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1);
291 if(sh502str->ptrs->ptr_path)
292 init_unistr2(&sh502str->uni_path, path, strlen(path)+1);
293 if(sh502str->ptrs->ptr_passwd)
294 init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1);
295 if(sh502str->ptrs->ptr_sd) {
297 sh502str->sd_size = sd_size;
301 /*******************************************************************
302 Reads or writes a structure.
303 ********************************************************************/
305 static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
310 prs_debug(ps, depth, desc, "srv_io_share_info502_str");
316 if(sh502->ptrs->ptr_netname) {
317 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
324 if(sh502->ptrs->ptr_remark) {
325 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
332 if(sh502->ptrs->ptr_path) {
333 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
340 if(sh502->ptrs->ptr_passwd) {
341 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
348 if(sh502->ptrs->ptr_sd) {
349 if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size))
351 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
358 /*******************************************************************
359 Reads or writes a structure.
360 ********************************************************************/
362 static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005,
363 prs_struct* ps, int depth)
368 prs_debug(ps, depth, desc, "srv_io_share_info1005");
374 if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag))
380 /*******************************************************************
381 Reads or writes a structure.
382 ********************************************************************/
384 static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501,
385 prs_struct* ps, int depth)
390 prs_debug(ps, depth, desc, "srv_io_share_info1501");
396 if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
402 /*******************************************************************
403 Reads or writes a structure.
404 ********************************************************************/
406 static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
411 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
414 if (UNMARSHALLING(ps)) {
415 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
421 if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
424 if (ctr->info_level == 0)
427 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
429 if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
432 if (ctr->ptr_share_info == 0)
435 if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
437 if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
440 if (ctr->ptr_entries == 0) {
441 if (ctr->num_entries == 0)
447 if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
450 if (ctr->num_entries2 != ctr->num_entries)
453 switch (ctr->switch_value) {
456 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
457 int num_entries = ctr->num_entries;
460 if (UNMARSHALLING(ps)) {
461 if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1))))
463 ctr->share.info1 = info1;
466 for (i = 0; i < num_entries; i++) {
467 if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
471 for (i = 0; i < num_entries; i++) {
472 if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
481 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
482 int num_entries = ctr->num_entries;
485 if (UNMARSHALLING(ps)) {
486 if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2))))
488 ctr->share.info2 = info2;
491 for (i = 0; i < num_entries; i++) {
492 if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
496 for (i = 0; i < num_entries; i++) {
497 if(!srv_io_share_info2_str("", &info2[i].info_2_str, ps, depth))
506 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
507 int num_entries = ctr->num_entries;
510 if (UNMARSHALLING(ps)) {
511 if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502))))
513 ctr->share.info502 = info502;
516 for (i = 0; i < num_entries; i++) {
517 if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
521 for (i = 0; i < num_entries; i++) {
522 info502[i].info_502_str.ptrs = &info502[i].info_502;
523 if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
531 DEBUG(5,("%s no share info at switch_value %d\n",
532 tab_depth(depth), ctr->switch_value));
539 /*******************************************************************
540 Inits a SRV_Q_NET_SHARE_ENUM structure.
541 ********************************************************************/
543 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
544 char *srv_name, uint32 info_level,
545 uint32 preferred_len, ENUM_HND *hnd)
548 DEBUG(5,("init_q_net_share_enum\n"));
550 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
552 q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
553 q_n->ctr.ptr_share_info = 0;
554 q_n->preferred_len = preferred_len;
556 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
559 /*******************************************************************
560 Reads or writes a structure.
561 ********************************************************************/
563 BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
568 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
574 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
576 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
579 if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
585 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
588 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
594 /*******************************************************************
595 Reads or writes a structure.
596 ********************************************************************/
598 BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
603 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
606 if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
612 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
614 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
616 if(!prs_ntstatus("status ", ps, depth, &r_n->status))
622 /*******************************************************************
623 Reads or writes a structure.
624 ********************************************************************/
626 BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
631 prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
637 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
639 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
642 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
648 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
654 /*******************************************************************
655 Reads or writes a structure.
656 ********************************************************************/
658 static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
663 prs_debug(ps, depth, desc, "srv_io_srv_share_info");
669 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
672 if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
675 if (r_n->ptr_share_ctr != 0) {
676 switch (r_n->switch_value) {
678 if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
681 if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
686 if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
689 if(!srv_io_share_info2_str("", &r_n->share.info2.info_2_str, ps, depth))
694 if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
697 /*allow access to pointers in the str part. */
698 r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
700 if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
704 if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
708 if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
711 DEBUG(5,("%s no share info at switch_value %d\n",
712 tab_depth(depth), r_n->switch_value));
720 /*******************************************************************
721 Reads or writes a structure.
722 ********************************************************************/
724 BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
729 prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
735 if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info))
741 if(!prs_ntstatus("status", ps, depth, &r_n->status))
747 /*******************************************************************
748 Reads or writes a structure.
749 ********************************************************************/
751 BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
756 prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
762 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
764 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
767 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
773 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
779 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
785 /*******************************************************************
786 Reads or writes a structure.
787 ********************************************************************/
789 BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
794 prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
800 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
802 if(!prs_ntstatus("status ", ps, depth, &q_n->status))
808 /*******************************************************************
809 Reads or writes a structure.
810 ********************************************************************/
812 BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
817 prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
823 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
825 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
831 if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
837 if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info))
843 /*******************************************************************
844 Reads or writes a structure.
845 ********************************************************************/
847 BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
852 prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
858 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
860 if(!prs_ntstatus("status ", ps, depth, &q_n->status))
866 /*******************************************************************
867 Reads or writes a structure.
868 ********************************************************************/
870 BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
875 prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
881 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
883 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
886 if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
892 /*******************************************************************
893 Reads or writes a structure.
894 ********************************************************************/
896 BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
901 prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
907 if(!prs_ntstatus("status ", ps, depth, &q_n->status))
913 /*******************************************************************
914 Inits a SESS_INFO_0_STR structure
915 ********************************************************************/
917 void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
919 DEBUG(5,("init_srv_sess_info0_str\n"));
921 init_unistr2(&ss0->uni_name, name, strlen(name)+1);
924 /*******************************************************************
925 Reads or writes a structure.
926 ********************************************************************/
928 static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
933 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
939 if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth))
945 /*******************************************************************
946 Inits a SESS_INFO_0 structure
947 ********************************************************************/
949 void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
951 DEBUG(5,("init_srv_sess_info0: %s\n", name));
953 ss0->ptr_name = (name != NULL) ? 1 : 0;
956 /*******************************************************************
957 Reads or writes a structure.
958 ********************************************************************/
960 static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
965 prs_debug(ps, depth, desc, "srv_io_sess_info0");
971 if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name))
977 /*******************************************************************
978 Reads or writes a structure.
979 ********************************************************************/
981 static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
986 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
992 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
994 if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
997 if (ss0->ptr_sess_info != 0) {
999 int num_entries = ss0->num_entries_read;
1001 if (num_entries > MAX_SESS_ENTRIES) {
1002 num_entries = MAX_SESS_ENTRIES; /* report this! */
1005 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1008 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
1010 for (i = 0; i < num_entries; i++) {
1011 if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth))
1015 for (i = 0; i < num_entries; i++) {
1016 if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth))
1027 /*******************************************************************
1028 Inits a SESS_INFO_1_STR structure
1029 ********************************************************************/
1031 void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
1033 DEBUG(5,("init_srv_sess_info1_str\n"));
1035 init_unistr2(&ss1->uni_name, name, strlen(name)+1);
1036 init_unistr2(&ss1->uni_user, name, strlen(user)+1);
1039 /*******************************************************************
1040 Reads or writes a structure.
1041 ********************************************************************/
1043 static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
1048 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
1054 if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth))
1056 if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth))
1062 /*******************************************************************
1063 Inits a SESS_INFO_1 structure
1064 ********************************************************************/
1066 void init_srv_sess_info1(SESS_INFO_1 *ss1,
1067 char *name, char *user,
1068 uint32 num_opens, uint32 open_time, uint32 idle_time,
1071 DEBUG(5,("init_srv_sess_info1: %s\n", name));
1073 ss1->ptr_name = (name != NULL) ? 1 : 0;
1074 ss1->ptr_user = (user != NULL) ? 1 : 0;
1076 ss1->num_opens = num_opens;
1077 ss1->open_time = open_time;
1078 ss1->idle_time = idle_time;
1079 ss1->user_flags = user_flags;
1082 /*******************************************************************
1083 reads or writes a structure.
1084 ********************************************************************/
1086 static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1091 prs_debug(ps, depth, desc, "srv_io_sess_info1");
1097 if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name))
1099 if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user))
1102 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1104 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1106 if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time))
1108 if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags))
1114 /*******************************************************************
1115 Reads or writes a structure.
1116 ********************************************************************/
1118 static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
1123 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
1129 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1131 if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
1134 if (ss1->ptr_sess_info != 0) {
1136 int num_entries = ss1->num_entries_read;
1138 if (num_entries > MAX_SESS_ENTRIES) {
1139 num_entries = MAX_SESS_ENTRIES; /* report this! */
1142 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1145 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
1147 for (i = 0; i < num_entries; i++) {
1148 if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth))
1152 for (i = 0; i < num_entries; i++) {
1153 if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth))
1164 /*******************************************************************
1165 Reads or writes a structure.
1166 ********************************************************************/
1168 static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1170 SRV_SESS_INFO_CTR *ctr = *pp_ctr;
1172 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
1175 if(UNMARSHALLING(ps)) {
1176 ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR));
1187 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1189 if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
1192 if (ctr->ptr_sess_ctr != 0) {
1193 switch (ctr->switch_value) {
1195 if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
1199 if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
1203 DEBUG(5,("%s no session info at switch_value %d\n",
1204 tab_depth(depth), ctr->switch_value));
1212 /*******************************************************************
1213 Inits a SRV_Q_NET_SESS_ENUM structure.
1214 ********************************************************************/
1216 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
1217 char *srv_name, char *qual_name,
1218 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
1219 uint32 preferred_len,
1224 DEBUG(5,("init_q_net_sess_enum\n"));
1226 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1227 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1229 q_n->sess_level = sess_level;
1230 q_n->preferred_len = preferred_len;
1232 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1235 /*******************************************************************
1236 Reads or writes a structure.
1237 ********************************************************************/
1239 BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
1244 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
1250 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1252 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1258 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1260 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1266 if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level))
1269 if (q_n->sess_level != -1) {
1270 if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth))
1274 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1277 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1283 /*******************************************************************
1284 Reads or writes a structure.
1285 ********************************************************************/
1287 BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
1292 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
1298 if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
1301 if (r_n->sess_level != -1) {
1302 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
1306 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1308 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1310 if(!prs_ntstatus("status ", ps, depth, &r_n->status))
1316 /*******************************************************************
1317 Inits a CONN_INFO_0 structure
1318 ********************************************************************/
1320 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
1322 DEBUG(5,("init_srv_conn_info0\n"));
1327 /*******************************************************************
1328 Reads or writes a structure.
1329 ********************************************************************/
1331 static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1336 prs_debug(ps, depth, desc, "srv_io_conn_info0");
1342 if(!prs_uint32("id", ps, depth, &ss0->id))
1348 /*******************************************************************
1349 Reads or writes a structure.
1350 ********************************************************************/
1352 static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
1357 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
1363 if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
1365 if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
1368 if (ss0->ptr_conn_info != 0) {
1370 int num_entries = ss0->num_entries_read;
1372 if (num_entries > MAX_CONN_ENTRIES) {
1373 num_entries = MAX_CONN_ENTRIES; /* report this! */
1376 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
1379 for (i = 0; i < num_entries; i++) {
1380 if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
1391 /*******************************************************************
1392 Inits a CONN_INFO_1_STR structure
1393 ********************************************************************/
1395 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
1397 DEBUG(5,("init_srv_conn_info1_str\n"));
1399 init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1);
1400 init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1);
1403 /*******************************************************************
1404 Reads or writes a structure.
1405 ********************************************************************/
1407 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
1412 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
1418 if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
1420 if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
1426 /*******************************************************************
1427 Inits a CONN_INFO_1 structure
1428 ********************************************************************/
1430 void init_srv_conn_info1(CONN_INFO_1 *ss1,
1431 uint32 id, uint32 type,
1432 uint32 num_opens, uint32 num_users, uint32 open_time,
1433 char *usr_name, char *net_name)
1435 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
1439 ss1->num_opens = num_opens ;
1440 ss1->num_users = num_users;
1441 ss1->open_time = open_time;
1443 ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
1444 ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
1447 /*******************************************************************
1448 Reads or writes a structure.
1449 ********************************************************************/
1451 static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1456 prs_debug(ps, depth, desc, "srv_io_conn_info1");
1462 if(!prs_uint32("id ", ps, depth, &ss1->id))
1464 if(!prs_uint32("type ", ps, depth, &ss1->type))
1466 if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens))
1468 if(!prs_uint32("num_users ", ps, depth, &ss1->num_users))
1470 if(!prs_uint32("open_time ", ps, depth, &ss1->open_time))
1473 if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
1475 if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
1481 /*******************************************************************
1482 Reads or writes a structure.
1483 ********************************************************************/
1485 static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
1490 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
1496 if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
1498 if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
1501 if (ss1->ptr_conn_info != 0) {
1503 int num_entries = ss1->num_entries_read;
1505 if (num_entries > MAX_CONN_ENTRIES) {
1506 num_entries = MAX_CONN_ENTRIES; /* report this! */
1509 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
1512 for (i = 0; i < num_entries; i++) {
1513 if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
1517 for (i = 0; i < num_entries; i++) {
1518 if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
1529 /*******************************************************************
1530 Reads or writes a structure.
1531 ********************************************************************/
1533 static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1535 SRV_CONN_INFO_CTR *ctr = *pp_ctr;
1537 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
1540 if (UNMARSHALLING(ps)) {
1541 ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR));
1552 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1554 if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
1557 if (ctr->ptr_conn_ctr != 0) {
1558 switch (ctr->switch_value) {
1560 if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
1564 if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
1568 DEBUG(5,("%s no connection info at switch_value %d\n",
1569 tab_depth(depth), ctr->switch_value));
1577 /*******************************************************************
1578 Reads or writes a structure.
1579 ********************************************************************/
1581 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
1582 char *srv_name, char *qual_name,
1583 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
1584 uint32 preferred_len,
1587 DEBUG(5,("init_q_net_conn_enum\n"));
1591 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
1592 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1594 q_n->conn_level = conn_level;
1595 q_n->preferred_len = preferred_len;
1597 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1600 /*******************************************************************
1601 Reads or writes a structure.
1602 ********************************************************************/
1604 BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
1609 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
1615 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
1617 if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
1623 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1625 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1631 if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
1634 if (q_n->conn_level != -1) {
1635 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
1639 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1642 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1648 /*******************************************************************
1649 Reads or writes a structure.
1650 ********************************************************************/
1652 BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
1657 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
1663 if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
1666 if (r_n->conn_level != -1) {
1667 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
1671 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1673 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1675 if(!prs_ntstatus("status ", ps, depth, &r_n->status))
1681 /*******************************************************************
1682 Inits a FILE_INFO_3_STR structure
1683 ********************************************************************/
1685 void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1687 DEBUG(5,("init_srv_file_info3_str\n"));
1689 init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1);
1690 init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1);
1693 /*******************************************************************
1694 Reads or writes a structure.
1695 ********************************************************************/
1697 static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1702 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1708 if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth))
1710 if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth))
1716 /*******************************************************************
1717 Inits a FILE_INFO_3 structure
1718 ********************************************************************/
1720 void init_srv_file_info3(FILE_INFO_3 *fl3,
1721 uint32 id, uint32 perms, uint32 num_locks,
1722 char *path_name, char *user_name)
1724 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name));
1728 fl3->num_locks = num_locks;
1730 fl3->ptr_path_name = (path_name != NULL) ? 1 : 0;
1731 fl3->ptr_user_name = (user_name != NULL) ? 1 : 0;
1734 /*******************************************************************
1735 Reads or writes a structure.
1736 ********************************************************************/
1738 static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1743 prs_debug(ps, depth, desc, "srv_io_file_info3");
1749 if(!prs_uint32("id ", ps, depth, &fl3->id))
1751 if(!prs_uint32("perms ", ps, depth, &fl3->perms))
1753 if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks))
1755 if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name))
1757 if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name))
1763 /*******************************************************************
1764 Reads or writes a structure.
1765 ********************************************************************/
1767 static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1772 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1778 if(!prs_uint32("num_entries_read", ps, depth, &fl3->num_entries_read))
1780 if(!prs_uint32("ptr_file_fl3", ps, depth, &fl3->ptr_file_info))
1783 if (fl3->ptr_file_info != 0) {
1785 int num_entries = fl3->num_entries_read;
1787 if (num_entries > MAX_FILE_ENTRIES) {
1788 num_entries = MAX_FILE_ENTRIES; /* report this! */
1791 if(!prs_uint32("num_entries_read2", ps, depth, &fl3->num_entries_read2))
1794 for (i = 0; i < num_entries; i++) {
1795 if(!srv_io_file_info3("", &fl3->info_3[i], ps, depth))
1799 for (i = 0; i < num_entries; i++) {
1800 if(!srv_io_file_info3_str("", &fl3->info_3_str[i], ps, depth))
1811 /*******************************************************************
1812 Reads or writes a structure.
1813 ********************************************************************/
1815 static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
1817 SRV_FILE_INFO_CTR *ctr = *pp_ctr;
1819 if (UNMARSHALLING(ps)) {
1820 ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR));
1828 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1834 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
1836 if(!prs_uint32("ptr_file_ctr", ps, depth, &ctr->ptr_file_ctr))
1839 if (ctr->ptr_file_ctr != 0) {
1840 switch (ctr->switch_value) {
1842 if(!srv_io_srv_file_info_3("", &ctr->file.info3, ps, depth))
1846 DEBUG(5,("%s no file info at switch_value %d\n",
1847 tab_depth(depth), ctr->switch_value));
1855 /*******************************************************************
1856 Inits a SRV_Q_NET_FILE_ENUM structure.
1857 ********************************************************************/
1859 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
1860 char *srv_name, char *qual_name,
1861 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1862 uint32 preferred_len,
1865 DEBUG(5,("init_q_net_file_enum\n"));
1869 init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
1870 init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
1872 q_n->file_level = file_level;
1873 q_n->preferred_len = preferred_len;
1875 memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
1878 /*******************************************************************
1879 Reads or writes a structure.
1880 ********************************************************************/
1882 BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1887 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1893 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
1895 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
1901 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
1903 if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
1909 if(!prs_uint32("file_level", ps, depth, &q_n->file_level))
1912 if (q_n->file_level != -1) {
1913 if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth))
1917 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
1920 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
1926 /*******************************************************************
1927 Reads or writes a structure.
1928 ********************************************************************/
1930 BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1935 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1941 if(!prs_uint32("file_level", ps, depth, &r_n->file_level))
1944 if (r_n->file_level != 0) {
1945 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
1949 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
1951 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
1953 if(!prs_ntstatus("status ", ps, depth, &r_n->status))
1959 /*******************************************************************
1960 Inits a SRV_INFO_100 structure.
1961 ********************************************************************/
1963 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name)
1965 DEBUG(5,("init_srv_info_100\n"));
1967 sv100->platform_id = platform_id;
1968 init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
1971 /*******************************************************************
1972 Reads or writes a SRV_INFO_101 structure.
1973 ********************************************************************/
1975 static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
1980 prs_debug(ps, depth, desc, "srv_io_info_100");
1986 if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
1988 if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name))
1991 if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth))
1998 /*******************************************************************
1999 Inits a SRV_INFO_101 structure.
2000 ********************************************************************/
2002 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
2003 uint32 ver_major, uint32 ver_minor,
2004 uint32 srv_type, char *comment)
2006 DEBUG(5,("init_srv_info_101\n"));
2008 sv101->platform_id = platform_id;
2009 init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
2010 sv101->ver_major = ver_major;
2011 sv101->ver_minor = ver_minor;
2012 sv101->srv_type = srv_type;
2013 init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
2016 /*******************************************************************
2017 Reads or writes a SRV_INFO_101 structure.
2018 ********************************************************************/
2020 static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
2025 prs_debug(ps, depth, desc, "srv_io_info_101");
2031 if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
2033 if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name))
2035 if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major))
2037 if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor))
2039 if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type))
2041 if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
2047 if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth))
2049 if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
2055 /*******************************************************************
2056 Inits a SRV_INFO_102 structure.
2057 ********************************************************************/
2059 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
2060 char *comment, uint32 ver_major, uint32 ver_minor,
2061 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
2062 uint32 announce, uint32 ann_delta, uint32 licenses,
2065 DEBUG(5,("init_srv_info_102\n"));
2067 sv102->platform_id = platform_id;
2068 init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
2069 sv102->ver_major = ver_major;
2070 sv102->ver_minor = ver_minor;
2071 sv102->srv_type = srv_type;
2072 init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
2074 /* same as 101 up to here */
2076 sv102->users = users;
2078 sv102->hidden = hidden;
2079 sv102->announce = announce;
2080 sv102->ann_delta =ann_delta;
2081 sv102->licenses = licenses;
2082 init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
2086 /*******************************************************************
2087 Reads or writes a SRV_INFO_102 structure.
2088 ********************************************************************/
2090 static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
2095 prs_debug(ps, depth, desc, "srv_io_info102");
2101 if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
2103 if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name))
2105 if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major))
2107 if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor))
2109 if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type))
2111 if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
2114 /* same as 101 up to here */
2116 if(!prs_uint32("users ", ps, depth, &sv102->users))
2118 if(!prs_uint32("disc ", ps, depth, &sv102->disc))
2120 if(!prs_uint32("hidden ", ps, depth, &sv102->hidden))
2122 if(!prs_uint32("announce ", ps, depth, &sv102->announce))
2124 if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta))
2126 if(!prs_uint32("licenses ", ps, depth, &sv102->licenses))
2128 if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
2131 if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth))
2135 if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
2139 if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
2145 /*******************************************************************
2146 Reads or writes a SRV_INFO_102 structure.
2147 ********************************************************************/
2149 static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
2154 prs_debug(ps, depth, desc, "srv_io_info_ctr");
2160 if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
2162 if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
2165 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
2166 switch (ctr->switch_value) {
2168 if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
2172 if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
2176 if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
2180 DEBUG(5,("%s no server info at switch_value %d\n",
2181 tab_depth(depth), ctr->switch_value));
2191 /*******************************************************************
2192 Inits a SRV_Q_NET_SRV_GET_INFO structure.
2193 ********************************************************************/
2195 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
2196 char *server_name, uint32 switch_value)
2198 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
2200 init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
2202 srv->switch_value = switch_value;
2205 /*******************************************************************
2206 Reads or writes a structure.
2207 ********************************************************************/
2209 BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
2214 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
2220 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2222 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2228 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2234 /*******************************************************************
2235 Inits a SRV_R_NET_SRV_GET_INFO structure.
2236 ********************************************************************/
2238 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
2239 uint32 switch_value, SRV_INFO_CTR *ctr, NTSTATUS status)
2241 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
2245 if (NT_STATUS_IS_OK(status)) {
2246 srv->ctr->switch_value = switch_value;
2247 srv->ctr->ptr_srv_ctr = 1;
2249 srv->ctr->switch_value = 0;
2250 srv->ctr->ptr_srv_ctr = 0;
2253 srv->status = status;
2256 /*******************************************************************
2257 Inits a SRV_R_NET_SRV_SET_INFO structure.
2258 ********************************************************************/
2260 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
2261 uint32 switch_value, NTSTATUS status)
2263 DEBUG(5,("init_srv_r_net_srv_set_info\n"));
2265 srv->switch_value = switch_value;
2266 srv->status = status;
2269 /*******************************************************************
2270 Reads or writes a structure.
2271 ********************************************************************/
2273 BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n,
2274 prs_struct *ps, int depth)
2276 prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
2282 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2284 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2290 if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
2293 if (UNMARSHALLING(ps)) {
2294 q_n->ctr = (SRV_INFO_CTR *)
2295 prs_alloc_mem(ps, sizeof(SRV_INFO_CTR));
2301 if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
2307 /*******************************************************************
2308 Reads or writes a structure.
2309 ********************************************************************/
2311 BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
2316 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
2322 if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
2325 if(!prs_ntstatus("status ", ps, depth, &r_n->status))
2331 /*******************************************************************
2332 Reads or writes a structure.
2333 ********************************************************************/
2335 BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
2336 prs_struct *ps, int depth)
2338 prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
2344 if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value))
2347 if(!prs_ntstatus("status ", ps, depth, &r_n->status))
2353 /*******************************************************************
2354 Reads or writes a structure.
2355 ********************************************************************/
2357 BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
2362 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
2368 if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
2370 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2376 /*******************************************************************
2377 Reads or writes a TIME_OF_DAY_INFO structure.
2378 ********************************************************************/
2380 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
2385 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
2391 if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt))
2393 if(!prs_uint32("msecs ", ps, depth, &tod->msecs))
2395 if(!prs_uint32("hours ", ps, depth, &tod->hours))
2397 if(!prs_uint32("mins ", ps, depth, &tod->mins))
2399 if(!prs_uint32("secs ", ps, depth, &tod->secs))
2401 if(!prs_uint32("hunds ", ps, depth, &tod->hunds))
2403 if(!prs_uint32("timezone ", ps, depth, &tod->zone))
2405 if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
2407 if(!prs_uint32("day ", ps, depth, &tod->day))
2409 if(!prs_uint32("month ", ps, depth, &tod->month))
2411 if(!prs_uint32("year ", ps, depth, &tod->year))
2413 if(!prs_uint32("weekday ", ps, depth, &tod->weekday))
2419 /*******************************************************************
2420 Inits a TIME_OF_DAY_INFO structure.
2421 ********************************************************************/
2423 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
2424 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
2425 uint32 zone, uint32 tintervals, uint32 day,
2426 uint32 month, uint32 year, uint32 weekday)
2428 DEBUG(5,("init_time_of_day_info\n"));
2430 tod->elapsedt = elapsedt;
2437 tod->tintervals = tintervals;
2441 tod->weekday = weekday;
2445 /*******************************************************************
2446 Reads or writes a structure.
2447 ********************************************************************/
2449 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
2454 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
2460 if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
2463 if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
2466 if(!prs_ntstatus("status ", ps, depth, &r_n->status))
2472 /*******************************************************************
2473 Reads or writes a structure.
2474 ********************************************************************/
2476 BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
2481 prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
2487 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2490 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2496 if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
2499 if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
2502 if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
2508 if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
2510 if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
2516 /*******************************************************************
2517 Reads or writes a structure.
2518 ********************************************************************/
2520 BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
2527 prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
2533 if(!prs_uint32("entries_read", ps, depth, &r_n->disk_enum_ctr.entries_read))
2535 if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
2538 /*this may be max, unknown, actual?*/
2540 if(!prs_uint32("max_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
2542 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
2544 if(!prs_uint32("actual_elements", ps, depth, &r_n->disk_enum_ctr.entries_read))
2547 for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) {
2549 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
2552 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
2559 if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
2562 if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
2565 if(!prs_ntstatus("status", ps, depth, &r_n->status))
2571 /*******************************************************************
2572 Reads or writes a structure.
2573 ********************************************************************/
2575 BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
2580 prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
2586 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2589 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2595 if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth))
2601 if(!prs_uint32("type", ps, depth, &q_n->type))
2604 if(!prs_uint32("flags", ps, depth, &q_n->flags))
2610 /*******************************************************************
2611 Reads or writes a structure.
2612 ********************************************************************/
2614 BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
2619 prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
2625 if(!prs_ntstatus("status", ps, depth, &r_n->status))
2631 /*******************************************************************
2632 Reads or writes a structure.
2633 ********************************************************************/
2635 BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
2640 prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
2646 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2649 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2655 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2658 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
2664 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
2667 if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
2670 if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
2673 if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
2679 /*******************************************************************
2680 Reads or writes a structure.
2681 ********************************************************************/
2683 BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
2688 prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
2694 if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
2697 if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
2700 if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
2703 if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
2706 if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
2712 if(!prs_ntstatus("status", ps, depth, &r_n->status))
2718 /*******************************************************************
2719 Reads or writes a structure.
2720 ********************************************************************/
2722 BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
2727 prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
2733 if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
2736 if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
2742 if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
2745 if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
2751 if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
2757 if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
2760 if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
2763 if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
2766 if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
2769 if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
2775 /*******************************************************************
2776 Reads or writes a structure.
2777 ********************************************************************/
2779 BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
2784 prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
2790 if(!prs_ntstatus("status", ps, depth, &r_n->status))