1 
2 /*
3  *  Unix SMB/Netbios implementation.
4  *  Version 1.9.
5  *  RPC Pipe client / server routines
6  *  Copyright (C) Andrew Tridgell              1992-1997,
7  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
8  *  Copyright (C) Paul Ashton                       1997.
9  *
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.
14  *
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.
19  *
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.
23  */
24 
25 
26 #include "../includes.h"
27 
28 extern int DEBUGLEVEL;
29 
30 #ifdef NTDOMAIN
31 
32 /*******************************************************************
33 reads or writes a structure.
34 ********************************************************************/
srv_io_share_info1_str(BOOL io,SH_INFO_1_STR * sh1,char * q,char * base,int align,int depth)35 char* srv_io_share_info1_str(BOOL io, SH_INFO_1_STR *sh1, char *q, char *base, int align, int depth)
36 {
37 	if (sh1 == NULL) return NULL;
38 
39 	DEBUG(5,("%s%04x srv_io_share_info1_str\n", tab_depth(depth), PTR_DIFF(q, base)));
40 	depth++;
41 
42 	q = align_offset(q, base, align);
43 
44 	q = smb_io_unistr2(io, &(sh1->uni_netname), q, base, align, depth);
45 	q = smb_io_unistr2(io, &(sh1->uni_remark ), q, base, align, depth);
46 
47 	return q;
48 }
49 
50 /*******************************************************************
51 reads or writes a structure.
52 ********************************************************************/
srv_io_share_info1(BOOL io,SH_INFO_1 * sh1,char * q,char * base,int align,int depth)53 char* srv_io_share_info1(BOOL io, SH_INFO_1 *sh1, char *q, char *base, int align, int depth)
54 {
55 	if (sh1 == NULL) return NULL;
56 
57 	DEBUG(5,("%s%04x srv_io_share_info1\n", tab_depth(depth), PTR_DIFF(q, base)));
58 	depth++;
59 
60 	q = align_offset(q, base, align);
61 
62 	DBG_RW_IVAL("ptr_netname", depth, base, io, q, sh1->ptr_netname); q += 4;
63 	DBG_RW_IVAL("type       ", depth, base, io, q, sh1->type       ); q += 4;
64 	DBG_RW_IVAL("ptr_remark ", depth, base, io, q, sh1->ptr_remark); q += 4;
65 
66 	return q;
67 }
68 
69 /*******************************************************************
70 reads or writes a structure.
71 ********************************************************************/
srv_io_share_1_ctr(BOOL io,SHARE_INFO_1_CTR * ctr,char * q,char * base,int align,int depth)72 char* srv_io_share_1_ctr(BOOL io, SHARE_INFO_1_CTR *ctr, char *q, char *base, int align, int depth)
73 {
74 	if (ctr == NULL) return NULL;
75 
76 	DEBUG(5,("%s%04x srv_io_share_1_ctr\n", tab_depth(depth), PTR_DIFF(q, base)));
77 	depth++;
78 
79 	q = align_offset(q, base, align);
80 
81 	DBG_RW_IVAL("num_entries_read", depth, base, io, q, ctr->num_entries_read); q += 4;
82 	DBG_RW_IVAL("ptr_share_info", depth, base, io, q, ctr->ptr_share_info); q += 4;
83 
84 	if (ctr->ptr_share_info != 0)
85 	{
86 		int i;
87 		int num_entries = ctr->num_entries_read;
88 		if (num_entries > MAX_SHARE_ENTRIES)
89 		{
90 			num_entries = MAX_SHARE_ENTRIES; /* report this! */
91 		}
92 
93 		DBG_RW_IVAL("num_entries_read2", depth, base, io, q, ctr->num_entries_read2); q += 4;
94 
95 		for (i = 0; i < num_entries; i++)
96 		{
97 			q = srv_io_share_info1(io, &(ctr->info_1[i]), q, base, align, depth);
98 		}
99 
100 		for (i = 0; i < num_entries; i++)
101 		{
102 			q = srv_io_share_info1_str(io, &(ctr->info_1_str[i]), q, base, align, depth);
103 		}
104 
105 		q = align_offset(q, base, align);
106 		DBG_RW_IVAL("num_entries_read3", depth, base, io, q, ctr->num_entries_read3); q += 4;
107 		DBG_RW_IVAL("padding          ", depth, base, io, q, ctr->padding); q += 4;
108 	}
109 
110 	return q;
111 }
112 
113 /*******************************************************************
114 reads or writes a structure.
115 ********************************************************************/
srv_io_q_net_share_enum(BOOL io,SRV_Q_NET_SHARE_ENUM * q_n,char * q,char * base,int align,int depth)116 char* srv_io_q_net_share_enum(BOOL io, SRV_Q_NET_SHARE_ENUM *q_n, char *q, char *base, int align, int depth)
117 {
118 	if (q_n == NULL) return NULL;
119 
120 	DEBUG(5,("%s%04x srv_io_q_net_share_enum\n", tab_depth(depth), PTR_DIFF(q, base)));
121 	depth++;
122 
123 	q = align_offset(q, base, align);
124 
125 	DBG_RW_IVAL("ptr_srv_name", depth, base, io, q, q_n->ptr_srv_name); q += 4;
126 	q = smb_io_unistr2(io, &(q_n->uni_srv_name), q, base, align, depth);
127 
128 	q = align_offset(q, base, align);
129 
130 	DBG_RW_IVAL("share_level   ", depth, base, io, q, q_n->share_level); q += 4;
131 	DBG_RW_IVAL("switch_value  ", depth, base, io, q, q_n->switch_value); q += 4;
132 
133 	DBG_RW_IVAL("ptr_share_info", depth, base, io, q, q_n->ptr_share_info); q += 4;
134 	if (q_n->ptr_share_info != 0)
135 	{
136 		switch (q_n->switch_value)
137 		{
138 			case 1:
139 			{
140 				q = srv_io_share_1_ctr(io, &(q_n->share.info1), q, base, align, depth);
141 				break;
142 			}
143 			default:
144 			{
145 				DEBUG(5,("%s% no share info at switch_value %d\n",
146 				         tab_depth(depth), q_n->switch_value));
147 				break;
148 			}
149 		}
150 	}
151 	DBG_RW_IVAL("preferred_len ", depth, base, io, q, q_n->preferred_len); q += 4;
152 
153 	return q;
154 }
155 
156 /*******************************************************************
157 reads or writes a structure.
158 ********************************************************************/
srv_io_r_net_share_enum(BOOL io,SRV_R_NET_SHARE_ENUM * r_n,char * q,char * base,int align,int depth)159 char* srv_io_r_net_share_enum(BOOL io, SRV_R_NET_SHARE_ENUM *r_n, char *q, char *base, int align, int depth)
160 {
161 	if (r_n == NULL) return NULL;
162 
163 	DEBUG(5,("%s%04x srv_io_q_net_share_enum\n", tab_depth(depth), PTR_DIFF(q, base)));
164 	depth++;
165 
166 	q = align_offset(q, base, align);
167 
168 	DBG_RW_IVAL("share_level   ", depth, base, io, q, r_n->share_level); q += 4;
169 	DBG_RW_IVAL("switch_value  ", depth, base, io, q, r_n->switch_value); q += 4;
170 
171 	DBG_RW_IVAL("ptr_share_info", depth, base, io, q, r_n->ptr_share_info); q += 4;
172 	if (r_n->ptr_share_info != 0)
173 	{
174 		switch (r_n->switch_value)
175 		{
176 			case 1:
177 			{
178 				q = srv_io_share_1_ctr(io, &(r_n->share.info1), q, base, align, depth);
179 				break;
180 			}
181 			default:
182 			{
183 				DEBUG(5,("%s% no share info at switch_value %d\n",
184 				         tab_depth(depth), r_n->switch_value));
185 				break;
186 			}
187 		}
188 	}
189 	DBG_RW_IVAL("status        ", depth, base, io, q, r_n->status); q += 4;
190 
191 	return q;
192 }
193 
194 #if 0
195 /*******************************************************************
196 reads or writes a structure.
197 ********************************************************************/
198  char* lsa_io_(BOOL io, *, char *q, char *base, int align, int depth)
199 {
200 	if (== NULL) return NULL;
201 
202 	q = align_offset(q, base, align);
203 
204 	DBG_RW_IVAL("", depth, base, io, q, ); q += 4;
205 
206 	return q;
207 }
208 #endif
209 
210 #endif
211