s4:torture:vfs_fruit: smb2/create context AAPL test
[Samba.git] / source4 / torture / vfs / fruit.c
blob5d4a411f5936027f149afb06d76a462f526de0f4
1 /*
2 Unix SMB/CIFS implementation.
4 vfs_fruit tests
6 Copyright (C) Ralph Boehme 2014
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "system/filesys.h"
24 #include "libcli/libcli.h"
25 #include "libcli/smb2/smb2.h"
26 #include "libcli/smb2/smb2_calls.h"
27 #include "libcli/smb/smb2_create_ctx.h"
28 #include "lib/cmdline/popt_common.h"
29 #include "param/param.h"
30 #include "libcli/resolve/resolve.h"
31 #include "MacExtensions.h"
33 #include "torture/torture.h"
34 #include "torture/util.h"
35 #include "torture/smb2/proto.h"
36 #include "torture/vfs/proto.h"
38 #define BASEDIR "vfs_fruit_dir"
40 #define CHECK_STATUS(status, correct) do { \
41 if (!NT_STATUS_EQUAL(status, correct)) { \
42 torture_result(tctx, TORTURE_FAIL, \
43 "(%s) Incorrect status %s - should be %s\n", \
44 __location__, nt_errstr(status), nt_errstr(correct)); \
45 ret = false; \
46 goto done; \
47 }} while (0)
50 * REVIEW:
51 * This is hokey, but what else can we do?
53 #if defined(HAVE_ATTROPEN) || defined(FREEBSD)
54 #define AFPINFO_EA_NETATALK "org.netatalk.Metadata"
55 #define AFPRESOURCE_EA_NETATALK "org.netatalk.ResourceFork"
56 #else
57 #define AFPINFO_EA_NETATALK "user.org.netatalk.Metadata"
58 #define AFPRESOURCE_EA_NETATALK "user.org.netatalk.ResourceFork"
59 #endif
62 The metadata xattr char buf below contains the following attributes:
64 -------------------------------------------------------------------------------
65 Entry ID : 00000008 : File Dates Info
66 Offset : 00000162 : 354
67 Length : 00000010 : 16
69 -DATE------: : (GMT) : (Local)
70 create : 1B442169 : Mon Jun 30 13:23:53 2014 : Mon Jun 30 15:23:53 2014
71 modify : 1B442169 : Mon Jun 30 13:23:53 2014 : Mon Jun 30 15:23:53 2014
72 backup : 80000000 : Unknown or Initial
73 access : 1B442169 : Mon Jun 30 13:23:53 2014 : Mon Jun 30 15:23:53 2014
75 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
76 00000000 : 1B 44 21 69 1B 44 21 69 80 00 00 00 1B 44 21 69 : .D!i.D!i.....D!i
78 -------------------------------------------------------------------------------
79 Entry ID : 00000009 : Finder Info
80 Offset : 0000007A : 122
81 Length : 00000020 : 32
83 -FInfo-----:
84 Type : 42415252 : BARR
85 Creator : 464F4F4F : FOOO
86 isAlias : 0
87 Invisible : 1
88 hasBundle : 0
89 nameLocked : 0
90 Stationery : 0
91 CustomIcon : 0
92 Reserved : 0
93 Inited : 0
94 NoINITS : 0
95 Shared : 0
96 SwitchLaunc: 0
97 Hidden Ext : 0
98 color : 000 : none
99 isOnDesk : 0
100 Location v : 0000 : 0
101 Location h : 0000 : 0
102 Fldr : 0000 : ..
104 -FXInfo----:
105 Rsvd|IconID: 0000 : 0
106 Rsvd : 0000 : ..
107 Rsvd : 0000 : ..
108 Rsvd : 0000 : ..
109 AreInvalid : 0
110 unknown bit: 0
111 unknown bit: 0
112 unknown bit: 0
113 unknown bit: 0
114 unknown bit: 0
115 unknown bit: 0
116 CustomBadge: 0
117 ObjctIsBusy: 0
118 unknown bit: 0
119 unknown bit: 0
120 unknown bit: 0
121 unknown bit: 0
122 RoutingInfo: 0
123 unknown bit: 0
124 unknown bit: 0
125 Rsvd|commnt: 0000 : 0
126 PutAway : 00000000 : 0
128 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
129 00000000 : 42 41 52 52 46 4F 4F 4F 40 00 00 00 00 00 00 00 : BARRFOOO@.......
130 00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
132 -------------------------------------------------------------------------------
133 Entry ID : 0000000E : AFP File Info
134 Offset : 00000172 : 370
135 Length : 00000004 : 4
137 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
138 00000000 : 00 00 01 A1 : ....
141 char metadata_xattr[] = {
142 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
146 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147 0x00, 0x08, 0x00, 0x00, 0x01, 0x62, 0x00, 0x00,
148 0x00, 0x10, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
149 0x00, 0x7a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
150 0x00, 0x0e, 0x00, 0x00, 0x01, 0x72, 0x00, 0x00,
151 0x00, 0x04, 0x80, 0x44, 0x45, 0x56, 0x00, 0x00,
152 0x01, 0x76, 0x00, 0x00, 0x00, 0x08, 0x80, 0x49,
153 0x4e, 0x4f, 0x00, 0x00, 0x01, 0x7e, 0x00, 0x00,
154 0x00, 0x08, 0x80, 0x53, 0x59, 0x4e, 0x00, 0x00,
155 0x01, 0x86, 0x00, 0x00, 0x00, 0x08, 0x80, 0x53,
156 0x56, 0x7e, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00,
157 0x00, 0x04, 0x42, 0x41, 0x52, 0x52, 0x46, 0x4f,
158 0x4f, 0x4f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
168 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
175 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
176 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
183 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
186 0x00, 0x00, 0x1b, 0x44, 0x21, 0x69, 0x1b, 0x44,
187 0x21, 0x69, 0x80, 0x00, 0x00, 0x00, 0x1b, 0x44,
188 0x21, 0x69, 0x00, 0x00, 0x01, 0xa1, 0x00, 0xfd,
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x20,
190 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0xe3,
191 0x86, 0x53, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x01,
192 0x00, 0x00
196 The buf below contains the following AppleDouble encoded data:
198 -------------------------------------------------------------------------------
199 MagicNumber: 00051607 : AppleDouble
200 Version : 00020000 : Version 2
201 Filler : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
202 Num. of ent: 0002 : 2
204 -------------------------------------------------------------------------------
205 Entry ID : 00000009 : Finder Info
206 Offset : 00000032 : 50
207 Length : 00000EB0 : 3760
209 -FInfo-----:
210 Type : 54455854 : TEXT
211 Creator : 21526368 : !Rch
214 -EA--------:
215 pad : 0000 : ..
216 magic : 41545452 : ATTR
217 debug_tag : 0007F98E : 522638
218 total_size : 00000EE2 : 3810
219 data_start : 00000078 : 120
220 data_length: 00000000 : 0
221 reserved[0]: 00000000 : ....
222 reserved[1]: 00000000 : ....
223 reserved[2]: 00000000 : ....
224 flags : 0000 : ..
225 num_attrs : 0000 : 0
227 -------------------------------------------------------------------------------
228 Entry ID : 00000002 : Resource Fork
229 Offset : 00000EE2 : 3810
230 Length : 0000011E : 286
232 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
233 00000000 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
234 00000010 : 54 68 69 73 20 72 65 73 6F 75 72 63 65 20 66 6F : This resource fo
235 00000020 : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
236 00000030 : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 : left blank ..
238 00000110 : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF : ..............
240 static char osx_adouble_w_xattr[] = {
241 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
242 0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
243 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
244 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
245 0x00, 0x32, 0x00, 0x00, 0x0e, 0xb0, 0x00, 0x00,
246 0x00, 0x02, 0x00, 0x00, 0x0e, 0xe2, 0x00, 0x00,
247 0x01, 0x1e, 0x54, 0x45, 0x58, 0x54, 0x21, 0x52,
248 0x63, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
251 0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52,
252 0x00, 0x07, 0xf9, 0x8e, 0x00, 0x00, 0x0e, 0xe2,
253 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00,
254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
255 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
259 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
261 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
275 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
295 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
305 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
307 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
308 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
309 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
317 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
354 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
359 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
404 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
406 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
413 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
417 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
418 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
422 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
427 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
429 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
433 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
435 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
436 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
438 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
439 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
440 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
443 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
444 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
447 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
466 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
467 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
468 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
469 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
470 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
471 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
472 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
473 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
475 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
476 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
477 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
483 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
484 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
485 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
486 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
487 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
489 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
490 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
491 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
492 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
500 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
501 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
504 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
507 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
510 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
516 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
517 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
519 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
521 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
522 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
523 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
524 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
525 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
527 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
532 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
533 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
535 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
537 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
543 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
544 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
545 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
548 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
549 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
550 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
551 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
552 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
553 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
557 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
558 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
559 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
560 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
561 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
562 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
563 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
564 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
567 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
568 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
569 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
570 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
571 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
572 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
573 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
574 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
575 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
576 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
578 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
579 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
580 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
581 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
582 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
583 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
585 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
587 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
593 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
596 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
597 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
598 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
599 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
600 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
601 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
602 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
603 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
604 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
605 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
606 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
607 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
608 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
609 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
613 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
614 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
615 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
616 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
619 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
620 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
621 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
622 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
623 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
624 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
625 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
626 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
628 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
629 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
630 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
631 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
632 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
633 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
634 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
635 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
636 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
637 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
642 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
644 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
646 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
651 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
652 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
657 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
658 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
659 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
660 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
662 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
663 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
664 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
665 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
666 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
669 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
670 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
671 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
672 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
673 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
674 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
675 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
676 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
677 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
678 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
679 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
680 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
681 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
682 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
683 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
684 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
685 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
686 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
687 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
688 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
689 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
690 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
692 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
693 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
694 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
695 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
696 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
697 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
698 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
699 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
700 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
701 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
702 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
703 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
704 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
705 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
706 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
707 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
708 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
711 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
712 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
713 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
714 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
715 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
716 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
717 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
718 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
719 0x00, 0x1e, 0x54, 0x68, 0x69, 0x73, 0x20, 0x72,
720 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20,
721 0x66, 0x6f, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
722 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
723 0x6c, 0x79, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20,
724 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x20, 0x20,
725 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
726 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
727 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
728 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
729 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
730 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
731 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
732 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
733 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
734 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
735 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
736 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
737 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
738 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
739 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
740 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
741 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
742 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
743 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
744 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
745 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
746 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
747 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
748 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
749 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
750 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
751 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
752 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0xff, 0xff
756 * talloc and intialize an AfpInfo
758 static AfpInfo *torture_afpinfo_new(TALLOC_CTX *mem_ctx)
760 AfpInfo *info;
762 info = talloc_zero(mem_ctx, AfpInfo);
763 if (info == NULL) {
764 return NULL;
767 info->afpi_Signature = AFP_Signature;
768 info->afpi_Version = AFP_Version;
769 info->afpi_BackupTime = AFP_BackupTime;
771 return info;
775 * Pack AfpInfo into a talloced buffer
777 static char *torture_afpinfo_pack(TALLOC_CTX *mem_ctx,
778 AfpInfo *info)
780 char *buf;
782 buf = talloc_array(mem_ctx, char, AFP_INFO_SIZE);
783 if (buf == NULL) {
784 return NULL;
787 RSIVAL(buf, 0, info->afpi_Signature);
788 RSIVAL(buf, 4, info->afpi_Version);
789 RSIVAL(buf, 12, info->afpi_BackupTime);
790 memcpy(buf + 16, info->afpi_FinderInfo, sizeof(info->afpi_FinderInfo));
792 return buf;
796 * Unpack AfpInfo
798 #if 0
799 static void torture_afpinfo_unpack(AfpInfo *info, char *data)
801 info->afpi_Signature = RIVAL(data, 0);
802 info->afpi_Version = RIVAL(data, 4);
803 info->afpi_BackupTime = RIVAL(data, 12);
804 memcpy(info->afpi_FinderInfo, (const char *)data + 16,
805 sizeof(info->afpi_FinderInfo));
807 #endif
809 static bool torture_write_afpinfo(struct smb2_tree *tree,
810 struct torture_context *tctx,
811 TALLOC_CTX *mem_ctx,
812 const char *fname,
813 AfpInfo *info)
815 struct smb2_handle handle;
816 struct smb2_create io;
817 NTSTATUS status;
818 const char *full_name;
819 char *infobuf;
820 bool ret = true;
822 full_name = talloc_asprintf(mem_ctx, "%s%s", fname, AFPINFO_STREAM);
823 if (full_name == NULL) {
824 torture_comment(tctx, "talloc_asprintf error\n");
825 return false;
827 ZERO_STRUCT(io);
828 io.in.desired_access = SEC_FILE_WRITE_DATA;
829 io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
830 io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
831 io.in.create_options = 0;
832 io.in.fname = full_name;
834 status = smb2_create(tree, mem_ctx, &io);
835 CHECK_STATUS(status, NT_STATUS_OK);
837 handle = io.out.file.handle;
839 infobuf = torture_afpinfo_pack(mem_ctx, info);
840 if (infobuf == NULL) {
841 return false;
844 status = smb2_util_write(tree, handle, infobuf, 0, AFP_INFO_SIZE);
845 CHECK_STATUS(status, NT_STATUS_OK);
847 smb2_util_close(tree, handle);
849 done:
850 return ret;
854 * Read 'count' bytes at 'offset' from stream 'fname:sname' and
855 * compare against buffer 'value'
857 static bool check_stream(struct smb2_tree *tree,
858 const char *location,
859 struct torture_context *tctx,
860 TALLOC_CTX *mem_ctx,
861 const char *fname,
862 const char *sname,
863 off_t read_offset,
864 size_t read_count,
865 off_t comp_offset,
866 size_t comp_count,
867 const char *value)
869 struct smb2_handle handle;
870 struct smb2_create create;
871 struct smb2_read r;
872 NTSTATUS status;
873 const char *full_name;
875 full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
876 if (full_name == NULL) {
877 torture_comment(tctx, "talloc_asprintf error\n");
878 return false;
880 ZERO_STRUCT(create);
881 create.in.desired_access = SEC_FILE_READ_DATA;
882 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
883 create.in.create_disposition = NTCREATEX_DISP_OPEN;
884 create.in.fname = full_name;
886 torture_comment(tctx, "Open stream %s\n", full_name);
888 status = smb2_create(tree, mem_ctx, &create);
889 if (!NT_STATUS_IS_OK(status)) {
890 if (value == NULL) {
891 return true;
892 } else {
893 torture_comment(tctx, "Unable to open stream %s\n",
894 full_name);
895 sleep(10000000);
896 return false;
900 handle = create.out.file.handle;
901 if (value == NULL) {
902 return true;
906 ZERO_STRUCT(r);
907 r.in.file.handle = handle;
908 r.in.length = read_count;
909 r.in.offset = read_offset;
911 status = smb2_read(tree, tree, &r);
913 if (!NT_STATUS_IS_OK(status)) {
914 torture_comment(tctx, "(%s) Failed to read %lu bytes from "
915 "stream '%s'\n", location, (long)strlen(value), full_name);
916 return false;
919 if (memcmp(r.out.data.data + comp_offset, value, comp_count) != 0) {
920 torture_comment(tctx, "(%s) Bad data in stream\n", location);
921 return false;
924 smb2_util_close(tree, handle);
925 return true;
929 * Read 'count' bytes at 'offset' from stream 'fname:sname' and
930 * compare against buffer 'value'
932 static bool write_stream(struct smb2_tree *tree,
933 const char *location,
934 struct torture_context *tctx,
935 TALLOC_CTX *mem_ctx,
936 const char *fname,
937 const char *sname,
938 off_t offset,
939 size_t size,
940 const char *value)
942 struct smb2_handle handle;
943 struct smb2_create create;
944 NTSTATUS status;
945 const char *full_name;
947 full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
948 if (full_name == NULL) {
949 torture_comment(tctx, "talloc_asprintf error\n");
950 return false;
952 ZERO_STRUCT(create);
953 create.in.desired_access = SEC_FILE_WRITE_DATA;
954 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
955 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
956 create.in.fname = full_name;
958 status = smb2_create(tree, mem_ctx, &create);
959 if (!NT_STATUS_IS_OK(status)) {
960 if (value == NULL) {
961 return true;
962 } else {
963 torture_comment(tctx, "Unable to open stream %s\n",
964 full_name);
965 sleep(10000000);
966 return false;
970 handle = create.out.file.handle;
971 if (value == NULL) {
972 return true;
975 status = smb2_util_write(tree, handle, value, offset, size);
977 if (!NT_STATUS_IS_OK(status)) {
978 torture_comment(tctx, "(%s) Failed to write %lu bytes to "
979 "stream '%s'\n", location, (long)size, full_name);
980 return false;
983 smb2_util_close(tree, handle);
984 return true;
987 static bool torture_setup_local_xattr(struct torture_context *tctx,
988 const char *path_option,
989 const char *name,
990 const char *metadata,
991 size_t size)
993 int ret = true;
994 int result;
995 const char *spath;
996 char *path;
998 spath = torture_setting_string(tctx, path_option, NULL);
999 if (spath == NULL) {
1000 printf("No sharepath for option %s\n", path_option);
1001 return false;
1004 path = talloc_asprintf(tctx, "%s/%s", spath, name);
1006 result = setxattr(path, AFPINFO_EA_NETATALK, metadata, size, 0);
1007 if (result != 0) {
1008 ret = false;
1011 TALLOC_FREE(path);
1013 return ret;
1016 static bool torture_setup_local_file(struct torture_context *tctx,
1017 const char *path_option,
1018 const char *name,
1019 const char *buf,
1020 size_t size)
1022 int fd;
1023 const char *spath;
1024 char *path;
1025 ssize_t rsize;
1027 spath = torture_setting_string(tctx, path_option, NULL);
1028 if (spath == NULL) {
1029 printf("No sharepath for option %s\n", path_option);
1030 return false;
1033 path = talloc_asprintf(tctx, "%s/%s", spath, name);
1034 if (path == NULL) {
1035 return false;
1038 fd = creat(path, S_IRWXU);
1039 TALLOC_FREE(path);
1040 if (fd == -1) {
1041 return false;
1044 if ((buf == NULL) || (size == 0)) {
1045 close(fd);
1046 return true;
1049 rsize = write(fd, buf, size);
1050 if (rsize != size) {
1051 return false;
1054 close(fd);
1056 return true;
1060 * Create a file or directory
1062 static bool torture_setup_file(TALLOC_CTX *mem_ctx, struct smb2_tree *tree,
1063 const char *name, bool dir)
1065 struct smb2_create io;
1066 NTSTATUS status;
1068 smb2_util_unlink(tree, name);
1069 ZERO_STRUCT(io);
1070 io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
1071 io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
1072 io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
1073 io.in.share_access =
1074 NTCREATEX_SHARE_ACCESS_DELETE|
1075 NTCREATEX_SHARE_ACCESS_READ|
1076 NTCREATEX_SHARE_ACCESS_WRITE;
1077 io.in.create_options = 0;
1078 io.in.fname = name;
1079 if (dir) {
1080 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
1081 io.in.share_access &= ~NTCREATEX_SHARE_ACCESS_DELETE;
1082 io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
1083 io.in.create_disposition = NTCREATEX_DISP_CREATE;
1086 status = smb2_create(tree, mem_ctx, &io);
1087 if (!NT_STATUS_IS_OK(status)) {
1088 return false;
1091 status = smb2_util_close(tree, io.out.file.handle);
1092 if (!NT_STATUS_IS_OK(status)) {
1093 return false;
1096 return true;
1099 static bool test_read_atalk_metadata(struct torture_context *tctx,
1100 struct smb2_tree *tree1,
1101 struct smb2_tree *tree2)
1103 TALLOC_CTX *mem_ctx = talloc_new(tctx);
1104 const char *fname = BASEDIR "\\torture_read_metadata";
1105 NTSTATUS status;
1106 struct smb2_handle testdirh;
1107 bool ret = true;
1109 torture_comment(tctx, "Checking metadata access\n");
1111 smb2_util_unlink(tree1, fname);
1113 status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
1114 CHECK_STATUS(status, NT_STATUS_OK);
1115 smb2_util_close(tree1, testdirh);
1117 ret = torture_setup_file(mem_ctx, tree1, fname, false);
1118 if (ret == false) {
1119 goto done;
1122 ret = torture_setup_local_xattr(tctx, "localdir",
1123 BASEDIR "/torture_read_metadata",
1124 metadata_xattr, sizeof(metadata_xattr));
1125 if (ret == false) {
1126 goto done;
1129 ret &= check_stream(tree1, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
1130 0, 60, 0, 4, "AFP");
1132 ret &= check_stream(tree1, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
1133 0, 60, 16, 8, "BARRFOOO");
1135 done:
1136 smb2_deltree(tree1, BASEDIR);
1137 talloc_free(mem_ctx);
1138 return ret;
1141 static bool test_write_atalk_metadata(struct torture_context *tctx,
1142 struct smb2_tree *tree1,
1143 struct smb2_tree *tree2)
1145 TALLOC_CTX *mem_ctx = talloc_new(tctx);
1146 const char *fname = BASEDIR "\\torture_write_metadata";
1147 const char *type_creator = "SMB,OLE!";
1148 NTSTATUS status;
1149 struct smb2_handle testdirh;
1150 bool ret = true;
1151 AfpInfo *info;
1153 smb2_util_unlink(tree1, fname);
1155 status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
1156 CHECK_STATUS(status, NT_STATUS_OK);
1157 smb2_util_close(tree1, testdirh);
1159 ret = torture_setup_file(mem_ctx, tree1, fname, false);
1160 if (ret == false) {
1161 goto done;
1164 info = torture_afpinfo_new(mem_ctx);
1165 if (info == NULL) {
1166 goto done;
1169 memcpy(info->afpi_FinderInfo, type_creator, 8);
1170 ret = torture_write_afpinfo(tree1, tctx, mem_ctx, fname, info);
1171 ret &= check_stream(tree1, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
1172 0, 60, 16, 8, type_creator);
1174 done:
1175 smb2_deltree(tree1, BASEDIR);
1176 talloc_free(mem_ctx);
1177 return ret;
1180 static bool test_write_atalk_rfork_io(struct torture_context *tctx,
1181 struct smb2_tree *tree1,
1182 struct smb2_tree *tree2)
1184 TALLOC_CTX *mem_ctx = talloc_new(tctx);
1185 const char *fname = BASEDIR "\\torture_write_rfork_io";
1186 const char *rfork = BASEDIR "\\torture_write_rfork_io" AFPRESOURCE_STREAM;
1187 const char *rfork_content = "1234567890";
1188 NTSTATUS status;
1189 struct smb2_handle testdirh;
1190 bool ret = true;
1192 union smb_open io;
1193 struct smb2_handle filehandle;
1194 union smb_fileinfo finfo;
1195 union smb_setfileinfo sinfo;
1197 smb2_util_unlink(tree1, fname);
1199 status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
1200 CHECK_STATUS(status, NT_STATUS_OK);
1201 smb2_util_close(tree1, testdirh);
1203 ret = torture_setup_file(mem_ctx, tree1, fname, false);
1204 if (ret == false) {
1205 goto done;
1208 torture_comment(tctx, "(%s) writing to resource fork\n",
1209 __location__);
1211 ret &= write_stream(tree1, __location__, tctx, mem_ctx,
1212 fname, AFPRESOURCE_STREAM,
1213 10, 10, rfork_content);
1215 ret &= check_stream(tree1, __location__, tctx, mem_ctx,
1216 fname, AFPRESOURCE_STREAM,
1217 0, 20, 10, 10, rfork_content);
1219 /* Check size after write */
1221 ZERO_STRUCT(io);
1222 io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
1223 io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
1224 SEC_FILE_WRITE_ATTRIBUTE;
1225 io.smb2.in.fname = rfork;
1226 status = smb2_create(tree1, mem_ctx, &(io.smb2));
1227 CHECK_STATUS(status, NT_STATUS_OK);
1228 filehandle = io.smb2.out.file.handle;
1230 torture_comment(tctx, "(%s) check resource fork size after write\n",
1231 __location__);
1233 ZERO_STRUCT(finfo);
1234 finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
1235 finfo.generic.in.file.handle = filehandle;
1236 status = smb2_getinfo_file(tree1, mem_ctx, &finfo);
1237 CHECK_STATUS(status, NT_STATUS_OK);
1238 if (finfo.all_info.out.size != 20) {
1239 torture_result(tctx, TORTURE_FAIL,
1240 "(%s) Incorrect resource fork size\n",
1241 __location__);
1242 ret = false;
1243 smb2_util_close(tree1, filehandle);
1244 goto done;
1246 smb2_util_close(tree1, filehandle);
1248 /* Write at large offset */
1250 torture_comment(tctx, "(%s) writing to resource fork at large offset\n",
1251 __location__);
1253 ret &= write_stream(tree1, __location__, tctx, mem_ctx,
1254 fname, AFPRESOURCE_STREAM,
1255 (off_t)1<<32, 10, rfork_content);
1257 ret &= check_stream(tree1, __location__, tctx, mem_ctx,
1258 fname, AFPRESOURCE_STREAM,
1259 (off_t)1<<32, 10, 0, 10, rfork_content);
1261 /* Truncate back to size of 1 byte */
1263 torture_comment(tctx, "(%s) truncate resource fork and check size\n",
1264 __location__);
1266 ZERO_STRUCT(io);
1267 io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
1268 io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
1269 SEC_FILE_WRITE_ATTRIBUTE;
1270 io.smb2.in.fname = rfork;
1271 status = smb2_create(tree1, mem_ctx, &(io.smb2));
1272 CHECK_STATUS(status, NT_STATUS_OK);
1273 filehandle = io.smb2.out.file.handle;
1275 ZERO_STRUCT(sinfo);
1276 sinfo.end_of_file_info.level =
1277 RAW_SFILEINFO_END_OF_FILE_INFORMATION;
1278 sinfo.end_of_file_info.in.file.handle = filehandle;
1279 sinfo.end_of_file_info.in.size = 1;
1280 status = smb2_setinfo_file(tree1, &sinfo);
1281 CHECK_STATUS(status, NT_STATUS_OK);
1283 smb2_util_close(tree1, filehandle);
1285 /* Now check size */
1286 ZERO_STRUCT(io);
1287 io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
1288 io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
1289 SEC_FILE_WRITE_ATTRIBUTE;
1290 io.smb2.in.fname = rfork;
1291 status = smb2_create(tree1, mem_ctx, &(io.smb2));
1292 CHECK_STATUS(status, NT_STATUS_OK);
1293 filehandle = io.smb2.out.file.handle;
1295 ZERO_STRUCT(finfo);
1296 finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
1297 finfo.generic.in.file.handle = filehandle;
1298 status = smb2_getinfo_file(tree1, mem_ctx, &finfo);
1299 CHECK_STATUS(status, NT_STATUS_OK);
1300 if (finfo.all_info.out.size != 1) {
1301 torture_result(tctx, TORTURE_FAIL,
1302 "(%s) Incorrect resource fork size\n",
1303 __location__);
1304 ret = false;
1305 smb2_util_close(tree1, filehandle);
1306 goto done;
1308 smb2_util_close(tree1, filehandle);
1310 done:
1311 smb2_deltree(tree1, BASEDIR);
1312 talloc_free(mem_ctx);
1313 return ret;
1316 static bool test_adouble_conversion(struct torture_context *tctx,
1317 struct smb2_tree *tree1,
1318 struct smb2_tree *tree2)
1320 TALLOC_CTX *mem_ctx = talloc_new(tctx);
1321 const char *fname = BASEDIR "\\test_adouble_conversion";
1322 const char *fname_local = BASEDIR "/test_adouble_conversion";
1323 const char *adname_local = BASEDIR "/._test_adouble_conversion";
1324 NTSTATUS status;
1325 struct smb2_handle testdirh;
1326 bool ret = true;
1327 const char *data = "This resource fork intentionally left blank";
1328 size_t datalen = strlen(data);
1330 smb2_util_unlink(tree1, fname);
1332 status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
1333 CHECK_STATUS(status, NT_STATUS_OK);
1334 smb2_util_close(tree1, testdirh);
1336 ret = torture_setup_local_file(tctx, "localdir", fname_local,
1337 NULL, 0);
1338 if (ret == false) {
1339 goto done;
1342 ret = torture_setup_local_file(tctx, "localdir", adname_local,
1343 osx_adouble_w_xattr,
1344 sizeof(osx_adouble_w_xattr));
1345 if (ret == false) {
1346 goto done;
1349 torture_comment(tctx, "(%s) test OS X AppleDouble conversion\n",
1350 __location__);
1352 ret &= check_stream(tree1, __location__, tctx, mem_ctx,
1353 fname, AFPRESOURCE_STREAM,
1354 16, datalen, 0, datalen, data);
1356 done:
1357 smb2_deltree(tree1, BASEDIR);
1358 talloc_free(mem_ctx);
1359 return ret;
1362 static bool test_aapl(struct torture_context *tctx,
1363 struct smb2_tree *tree1,
1364 struct smb2_tree *tree2)
1366 TALLOC_CTX *mem_ctx = talloc_new(tctx);
1367 const char *fname = BASEDIR "\\test_aapl";
1368 NTSTATUS status;
1369 struct smb2_handle testdirh;
1370 bool ret = true;
1371 struct smb2_create io;
1372 DATA_BLOB data;
1373 struct smb2_create_blob *aapl = NULL;
1374 AfpInfo *info;
1375 const char *type_creator = "SMB,OLE!";
1376 char type_creator_buf[9];
1377 uint32_t aapl_cmd;
1378 uint32_t aapl_reply_bitmap;
1379 uint32_t aapl_server_caps;
1380 uint32_t aapl_vol_caps;
1381 char *model;
1382 struct smb2_find f;
1383 unsigned int count;
1384 union smb_search_data *d;
1385 uint64_t rfork_len;
1387 smb2_deltree(tree1, BASEDIR);
1389 status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
1390 CHECK_STATUS(status, NT_STATUS_OK);
1391 smb2_util_close(tree1, testdirh);
1393 ZERO_STRUCT(io);
1394 io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
1395 io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
1396 io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
1397 io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
1398 NTCREATEX_SHARE_ACCESS_READ |
1399 NTCREATEX_SHARE_ACCESS_WRITE);
1400 io.in.fname = fname;
1403 * Issuing an SMB2/CREATE with a suitably formed AAPL context,
1404 * controls behaviour of Apple's SMB2 extensions for the whole
1405 * session!
1408 data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
1409 SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
1410 SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS |
1411 SMB2_CRTCTX_AAPL_VOLUME_CAPS |
1412 SMB2_CRTCTX_AAPL_MODEL_INFO));
1413 SBVAL(data.data, 16, (SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR |
1414 SMB2_CRTCTX_AAPL_UNIX_BASED |
1415 SMB2_CRTCTX_AAPL_SUPPORTS_NFS_ACE));
1417 torture_comment(tctx, "Testing SMB2 create context AAPL\n");
1418 status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
1419 CHECK_STATUS(status, NT_STATUS_OK);
1421 status = smb2_create(tree1, tctx, &io);
1422 CHECK_STATUS(status, NT_STATUS_OK);
1423 status = smb2_util_close(tree1, io.out.file.handle);
1424 CHECK_STATUS(status, NT_STATUS_OK);
1427 * Now check returned AAPL context
1429 torture_comment(tctx, "Comparing returned AAPL capabilites\n");
1431 aapl = smb2_create_blob_find(&io.out.blobs,
1432 SMB2_CREATE_TAG_AAPL);
1434 if (aapl->data.length != 50) {
1436 * uint32_t CommandCode = kAAPL_SERVER_QUERY
1437 * uint32_t Reserved = 0;
1438 * uint64_t ReplyBitmap = kAAPL_SERVER_CAPS |
1439 * kAAPL_VOLUME_CAPS |
1440 * kAAPL_MODEL_INFO;
1441 * uint64_t ServerCaps = kAAPL_SUPPORTS_READDIR_ATTR |
1442 * kAAPL_SUPPORTS_OSX_COPYFILE;
1443 * uint64_t VolumeCaps = kAAPL_SUPPORT_RESOLVE_ID |
1444 * kAAPL_CASE_SENSITIVE;
1445 * uint32_t Pad2 = 0;
1446 * uint32_t ModelStringLen = 10;
1447 * ucs2_t ModelString[5] = "Samba";
1449 ret = false;
1450 goto done;
1453 aapl_cmd = IVAL(aapl->data.data, 0);
1454 if (aapl_cmd != SMB2_CRTCTX_AAPL_SERVER_QUERY) {
1455 torture_result(tctx, TORTURE_FAIL,
1456 "(%s) unexpected cmd: %d",
1457 __location__, (int)aapl_cmd);
1458 ret = false;
1459 goto done;
1462 aapl_reply_bitmap = BVAL(aapl->data.data, 8);
1463 if (aapl_reply_bitmap != (SMB2_CRTCTX_AAPL_SERVER_CAPS |
1464 SMB2_CRTCTX_AAPL_VOLUME_CAPS |
1465 SMB2_CRTCTX_AAPL_MODEL_INFO)) {
1466 torture_result(tctx, TORTURE_FAIL,
1467 "(%s) unexpected reply_bitmap: %d",
1468 __location__, (int)aapl_reply_bitmap);
1469 ret = false;
1470 goto done;
1473 aapl_server_caps = BVAL(aapl->data.data, 16);
1474 if (aapl_server_caps != (SMB2_CRTCTX_AAPL_UNIX_BASED |
1475 SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR |
1476 SMB2_CRTCTX_AAPL_SUPPORTS_NFS_ACE)) {
1477 torture_result(tctx, TORTURE_FAIL,
1478 "(%s) unexpected server_caps: %d",
1479 __location__, (int)aapl_server_caps);
1480 ret = false;
1481 goto done;
1484 aapl_vol_caps = BVAL(aapl->data.data, 24);
1485 if (aapl_vol_caps != SMB2_CRTCTX_AAPL_CASE_SENSITIVE) {
1486 /* this will fail on a case insensitive fs ... */
1487 torture_result(tctx, TORTURE_FAIL,
1488 "(%s) unexpected vol_caps: %d",
1489 __location__, (int)aapl_vol_caps);
1490 ret = false;
1491 goto done;
1494 ret = convert_string_talloc(mem_ctx,
1495 CH_UTF16LE, CH_UNIX,
1496 aapl->data.data + 40, 10,
1497 &model, NULL);
1498 if (ret == false) {
1499 torture_result(tctx, TORTURE_FAIL,
1500 "(%s) convert_string_talloc() failed",
1501 __location__);
1502 goto done;
1504 if (strncmp(model, "Samba", 5) != 0) {
1505 torture_result(tctx, TORTURE_FAIL,
1506 "(%s) expected model \"Samba\", got: \"%s\"",
1507 __location__, model);
1508 ret = false;
1509 goto done;
1513 * Now that Requested AAPL extensions are enabled, setup some
1514 * Mac files with metadata and resource fork
1516 ret = torture_setup_file(mem_ctx, tree1, fname, false);
1517 if (ret == false) {
1518 torture_result(tctx, TORTURE_FAIL,
1519 "(%s) torture_setup_file() failed",
1520 __location__);
1521 goto done;
1524 info = torture_afpinfo_new(mem_ctx);
1525 if (info == NULL) {
1526 torture_result(tctx, TORTURE_FAIL,
1527 "(%s) torture_afpinfo_new() failed",
1528 __location__);
1529 ret = false;
1530 goto done;
1533 memcpy(info->afpi_FinderInfo, type_creator, 8);
1534 ret = torture_write_afpinfo(tree1, tctx, mem_ctx, fname, info);
1535 if (ret == false) {
1536 torture_result(tctx, TORTURE_FAIL,
1537 "(%s) torture_write_afpinfo() failed",
1538 __location__);
1539 goto done;
1542 ret = write_stream(tree1, __location__, tctx, mem_ctx,
1543 fname, AFPRESOURCE_STREAM,
1544 0, 3, "foo");
1545 if (ret == false) {
1546 torture_result(tctx, TORTURE_FAIL,
1547 "(%s) write_stream() failed",
1548 __location__);
1549 goto done;
1553 * Ok, file is prepared, now call smb2/find
1556 ZERO_STRUCT(io);
1557 io.in.desired_access = SEC_RIGHTS_DIR_ALL;
1558 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
1559 io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
1560 io.in.share_access = (NTCREATEX_SHARE_ACCESS_READ |
1561 NTCREATEX_SHARE_ACCESS_WRITE |
1562 NTCREATEX_SHARE_ACCESS_DELETE);
1563 io.in.create_disposition = NTCREATEX_DISP_OPEN;
1564 io.in.fname = BASEDIR;
1565 status = smb2_create(tree1, tctx, &io);
1566 CHECK_STATUS(status, NT_STATUS_OK);
1568 ZERO_STRUCT(f);
1569 f.in.file.handle = io.out.file.handle;
1570 f.in.pattern = "test_aapl";
1571 f.in.continue_flags = SMB2_CONTINUE_FLAG_SINGLE;
1572 f.in.max_response_size = 0x1000;
1573 f.in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO;
1575 status = smb2_find_level(tree1, tree1, &f, &count, &d);
1576 CHECK_STATUS(status, NT_STATUS_OK);
1578 status = smb2_util_close(tree1, io.out.file.handle);
1579 CHECK_STATUS(status, NT_STATUS_OK);
1581 if (strcmp(d[0].id_both_directory_info.name.s, "test_aapl") != 0) {
1582 torture_result(tctx, TORTURE_FAIL,
1583 "(%s) write_stream() failed",
1584 __location__);
1585 ret = false;
1586 goto done;
1589 if (d[0].id_both_directory_info.short_name.private_length != 24) {
1590 torture_result(tctx, TORTURE_FAIL,
1591 "(%s) bad short_name length %" PRIu32 ", expected 24",
1592 __location__, d[0].id_both_directory_info.short_name.private_length);
1593 ret = false;
1594 goto done;
1597 torture_comment(tctx, "short_name buffer:\n");
1598 dump_data(0, d[0].id_both_directory_info.short_name_buf, 24);
1601 * Extract data as specified by the AAPL extension:
1602 * - ea_size contains max_access
1603 * - short_name contains resource fork length + FinderInfo
1604 * - reserved2 contains the unix mode
1606 torture_comment(tctx, "mac_access: %" PRIx32 "\n",
1607 d[0].id_both_directory_info.ea_size);
1609 rfork_len = BVAL(d[0].id_both_directory_info.short_name_buf, 0);
1610 if (rfork_len != 3) {
1611 torture_result(tctx, TORTURE_FAIL,
1612 "(%s) expected resource fork length 3, got: %" PRIu64,
1613 __location__, rfork_len);
1614 ret = false;
1615 goto done;
1618 memcpy(type_creator_buf, d[0].id_both_directory_info.short_name_buf + 8, 8);
1619 type_creator_buf[8] = 0;
1620 if (strcmp(type_creator, type_creator_buf) != 0) {
1621 torture_result(tctx, TORTURE_FAIL,
1622 "(%s) expected type/creator \"%s\" , got: %s",
1623 __location__, type_creator, type_creator_buf);
1624 ret = false;
1625 goto done;
1628 done:
1629 talloc_free(mem_ctx);
1630 return ret;
1634 * Note: This test depends on "vfs objects = catia fruit
1635 * streams_xattr". Note: To run this test, use
1636 * "--option=torture:share1=<SHARENAME1>
1637 * --option=torture:share2=<SHARENAME2>
1638 * --option=torture:localdir=<SHAREPATH>"
1640 struct torture_suite *torture_vfs_fruit(void)
1642 struct torture_suite *suite = torture_suite_create(
1643 talloc_autofree_context(), "fruit");
1645 suite->description = talloc_strdup(suite, "vfs_fruit tests");
1647 torture_suite_add_2ns_smb2_test(suite, "read metadata", test_read_atalk_metadata);
1648 torture_suite_add_2ns_smb2_test(suite, "write metadata", test_write_atalk_metadata);
1649 torture_suite_add_2ns_smb2_test(suite, "resource fork IO", test_write_atalk_rfork_io);
1650 torture_suite_add_2ns_smb2_test(suite, "OS X AppleDouble file conversion", test_adouble_conversion);
1651 torture_suite_add_2ns_smb2_test(suite, "SMB2/CREATE context AAPL", test_aapl);
1653 return suite;