2 Unix SMB/Netbios implementation.
4 Samba utility functions
5 Copyright (C) Luke Leighton 1996 - 1997 Paul Ashton 1997
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 extern int DEBUGLEVEL
;
27 /*******************************************************************
28 reads or writes a structure.
29 ********************************************************************/
30 char* srv_io_share_info1_str(BOOL io
, SH_INFO_1_STR
*sh1
, char *q
, char *base
, int align
, int depth
)
32 if (sh1
== NULL
) return NULL
;
34 DEBUG(5,("%s%04x srv_io_share_info1_str\n", tab_depth(depth
), PTR_DIFF(q
, base
)));
37 q
= align_offset(q
, base
, align
);
39 q
= smb_io_unistr2(io
, &(sh1
->uni_netname
), q
, base
, align
, depth
);
40 q
= smb_io_unistr2(io
, &(sh1
->uni_remark
), q
, base
, align
, depth
);
45 /*******************************************************************
46 reads or writes a structure.
47 ********************************************************************/
48 char* srv_io_share_info1(BOOL io
, SH_INFO_1
*sh1
, char *q
, char *base
, int align
, int depth
)
50 if (sh1
== NULL
) return NULL
;
52 DEBUG(5,("%s%04x srv_io_share_info1\n", tab_depth(depth
), PTR_DIFF(q
, base
)));
55 q
= align_offset(q
, base
, align
);
57 DBG_RW_IVAL("ptr_netname", depth
, base
, io
, q
, sh1
->ptr_netname
); q
+= 4;
58 DBG_RW_IVAL("type ", depth
, base
, io
, q
, sh1
->type
); q
+= 4;
59 DBG_RW_IVAL("ptr_remark ", depth
, base
, io
, q
, sh1
->ptr_remark
); q
+= 4;
64 /*******************************************************************
65 reads or writes a structure.
66 ********************************************************************/
67 char* srv_io_share_1_ctr(BOOL io
, SHARE_INFO_1_CTR
*ctr
, char *q
, char *base
, int align
, int depth
)
69 if (ctr
== NULL
) return NULL
;
71 DEBUG(5,("%s%04x srv_io_share_1_ctr\n", tab_depth(depth
), PTR_DIFF(q
, base
)));
74 q
= align_offset(q
, base
, align
);
76 DBG_RW_IVAL("num_entries_read", depth
, base
, io
, q
, ctr
->num_entries_read
); q
+= 4;
77 DBG_RW_IVAL("ptr_share_info", depth
, base
, io
, q
, ctr
->ptr_share_info
); q
+= 4;
79 if (ctr
->ptr_share_info
!= 0)
82 int num_entries
= ctr
->num_entries_read
;
83 if (num_entries
> MAX_SHARE_ENTRIES
)
85 num_entries
= MAX_SHARE_ENTRIES
; /* report this! */
88 DBG_RW_IVAL("num_entries_read2", depth
, base
, io
, q
, ctr
->num_entries_read2
); q
+= 4;
90 for (i
= 0; i
< num_entries
; i
++)
92 q
= srv_io_share_info1(io
, &(ctr
->info_1
[i
]), q
, base
, align
, depth
);
95 for (i
= 0; i
< num_entries
; i
++)
97 q
= srv_io_share_info1_str(io
, &(ctr
->info_1_str
[i
]), q
, base
, align
, depth
);
100 q
= align_offset(q
, base
, align
);
101 DBG_RW_IVAL("num_entries_read3", depth
, base
, io
, q
, ctr
->num_entries_read3
); q
+= 4;
102 DBG_RW_IVAL("padding ", depth
, base
, io
, q
, ctr
->padding
); q
+= 4;
108 /*******************************************************************
109 reads or writes a structure.
110 ********************************************************************/
111 char* srv_io_q_net_share_enum(BOOL io
, SRV_Q_NET_SHARE_ENUM
*q_n
, char *q
, char *base
, int align
, int depth
)
113 if (q_n
== NULL
) return NULL
;
115 DEBUG(5,("%s%04x srv_io_q_net_share_enum\n", tab_depth(depth
), PTR_DIFF(q
, base
)));
118 q
= align_offset(q
, base
, align
);
120 DBG_RW_IVAL("ptr_srv_name", depth
, base
, io
, q
, q_n
->ptr_srv_name
); q
+= 4;
121 q
= smb_io_unistr2(io
, &(q_n
->uni_srv_name
), q
, base
, align
, depth
);
123 q
= align_offset(q
, base
, align
);
125 DBG_RW_IVAL("share_level ", depth
, base
, io
, q
, q_n
->share_level
); q
+= 4;
126 DBG_RW_IVAL("switch_value ", depth
, base
, io
, q
, q_n
->switch_value
); q
+= 4;
128 DBG_RW_IVAL("ptr_share_info", depth
, base
, io
, q
, q_n
->ptr_share_info
); q
+= 4;
129 if (q_n
->ptr_share_info
!= 0)
131 switch (q_n
->switch_value
)
135 q
= srv_io_share_1_ctr(io
, &(q_n
->share
.info1
), q
, base
, align
, depth
);
140 DEBUG(5,("%s% no share info at switch_value %d\n",
141 tab_depth(depth
), q_n
->switch_value
));
146 DBG_RW_IVAL("preferred_len ", depth
, base
, io
, q
, q_n
->preferred_len
); q
+= 4;
151 /*******************************************************************
152 reads or writes a structure.
153 ********************************************************************/
154 char* srv_io_r_net_share_enum(BOOL io
, SRV_R_NET_SHARE_ENUM
*r_n
, char *q
, char *base
, int align
, int depth
)
156 if (r_n
== NULL
) return NULL
;
158 DEBUG(5,("%s%04x srv_io_q_net_share_enum\n", tab_depth(depth
), PTR_DIFF(q
, base
)));
161 q
= align_offset(q
, base
, align
);
163 DBG_RW_IVAL("share_level ", depth
, base
, io
, q
, r_n
->share_level
); q
+= 4;
164 DBG_RW_IVAL("switch_value ", depth
, base
, io
, q
, r_n
->switch_value
); q
+= 4;
166 DBG_RW_IVAL("ptr_share_info", depth
, base
, io
, q
, r_n
->ptr_share_info
); q
+= 4;
167 if (r_n
->ptr_share_info
!= 0)
169 switch (r_n
->switch_value
)
173 q
= srv_io_share_1_ctr(io
, &(r_n
->share
.info1
), q
, base
, align
, depth
);
178 DEBUG(5,("%s% no share info at switch_value %d\n",
179 tab_depth(depth
), r_n
->switch_value
));
184 DBG_RW_IVAL("status ", depth
, base
, io
, q
, r_n
->status
); q
+= 4;
190 /*******************************************************************
191 reads or writes a structure.
192 ********************************************************************/
193 char* lsa_io_(BOOL io
, *, char *q
, char *base
, int align
, int depth
)
195 if (== NULL
) return NULL
;
197 q
= align_offset(q
, base
, align
);
199 DBG_RW_IVAL("", depth
, base
, io
, q
, ); q
+= 4;