Debian Codegraph @

source4/torture/vfs/fruit.c

raw
1 /*
2 Unix SMB/CIFS implementation.
3
4 vfs_fruit tests
5
6 Copyright (C) Ralph Boehme 2014
7
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.
12
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.
17
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/>.
20 */
21
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/cmdline.h"
29 #include "param/param.h"
30 #include "libcli/resolve/resolve.h"
31 #include "MacExtensions.h"
32 #include "lib/util/tsort.h"
33
34 #include "torture/torture.h"
35 #include "torture/util.h"
36 #include "torture/smb2/proto.h"
37 #include "torture/vfs/proto.h"
38 #include "librpc/gen_ndr/ndr_ioctl.h"
39 #include "libcli/security/dom_sid.h"
40 #include "../librpc/gen_ndr/ndr_security.h"
41 #include "libcli/security/secace.h"
42 #include "libcli/security/security_descriptor.h"
43
44 #define BASEDIR "vfs_fruit_dir"
45 #define FNAME_CC_SRC "testfsctl.dat"
46 #define FNAME_CC_DST "testfsctl2.dat"
47
48 #define CHECK_STATUS(status, correct) do { \
49 if (!NT_STATUS_EQUAL(status, correct)) { \
50 torture_result(tctx, TORTURE_FAIL, \
51 "(%s) Incorrect status %s - should be %s\n", \
52 __location__, nt_errstr(status), nt_errstr(correct)); \
53 ret = false; \
54 goto done; \
55 }} while (0)
56
57 #define CHECK_VALUE(v, correct) do { \
58 if ((v) != (correct)) { \
59 torture_result(tctx, TORTURE_FAIL, \
60 "(%s) Incorrect value %s=%u - should be %u\n", \
61 __location__, #v, (unsigned)v, (unsigned)correct); \
62 ret = false; \
63 goto done; \
64 }} while (0)
65
66 static bool check_stream_list(struct smb2_tree *tree,
67 struct torture_context *tctx,
68 const char *fname,
69 int num_exp,
70 const char **exp,
71 bool is_dir);
72
73 static int qsort_string(char * const *s1, char * const *s2)
74 {
75 return strcmp(*s1, *s2);
76 }
77
78 static int qsort_stream(const struct stream_struct * s1, const struct stream_struct *s2)
79 {
80 return strcmp(s1->stream_name.s, s2->stream_name.s);
81 }
82
83 /*
84 * REVIEW:
85 * This is hokey, but what else can we do?
86 */
87 #if defined(HAVE_ATTROPEN) || defined(FREEBSD)
88 #define AFPINFO_EA_NETATALK "org.netatalk.Metadata"
89 #define AFPRESOURCE_EA_NETATALK "org.netatalk.ResourceFork"
90 #else
91 #define AFPINFO_EA_NETATALK "user.org.netatalk.Metadata"
92 #define AFPRESOURCE_EA_NETATALK "user.org.netatalk.ResourceFork"
93 #endif
94
95 /*
96 The metadata xattr char buf below contains the following attributes:
97
98 -------------------------------------------------------------------------------
99 Entry ID : 00000008 : File Dates Info
100 Offset : 00000162 : 354
101 Length : 00000010 : 16
102
103 -DATE------: : (GMT) : (Local)
104 create : 1B442169 : Mon Jun 30 13:23:53 2014 : Mon Jun 30 15:23:53 2014
105 modify : 1B442169 : Mon Jun 30 13:23:53 2014 : Mon Jun 30 15:23:53 2014
106 backup : 80000000 : Unknown or Initial
107 access : 1B442169 : Mon Jun 30 13:23:53 2014 : Mon Jun 30 15:23:53 2014
108
109 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
110 00000000 : 1B 44 21 69 1B 44 21 69 80 00 00 00 1B 44 21 69 : .D!i.D!i.....D!i
111
112 -------------------------------------------------------------------------------
113 Entry ID : 00000009 : Finder Info
114 Offset : 0000007A : 122
115 Length : 00000020 : 32
116
117 -FInfo-----:
118 Type : 42415252 : BARR
119 Creator : 464F4F4F : FOOO
120 isAlias : 0
121 Invisible : 1
122 hasBundle : 0
123 nameLocked : 0
124 Stationery : 0
125 CustomIcon : 0
126 Reserved : 0
127 Inited : 0
128 NoINITS : 0
129 Shared : 0
130 SwitchLaunc: 0
131 Hidden Ext : 0
132 color : 000 : none
133 isOnDesk : 0
134 Location v : 0000 : 0
135 Location h : 0000 : 0
136 Fldr : 0000 : ..
137
138 -FXInfo----:
139 Rsvd|IconID: 0000 : 0
140 Rsvd : 0000 : ..
141 Rsvd : 0000 : ..
142 Rsvd : 0000 : ..
143 AreInvalid : 0
144 unknown bit: 0
145 unknown bit: 0
146 unknown bit: 0
147 unknown bit: 0
148 unknown bit: 0
149 unknown bit: 0
150 CustomBadge: 0
151 ObjctIsBusy: 0
152 unknown bit: 0
153 unknown bit: 0
154 unknown bit: 0
155 unknown bit: 0
156 RoutingInfo: 0
157 unknown bit: 0
158 unknown bit: 0
159 Rsvd|commnt: 0000 : 0
160 PutAway : 00000000 : 0
161
162 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
163 00000000 : 42 41 52 52 46 4F 4F 4F 40 00 00 00 00 00 00 00 : BARRFOOO@.......
164 00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
165
166 -------------------------------------------------------------------------------
167 Entry ID : 0000000E : AFP File Info
168 Offset : 00000172 : 370
169 Length : 00000004 : 4
170
171 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
172 00000000 : 00 00 01 A1 : ....
173 */
174
175 static const char metadata_xattr[] = {
176 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
179 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
180 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
181 0x00, 0x08, 0x00, 0x00, 0x01, 0x62, 0x00, 0x00,
182 0x00, 0x10, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
183 0x00, 0x7a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
184 0x00, 0x0e, 0x00, 0x00, 0x01, 0x72, 0x00, 0x00,
185 0x00, 0x04, 0x80, 0x44, 0x45, 0x56, 0x00, 0x00,
186 0x01, 0x76, 0x00, 0x00, 0x00, 0x08, 0x80, 0x49,
187 0x4e, 0x4f, 0x00, 0x00, 0x01, 0x7e, 0x00, 0x00,
188 0x00, 0x08, 0x80, 0x53, 0x59, 0x4e, 0x00, 0x00,
189 0x01, 0x86, 0x00, 0x00, 0x00, 0x08, 0x80, 0x53,
190 0x56, 0x7e, 0x00, 0x00, 0x01, 0x8e, 0x00, 0x00,
191 0x00, 0x04, 0x42, 0x41, 0x52, 0x52, 0x46, 0x4f,
192 0x4f, 0x4f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
193 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
195 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
197 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
198 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
199 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
200 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
205 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
220 0x00, 0x00, 0x1b, 0x44, 0x21, 0x69, 0x1b, 0x44,
221 0x21, 0x69, 0x80, 0x00, 0x00, 0x00, 0x1b, 0x44,
222 0x21, 0x69, 0x00, 0x00, 0x01, 0xa1, 0x00, 0xfd,
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x20,
224 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0xe3,
225 0x86, 0x53, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x01,
226 0x00, 0x00
227 };
228
229 /*
230 The buf below contains the following AppleDouble encoded data:
231
232 -------------------------------------------------------------------------------
233 MagicNumber: 00051607 : AppleDouble
234 Version : 00020000 : Version 2
235 Filler : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
236 Num. of ent: 0002 : 2
237
238 -------------------------------------------------------------------------------
239 Entry ID : 00000009 : Finder Info
240 Offset : 00000032 : 50
241 Length : 00000EB0 : 3760
242
243 -FInfo-----:
244 Type : 54455354 : TEST
245 Creator : 534C4F57 : SLOW
246 isAlias : 0
247 Invisible : 0
248 hasBundle : 0
249 nameLocked : 0
250 Stationery : 0
251 CustomIcon : 0
252 Reserved : 0
253 Inited : 0
254 NoINITS : 0
255 Shared : 0
256 SwitchLaunc: 0
257 Hidden Ext : 0
258 color : 100 : blue
259 isOnDesk : 0
260 Location v : 0000 : 0
261 Location h : 0000 : 0
262 Fldr : 0000 : ..
263
264 -FXInfo----:
265 Rsvd|IconID: 0000 : 0
266 Rsvd : 0000 : ..
267 Rsvd : 0000 : ..
268 Rsvd : 0000 : ..
269 AreInvalid : 0
270 unknown bit: 0
271 unknown bit: 0
272 unknown bit: 0
273 unknown bit: 0
274 unknown bit: 0
275 unknown bit: 0
276 CustomBadge: 0
277 ObjctIsBusy: 0
278 unknown bit: 0
279 unknown bit: 0
280 unknown bit: 0
281 unknown bit: 0
282 RoutingInfo: 0
283 unknown bit: 0
284 unknown bit: 0
285 Rsvd|commnt: 0000 : 0
286 PutAway : 00000000 : 0
287
288 -EA--------:
289 pad : 0000 : ..
290 magic : 41545452 : ATTR
291 debug_tag : 53D4580C : 1406425100
292 total_size : 00000EE2 : 3810
293 data_start : 000000BC : 188
294 data_length: 0000005E : 94
295 reserved[0]: 00000000 : ....
296 reserved[1]: 00000000 : ....
297 reserved[2]: 00000000 : ....
298 flags : 0000 : ..
299 num_attrs : 0002 : 2
300 -EA ENTRY--:
301 offset : 000000BC : 188
302 length : 0000005B : 91
303 flags : 0000 : ..
304 namelen : 24 : 36
305 -EA NAME---: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
306 00000000 : 63 6F 6D 2E 61 70 70 6C 65 2E 6D 65 74 61 64 61 : com.apple.metada
307 00000010 : 74 61 3A 5F 6B 4D 44 49 74 65 6D 55 73 65 72 54 : ta:_kMDItemUserT
308 00000020 : 61 67 73 00 : ags.
309 -EA VALUE--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
310 00000000 : 62 70 6C 69 73 74 30 30 A5 01 02 03 04 05 54 74 : bplist00......Tt
311 00000010 : 65 73 74 66 00 47 00 72 00 FC 00 6E 00 0A 00 32 : estf.G.r...n...2
312 00000020 : 56 4C 69 6C 61 0A 33 56 47 65 6C 62 0A 35 56 42 : VLila.3VGelb.5VB
313 00000030 : 6C 61 75 0A 34 08 0E 13 20 27 2E 00 00 00 00 00 : lau.4... '......
314 00000040 : 00 01 01 00 00 00 00 00 00 00 06 00 00 00 00 00 : ................
315 00000050 : 00 00 00 00 00 00 00 00 00 00 35 : ..........5
316 -EA ENTRY--:
317 offset : 00000117 : 279
318 length : 00000003 : 3
319 flags : 0000 : ..
320 namelen : 08 : 8
321 -EA NAME---: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
322 00000000 : 66 6F 6F 3A 62 61 72 00 : foo:bar.
323 -EA VALUE--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
324 00000000 : 62 61 7A : baz
325
326 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
327 00000000 : 54 45 53 54 53 4C 4F 57 00 08 00 00 00 00 00 00 : TESTSLOW........
328 00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
329 00000020 : 00 00 41 54 54 52 53 D4 58 0C 00 00 0E E2 00 00 : ..ATTRS.X.......
330 00000030 : 00 BC 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 : .....^..........
331 00000040 : 00 00 00 00 00 02 00 00 00 BC 00 00 00 5B 00 00 : .............[..
332 00000050 : 24 63 6F 6D 2E 61 70 70 6C 65 2E 6D 65 74 61 64 : $com.apple.metad
333 00000060 : 61 74 61 3A 5F 6B 4D 44 49 74 65 6D 55 73 65 72 : ata:_kMDItemUser
334 00000070 : 54 61 67 73 00 00 00 00 01 17 00 00 00 03 00 00 : Tags............
335 00000080 : 08 66 6F 6F 3A 62 61 72 00 66 62 70 6C 69 73 74 : .foo:bar.fbplist
336 00000090 : 30 30 A5 01 02 03 04 05 54 74 65 73 74 66 00 47 : 00......Ttestf.G
337 000000A0 : 00 72 00 FC 00 6E 00 0A 00 32 56 4C 69 6C 61 0A : .r...n...2VLila.
338 000000B0 : 33 56 47 65 6C 62 0A 35 56 42 6C 61 75 0A 34 08 : 3VGelb.5VBlau.4.
339 000000C0 : 0E 13 20 27 2E 00 00 00 00 00 00 01 01 00 00 00 : .. '............
340 000000D0 : 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 : ................
341 000000E0 : 00 00 00 00 35 62 61 7A 00 00 00 00 00 00 00 00 : ....5baz........
342 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
343 ... all zeroes ...
344 00000EA0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
345
346 -------------------------------------------------------------------------------
347 Entry ID : 00000002 : Resource Fork
348 Offset : 00000EE2 : 3810
349 Length : 0000011E : 286
350
351 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
352 00000000 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
353 00000010 : 54 68 69 73 20 72 65 73 6F 75 72 63 65 20 66 6F : This resource fo
354 00000020 : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
355 00000030 : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 : left blank ..
356 00000040 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
357 00000050 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
358 00000060 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
359 00000070 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
360 00000080 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
361 00000090 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
362 000000A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
363 000000B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
364 000000C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
365 000000D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
366 000000E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
367 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
368 00000100 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
369 00000110 : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF : ..............
370
371 It was created with:
372 $ hexdump -ve '"\t" 7/1 "0x%02x, " 1/1 " 0x%02x," "\n"'
373 */
374 static char osx_adouble_w_xattr[] = {
375 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
376 0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
377 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
378 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
379 0x00, 0x32, 0x00, 0x00, 0x0e, 0xb0, 0x00, 0x00,
380 0x00, 0x02, 0x00, 0x00, 0x0e, 0xe2, 0x00, 0x00,
381 0x01, 0x1e, 0x54, 0x45, 0x53, 0x54, 0x53, 0x4c,
382 0x4f, 0x57, 0x00, 0x08, 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, 0x41, 0x54, 0x54, 0x52,
386 0x53, 0xd4, 0x58, 0x0c, 0x00, 0x00, 0x0e, 0xe2,
387 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x5e,
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
390 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x5b,
391 0x00, 0x00, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x61,
392 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x6d, 0x65, 0x74,
393 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x5f, 0x6b,
394 0x4d, 0x44, 0x49, 0x74, 0x65, 0x6d, 0x55, 0x73,
395 0x65, 0x72, 0x54, 0x61, 0x67, 0x73, 0x00, 0x00,
396 0x00, 0x00, 0x01, 0x17, 0x00, 0x00, 0x00, 0x03,
397 0x00, 0x00, 0x08, 0x66, 0x6f, 0x6f, 0x3a, 0x62,
398 0x61, 0x72, 0x00, 0x66, 0x62, 0x70, 0x6c, 0x69,
399 0x73, 0x74, 0x30, 0x30, 0xa5, 0x01, 0x02, 0x03,
400 0x04, 0x05, 0x54, 0x74, 0x65, 0x73, 0x74, 0x66,
401 0x00, 0x47, 0x00, 0x72, 0x00, 0xfc, 0x00, 0x6e,
402 0x00, 0x0a, 0x00, 0x32, 0x56, 0x4c, 0x69, 0x6c,
403 0x61, 0x0a, 0x33, 0x56, 0x47, 0x65, 0x6c, 0x62,
404 0x0a, 0x35, 0x56, 0x42, 0x6c, 0x61, 0x75, 0x0a,
405 0x34, 0x08, 0x0e, 0x13, 0x20, 0x27, 0x2e, 0x00,
406 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x62,
410 0x61, 0x7a, 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, 0x00, 0x00, 0x00, 0x00,
718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
721 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
723 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
724 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x00, 0x00, 0x00, 0x00,
750 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
751 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
752 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
753 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
754 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
755 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
756 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
757 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
758 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
759 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
760 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
761 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
762 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
763 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
764 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
765 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
766 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
767 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
768 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
769 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
770 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
771 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
772 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
773 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
774 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
775 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
776 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
777 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
778 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
779 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
780 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
781 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
782 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
783 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
784 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
785 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
786 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
787 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
788 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
789 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
790 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
791 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
792 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
793 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
794 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
795 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
796 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
797 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
798 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
799 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
800 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
801 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
802 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
803 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
804 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
805 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
806 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
807 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
808 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
809 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
810 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
811 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
812 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
813 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
814 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
815 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
816 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
817 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
818 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
819 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
820 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
821 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
822 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
823 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
824 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
825 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
826 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
827 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
828 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
829 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
830 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
831 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
832 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
833 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
834 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
835 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
836 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
837 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
838 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
839 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
840 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
841 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
842 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
843 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
844 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
845 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
848 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
849 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
850 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
851 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
852 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
853 0x00, 0x1e, 0x54, 0x68, 0x69, 0x73, 0x20, 0x72,
854 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20,
855 0x66, 0x6f, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
856 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
857 0x6c, 0x79, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20,
858 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x20, 0x20,
859 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
860 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
861 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
862 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
863 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
864 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
865 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
866 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
867 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
868 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
869 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
870 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
871 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
872 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
873 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
874 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
875 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
876 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
877 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
878 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
879 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
880 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
881 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
882 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
883 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
884 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
885 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
886 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0xff, 0xff
887 };
888
889 /*
890 * The buf below contains the following AppleDouble encoded data:
891 *
892 * -------------------------------------------------------------------------------
893 * MagicNumber: 00051607 : AppleDouble
894 * Version : 00020000 : Version 2
895 * Filler : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
896 * Num. of ent: 0002 : 2
897 *
898 * -------------------------------------------------------------------------------
899 * Entry ID : 00000002 : Resource Fork
900 * Offset : 00000052 : 82
901 * Length : 0000011E : 286
902 *
903 * -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
904 * 00000000 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
905 * 00000010 : F0 F1 F2 F3 F5 F5 F6 F7 F8 F9 FA FB FC FD FE FF : ................
906 * 00000020 : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
907 * 00000030 : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 : left blank ..
908 * 00000040 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
909 * 00000050 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
910 * 00000060 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
911 * 00000070 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
912 * 00000080 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
913 * 00000090 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
914 * 000000A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
915 * 000000B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
916 * 000000C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
917 * 000000D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
918 * 000000E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
919 * 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
920 * 00000100 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
921 * 00000110 : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF : ..............
922 *
923 * Entry ID : 00000009 : Finder Info
924 * Offset : 00000032 : 50
925 * Length : 00000020 : 32
926 *
927 * -NOTE------: cannot detect whether FInfo or DInfo. assume FInfo.
928 *
929 * -FInfo-----:
930 * Type : 57415645 : WAVE
931 * Creator : 5054756C : PTul
932 * isAlias : 0
933 * Invisible : 0
934 * hasBundle : 0
935 * nameLocked : 0
936 * Stationery : 0
937 * CustomIcon : 0
938 * Reserved : 0
939 * Inited : 0
940 * NoINITS : 0
941 * Shared : 0
942 * SwitchLaunc: 0
943 * Hidden Ext : 0
944 * color : 000 : none
945 * isOnDesk : 0
946 * Location v : 0000 : 0
947 * Location h : 0000 : 0
948 * Fldr : 0000 : ..
949 *
950 * -FXInfo----:
951 * Rsvd|IconID: 0000 : 0
952 * Rsvd : 0000 : ..
953 * Rsvd : 0000 : ..
954 * Rsvd : 0000 : ..
955 * AreInvalid : 0
956 * unknown bit: 0
957 * unknown bit: 0
958 * unknown bit: 0
959 * unknown bit: 0
960 * unknown bit: 0
961 * unknown bit: 0
962 * CustomBadge: 0
963 * ObjctIsBusy: 0
964 * unknown bit: 0
965 * unknown bit: 0
966 * unknown bit: 0
967 * unknown bit: 0
968 * RoutingInfo: 0
969 * unknown bit: 0
970 * unknown bit: 0
971 * Rsvd|commnt: 0000 : 0
972 * PutAway : 00000000 : 0
973 *
974 * -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
975 * 00000000 : 57 41 56 45 50 54 75 6C 00 00 00 00 00 00 00 00 : WAVEPTul........
976 * 00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
977 * *
978 * It was created with:
979 * $ hexdump -ve '"\t" 7/1 "0x%02x, " 1/1 " 0x%02x," "\n"'
980 */
981 static char osx_adouble_without_xattr[] = {
982 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
983 0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
984 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
985 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
986 0x00, 0x52, 0x00, 0x00, 0x01, 0x1e, 0x00, 0x00,
987 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
988 0x00, 0x20, 0x57, 0x41, 0x56, 0x45, 0x50, 0x54,
989 0x75, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
990 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
991 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
992 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
993 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
994 0x00, 0x1e, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5,
995 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd,
996 0xfe, 0xff, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
997 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
998 0x6c, 0x79, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20,
999 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x20, 0x20,
1000 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1001 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1002 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1003 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1004 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1005 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1006 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1007 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1008 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1009 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1010 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1012 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1013 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1014 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1015 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1016 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1017 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1018 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1019 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1020 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1021 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1022 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1023 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1024 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1025 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1026 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1027 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0xff, 0xff
1028 };
1029
1030 /*
1031 The buf below contains the following AppleDouble encoded data:
1032
1033 -------------------------------------------------------------------------------
1034 MagicNumber: 00051607 : AppleDouble
1035 Version : 00020000 : Version 2
1036 Filler : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
1037 Num. of ent: 0002 : 2
1038
1039 -------------------------------------------------------------------------------
1040 Entry ID : 00000009 : Finder Info
1041 Offset : 00000032 : 50
1042 Length : 00000EB0 : 3760
1043
1044 -FInfo-----:
1045 Type : 54455354 : TEST
1046 Creator : 534C4F57 : SLOW
1047 isAlias : 0
1048 Invisible : 0
1049 hasBundle : 0
1050 nameLocked : 0
1051 Stationery : 0
1052 CustomIcon : 0
1053 Reserved : 0
1054 Inited : 0
1055 NoINITS : 0
1056 Shared : 0
1057 SwitchLaunc: 0
1058 Hidden Ext : 0
1059 color : 100 : blue
1060 isOnDesk : 0
1061 Location v : 0000 : 0
1062 Location h : 0000 : 0
1063 Fldr : 0000 : ..
1064
1065 -FXInfo----:
1066 Rsvd|IconID: 0000 : 0
1067 Rsvd : 0000 : ..
1068 Rsvd : 0000 : ..
1069 Rsvd : 0000 : ..
1070 AreInvalid : 0
1071 unknown bit: 0
1072 unknown bit: 0
1073 unknown bit: 0
1074 unknown bit: 0
1075 unknown bit: 0
1076 unknown bit: 0
1077 CustomBadge: 0
1078 ObjctIsBusy: 0
1079 unknown bit: 0
1080 unknown bit: 0
1081 unknown bit: 0
1082 unknown bit: 0
1083 RoutingInfo: 0
1084 unknown bit: 0
1085 unknown bit: 0
1086 Rsvd|commnt: 0000 : 0
1087 PutAway : 00000000 : 0
1088
1089 -EA--------:
1090 pad : 0000 : ..
1091 magic : 41545452 : ATTR
1092 debug_tag : 53D4580C : 1406425100
1093 total_size : 00000EE2 : 3810
1094 data_start : 000000BC : 188
1095 data_length: 0000005E : 94
1096 reserved[0]: 00000000 : ....
1097 reserved[1]: 00000000 : ....
1098 reserved[2]: 00000000 : ....
1099 flags : 0000 : ..
1100 num_attrs : 0002 : 2
1101 -EA ENTRY--:
1102 offset : 000000BC : 188
1103 length : 0000005B : 91
1104 flags : 0000 : ..
1105 namelen : 24 : 36
1106 -EA NAME---: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
1107 00000000 : 63 6F 6D 2E 61 70 70 6C 65 2E 6D 65 74 61 64 61 : com.apple.metada
1108 00000010 : 74 61 3A 5F 6B 4D 44 49 74 65 6D 55 73 65 72 54 : ta:_kMDItemUserT
1109 00000020 : 61 67 73 00 : ags.
1110 -EA VALUE--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
1111 00000000 : 62 70 6C 69 73 74 30 30 A5 01 02 03 04 05 54 74 : bplist00......Tt
1112 00000010 : 65 73 74 66 00 47 00 72 00 FC 00 6E 00 0A 00 32 : estf.G.r...n...2
1113 00000020 : 56 4C 69 6C 61 0A 33 56 47 65 6C 62 0A 35 56 42 : VLila.3VGelb.5VB
1114 00000030 : 6C 61 75 0A 34 08 0E 13 20 27 2E 00 00 00 00 00 : lau.4... '......
1115 00000040 : 00 01 01 00 00 00 00 00 00 00 06 00 00 00 00 00 : ................
1116 00000050 : 00 00 00 00 00 00 00 00 00 00 35 : ..........5
1117 -EA ENTRY--:
1118 offset : 00000117 : 279
1119 length : 00000003 : 3
1120 flags : 0000 : ..
1121 namelen : 08 : 8
1122 -EA NAME---: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
1123 00000000 : 66 6F 6F 3A 62 61 72 00 : foo:bar.
1124 -EA VALUE--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
1125 00000000 : 62 61 7A : baz
1126
1127 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
1128 00000000 : 54 45 53 54 53 4C 4F 57 00 08 00 00 00 00 00 00 : TESTSLOW........
1129 00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1130 00000020 : 00 00 41 54 54 52 53 D4 58 0C 00 00 0E E2 00 00 : ..ATTRS.X.......
1131 00000030 : 00 BC 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 : .....^..........
1132 00000040 : 00 00 00 00 00 02 00 00 00 BC 00 00 00 5B 00 00 : .............[..
1133 00000050 : 24 63 6F 6D 2E 61 70 70 6C 65 2E 6D 65 74 61 64 : $com.apple.metad
1134 00000060 : 61 74 61 3A 5F 6B 4D 44 49 74 65 6D 55 73 65 72 : ata:_kMDItemUser
1135 00000070 : 54 61 67 73 00 00 00 00 01 17 00 00 00 03 00 00 : Tags............
1136 00000080 : 08 66 6F 6F 3A 62 61 72 00 66 62 70 6C 69 73 74 : .foo:bar.fbplist
1137 00000090 : 30 30 A5 01 02 03 04 05 54 74 65 73 74 66 00 47 : 00......Ttestf.G
1138 000000A0 : 00 72 00 FC 00 6E 00 0A 00 32 56 4C 69 6C 61 0A : .r...n...2VLila.
1139 000000B0 : 33 56 47 65 6C 62 0A 35 56 42 6C 61 75 0A 34 08 : 3VGelb.5VBlau.4.
1140 000000C0 : 0E 13 20 27 2E 00 00 00 00 00 00 01 01 00 00 00 : .. '............
1141 000000D0 : 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 : ................
1142 000000E0 : 00 00 00 00 35 62 61 7A 00 00 00 00 00 00 00 00 : ....5baz........
1143 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1144 ... all zeroes ...
1145 00000EA0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1146
1147 -------------------------------------------------------------------------------
1148 Entry ID : 00000002 : Resource Fork
1149 Offset : 00000EE2 : 3810
1150 Length : 0000011E : 286
1151
1152 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
1153 00000000 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
1154 00000010 : F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF : This resource fo
1155 00000020 : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
1156 00000030 : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 : left blank ..
1157 00000040 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1158 00000050 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1159 00000060 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1160 00000070 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1161 00000080 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1162 00000090 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1163 000000A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1164 000000B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1165 000000C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1166 000000D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1167 000000E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1168 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
1169 00000100 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
1170 00000110 : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF : ..............
1171
1172 It was created with:
1173 $ hexdump -ve '"\t" 7/1 "0x%02x, " 1/1 " 0x%02x," "\n"'
1174 */
1175 static char osx_adouble_non_empty_rfork_w_xattr[] = {
1176 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
1177 0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
1178 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1179 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
1180 0x00, 0x32, 0x00, 0x00, 0x0e, 0xb0, 0x00, 0x00,
1181 0x00, 0x02, 0x00, 0x00, 0x0e, 0xe2, 0x00, 0x00,
1182 0x01, 0x1e, 0x54, 0x45, 0x53, 0x54, 0x53, 0x4c,
1183 0x4f, 0x57, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
1184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1186 0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52,
1187 0x53, 0xd4, 0x58, 0x0c, 0x00, 0x00, 0x0e, 0xe2,
1188 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x5e,
1189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1191 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x5b,
1192 0x00, 0x00, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x61,
1193 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x6d, 0x65, 0x74,
1194 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x5f, 0x6b,
1195 0x4d, 0x44, 0x49, 0x74, 0x65, 0x6d, 0x55, 0x73,
1196 0x65, 0x72, 0x54, 0x61, 0x67, 0x73, 0x00, 0x00,
1197 0x00, 0x00, 0x01, 0x17, 0x00, 0x00, 0x00, 0x03,
1198 0x00, 0x00, 0x08, 0x66, 0x6f, 0x6f, 0x3a, 0x62,
1199 0x61, 0x72, 0x00, 0x66, 0x62, 0x70, 0x6c, 0x69,
1200 0x73, 0x74, 0x30, 0x30, 0xa5, 0x01, 0x02, 0x03,
1201 0x04, 0x05, 0x54, 0x74, 0x65, 0x73, 0x74, 0x66,
1202 0x00, 0x47, 0x00, 0x72, 0x00, 0xfc, 0x00, 0x6e,
1203 0x00, 0x0a, 0x00, 0x32, 0x56, 0x4c, 0x69, 0x6c,
1204 0x61, 0x0a, 0x33, 0x56, 0x47, 0x65, 0x6c, 0x62,
1205 0x0a, 0x35, 0x56, 0x42, 0x6c, 0x61, 0x75, 0x0a,
1206 0x34, 0x08, 0x0e, 0x13, 0x20, 0x27, 0x2e, 0x00,
1207 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
1208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
1209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x62,
1211 0x61, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1227 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1235 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1238 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1240 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1244 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1247 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1252 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1253 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1255 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1259 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1261 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1275 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1282 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1295 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1305 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1307 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1308 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1309 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1316 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1317 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1354 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1355 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1359 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1380 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1404 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1406 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1413 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1417 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1418 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1422 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1427 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1429 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1433 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1435 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1436 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1438 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1439 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1440 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1443 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1444 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1447 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1466 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1467 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1468 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1469 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1470 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1471 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1472 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1473 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1475 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1476 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1477 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1483 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1484 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1485 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1486 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1487 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1489 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1490 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1491 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1492 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1500 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1501 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1504 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1507 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1510 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1516 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1517 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1519 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1521 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1522 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1523 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1524 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1525 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1527 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1532 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1533 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1535 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1537 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1543 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1544 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1545 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1548 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1549 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1550 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1551 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1552 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1553 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1557 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1558 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1559 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1560 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1561 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1562 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1563 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1564 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1567 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1568 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1569 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1570 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1571 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1572 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1573 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1574 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1575 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1576 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1578 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1579 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1580 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1581 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1582 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1583 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1585 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1587 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1593 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1596 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1597 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1598 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1599 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1600 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1601 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1602 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1603 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1604 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1605 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1606 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1607 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1608 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1609 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1613 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1614 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1615 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1616 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1619 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1620 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1621 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1622 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1623 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1624 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1625 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1626 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1628 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1629 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1630 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1631 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1632 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1633 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1634 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1635 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1636 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1637 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1642 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1644 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1646 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1651 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1652 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1653 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1654 0x00, 0x1e, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5,
1655 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd,
1656 0xfe, 0xff, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
1657 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
1658 0x6c, 0x79, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20,
1659 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x20, 0x20,
1660 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1662 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1663 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1664 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1665 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1666 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1669 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1670 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1671 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1672 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1673 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1674 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1675 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1676 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1677 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1678 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1679 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1680 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1681 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1682 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1683 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1684 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1685 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1686 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1687 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0xff, 0xff
1688 };
1689
1690 /**
1691 * talloc and intialize an AfpInfo
1692 **/
1693 static AfpInfo *torture_afpinfo_new(TALLOC_CTX *mem_ctx)
1694 {
1695 AfpInfo *info;
1696
1697 info = talloc_zero(mem_ctx, AfpInfo);
1698 if (info == NULL) {
1699 return NULL;
1700 }
1701
1702 info->afpi_Signature = AFP_Signature;
1703 info->afpi_Version = AFP_Version;
1704 info->afpi_BackupTime = AFP_BackupTime;
1705
1706 return info;
1707 }
1708
1709 /**
1710 * Pack AfpInfo into a talloced buffer
1711 **/
1712 static char *torture_afpinfo_pack(TALLOC_CTX *mem_ctx,
1713 AfpInfo *info)
1714 {
1715 char *buf;
1716
1717 buf = talloc_zero_array(mem_ctx, char, AFP_INFO_SIZE);
1718 if (buf == NULL) {
1719 return NULL;
1720 }
1721
1722 RSIVAL(buf, 0, info->afpi_Signature);
1723 RSIVAL(buf, 4, info->afpi_Version);
1724 RSIVAL(buf, 12, info->afpi_BackupTime);
1725 memcpy(buf + 16, info->afpi_FinderInfo, sizeof(info->afpi_FinderInfo));
1726
1727 return buf;
1728 }
1729
1730 /**
1731 * Unpack AfpInfo
1732 **/
1733 #if 0
1734 static void torture_afpinfo_unpack(AfpInfo *info, char *data)
1735 {
1736 info->afpi_Signature = RIVAL(data, 0);
1737 info->afpi_Version = RIVAL(data, 4);
1738 info->afpi_BackupTime = RIVAL(data, 12);
1739 memcpy(info->afpi_FinderInfo, (const char *)data + 16,
1740 sizeof(info->afpi_FinderInfo));
1741 }
1742 #endif
1743
1744 static bool torture_write_afpinfo(struct smb2_tree *tree,
1745 struct torture_context *tctx,
1746 TALLOC_CTX *mem_ctx,
1747 const char *fname,
1748 AfpInfo *info)
1749 {
1750 struct smb2_handle handle;
1751 struct smb2_create io;
1752 NTSTATUS status;
1753 const char *full_name;
1754 char *infobuf;
1755 bool ret = true;
1756
1757 full_name = talloc_asprintf(mem_ctx, "%s%s", fname, AFPINFO_STREAM_NAME);
1758 if (full_name == NULL) {
1759 torture_comment(tctx, "talloc_asprintf error\n");
1760 return false;
1761 }
1762 ZERO_STRUCT(io);
1763 io.in.desired_access = SEC_FILE_WRITE_DATA;
1764 io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
1765 io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
1766 io.in.create_options = 0;
1767 io.in.fname = full_name;
1768
1769 status = smb2_create(tree, mem_ctx, &io);
1770 CHECK_STATUS(status, NT_STATUS_OK);
1771
1772 handle = io.out.file.handle;
1773
1774 infobuf = torture_afpinfo_pack(mem_ctx, info);
1775 if (infobuf == NULL) {
1776 return false;
1777 }
1778
1779 status = smb2_util_write(tree, handle, infobuf, 0, AFP_INFO_SIZE);
1780 CHECK_STATUS(status, NT_STATUS_OK);
1781
1782 smb2_util_close(tree, handle);
1783
1784 done:
1785 return ret;
1786 }
1787
1788 /**
1789 * Read 'count' bytes at 'offset' from stream 'fname:sname' and
1790 * compare against buffer 'value'
1791 **/
1792 static bool check_stream(struct smb2_tree *tree,
1793 const char *location,
1794 struct torture_context *tctx,
1795 TALLOC_CTX *mem_ctx,
1796 const char *fname,
1797 const char *sname,
1798 off_t read_offset,
1799 size_t read_count,
1800 off_t comp_offset,
1801 size_t comp_count,
1802 const char *value)
1803 {
1804 struct smb2_handle handle;
1805 struct smb2_create create;
1806 struct smb2_read r;
1807 NTSTATUS status;
1808 char *full_name;
1809 bool ret = true;
1810
1811 full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
1812 if (full_name == NULL) {
1813 torture_comment(tctx, "talloc_asprintf error\n");
1814 return false;
1815 }
1816 ZERO_STRUCT(create);
1817 create.in.desired_access = SEC_FILE_READ_DATA;
1818 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
1819 create.in.create_disposition = NTCREATEX_DISP_OPEN;
1820 create.in.fname = full_name;
1821
1822 torture_comment(tctx, "Open stream %s\n", full_name);
1823
1824 status = smb2_create(tree, mem_ctx, &create);
1825 if (!NT_STATUS_IS_OK(status)) {
1826 if (value == NULL) {
1827 TALLOC_FREE(full_name);
1828 return true;
1829 }
1830 torture_comment(tctx, "Unable to open stream %s: %s\n",
1831 full_name, nt_errstr(status));
1832 TALLOC_FREE(full_name);
1833 return false;
1834 }
1835
1836 handle = create.out.file.handle;
1837 if (value == NULL) {
1838 TALLOC_FREE(full_name);
1839 smb2_util_close(tree, handle);
1840 return true;
1841 }
1842
1843 ZERO_STRUCT(r);
1844 r.in.file.handle = handle;
1845 r.in.length = read_count;
1846 r.in.offset = read_offset;
1847
1848 status = smb2_read(tree, tree, &r);
1849
1850 torture_assert_ntstatus_ok_goto(
1851 tctx, status, ret, done,
1852 talloc_asprintf(tctx, "(%s) Failed to read %lu bytes from stream '%s'\n",
1853 location, (long)strlen(value), full_name));
1854
1855 torture_assert_goto(tctx, r.out.data.length == read_count, ret, done,
1856 talloc_asprintf(tctx, "smb2_read returned %jd bytes, expected %jd\n",
1857 (intmax_t)r.out.data.length, (intmax_t)read_count));
1858
1859 torture_assert_goto(
1860 tctx, memcmp(r.out.data.data + comp_offset, value, comp_count) == 0,
1861 ret, done,
1862 talloc_asprintf(tctx, "(%s) Bad data in stream\n", location));
1863
1864 done:
1865 TALLOC_FREE(full_name);
1866 smb2_util_close(tree, handle);
1867 return ret;
1868 }
1869
1870 /**
1871 * Read 'count' bytes at 'offset' from stream 'fname:sname' and
1872 * compare against buffer 'value'
1873 **/
1874 static ssize_t read_stream(struct smb2_tree *tree,
1875 const char *location,
1876 struct torture_context *tctx,
1877 TALLOC_CTX *mem_ctx,
1878 const char *fname,
1879 const char *sname,
1880 off_t read_offset,
1881 size_t read_count)
1882 {
1883 struct smb2_handle handle;
1884 struct smb2_create create;
1885 struct smb2_read r;
1886 NTSTATUS status;
1887 const char *full_name;
1888 bool ret = true;
1889
1890 full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
1891 if (full_name == NULL) {
1892 torture_comment(tctx, "talloc_asprintf error\n");
1893 return -1;
1894 }
1895 ZERO_STRUCT(create);
1896 create.in.desired_access = SEC_FILE_READ_DATA;
1897 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
1898 create.in.create_disposition = NTCREATEX_DISP_OPEN;
1899 create.in.fname = full_name;
1900
1901 torture_comment(tctx, "Open stream %s\n", full_name);
1902
1903 status = smb2_create(tree, mem_ctx, &create);
1904 if (!NT_STATUS_IS_OK(status)) {
1905 torture_comment(tctx, "Unable to open stream %s: %s\n",
1906 full_name, nt_errstr(status));
1907 return -1;
1908 }
1909
1910 handle = create.out.file.handle;
1911
1912 ZERO_STRUCT(r);
1913 r.in.file.handle = handle;
1914 r.in.length = read_count;
1915 r.in.offset = read_offset;
1916
1917 status = smb2_read(tree, tree, &r);
1918 if (!NT_STATUS_IS_OK(status)) {
1919 CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
1920 }
1921
1922 smb2_util_close(tree, handle);
1923
1924 done:
1925 if (ret == false) {
1926 return -1;
1927 }
1928 return r.out.data.length;
1929 }
1930
1931 /**
1932 * Read 'count' bytes at 'offset' from stream 'fname:sname' and
1933 * compare against buffer 'value'
1934 **/
1935 static bool write_stream(struct smb2_tree *tree,
1936 const char *location,
1937 struct torture_context *tctx,
1938 TALLOC_CTX *mem_ctx,
1939 const char *fname,
1940 const char *sname,
1941 off_t offset,
1942 size_t size,
1943 const char *value)
1944 {
1945 struct smb2_handle handle;
1946 struct smb2_create create;
1947 NTSTATUS status;
1948 const char *full_name;
1949
1950 full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname ? sname : "");
1951 if (full_name == NULL) {
1952 torture_comment(tctx, "talloc_asprintf error\n");
1953 return false;
1954 }
1955 ZERO_STRUCT(create);
1956 create.in.desired_access = SEC_FILE_WRITE_DATA;
1957 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
1958 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
1959 create.in.fname = full_name;
1960
1961 status = smb2_create(tree, mem_ctx, &create);
1962 if (!NT_STATUS_IS_OK(status)) {
1963 if (value == NULL) {
1964 return true;
1965 } else {
1966 torture_comment(tctx, "Unable to open stream %s: %s\n",
1967 full_name, nt_errstr(status));
1968 return false;
1969 }
1970 }
1971
1972 handle = create.out.file.handle;
1973 if (value == NULL) {
1974 return true;
1975 }
1976
1977 status = smb2_util_write(tree, handle, value, offset, size);
1978
1979 if (!NT_STATUS_IS_OK(status)) {
1980 torture_comment(tctx, "(%s) Failed to write %lu bytes to "
1981 "stream '%s'\n", location, (long)size, full_name);
1982 return false;
1983 }
1984
1985 smb2_util_close(tree, handle);
1986 return true;
1987 }
1988
1989 static bool torture_setup_local_xattr(struct torture_context *tctx,
1990 const char *path_option,
1991 const char *name,
1992 const char *xattr,
1993 const char *metadata,
1994 size_t size)
1995 {
1996 int ret = true;
1997 int result;
1998 const char *spath;
1999 char *path;
2000
2001 spath = torture_setting_string(tctx, path_option, NULL);
2002 if (spath == NULL) {
2003 printf("No sharepath for option %s\n", path_option);
2004 return false;
2005 }
2006
2007 path = talloc_asprintf(tctx, "%s/%s", spath, name);
2008
2009 result = setxattr(path, xattr, metadata, size, 0);
2010 if (result != 0) {
2011 ret = false;
2012 }
2013
2014 TALLOC_FREE(path);
2015
2016 return ret;
2017 }
2018
2019 /**
2020 * Create a file or directory
2021 **/
2022 static bool torture_setup_file(TALLOC_CTX *mem_ctx, struct smb2_tree *tree,
2023 const char *name, bool dir)
2024 {
2025 struct smb2_create io;
2026 NTSTATUS status;
2027
2028 smb2_util_unlink(tree, name);
2029 ZERO_STRUCT(io);
2030 io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
2031 io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2032 io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
2033 io.in.share_access =
2034 NTCREATEX_SHARE_ACCESS_DELETE|
2035 NTCREATEX_SHARE_ACCESS_READ|
2036 NTCREATEX_SHARE_ACCESS_WRITE;
2037 io.in.create_options = 0;
2038 io.in.fname = name;
2039 if (dir) {
2040 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
2041 io.in.share_access &= ~NTCREATEX_SHARE_ACCESS_DELETE;
2042 io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
2043 io.in.create_disposition = NTCREATEX_DISP_CREATE;
2044 }
2045
2046 status = smb2_create(tree, mem_ctx, &io);
2047 if (!NT_STATUS_IS_OK(status)) {
2048 return false;
2049 }
2050
2051 status = smb2_util_close(tree, io.out.file.handle);
2052 if (!NT_STATUS_IS_OK(status)) {
2053 return false;
2054 }
2055
2056 return true;
2057 }
2058
2059 static bool enable_aapl(struct torture_context *tctx,
2060 struct smb2_tree *tree)
2061 {
2062 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2063 NTSTATUS status;
2064 bool ret = true;
2065 struct smb2_create io;
2066 DATA_BLOB data;
2067 struct smb2_create_blob *aapl = NULL;
2068 uint32_t aapl_server_caps;
2069 uint32_t expected_scaps = (SMB2_CRTCTX_AAPL_UNIX_BASED |
2070 SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR |
2071 SMB2_CRTCTX_AAPL_SUPPORTS_NFS_ACE |
2072 SMB2_CRTCTX_AAPL_SUPPORTS_OSX_COPYFILE);
2073 bool is_osx_server = torture_setting_bool(tctx, "osx", false);
2074
2075 ZERO_STRUCT(io);
2076 io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
2077 io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
2078 io.in.create_disposition = NTCREATEX_DISP_OPEN;
2079 io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
2080 NTCREATEX_SHARE_ACCESS_READ |
2081 NTCREATEX_SHARE_ACCESS_WRITE);
2082 io.in.fname = "";
2083
2084 /*
2085 * Issuing an SMB2/CREATE with a suitably formed AAPL context,
2086 * controls behaviour of Apple's SMB2 extensions for the whole
2087 * session!
2088 */
2089
2090 data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
2091 SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
2092 SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS |
2093 SMB2_CRTCTX_AAPL_VOLUME_CAPS |
2094 SMB2_CRTCTX_AAPL_MODEL_INFO));
2095 SBVAL(data.data, 16, (SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR |
2096 SMB2_CRTCTX_AAPL_UNIX_BASED |
2097 SMB2_CRTCTX_AAPL_SUPPORTS_NFS_ACE));
2098
2099 status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
2100 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create_blob_add");
2101
2102 status = smb2_create(tree, tctx, &io);
2103 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
2104
2105 status = smb2_util_close(tree, io.out.file.handle);
2106 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_close");
2107
2108 /*
2109 * Now check returned AAPL context
2110 */
2111 torture_comment(tctx, "Comparing returned AAPL capabilities\n");
2112
2113 aapl = smb2_create_blob_find(&io.out.blobs,
2114 SMB2_CREATE_TAG_AAPL);
2115 torture_assert_goto(tctx, aapl != NULL, ret, done, "missing AAPL context");
2116
2117 if (!is_osx_server) {
2118 size_t expected_aapl_ctx_size;
2119
2120 expected_aapl_ctx_size = strlen("MacSamba") * 2 + 40;
2121
2122 torture_assert_goto(
2123 tctx, aapl->data.length == expected_aapl_ctx_size,
2124 ret, done, "bad AAPL size");
2125 }
2126
2127 aapl_server_caps = BVAL(aapl->data.data, 16);
2128 torture_assert_goto(tctx, aapl_server_caps == expected_scaps,
2129 ret, done, "bad AAPL caps");
2130
2131 done:
2132 talloc_free(mem_ctx);
2133 return ret;
2134 }
2135
2136 static bool test_read_netatalk_metadata(struct torture_context *tctx,
2137 struct smb2_tree *tree)
2138 {
2139 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2140 const char *fname = BASEDIR "\\torture_read_metadata";
2141 NTSTATUS status;
2142 struct smb2_handle testdirh;
2143 bool ret = true;
2144 ssize_t len;
2145 const char *localdir = NULL;
2146
2147 torture_comment(tctx, "Checking metadata access\n");
2148
2149 localdir = torture_setting_string(tctx, "localdir", NULL);
2150 if (localdir == NULL) {
2151 torture_skip(tctx, "Need localdir for test");
2152 }
2153
2154 smb2_util_unlink(tree, fname);
2155
2156 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2157 CHECK_STATUS(status, NT_STATUS_OK);
2158 smb2_util_close(tree, testdirh);
2159
2160 ret = torture_setup_file(mem_ctx, tree, fname, false);
2161 if (ret == false) {
2162 goto done;
2163 }
2164
2165 ret = torture_setup_local_xattr(tctx, "localdir",
2166 BASEDIR "/torture_read_metadata",
2167 AFPINFO_EA_NETATALK,
2168 metadata_xattr, sizeof(metadata_xattr));
2169 if (ret == false) {
2170 goto done;
2171 }
2172
2173 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2174 0, 60, 0, 4, "AFP");
2175 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2176
2177 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2178 0, 60, 16, 8, "BARRFOOO");
2179 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2180
2181 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2182 16, 8, 0, 3, "AFP");
2183 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2184
2185 /* Check reading offset and read size > sizeof(AFPINFO_STREAM) */
2186
2187 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2188 AFPINFO_STREAM, 0, 61);
2189 CHECK_VALUE(len, 60);
2190
2191 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2192 AFPINFO_STREAM, 59, 2);
2193 CHECK_VALUE(len, 2);
2194
2195 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2196 AFPINFO_STREAM, 60, 1);
2197 CHECK_VALUE(len, 1);
2198
2199 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2200 AFPINFO_STREAM, 61, 1);
2201 CHECK_VALUE(len, 0);
2202
2203 done:
2204 smb2_deltree(tree, BASEDIR);
2205 talloc_free(mem_ctx);
2206 return ret;
2207 }
2208
2209 static bool test_read_afpinfo(struct torture_context *tctx,
2210 struct smb2_tree *tree)
2211 {
2212 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2213 const char *fname = BASEDIR "\\torture_read_metadata";
2214 NTSTATUS status;
2215 struct smb2_handle testdirh;
2216 bool ret = true;
2217 ssize_t len;
2218 AfpInfo *info;
2219 const char *type_creator = "SMB,OLE!";
2220
2221 torture_comment(tctx, "Checking metadata access\n");
2222
2223 smb2_util_unlink(tree, fname);
2224
2225 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2226 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir failed");
2227 smb2_util_close(tree, testdirh);
2228
2229 ret = torture_setup_file(mem_ctx, tree, fname, false);
2230 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
2231
2232 info = torture_afpinfo_new(mem_ctx);
2233 torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
2234
2235 memcpy(info->afpi_FinderInfo, type_creator, 8);
2236 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
2237 torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
2238
2239 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2240 0, 60, 0, 4, "AFP");
2241 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2242
2243 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2244 0, 60, 16, 8, type_creator);
2245 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2246
2247 /*
2248 * OS X ignores offset <= 60 and treats the as
2249 * offset=0. Reading from offsets > 60 returns EOF=0.
2250 */
2251
2252 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2253 16, 8, 0, 8, "AFP\0\0\0\001\0");
2254 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2255
2256 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2257 AFPINFO_STREAM, 0, 61);
2258 torture_assert_goto(tctx, len == 60, ret, done, "read_stream failed");
2259
2260 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2261 AFPINFO_STREAM, 59, 2);
2262 torture_assert_goto(tctx, len == 2, ret, done, "read_stream failed");
2263
2264 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2265 59, 2, 0, 2, "AF");
2266 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2267
2268 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2269 AFPINFO_STREAM, 60, 1);
2270 torture_assert_goto(tctx, len == 1, ret, done, "read_stream failed");
2271
2272 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2273 60, 1, 0, 1, "A");
2274 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
2275
2276 len = read_stream(tree, __location__, tctx, mem_ctx, fname,
2277 AFPINFO_STREAM, 61, 1);
2278 torture_assert_goto(tctx, len == 0, ret, done, "read_stream failed");
2279
2280 done:
2281 smb2_util_unlink(tree, fname);
2282 smb2_deltree(tree, BASEDIR);
2283 talloc_free(mem_ctx);
2284 return ret;
2285 }
2286
2287 static bool test_write_atalk_metadata(struct torture_context *tctx,
2288 struct smb2_tree *tree)
2289 {
2290 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2291 const char *fname = BASEDIR "\\torture_write_metadata";
2292 const char *type_creator = "SMB,OLE!";
2293 NTSTATUS status;
2294 struct smb2_handle testdirh;
2295 bool ret = true;
2296 AfpInfo *info;
2297
2298 smb2_deltree(tree, BASEDIR);
2299 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2300 CHECK_STATUS(status, NT_STATUS_OK);
2301 smb2_util_close(tree, testdirh);
2302
2303 ret = torture_setup_file(mem_ctx, tree, fname, false);
2304 if (ret == false) {
2305 goto done;
2306 }
2307
2308 info = torture_afpinfo_new(mem_ctx);
2309 if (info == NULL) {
2310 goto done;
2311 }
2312
2313 memcpy(info->afpi_FinderInfo, type_creator, 8);
2314 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
2315 ret &= check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
2316 0, 60, 16, 8, type_creator);
2317
2318 done:
2319 smb2_util_unlink(tree, fname);
2320 smb2_deltree(tree, BASEDIR);
2321 talloc_free(mem_ctx);
2322 return ret;
2323 }
2324
2325 static bool test_write_atalk_rfork_io(struct torture_context *tctx,
2326 struct smb2_tree *tree)
2327 {
2328 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2329 const char *fname = BASEDIR "\\torture_write_rfork_io";
2330 const char *rfork = BASEDIR "\\torture_write_rfork_io" AFPRESOURCE_STREAM_NAME;
2331 const char *rfork_content = "1234567890";
2332 NTSTATUS status;
2333 struct smb2_handle testdirh;
2334 bool ret = true;
2335
2336 union smb_open io;
2337 struct smb2_handle filehandle;
2338 union smb_fileinfo finfo;
2339 union smb_setfileinfo sinfo;
2340
2341 smb2_util_unlink(tree, fname);
2342
2343 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2344 CHECK_STATUS(status, NT_STATUS_OK);
2345 smb2_util_close(tree, testdirh);
2346
2347 ret = torture_setup_file(mem_ctx, tree, fname, false);
2348 if (ret == false) {
2349 goto done;
2350 }
2351
2352 torture_comment(tctx, "(%s) writing to resource fork\n",
2353 __location__);
2354
2355 ret &= write_stream(tree, __location__, tctx, mem_ctx,
2356 fname, AFPRESOURCE_STREAM_NAME,
2357 10, 10, rfork_content);
2358
2359 ret &= check_stream(tree, __location__, tctx, mem_ctx,
2360 fname, AFPRESOURCE_STREAM_NAME,
2361 0, 20, 10, 10, rfork_content);
2362
2363 /* Check size after write */
2364
2365 ZERO_STRUCT(io);
2366 io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
2367 io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
2368 SEC_FILE_WRITE_ATTRIBUTE;
2369 io.smb2.in.fname = rfork;
2370 status = smb2_create(tree, mem_ctx, &(io.smb2));
2371 CHECK_STATUS(status, NT_STATUS_OK);
2372 filehandle = io.smb2.out.file.handle;
2373
2374 torture_comment(tctx, "(%s) check resource fork size after write\n",
2375 __location__);
2376
2377 ZERO_STRUCT(finfo);
2378 finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
2379 finfo.generic.in.file.handle = filehandle;
2380 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
2381 CHECK_STATUS(status, NT_STATUS_OK);
2382 if (finfo.all_info.out.size != 20) {
2383 torture_result(tctx, TORTURE_FAIL,
2384 "(%s) Incorrect resource fork size\n",
2385 __location__);
2386 ret = false;
2387 smb2_util_close(tree, filehandle);
2388 goto done;
2389 }
2390 smb2_util_close(tree, filehandle);
2391
2392 /* Write at large offset */
2393
2394 torture_comment(tctx, "(%s) writing to resource fork at large offset\n",
2395 __location__);
2396
2397 ret &= write_stream(tree, __location__, tctx, mem_ctx,
2398 fname, AFPRESOURCE_STREAM_NAME,
2399 (off_t)64*1024*1024, 10, rfork_content);
2400
2401 /* Check size after write */
2402
2403 ZERO_STRUCT(io);
2404 io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
2405 io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
2406 SEC_FILE_WRITE_ATTRIBUTE;
2407 io.smb2.in.fname = rfork;
2408 status = smb2_create(tree, mem_ctx, &(io.smb2));
2409 CHECK_STATUS(status, NT_STATUS_OK);
2410 filehandle = io.smb2.out.file.handle;
2411
2412 torture_comment(tctx, "(%s) check resource fork size after write\n",
2413 __location__);
2414
2415 ZERO_STRUCT(finfo);
2416 finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
2417 finfo.generic.in.file.handle = filehandle;
2418 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
2419 CHECK_STATUS(status, NT_STATUS_OK);
2420 if (finfo.all_info.out.size != 64*1024*1024 + 10) {
2421 torture_result(tctx, TORTURE_FAIL,
2422 "(%s) Incorrect resource fork size\n",
2423 __location__);
2424 ret = false;
2425 smb2_util_close(tree, filehandle);
2426 goto done;
2427 }
2428 smb2_util_close(tree, filehandle);
2429
2430 ret &= check_stream(tree, __location__, tctx, mem_ctx,
2431 fname, AFPRESOURCE_STREAM_NAME,
2432 (off_t)64*1024*1024, 10, 0, 10, rfork_content);
2433
2434 /* Truncate back to size of 1 byte */
2435
2436 torture_comment(tctx, "(%s) truncate resource fork and check size\n",
2437 __location__);
2438
2439 ZERO_STRUCT(io);
2440 io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
2441 io.smb2.in.desired_access = SEC_FILE_ALL;
2442 io.smb2.in.fname = rfork;
2443 status = smb2_create(tree, mem_ctx, &(io.smb2));
2444 CHECK_STATUS(status, NT_STATUS_OK);
2445 filehandle = io.smb2.out.file.handle;
2446
2447 ZERO_STRUCT(sinfo);
2448 sinfo.end_of_file_info.level =
2449 RAW_SFILEINFO_END_OF_FILE_INFORMATION;
2450 sinfo.end_of_file_info.in.file.handle = filehandle;
2451 sinfo.end_of_file_info.in.size = 1;
2452 status = smb2_setinfo_file(tree, &sinfo);
2453 CHECK_STATUS(status, NT_STATUS_OK);
2454
2455 smb2_util_close(tree, filehandle);
2456
2457 /* Now check size */
2458 ZERO_STRUCT(io);
2459 io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
2460 io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
2461 SEC_FILE_WRITE_ATTRIBUTE;
2462 io.smb2.in.fname = rfork;
2463 status = smb2_create(tree, mem_ctx, &(io.smb2));
2464 CHECK_STATUS(status, NT_STATUS_OK);
2465 filehandle = io.smb2.out.file.handle;
2466
2467 ZERO_STRUCT(finfo);
2468 finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
2469 finfo.generic.in.file.handle = filehandle;
2470 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
2471 CHECK_STATUS(status, NT_STATUS_OK);
2472 if (finfo.all_info.out.size != 1) {
2473 torture_result(tctx, TORTURE_FAIL,
2474 "(%s) Incorrect resource fork size\n",
2475 __location__);
2476 ret = false;
2477 smb2_util_close(tree, filehandle);
2478 goto done;
2479 }
2480 smb2_util_close(tree, filehandle);
2481
2482 done:
2483 smb2_util_unlink(tree, fname);
2484 smb2_deltree(tree, BASEDIR);
2485 talloc_free(mem_ctx);
2486 return ret;
2487 }
2488
2489 static bool test_rfork_truncate(struct torture_context *tctx,
2490 struct smb2_tree *tree)
2491 {
2492 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2493 const char *fname = BASEDIR "\\torture_rfork_truncate";
2494 const char *rfork = BASEDIR "\\torture_rfork_truncate" AFPRESOURCE_STREAM;
2495 const char *rfork_content = "1234567890";
2496 NTSTATUS status;
2497 struct smb2_handle testdirh;
2498 bool ret = true;
2499 struct smb2_create create;
2500 struct smb2_handle fh1, fh2, fh3;
2501 union smb_setfileinfo sinfo;
2502
2503 ret = enable_aapl(tctx, tree);
2504 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
2505
2506 smb2_util_unlink(tree, fname);
2507
2508 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2509 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
2510 smb2_util_close(tree, testdirh);
2511
2512 ret = torture_setup_file(mem_ctx, tree, fname, false);
2513 if (ret == false) {
2514 goto done;
2515 }
2516
2517 ret &= write_stream(tree, __location__, tctx, mem_ctx,
2518 fname, AFPRESOURCE_STREAM,
2519 10, 10, rfork_content);
2520
2521 /* Truncate back to size 0, further access MUST return ENOENT */
2522
2523 torture_comment(tctx, "(%s) truncate resource fork to size 0\n",
2524 __location__);
2525
2526 ZERO_STRUCT(create);
2527 create.in.create_disposition = NTCREATEX_DISP_OPEN;
2528 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2529 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2530 create.in.fname = fname;
2531 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2532 NTCREATEX_SHARE_ACCESS_READ |
2533 NTCREATEX_SHARE_ACCESS_WRITE;
2534 status = smb2_create(tree, mem_ctx, &create);
2535 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
2536 fh1 = create.out.file.handle;
2537
2538 ZERO_STRUCT(create);
2539 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
2540 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2541 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2542 create.in.fname = rfork;
2543 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2544 NTCREATEX_SHARE_ACCESS_READ |
2545 NTCREATEX_SHARE_ACCESS_WRITE;
2546 status = smb2_create(tree, mem_ctx, &create);
2547 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
2548 fh2 = create.out.file.handle;
2549
2550 ZERO_STRUCT(sinfo);
2551 sinfo.end_of_file_info.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
2552 sinfo.end_of_file_info.in.file.handle = fh2;
2553 sinfo.end_of_file_info.in.size = 0;
2554 status = smb2_setinfo_file(tree, &sinfo);
2555 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_setinfo_file");
2556
2557 /*
2558 * Now check size, we should get OBJECT_NAME_NOT_FOUND (!)
2559 */
2560 ZERO_STRUCT(create);
2561 create.in.create_disposition = NTCREATEX_DISP_OPEN;
2562 create.in.desired_access = SEC_FILE_ALL;
2563 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2564 create.in.fname = rfork;
2565 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2566 NTCREATEX_SHARE_ACCESS_READ |
2567 NTCREATEX_SHARE_ACCESS_WRITE;
2568 status = smb2_create(tree, mem_ctx, &create);
2569 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
2570
2571 /*
2572 * Do another open on the rfork and write to the new handle. A
2573 * naive server might unlink the AppleDouble resource fork
2574 * file when its truncated to 0 bytes above, so in case both
2575 * open handles share the same underlying fd, the unlink would
2576 * cause the below write to be lost.
2577 */
2578 ZERO_STRUCT(create);
2579 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
2580 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2581 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2582 create.in.fname = rfork;
2583 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2584 NTCREATEX_SHARE_ACCESS_READ |
2585 NTCREATEX_SHARE_ACCESS_WRITE;
2586 status = smb2_create(tree, mem_ctx, &create);
2587 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
2588 fh3 = create.out.file.handle;
2589
2590 status = smb2_util_write(tree, fh3, "foo", 0, 3);
2591 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_write");
2592
2593 smb2_util_close(tree, fh3);
2594 smb2_util_close(tree, fh2);
2595 smb2_util_close(tree, fh1);
2596
2597 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM,
2598 0, 3, 0, 3, "foo");
2599 torture_assert_goto(tctx, ret == true, ret, done, "check_stream");
2600
2601 done:
2602 smb2_util_unlink(tree, fname);
2603 smb2_deltree(tree, BASEDIR);
2604 talloc_free(mem_ctx);
2605 return ret;
2606 }
2607
2608 static bool test_rfork_create(struct torture_context *tctx,
2609 struct smb2_tree *tree)
2610 {
2611 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2612 const char *fname = BASEDIR "\\torture_rfork_create";
2613 const char *rfork = BASEDIR "\\torture_rfork_create" AFPRESOURCE_STREAM;
2614 NTSTATUS status;
2615 struct smb2_handle testdirh;
2616 bool ret = true;
2617 struct smb2_create create;
2618 struct smb2_handle fh1;
2619 const char *streams[] = {
2620 "::$DATA"
2621 };
2622 union smb_fileinfo finfo;
2623
2624 ret = enable_aapl(tctx, tree);
2625 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
2626
2627 smb2_util_unlink(tree, fname);
2628
2629 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2630 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
2631 smb2_util_close(tree, testdirh);
2632
2633 ret = torture_setup_file(mem_ctx, tree, fname, false);
2634 if (ret == false) {
2635 goto done;
2636 }
2637
2638 torture_comment(tctx, "(%s) open rfork, should return ENOENT\n",
2639 __location__);
2640
2641 ZERO_STRUCT(create);
2642 create.in.create_disposition = NTCREATEX_DISP_OPEN;
2643 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2644 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2645 create.in.fname = rfork;
2646 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2647 NTCREATEX_SHARE_ACCESS_READ |
2648 NTCREATEX_SHARE_ACCESS_WRITE;
2649 status = smb2_create(tree, mem_ctx, &create);
2650 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
2651
2652 torture_comment(tctx, "(%s) create resource fork\n", __location__);
2653
2654 ZERO_STRUCT(create);
2655 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
2656 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2657 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2658 create.in.fname = rfork;
2659 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2660 NTCREATEX_SHARE_ACCESS_READ |
2661 NTCREATEX_SHARE_ACCESS_WRITE;
2662 status = smb2_create(tree, mem_ctx, &create);
2663 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
2664 fh1 = create.out.file.handle;
2665
2666 torture_comment(tctx, "(%s) getinfo on create handle\n",
2667 __location__);
2668
2669 ZERO_STRUCT(finfo);
2670 finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
2671 finfo.generic.in.file.handle = fh1;
2672 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
2673 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_getinfo_file");
2674 if (finfo.all_info.out.size != 0) {
2675 torture_result(tctx, TORTURE_FAIL,
2676 "(%s) Incorrect resource fork size\n",
2677 __location__);
2678 ret = false;
2679 smb2_util_close(tree, fh1);
2680 goto done;
2681 }
2682
2683 torture_comment(tctx, "(%s) open rfork, should still return ENOENT\n",
2684 __location__);
2685
2686 ZERO_STRUCT(create);
2687 create.in.create_disposition = NTCREATEX_DISP_OPEN;
2688 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2689 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2690 create.in.fname = rfork;
2691 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2692 NTCREATEX_SHARE_ACCESS_READ |
2693 NTCREATEX_SHARE_ACCESS_WRITE;
2694 status = smb2_create(tree, mem_ctx, &create);
2695 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
2696
2697 ret = check_stream_list(tree, tctx, fname, 1, streams, false);
2698 torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
2699
2700 torture_comment(tctx, "(%s) close empty created rfork, open should return ENOENT\n",
2701 __location__);
2702
2703 ZERO_STRUCT(create);
2704 create.in.create_disposition = NTCREATEX_DISP_OPEN;
2705 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2706 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2707 create.in.fname = rfork;
2708 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2709 NTCREATEX_SHARE_ACCESS_READ |
2710 NTCREATEX_SHARE_ACCESS_WRITE;
2711 status = smb2_create(tree, mem_ctx, &create);
2712 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
2713
2714 done:
2715 smb2_util_unlink(tree, fname);
2716 smb2_deltree(tree, BASEDIR);
2717 talloc_free(mem_ctx);
2718 return ret;
2719 }
2720
2721 /*
2722 * BUG: https://bugzilla.samba.org/show_bug.cgi?id=15182
2723 */
2724
2725 static bool test_rfork_fsync(struct torture_context *tctx,
2726 struct smb2_tree *tree)
2727 {
2728 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2729 const char *fname = BASEDIR "\\torture_rfork_fsync";
2730 const char *rfork = BASEDIR "\\torture_rfork_fsync" AFPRESOURCE_STREAM;
2731 NTSTATUS status;
2732 struct smb2_handle testdirh;
2733 bool ret = true;
2734 struct smb2_create create;
2735 struct smb2_handle fh1;
2736 struct smb2_flush f;
2737
2738 ZERO_STRUCT(fh1);
2739
2740 ret = enable_aapl(tctx, tree);
2741 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
2742
2743 smb2_util_unlink(tree, fname);
2744
2745 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2746 torture_assert_ntstatus_ok_goto(tctx,
2747 status,
2748 ret,
2749 done,
2750 "torture_smb2_testdir");
2751 smb2_util_close(tree, testdirh);
2752
2753 ret = torture_setup_file(mem_ctx, tree, fname, false);
2754 if (ret == false) {
2755 goto done;
2756 }
2757
2758 torture_comment(tctx, "(%s) create resource fork %s\n",
2759 __location__,
2760 rfork);
2761
2762 ZERO_STRUCT(create);
2763 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
2764 create.in.desired_access = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
2765 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2766 create.in.fname = rfork;
2767 create.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE |
2768 NTCREATEX_SHARE_ACCESS_READ |
2769 NTCREATEX_SHARE_ACCESS_WRITE;
2770 status = smb2_create(tree, mem_ctx, &create);
2771 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
2772 fh1 = create.out.file.handle;
2773
2774 torture_comment(tctx, "(%s) Write 10 bytes to resource fork %s\n",
2775 __location__,
2776 rfork);
2777
2778 status = smb2_util_write(tree, fh1, "1234567890", 0, 10);
2779 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
2780 "smb2_util_write failed\n");
2781
2782 torture_comment(tctx, "(%s) fsync on resource fork %s\n",
2783 __location__,
2784 rfork);
2785
2786 f.in.file.handle = fh1;
2787 status = smb2_flush(tree, &f);
2788 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
2789 "smb2_flush failed\n");
2790
2791 done:
2792
2793 smb2_util_close(tree, fh1);
2794 smb2_util_unlink(tree, fname);
2795 smb2_deltree(tree, BASEDIR);
2796 talloc_free(mem_ctx);
2797 return ret;
2798 }
2799
2800 static bool test_rfork_create_ro(struct torture_context *tctx,
2801 struct smb2_tree *tree)
2802 {
2803 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2804 const char *fname = BASEDIR "\\torture_rfork_create";
2805 const char *rfork = BASEDIR "\\torture_rfork_create" AFPRESOURCE_STREAM;
2806 NTSTATUS status;
2807 struct smb2_handle testdirh;
2808 bool ret = true;
2809 struct smb2_create create;
2810
2811 smb2_util_unlink(tree, fname);
2812 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2813 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
2814 "torture_smb2_testdir\n");
2815 smb2_util_close(tree, testdirh);
2816
2817 ret = torture_setup_file(mem_ctx, tree, fname, false);
2818 if (ret == false) {
2819 goto done;
2820 }
2821
2822 torture_comment(tctx, "(%s) Try opening read-only with "
2823 "open_if create disposition, should work\n",
2824 __location__);
2825
2826 ZERO_STRUCT(create);
2827 create.in.fname = rfork;
2828 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
2829 create.in.desired_access = SEC_FILE_READ_DATA | SEC_STD_READ_CONTROL;
2830 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
2831 create.in.share_access = FILE_SHARE_READ | FILE_SHARE_DELETE;
2832 status = smb2_create(tree, mem_ctx, &(create));
2833 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
2834 "smb2_create failed\n");
2835
2836 smb2_util_close(tree, create.out.file.handle);
2837
2838 done:
2839 smb2_util_unlink(tree, fname);
2840 smb2_deltree(tree, BASEDIR);
2841 talloc_free(mem_ctx);
2842 return ret;
2843 }
2844
2845 static bool test_adouble_conversion(struct torture_context *tctx,
2846 struct smb2_tree *tree)
2847 {
2848 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2849 const char *fname = BASEDIR "\\test_adouble_conversion";
2850 const char *adname = BASEDIR "/._test_adouble_conversion";
2851 NTSTATUS status;
2852 struct smb2_handle testdirh;
2853 bool ret = true;
2854 const char data[] = {
2855 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
2856 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
2857 };
2858 size_t datalen = sizeof(data);
2859 const char *streams[] = {
2860 "::$DATA",
2861 AFPINFO_STREAM,
2862 AFPRESOURCE_STREAM,
2863 ":com.apple.metadata" "\xef\x80\xa2" "_kMDItemUserTags:$DATA",
2864 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
2865 };
2866 bool is_osx = torture_setting_bool(tctx, "osx", false);
2867
2868 if (is_osx) {
2869 torture_skip(tctx, "Test only works with Samba\n");
2870 }
2871
2872 smb2_deltree(tree, BASEDIR);
2873
2874 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2875 CHECK_STATUS(status, NT_STATUS_OK);
2876 smb2_util_close(tree, testdirh);
2877
2878 ret = torture_setup_file(tctx, tree, fname, false);
2879 torture_assert_goto(tctx, ret == true, ret, done,
2880 "torture_setup_file failed\n");
2881
2882 ret = torture_setup_file(tctx, tree, adname, false);
2883 torture_assert_goto(tctx, ret == true, ret, done,
2884 "torture_setup_file failed\n");
2885
2886 ret = write_stream(tree, __location__, tctx, mem_ctx,
2887 adname, NULL,
2888 0,
2889 sizeof(osx_adouble_non_empty_rfork_w_xattr),
2890 osx_adouble_non_empty_rfork_w_xattr);
2891 torture_assert_goto(tctx, ret == true, ret, done,
2892 "write_stream failed\n");
2893
2894 torture_comment(tctx, "(%s) test OS X AppleDouble conversion\n",
2895 __location__);
2896
2897 ret = check_stream(tree, __location__, tctx, mem_ctx,
2898 fname, AFPRESOURCE_STREAM,
2899 16, datalen, 0, datalen, data);
2900 torture_assert_goto(tctx, ret == true, ret, done,
2901 "check AFPRESOURCE_STREAM failed\n");
2902
2903 ret = check_stream(tree, __location__, tctx, mem_ctx,
2904 fname, AFPINFO_STREAM,
2905 0, 60, 16, 8, "TESTSLOW");
2906 torture_assert_goto(tctx, ret == true, ret, done,
2907 "check AFPINFO_STREAM failed\n");
2908
2909 ret = check_stream(tree, __location__, tctx, mem_ctx, fname,
2910 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
2911 0, 3, 0, 3, "baz");
2912 torture_assert_goto(tctx, ret == true, ret, done,
2913 "check foo:bar stream failed\n");
2914
2915 ret = check_stream_list(tree, tctx, fname, 5, streams, false);
2916 torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
2917
2918 done:
2919 smb2_deltree(tree, BASEDIR);
2920 talloc_free(mem_ctx);
2921 return ret;
2922 }
2923
2924 /*
2925 * Test conversion of AppleDouble file without embedded xattr data
2926 */
2927 static bool test_adouble_conversion_wo_xattr(struct torture_context *tctx,
2928 struct smb2_tree *tree)
2929 {
2930 TALLOC_CTX *mem_ctx = talloc_new(tctx);
2931 const char *fname = BASEDIR "\\test_adouble_conversion";
2932 const char *adname = BASEDIR "/._test_adouble_conversion";
2933 NTSTATUS status;
2934 struct smb2_handle testdirh;
2935 bool ret = true;
2936 const char *streams[] = {
2937 "::$DATA",
2938 AFPINFO_STREAM,
2939 AFPRESOURCE_STREAM
2940 };
2941 struct smb2_create create;
2942 struct smb2_find find;
2943 unsigned int count;
2944 union smb_search_data *d;
2945 const char data[] = {
2946 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
2947 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
2948 };
2949 size_t datalen = sizeof(data);
2950 bool is_osx = torture_setting_bool(tctx, "osx", false);
2951
2952 if (is_osx) {
2953 torture_skip(tctx, "Test only works with Samba\n");
2954 }
2955
2956 smb2_deltree(tree, BASEDIR);
2957
2958 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
2959 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
2960 "torture_smb2_testdir failed\n");
2961 smb2_util_close(tree, testdirh);
2962
2963 ret = torture_setup_file(tctx, tree, fname, false);
2964 torture_assert_goto(tctx, ret == true, ret, done,
2965 "torture_setup_file failed\n");
2966
2967 ret = torture_setup_file(tctx, tree, adname, false);
2968 torture_assert_goto(tctx, ret == true, ret, done,
2969 "torture_setup_file failed\n");
2970
2971 ret = write_stream(tree, __location__, tctx, mem_ctx,
2972 adname, NULL, 0,
2973 sizeof(osx_adouble_without_xattr),
2974 osx_adouble_without_xattr);
2975 torture_assert_goto(tctx, ret == true, ret, done,
2976 "write_stream failed\n");
2977
2978 ret = enable_aapl(tctx, tree);
2979 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
2980
2981 /*
2982 * Issue a smb2_find(), this triggers the server-side conversion
2983 */
2984
2985 create = (struct smb2_create) {
2986 .in.desired_access = SEC_RIGHTS_DIR_READ,
2987 .in.create_options = NTCREATEX_OPTIONS_DIRECTORY,
2988 .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY,
2989 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
2990 .in.create_disposition = NTCREATEX_DISP_OPEN,
2991 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
2992 .in.fname = BASEDIR,
2993 };
2994
2995 status = smb2_create(tree, tctx, &create);
2996 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
2997 "smb2_create failed\n");
2998
2999 find = (struct smb2_find) {
3000 .in.file.handle = create.out.file.handle,
3001 .in.pattern = "*",
3002 .in.max_response_size = 0x1000,
3003 .in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO,
3004 };
3005
3006 status = smb2_find_level(tree, tree, &find, &count, &d);
3007 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
3008 "smb2_find_level failed\n");
3009
3010 status = smb2_util_close(tree, create.out.file.handle);
3011 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
3012 "smb2_util_close failed");
3013
3014 /*
3015 * Check number of streams
3016 */
3017
3018 ret = check_stream_list(tree, tctx, fname, 3, streams, false);
3019 torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
3020
3021
3022 /*
3023 * Check Resourcefork data can be read.
3024 */
3025
3026 ret = check_stream(tree, __location__, tctx, mem_ctx,
3027 fname, AFPRESOURCE_STREAM,
3028 16, datalen, 0, datalen, data);
3029 torture_assert_goto(tctx, ret == true, ret, done,
3030 "check AFPRESOURCE_STREAM failed\n");
3031
3032 /*
3033 * Check FinderInfo data has been migrated to stream.
3034 */
3035
3036 ret = check_stream(tree, __location__, tctx, mem_ctx,
3037 fname, AFPINFO_STREAM,
3038 0, 60, 16, 8, "WAVEPTul");
3039 torture_assert_goto(tctx, ret == true, ret, done,
3040 "check AFPINFO_STREAM failed\n");
3041
3042 done:
3043 smb2_deltree(tree, BASEDIR);
3044 talloc_free(mem_ctx);
3045 return ret;
3046 }
3047
3048 static bool test_aapl(struct torture_context *tctx,
3049 struct smb2_tree *tree)
3050 {
3051 TALLOC_CTX *mem_ctx = talloc_new(tctx);
3052 const char *fname = BASEDIR "\\test_aapl";
3053 NTSTATUS status;
3054 struct smb2_handle testdirh;
3055 bool ret = true;
3056 struct smb2_create io;
3057 DATA_BLOB data;
3058 struct smb2_create_blob *aapl = NULL;
3059 AfpInfo *info;
3060 const char *type_creator = "SMB,OLE!";
3061 char type_creator_buf[9];
3062 uint32_t aapl_cmd;
3063 uint32_t aapl_reply_bitmap;
3064 uint32_t aapl_server_caps;
3065 uint32_t aapl_vol_caps;
3066 uint32_t expected_vol_caps = 0;
3067 char *model;
3068 struct smb2_find f;
3069 unsigned int count;
3070 union smb_search_data *d;
3071 uint64_t rfork_len;
3072 bool is_osx_server = torture_setting_bool(tctx, "osx", false);
3073
3074 smb2_deltree(tree, BASEDIR);
3075
3076 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
3077 CHECK_STATUS(status, NT_STATUS_OK);
3078 smb2_util_close(tree, testdirh);
3079
3080 ZERO_STRUCT(io);
3081 io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
3082 io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
3083 io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
3084 io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
3085 NTCREATEX_SHARE_ACCESS_READ |
3086 NTCREATEX_SHARE_ACCESS_WRITE);
3087 io.in.fname = fname;
3088
3089 /*
3090 * Issuing an SMB2/CREATE with a suitably formed AAPL context,
3091 * controls behaviour of Apple's SMB2 extensions for the whole
3092 * session!
3093 */
3094
3095 data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
3096 SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
3097 SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS |
3098 SMB2_CRTCTX_AAPL_VOLUME_CAPS |
3099 SMB2_CRTCTX_AAPL_MODEL_INFO));
3100 SBVAL(data.data, 16, (SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR |
3101 SMB2_CRTCTX_AAPL_UNIX_BASED |
3102 SMB2_CRTCTX_AAPL_SUPPORTS_NFS_ACE));
3103
3104 torture_comment(tctx, "Testing SMB2 create context AAPL\n");
3105 status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
3106 CHECK_STATUS(status, NT_STATUS_OK);
3107
3108 status = smb2_create(tree, tctx, &io);
3109 CHECK_STATUS(status, NT_STATUS_OK);
3110 status = smb2_util_close(tree, io.out.file.handle);
3111 CHECK_STATUS(status, NT_STATUS_OK);
3112
3113 /*
3114 * Now check returned AAPL context
3115 */
3116 torture_comment(tctx, "Comparing returned AAPL capabilities\n");
3117
3118 aapl = smb2_create_blob_find(&io.out.blobs,
3119 SMB2_CREATE_TAG_AAPL);
3120
3121 if (aapl == NULL) {
3122 torture_result(tctx, TORTURE_FAIL,
3123 "(%s) unexpectedly no AAPL capabilities were returned.",
3124 __location__);
3125 ret = false;
3126 goto done;
3127 }
3128
3129 if (!is_osx_server) {
3130 size_t expected_aapl_ctx_size;
3131 bool size_ok;
3132
3133 /*
3134 * uint32_t CommandCode = kAAPL_SERVER_QUERY
3135 * uint32_t Reserved = 0;
3136 * uint64_t ReplyBitmap = kAAPL_SERVER_CAPS |
3137 * kAAPL_VOLUME_CAPS |
3138 * kAAPL_MODEL_INFO;
3139 * uint64_t ServerCaps = kAAPL_SUPPORTS_READDIR_ATTR |
3140 * kAAPL_SUPPORTS_OSX_COPYFILE;
3141 * uint64_t VolumeCaps = kAAPL_SUPPORT_RESOLVE_ID |
3142 * kAAPL_CASE_SENSITIVE;
3143 * uint32_t Pad2 = 0;
3144 * uint32_t ModelStringLen = 10;
3145 * ucs2_t ModelString[5] = "MacSamba";
3146 */
3147 expected_aapl_ctx_size = strlen("MacSamba") * 2 + 40;
3148
3149 size_ok = aapl->data.length == expected_aapl_ctx_size;
3150 torture_assert_goto(tctx, size_ok, ret, done, "bad AAPL size");
3151 }
3152
3153 aapl_cmd = IVAL(aapl->data.data, 0);
3154 if (aapl_cmd != SMB2_CRTCTX_AAPL_SERVER_QUERY) {
3155 torture_result(tctx, TORTURE_FAIL,
3156 "(%s) unexpected cmd: %d",
3157 __location__, (int)aapl_cmd);
3158 ret = false;
3159 goto done;
3160 }
3161
3162 aapl_reply_bitmap = BVAL(aapl->data.data, 8);
3163 if (aapl_reply_bitmap != (SMB2_CRTCTX_AAPL_SERVER_CAPS |
3164 SMB2_CRTCTX_AAPL_VOLUME_CAPS |
3165 SMB2_CRTCTX_AAPL_MODEL_INFO)) {
3166 torture_result(tctx, TORTURE_FAIL,
3167 "(%s) unexpected reply_bitmap: %d",
3168 __location__, (int)aapl_reply_bitmap);
3169 ret = false;
3170 goto done;
3171 }
3172
3173 aapl_server_caps = BVAL(aapl->data.data, 16);
3174 if (aapl_server_caps != (SMB2_CRTCTX_AAPL_UNIX_BASED |
3175 SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR |
3176 SMB2_CRTCTX_AAPL_SUPPORTS_NFS_ACE |
3177 SMB2_CRTCTX_AAPL_SUPPORTS_OSX_COPYFILE)) {
3178 torture_result(tctx, TORTURE_FAIL,
3179 "(%s) unexpected server_caps: %d",
3180 __location__, (int)aapl_server_caps);
3181 ret = false;
3182 goto done;
3183 }
3184
3185 if (is_osx_server) {
3186 expected_vol_caps = 5;
3187 }
3188 aapl_vol_caps = BVAL(aapl->data.data, 24);
3189 if (aapl_vol_caps != expected_vol_caps) {
3190 /* this will fail on a case insensitive fs ... */
3191 torture_result(tctx, TORTURE_FAIL,
3192 "(%s) unexpected vol_caps: %d",
3193 __location__, (int)aapl_vol_caps);
3194 }
3195
3196 ret = convert_string_talloc(mem_ctx,
3197 CH_UTF16LE, CH_UNIX,
3198 aapl->data.data + 40, 10,
3199 &model, NULL);
3200 if (ret == false) {
3201 torture_result(tctx, TORTURE_FAIL,
3202 "(%s) convert_string_talloc() failed",
3203 __location__);
3204 goto done;
3205 }
3206 torture_comment(tctx, "Got server model: \"%s\"\n", model);
3207
3208 /*
3209 * Now that Requested AAPL extensions are enabled, setup some
3210 * Mac files with metadata and resource fork
3211 */
3212 ret = torture_setup_file(mem_ctx, tree, fname, false);
3213 if (ret == false) {
3214 torture_result(tctx, TORTURE_FAIL,
3215 "(%s) torture_setup_file() failed",
3216 __location__);
3217 goto done;
3218 }
3219
3220 info = torture_afpinfo_new(mem_ctx);
3221 if (info == NULL) {
3222 torture_result(tctx, TORTURE_FAIL,
3223 "(%s) torture_afpinfo_new() failed",
3224 __location__);
3225 ret = false;
3226 goto done;
3227 }
3228
3229 memcpy(info->afpi_FinderInfo, type_creator, 8);
3230 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
3231 if (ret == false) {
3232 torture_result(tctx, TORTURE_FAIL,
3233 "(%s) torture_write_afpinfo() failed",
3234 __location__);
3235 goto done;
3236 }
3237
3238 ret = write_stream(tree, __location__, tctx, mem_ctx,
3239 fname, AFPRESOURCE_STREAM_NAME,
3240 0, 3, "foo");
3241 if (ret == false) {
3242 torture_result(tctx, TORTURE_FAIL,
3243 "(%s) write_stream() failed",
3244 __location__);
3245 goto done;
3246 }
3247
3248 /*
3249 * Ok, file is prepared, now call smb2/find
3250 */
3251
3252 ZERO_STRUCT(io);
3253 io.in.desired_access = SEC_RIGHTS_DIR_READ;
3254 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
3255 io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
3256 io.in.share_access = (NTCREATEX_SHARE_ACCESS_READ |
3257 NTCREATEX_SHARE_ACCESS_WRITE |
3258 NTCREATEX_SHARE_ACCESS_DELETE);
3259 io.in.create_disposition = NTCREATEX_DISP_OPEN;
3260 io.in.fname = BASEDIR;
3261 status = smb2_create(tree, tctx, &io);
3262 CHECK_STATUS(status, NT_STATUS_OK);
3263
3264 ZERO_STRUCT(f);
3265 f.in.file.handle = io.out.file.handle;
3266 f.in.pattern = "test_aapl";
3267 f.in.continue_flags = SMB2_CONTINUE_FLAG_SINGLE;
3268 f.in.max_response_size = 0x1000;
3269 f.in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO;
3270
3271 status = smb2_find_level(tree, tree, &f, &count, &d);
3272 CHECK_STATUS(status, NT_STATUS_OK);
3273
3274 status = smb2_util_close(tree, io.out.file.handle);
3275 CHECK_STATUS(status, NT_STATUS_OK);
3276
3277 if (strcmp(d[0].id_both_directory_info.name.s, "test_aapl") != 0) {
3278 torture_result(tctx, TORTURE_FAIL,
3279 "(%s) write_stream() failed",
3280 __location__);
3281 ret = false;
3282 goto done;
3283 }
3284
3285 if (d[0].id_both_directory_info.short_name.private_length != 24) {
3286 torture_result(tctx, TORTURE_FAIL,
3287 "(%s) bad short_name length %" PRIu32 ", expected 24",
3288 __location__, d[0].id_both_directory_info.short_name.private_length);
3289 ret = false;
3290 goto done;
3291 }
3292
3293 torture_comment(tctx, "short_name buffer:\n");
3294 dump_data(0, d[0].id_both_directory_info.short_name_buf, 24);
3295
3296 /*
3297 * Extract data as specified by the AAPL extension:
3298 * - ea_size contains max_access
3299 * - short_name contains resource fork length + FinderInfo
3300 * - reserved2 contains the unix mode
3301 */
3302 torture_comment(tctx, "mac_access: %" PRIx32 "\n",
3303 d[0].id_both_directory_info.ea_size);
3304
3305 rfork_len = BVAL(d[0].id_both_directory_info.short_name_buf, 0);
3306 if (rfork_len != 3) {
3307 torture_result(tctx, TORTURE_FAIL,
3308 "(%s) expected resource fork length 3, got: %" PRIu64,
3309 __location__, rfork_len);
3310 ret = false;
3311 goto done;
3312 }
3313
3314 memcpy(type_creator_buf, d[0].id_both_directory_info.short_name_buf + 8, 8);
3315 type_creator_buf[8] = 0;
3316 if (strcmp(type_creator, type_creator_buf) != 0) {
3317 torture_result(tctx, TORTURE_FAIL,
3318 "(%s) expected type/creator \"%s\" , got: %s",
3319 __location__, type_creator, type_creator_buf);
3320 ret = false;
3321 goto done;
3322 }
3323
3324 done:
3325 smb2_util_unlink(tree, fname);
3326 smb2_deltree(tree, BASEDIR);
3327 talloc_free(mem_ctx);
3328 return ret;
3329 }
3330
3331 static uint64_t patt_hash(uint64_t off)
3332 {
3333 return off;
3334 }
3335
3336 static bool write_pattern(struct torture_context *torture,
3337 struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
3338 struct smb2_handle h, uint64_t off, uint64_t len,
3339 uint64_t patt_off)
3340 {
3341 NTSTATUS status;
3342 uint64_t i;
3343 uint8_t *buf;
3344 uint64_t io_sz = MIN(1024 * 64, len);
3345
3346 if (len == 0) {
3347 return true;
3348 }
3349
3350 torture_assert(torture, (len % 8) == 0, "invalid write len");
3351
3352 buf = talloc_zero_size(mem_ctx, io_sz);
3353 torture_assert(torture, (buf != NULL), "no memory for file data buf");
3354
3355 while (len > 0) {
3356 for (i = 0; i <= io_sz - 8; i += 8) {
3357 SBVAL(buf, i, patt_hash(patt_off));
3358 patt_off += 8;
3359 }
3360
3361 status = smb2_util_write(tree, h,
3362 buf, off, io_sz);
3363 torture_assert_ntstatus_ok(torture, status, "file write");
3364
3365 len -= io_sz;
3366 off += io_sz;
3367 }
3368
3369 talloc_free(buf);
3370
3371 return true;
3372 }
3373
3374 static bool check_pattern(struct torture_context *torture,
3375 struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
3376 struct smb2_handle h, uint64_t off, uint64_t len,
3377 uint64_t patt_off)
3378 {
3379 if (len == 0) {
3380 return true;
3381 }
3382
3383 torture_assert(torture, (len % 8) == 0, "invalid read len");
3384
3385 while (len > 0) {
3386 uint64_t i;
3387 struct smb2_read r;
3388 NTSTATUS status;
3389 uint64_t io_sz = MIN(1024 * 64, len);
3390
3391 ZERO_STRUCT(r);
3392 r.in.file.handle = h;
3393 r.in.length = io_sz;
3394 r.in.offset = off;
3395 status = smb2_read(tree, mem_ctx, &r);
3396 torture_assert_ntstatus_ok(torture, status, "read");
3397
3398 torture_assert_u64_equal(torture, r.out.data.length, io_sz,
3399 "read data len mismatch");
3400
3401 for (i = 0; i <= io_sz - 8; i += 8, patt_off += 8) {
3402 uint64_t data = BVAL(r.out.data.data, i);
3403 torture_assert_u64_equal(torture, data, patt_hash(patt_off),
3404 talloc_asprintf(torture, "read data "
3405 "pattern bad at %llu\n",
3406 (unsigned long long)off + i));
3407 }
3408 talloc_free(r.out.data.data);
3409 len -= io_sz;
3410 off += io_sz;
3411 }
3412
3413 return true;
3414 }
3415
3416 static bool test_setup_open(struct torture_context *torture,
3417 struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
3418 const char *fname,
3419 struct smb2_handle *fh,
3420 uint32_t desired_access,
3421 uint32_t file_attributes)
3422 {
3423 struct smb2_create io;
3424 NTSTATUS status;
3425
3426 ZERO_STRUCT(io);
3427 io.in.desired_access = desired_access;
3428 io.in.file_attributes = file_attributes;
3429 io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
3430 io.in.share_access =
3431 NTCREATEX_SHARE_ACCESS_DELETE|
3432 NTCREATEX_SHARE_ACCESS_READ|
3433 NTCREATEX_SHARE_ACCESS_WRITE;
3434 if (file_attributes & FILE_ATTRIBUTE_DIRECTORY) {
3435 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
3436 }
3437 io.in.fname = fname;
3438
3439 status = smb2_create(tree, mem_ctx, &io);
3440 torture_assert_ntstatus_ok(torture, status, "file create");
3441
3442 *fh = io.out.file.handle;
3443
3444 return true;
3445 }
3446
3447 static bool test_setup_create_fill(struct torture_context *torture,
3448 struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
3449 const char *fname,
3450 struct smb2_handle *fh,
3451 uint64_t size,
3452 uint32_t desired_access,
3453 uint32_t file_attributes)
3454 {
3455 bool ok;
3456
3457 ok = test_setup_open(torture, tree, mem_ctx,
3458 fname,
3459 fh,
3460 desired_access,
3461 file_attributes);
3462 torture_assert(torture, ok, "file open");
3463
3464 if (size > 0) {
3465 ok = write_pattern(torture, tree, mem_ctx, *fh, 0, size, 0);
3466 torture_assert(torture, ok, "write pattern");
3467 }
3468 return true;
3469 }
3470
3471 static bool test_setup_copy_chunk(struct torture_context *torture,
3472 struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
3473 uint32_t nchunks,
3474 const char *src_name,
3475 struct smb2_handle *src_h,
3476 uint64_t src_size,
3477 uint32_t src_desired_access,
3478 const char *dst_name,
3479 struct smb2_handle *dest_h,
3480 uint64_t dest_size,
3481 uint32_t dest_desired_access,
3482 struct srv_copychunk_copy *cc_copy,
3483 union smb_ioctl *io)
3484 {
3485 struct req_resume_key_rsp res_key;
3486 bool ok;
3487 NTSTATUS status;
3488 enum ndr_err_code ndr_ret;
3489
3490 ok = test_setup_create_fill(torture, tree, mem_ctx, src_name,
3491 src_h, src_size, src_desired_access,
3492 FILE_ATTRIBUTE_NORMAL);
3493 torture_assert(torture, ok, "src file create fill");
3494
3495 ok = test_setup_create_fill(torture, tree, mem_ctx, dst_name,
3496 dest_h, dest_size, dest_desired_access,
3497 FILE_ATTRIBUTE_NORMAL);
3498 torture_assert(torture, ok, "dest file create fill");
3499
3500 ZERO_STRUCTPN(io);
3501 io->smb2.level = RAW_IOCTL_SMB2;
3502 io->smb2.in.file.handle = *src_h;
3503 io->smb2.in.function = FSCTL_SRV_REQUEST_RESUME_KEY;
3504 /* Allow for Key + ContextLength + Context */
3505 io->smb2.in.max_output_response = 32;
3506 io->smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
3507
3508 status = smb2_ioctl(tree, mem_ctx, &io->smb2);
3509 torture_assert_ntstatus_ok(torture, status,
3510 "FSCTL_SRV_REQUEST_RESUME_KEY");
3511
3512 ndr_ret = ndr_pull_struct_blob(&io->smb2.out.out, mem_ctx, &res_key,
3513 (ndr_pull_flags_fn_t)ndr_pull_req_resume_key_rsp);
3514
3515 torture_assert_ndr_success(torture, ndr_ret,
3516 "ndr_pull_req_resume_key_rsp");
3517
3518 ZERO_STRUCTPN(io);
3519 io->smb2.level = RAW_IOCTL_SMB2;
3520 io->smb2.in.file.handle = *dest_h;
3521 io->smb2.in.function = FSCTL_SRV_COPYCHUNK;
3522 io->smb2.in.max_output_response = sizeof(struct srv_copychunk_rsp);
3523 io->smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
3524
3525 ZERO_STRUCTPN(cc_copy);
3526 memcpy(cc_copy->source_key, res_key.resume_key, ARRAY_SIZE(cc_copy->source_key));
3527 cc_copy->chunk_count = nchunks;
3528 cc_copy->chunks = talloc_zero_array(mem_ctx, struct srv_copychunk, nchunks);
3529 torture_assert(torture, (cc_copy->chunks != NULL), "no memory for chunks");
3530
3531 return true;
3532 }
3533
3534
3535 static bool check_copy_chunk_rsp(struct torture_context *torture,
3536 struct srv_copychunk_rsp *cc_rsp,
3537 uint32_t ex_chunks_written,
3538 uint32_t ex_chunk_bytes_written,
3539 uint32_t ex_total_bytes_written)
3540 {
3541 torture_assert_int_equal(torture, cc_rsp->chunks_written,
3542 ex_chunks_written, "num chunks");
3543 torture_assert_int_equal(torture, cc_rsp->chunk_bytes_written,
3544 ex_chunk_bytes_written, "chunk bytes written");
3545 torture_assert_int_equal(torture, cc_rsp->total_bytes_written,
3546 ex_total_bytes_written, "chunk total bytes");
3547 return true;
3548 }
3549
3550 static bool neg_aapl_copyfile(struct torture_context *tctx,
3551 struct smb2_tree *tree,
3552 uint64_t flags)
3553 {
3554 TALLOC_CTX *mem_ctx = talloc_new(tctx);
3555 const char *fname = "aapl";
3556 NTSTATUS status;
3557 struct smb2_create io;
3558 DATA_BLOB data;
3559 struct smb2_create_blob *aapl = NULL;
3560 uint32_t aapl_cmd;
3561 uint32_t aapl_reply_bitmap;
3562 uint32_t aapl_server_caps;
3563 bool ret = true;
3564
3565 ZERO_STRUCT(io);
3566 io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
3567 io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
3568 io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
3569 io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
3570 NTCREATEX_SHARE_ACCESS_READ |
3571 NTCREATEX_SHARE_ACCESS_WRITE);
3572 io.in.fname = fname;
3573
3574 data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
3575 SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
3576 SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS));
3577 SBVAL(data.data, 16, flags);
3578
3579 status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
3580 CHECK_STATUS(status, NT_STATUS_OK);
3581
3582 status = smb2_create(tree, tctx, &io);
3583 CHECK_STATUS(status, NT_STATUS_OK);
3584
3585 aapl = smb2_create_blob_find(&io.out.blobs,
3586 SMB2_CREATE_TAG_AAPL);
3587 if (aapl == NULL) {
3588 ret = false;
3589 goto done;
3590
3591 }
3592 if (aapl->data.length < 24) {
3593 ret = false;
3594 goto done;
3595 }
3596
3597 aapl_cmd = IVAL(aapl->data.data, 0);
3598 if (aapl_cmd != SMB2_CRTCTX_AAPL_SERVER_QUERY) {
3599 torture_result(tctx, TORTURE_FAIL,
3600 "(%s) unexpected cmd: %d",
3601 __location__, (int)aapl_cmd);
3602 ret = false;
3603 goto done;
3604 }
3605
3606 aapl_reply_bitmap = BVAL(aapl->data.data, 8);
3607 if (!(aapl_reply_bitmap & SMB2_CRTCTX_AAPL_SERVER_CAPS)) {
3608 torture_result(tctx, TORTURE_FAIL,
3609 "(%s) unexpected reply_bitmap: %d",
3610 __location__, (int)aapl_reply_bitmap);
3611 ret = false;
3612 goto done;
3613 }
3614
3615 aapl_server_caps = BVAL(aapl->data.data, 16);
3616 if (!(aapl_server_caps & flags)) {
3617 torture_result(tctx, TORTURE_FAIL,
3618 "(%s) unexpected server_caps: %d",
3619 __location__, (int)aapl_server_caps);
3620 ret = false;
3621 goto done;
3622 }
3623
3624 done:
3625 status = smb2_util_close(tree, io.out.file.handle);
3626 CHECK_STATUS(status, NT_STATUS_OK);
3627
3628 smb2_util_unlink(tree, "aapl");
3629 talloc_free(mem_ctx);
3630 return ret;
3631 }
3632
3633 static bool test_copyfile(struct torture_context *torture,
3634 struct smb2_tree *tree)
3635 {
3636 struct smb2_handle src_h;
3637 struct smb2_handle dest_h;
3638 NTSTATUS status;
3639 union smb_ioctl io;
3640 TALLOC_CTX *tmp_ctx = talloc_new(tree);
3641 struct srv_copychunk_copy cc_copy;
3642 struct srv_copychunk_rsp cc_rsp;
3643 enum ndr_err_code ndr_ret;
3644 bool ok;
3645 const char *sname = ":foo" "\xef\x80\xa2" "bar:$DATA";
3646
3647 /*
3648 * First test a copy_chunk with a 0 chunk count without having
3649 * enabled this via AAPL. The request must not fail and the
3650 * copied length in the response must be 0. This is verified
3651 * against Windows 2008r2.
3652 */
3653
3654 ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
3655 0, /* 0 chunks, copyfile semantics */
3656 FNAME_CC_SRC,
3657 &src_h, 4096, /* fill 4096 byte src file */
3658 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
3659 FNAME_CC_DST,
3660 &dest_h, 0, /* 0 byte dest file */
3661 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
3662 &cc_copy,
3663 &io);
3664 if (!ok) {
3665 torture_fail_goto(torture, done, "setup copy chunk error");
3666 }
3667
3668 ndr_ret = ndr_push_struct_blob(&io.smb2.in.out, tmp_ctx,
3669 &cc_copy,
3670 (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
3671 torture_assert_ndr_success(torture, ndr_ret,
3672 "ndr_push_srv_copychunk_copy");
3673
3674 status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
3675 torture_assert_ntstatus_ok_goto(torture, status, ok, done, "FSCTL_SRV_COPYCHUNK");
3676
3677 ndr_ret = ndr_pull_struct_blob(&io.smb2.out.out, tmp_ctx,
3678 &cc_rsp,
3679 (ndr_pull_flags_fn_t)ndr_pull_srv_copychunk_rsp);
3680 torture_assert_ndr_success(torture, ndr_ret,
3681 "ndr_pull_srv_copychunk_rsp");
3682
3683 ok = check_copy_chunk_rsp(torture, &cc_rsp,
3684 0, /* chunks written */
3685 0, /* chunk bytes unsuccessfully written */
3686 0); /* total bytes written */
3687 if (!ok) {
3688 torture_fail_goto(torture, done, "bad copy chunk response data");
3689 }
3690
3691 /*
3692 * Now enable AAPL copyfile and test again, the file and the
3693 * stream must be copied by the server.
3694 */
3695 ok = neg_aapl_copyfile(torture, tree,
3696 SMB2_CRTCTX_AAPL_SUPPORTS_OSX_COPYFILE);
3697 if (!ok) {
3698 torture_skip_goto(torture, done, "missing AAPL copyfile");
3699 goto done;
3700 }
3701
3702 smb2_util_close(tree, src_h);
3703 smb2_util_close(tree, dest_h);
3704 smb2_util_unlink(tree, FNAME_CC_SRC);
3705 smb2_util_unlink(tree, FNAME_CC_DST);
3706
3707 ok = torture_setup_file(tmp_ctx, tree, FNAME_CC_SRC, false);
3708 if (!ok) {
3709 torture_fail(torture, "setup file error");
3710 }
3711 ok = write_stream(tree, __location__, torture, tmp_ctx,
3712 FNAME_CC_SRC, AFPRESOURCE_STREAM,
3713 10, 10, "1234567890");
3714 if (!ok) {
3715 torture_fail(torture, "setup stream error");
3716 }
3717
3718 ok = write_stream(tree, __location__, torture, tmp_ctx,
3719 FNAME_CC_SRC, sname,
3720 10, 10, "abcdefghij");
3721 torture_assert_goto(torture, ok == true, ok, done, "write_stream failed\n");
3722
3723 ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
3724 0, /* 0 chunks, copyfile semantics */
3725 FNAME_CC_SRC,
3726 &src_h, 4096, /* fill 4096 byte src file */
3727 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
3728 FNAME_CC_DST,
3729 &dest_h, 0, /* 0 byte dest file */
3730 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
3731 &cc_copy,
3732 &io);
3733 if (!ok) {
3734 torture_fail_goto(torture, done, "setup copy chunk error");
3735 }
3736
3737 ndr_ret = ndr_push_struct_blob(&io.smb2.in.out, tmp_ctx,
3738 &cc_copy,
3739 (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
3740 torture_assert_ndr_success(torture, ndr_ret,
3741 "ndr_push_srv_copychunk_copy");
3742
3743 status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
3744 torture_assert_ntstatus_ok_goto(torture, status, ok, done, "FSCTL_SRV_COPYCHUNK");
3745
3746 ndr_ret = ndr_pull_struct_blob(&io.smb2.out.out, tmp_ctx,
3747 &cc_rsp,
3748 (ndr_pull_flags_fn_t)ndr_pull_srv_copychunk_rsp);
3749 torture_assert_ndr_success(torture, ndr_ret,
3750 "ndr_pull_srv_copychunk_rsp");
3751
3752 ok = check_copy_chunk_rsp(torture, &cc_rsp,
3753 0, /* chunks written */
3754 0, /* chunk bytes unsuccessfully written */
3755 4096); /* total bytes written */
3756 if (!ok) {
3757 torture_fail_goto(torture, done, "bad copy chunk response data");
3758 }
3759
3760 ok = test_setup_open(torture, tree, tmp_ctx, FNAME_CC_DST, &dest_h,
3761 SEC_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL);
3762 if (!ok) {
3763 torture_fail_goto(torture, done,"open failed");
3764 }
3765 ok = check_pattern(torture, tree, tmp_ctx, dest_h, 0, 4096, 0);
3766 if (!ok) {
3767 torture_fail_goto(torture, done, "inconsistent file data");
3768 }
3769
3770 ok = check_stream(tree, __location__, torture, tmp_ctx,
3771 FNAME_CC_DST, AFPRESOURCE_STREAM,
3772 0, 20, 10, 10, "1234567890");
3773 if (!ok) {
3774 torture_fail_goto(torture, done, "inconsistent stream data");
3775 }
3776
3777 ok = check_stream(tree, __location__, torture, tmp_ctx,
3778 FNAME_CC_DST, sname,
3779 0, 20, 10, 10, "abcdefghij");
3780 torture_assert_goto(torture, ok == true, ok, done, "check_stream failed\n");
3781
3782 done:
3783 smb2_util_close(tree, src_h);
3784 smb2_util_close(tree, dest_h);
3785 smb2_util_unlink(tree, FNAME_CC_SRC);
3786 smb2_util_unlink(tree, FNAME_CC_DST);
3787 talloc_free(tmp_ctx);
3788 return true;
3789 }
3790
3791 static bool check_stream_list(struct smb2_tree *tree,
3792 struct torture_context *tctx,
3793 const char *fname,
3794 int num_exp,
3795 const char **exp,
3796 bool is_dir)
3797 {
3798 bool ret = true;
3799 union smb_fileinfo finfo;
3800 NTSTATUS status;
3801 int i;
3802 TALLOC_CTX *tmp_ctx = talloc_new(tctx);
3803 char **exp_sort;
3804 struct stream_struct *stream_sort;
3805 struct smb2_create create;
3806 struct smb2_handle h;
3807
3808 ZERO_STRUCT(h);
3809 torture_assert_goto(tctx, tmp_ctx != NULL, ret, done, "talloc_new failed");
3810
3811 ZERO_STRUCT(create);
3812 create.in.fname = fname;
3813 create.in.create_disposition = NTCREATEX_DISP_OPEN;
3814 create.in.desired_access = SEC_FILE_ALL;
3815 create.in.create_options = is_dir ? NTCREATEX_OPTIONS_DIRECTORY : 0;
3816 create.in.file_attributes = is_dir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
3817 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
3818 status = smb2_create(tree, tmp_ctx, &create);
3819 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
3820 h = create.out.file.handle;
3821
3822 finfo.generic.level = RAW_FILEINFO_STREAM_INFORMATION;
3823 finfo.generic.in.file.handle = h;
3824
3825 status = smb2_getinfo_file(tree, tctx, &finfo);
3826 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "get stream info");
3827
3828 smb2_util_close(tree, h);
3829
3830 torture_assert_int_equal_goto(tctx, finfo.stream_info.out.num_streams, num_exp,
3831 ret, done, "stream count");
3832
3833 if (num_exp == 0) {
3834 TALLOC_FREE(tmp_ctx);
3835 goto done;
3836 }
3837
3838 exp_sort = talloc_memdup(tmp_ctx, exp, num_exp * sizeof(*exp));
3839 torture_assert_goto(tctx, exp_sort != NULL, ret, done, __location__);
3840
3841 TYPESAFE_QSORT(exp_sort, num_exp, qsort_string);
3842
3843 stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams,
3844 finfo.stream_info.out.num_streams *
3845 sizeof(*stream_sort));
3846 torture_assert_goto(tctx, stream_sort != NULL, ret, done, __location__);
3847
3848 TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream);
3849
3850 for (i=0; i<num_exp; i++) {
3851 torture_comment(tctx, "i[%d] exp[%s] got[%s]\n",
3852 i, exp_sort[i], stream_sort[i].stream_name.s);
3853 torture_assert_str_equal_goto(tctx, stream_sort[i].stream_name.s, exp_sort[i],
3854 ret, done, "stream name");
3855 }
3856
3857 done:
3858 TALLOC_FREE(tmp_ctx);
3859 return ret;
3860 }
3861
3862 static bool check_stream_list_handle(struct smb2_tree *tree,
3863 struct torture_context *tctx,
3864 struct smb2_handle h,
3865 int num_exp,
3866 const char **exp,
3867 bool is_dir)
3868 {
3869 bool ret = true;
3870 union smb_fileinfo finfo;
3871 NTSTATUS status;
3872 int i;
3873 TALLOC_CTX *tmp_ctx = talloc_new(tctx);
3874 char **exp_sort;
3875 struct stream_struct *stream_sort;
3876
3877 torture_assert_goto(tctx, tmp_ctx != NULL, ret, done,
3878 "talloc_new failed\n");
3879
3880 finfo = (union smb_fileinfo) {
3881 .stream_info.level = RAW_FILEINFO_STREAM_INFORMATION,
3882 .stream_info.in.file.handle = h,
3883 };
3884
3885 status = smb2_getinfo_file(tree, tctx, &finfo);
3886 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
3887 "get stream info\n");
3888
3889 torture_assert_int_equal_goto(tctx, finfo.stream_info.out.num_streams,
3890 num_exp, ret, done, "stream count\n");
3891
3892 if (num_exp == 0) {
3893 TALLOC_FREE(tmp_ctx);
3894 goto done;
3895 }
3896
3897 exp_sort = talloc_memdup(tmp_ctx, exp, num_exp * sizeof(*exp));
3898 torture_assert_goto(tctx, exp_sort != NULL, ret, done, __location__);
3899
3900 TYPESAFE_QSORT(exp_sort, num_exp, qsort_string);
3901
3902 stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams,
3903 finfo.stream_info.out.num_streams *
3904 sizeof(*stream_sort));
3905 torture_assert_goto(tctx, stream_sort != NULL, ret, done, __location__);
3906
3907 TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream);
3908
3909 for (i=0; i<num_exp; i++) {
3910 torture_comment(tctx, "i[%d] exp[%s] got[%s]\n",
3911 i, exp_sort[i], stream_sort[i].stream_name.s);
3912 torture_assert_str_equal_goto(tctx, stream_sort[i].stream_name.s,
3913 exp_sort[i], ret, done,
3914 "stream name\n");
3915 }
3916
3917 done:
3918 TALLOC_FREE(tmp_ctx);
3919 return ret;
3920 }
3921
3922 /*
3923 test stream names
3924 */
3925 static bool test_stream_names(struct torture_context *tctx,
3926 struct smb2_tree *tree)
3927 {
3928 TALLOC_CTX *mem_ctx = talloc_new(tctx);
3929 NTSTATUS status;
3930 struct smb2_create create;
3931 struct smb2_handle h;
3932 const char *fname = BASEDIR "\\stream_names.txt";
3933 const char *sname1;
3934 bool ret;
3935 /* UTF8 private use are starts at 0xef 0x80 0x80 (0xf000) */
3936 const char *streams[] = {
3937 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
3938 "::$DATA"
3939 };
3940
3941 sname1 = talloc_asprintf(mem_ctx, "%s%s", fname, streams[0]);
3942
3943 /* clean slate ...*/
3944 smb2_util_unlink(tree, fname);
3945 smb2_deltree(tree, fname);
3946 smb2_deltree(tree, BASEDIR);
3947
3948 status = torture_smb2_testdir(tree, BASEDIR, &h);
3949 CHECK_STATUS(status, NT_STATUS_OK);
3950 smb2_util_close(tree, h);
3951
3952 ret = torture_setup_file(mem_ctx, tree, fname, false);
3953 torture_assert_goto(tctx, ret, ret, done, "torture_setup_file");
3954
3955 torture_comment(tctx, "(%s) testing stream names\n", __location__);
3956 ZERO_STRUCT(create);
3957 create.in.desired_access = SEC_FILE_WRITE_DATA;
3958 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
3959 create.in.share_access =
3960 NTCREATEX_SHARE_ACCESS_DELETE|
3961 NTCREATEX_SHARE_ACCESS_READ|
3962 NTCREATEX_SHARE_ACCESS_WRITE;
3963 create.in.create_disposition = NTCREATEX_DISP_CREATE;
3964 create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
3965 create.in.fname = sname1;
3966
3967 status = smb2_create(tree, mem_ctx, &create);
3968 CHECK_STATUS(status, NT_STATUS_OK);
3969
3970 status = smb2_util_write(tree, create.out.file.handle, "foo", 0, 3);
3971 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
3972 "smb2_util_write failed\n");
3973
3974 smb2_util_close(tree, create.out.file.handle);
3975
3976 ret = check_stream_list(tree, tctx, fname, 2, streams, false);
3977 CHECK_VALUE(ret, true);
3978
3979 done:
3980 status = smb2_util_unlink(tree, fname);
3981 smb2_deltree(tree, BASEDIR);
3982 talloc_free(mem_ctx);
3983
3984 return ret;
3985 }
3986
3987 static bool test_afpinfo_enoent(struct torture_context *tctx,
3988 struct smb2_tree *tree)
3989 {
3990 bool ret = true;
3991 NTSTATUS status;
3992 struct smb2_create create;
3993 struct smb2_handle h1;
3994 TALLOC_CTX *mem_ctx = talloc_new(tctx);
3995 const char *fname = BASEDIR "\\file";
3996 const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
3997
3998 torture_comment(tctx, "Opening file without AFP_AfpInfo\n");
3999
4000 smb2_deltree(tree, BASEDIR);
4001 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4002 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
4003 smb2_util_close(tree, h1);
4004 ret = torture_setup_file(mem_ctx, tree, fname, false);
4005 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4006
4007 torture_comment(tctx, "Opening not existing AFP_AfpInfo\n");
4008
4009 ZERO_STRUCT(create);
4010 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4011 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
4012 create.in.fname = sname;
4013
4014 status = smb2_create(tree, mem_ctx, &create);
4015 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4016 ret, done, "Got unexpected AFP_AfpInfo stream");
4017
4018 done:
4019 smb2_util_unlink(tree, fname);
4020 smb2_util_rmdir(tree, BASEDIR);
4021 return ret;
4022 }
4023
4024 static bool test_create_delete_on_close(struct torture_context *tctx,
4025 struct smb2_tree *tree)
4026 {
4027 bool ret = true;
4028 NTSTATUS status;
4029 struct smb2_create create;
4030 struct smb2_handle h1;
4031 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4032 const char *fname = BASEDIR "\\file";
4033 const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
4034 const char *type_creator = "SMB,OLE!";
4035 AfpInfo *info = NULL;
4036 const char *streams_basic[] = {
4037 "::$DATA"
4038 };
4039 const char *streams_afpinfo[] = {
4040 "::$DATA",
4041 AFPINFO_STREAM
4042 };
4043
4044 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
4045
4046 torture_comment(tctx, "Checking whether create with delete-on-close work with AFP_AfpInfo\n");
4047
4048 smb2_deltree(tree, BASEDIR);
4049 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4050 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
4051 smb2_util_close(tree, h1);
4052 ret = torture_setup_file(mem_ctx, tree, fname, false);
4053 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4054
4055 torture_comment(tctx, "Opening not existing AFP_AfpInfo\n");
4056
4057 ZERO_STRUCT(create);
4058 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4059 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
4060 create.in.fname = sname;
4061
4062 status = smb2_create(tree, mem_ctx, &create);
4063 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4064 ret, done, "Got unexpected AFP_AfpInfo stream");
4065
4066 ZERO_STRUCT(create);
4067 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4068 create.in.desired_access = SEC_FILE_ALL;
4069 create.in.fname = sname;
4070
4071 status = smb2_create(tree, mem_ctx, &create);
4072 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4073 ret, done, "Got unexpected AFP_AfpInfo stream");
4074
4075 ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
4076 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4077
4078 torture_comment(tctx, "Deleting AFP_AfpInfo via create with delete-on-close\n");
4079
4080 info = torture_afpinfo_new(mem_ctx);
4081 torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
4082
4083 memcpy(info->afpi_FinderInfo, type_creator, 8);
4084 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
4085 torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
4086
4087 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
4088 0, 60, 16, 8, type_creator);
4089 torture_assert_goto(tctx, ret == true, ret, done, "Bad type/creator in AFP_AfpInfo");
4090
4091 ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
4092 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4093
4094 ZERO_STRUCT(create);
4095 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4096 create.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
4097 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
4098 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4099 create.in.fname = sname;
4100 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4101
4102 status = smb2_create(tree, mem_ctx, &create);
4103 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4104
4105 h1 = create.out.file.handle;
4106 smb2_util_close(tree, h1);
4107
4108 ZERO_STRUCT(create);
4109 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4110 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
4111 create.in.fname = sname;
4112 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4113 status = smb2_create(tree, mem_ctx, &create);
4114 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4115 ret, done, "Got unexpected AFP_AfpInfo stream");
4116
4117 ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
4118 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4119
4120 done:
4121 smb2_util_unlink(tree, fname);
4122 smb2_util_rmdir(tree, BASEDIR);
4123 return ret;
4124 }
4125
4126 static bool test_setinfo_delete_on_close(struct torture_context *tctx,
4127 struct smb2_tree *tree)
4128 {
4129 bool ret = true;
4130 NTSTATUS status;
4131 struct smb2_create create;
4132 union smb_setfileinfo sfinfo;
4133 struct smb2_handle h1;
4134 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4135 const char *fname = BASEDIR "\\file";
4136 const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
4137 const char *type_creator = "SMB,OLE!";
4138 AfpInfo *info = NULL;
4139 const char *streams[] = {
4140 AFPINFO_STREAM,
4141 "::$DATA"
4142 };
4143 const char *streams_basic[] = {
4144 "::$DATA"
4145 };
4146
4147 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
4148
4149 torture_comment(tctx, "Deleting AFP_AfpInfo via setinfo with delete-on-close\n");
4150
4151 smb2_deltree(tree, BASEDIR);
4152 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4153 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
4154 smb2_util_close(tree, h1);
4155 ret = torture_setup_file(mem_ctx, tree, fname, false);
4156 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4157
4158 info = torture_afpinfo_new(mem_ctx);
4159 torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
4160 memcpy(info->afpi_FinderInfo, type_creator, 8);
4161 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
4162 torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
4163
4164 ZERO_STRUCT(create);
4165 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4166 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
4167 create.in.fname = sname;
4168 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4169 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4170
4171 status = smb2_create(tree, mem_ctx, &create);
4172 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4173
4174 h1 = create.out.file.handle;
4175
4176 /* Delete stream via setinfo delete-on-close */
4177 ZERO_STRUCT(sfinfo);
4178 sfinfo.disposition_info.in.delete_on_close = 1;
4179 sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
4180 sfinfo.generic.in.file.handle = h1;
4181 status = smb2_setinfo_file(tree, &sfinfo);
4182 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set delete-on-close failed");
4183
4184 ret = check_stream_list(tree, tctx, fname, 2, streams, false);
4185 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4186
4187 ZERO_STRUCT(create);
4188 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4189 create.in.desired_access = SEC_FILE_ALL;
4190 create.in.fname = sname;
4191 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4192 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4193 status = smb2_create(tree, mem_ctx, &create);
4194 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_DELETE_PENDING,
4195 ret, done, "Got unexpected AFP_AfpInfo stream");
4196
4197 smb2_util_close(tree, h1);
4198
4199 ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
4200 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4201
4202 ZERO_STRUCT(create);
4203 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4204 create.in.desired_access = SEC_FILE_ALL;
4205 create.in.fname = sname;
4206 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4207 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4208 status = smb2_create(tree, mem_ctx, &create);
4209 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4210 ret, done, "Got unexpected AFP_AfpInfo stream");
4211
4212 done:
4213 smb2_util_unlink(tree, fname);
4214 smb2_util_rmdir(tree, BASEDIR);
4215 return ret;
4216 }
4217
4218 static bool test_setinfo_eof(struct torture_context *tctx,
4219 struct smb2_tree *tree)
4220 {
4221 bool ret = true;
4222 NTSTATUS status;
4223 struct smb2_create create;
4224 union smb_setfileinfo sfinfo;
4225 struct smb2_handle h1;
4226 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4227 const char *fname = BASEDIR "\\file";
4228 const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
4229 const char *type_creator = "SMB,OLE!";
4230 AfpInfo *info = NULL;
4231 const char *streams_afpinfo[] = {
4232 "::$DATA",
4233 AFPINFO_STREAM
4234 };
4235
4236 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
4237
4238 torture_comment(tctx, "Set AFP_AfpInfo EOF to 61, 1 and 0\n");
4239
4240 smb2_deltree(tree, BASEDIR);
4241 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4242 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
4243 smb2_util_close(tree, h1);
4244 ret = torture_setup_file(mem_ctx, tree, fname, false);
4245 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4246
4247 info = torture_afpinfo_new(mem_ctx);
4248 torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
4249 memcpy(info->afpi_FinderInfo, type_creator, 8);
4250 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
4251 torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
4252
4253 ZERO_STRUCT(create);
4254 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4255 create.in.desired_access = SEC_FILE_ALL;
4256 create.in.fname = sname;
4257 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4258 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4259
4260 status = smb2_create(tree, mem_ctx, &create);
4261 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4262
4263 h1 = create.out.file.handle;
4264
4265 torture_comment(tctx, "Set AFP_AfpInfo EOF to 61\n");
4266
4267 /* Test setinfo end-of-file info */
4268 ZERO_STRUCT(sfinfo);
4269 sfinfo.generic.in.file.handle = h1;
4270 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
4271 sfinfo.position_information.in.position = 61;
4272 status = smb2_setinfo_file(tree, &sfinfo);
4273 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_ALLOTTED_SPACE_EXCEEDED,
4274 ret, done, "set eof 61 failed");
4275
4276 torture_comment(tctx, "Set AFP_AfpInfo EOF to 1\n");
4277
4278 /* Truncation returns success, but has no effect */
4279 ZERO_STRUCT(sfinfo);
4280 sfinfo.generic.in.file.handle = h1;
4281 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
4282 sfinfo.position_information.in.position = 1;
4283 status = smb2_setinfo_file(tree, &sfinfo);
4284 torture_assert_ntstatus_ok_goto(tctx, status,
4285 ret, done, "set eof 1 failed");
4286 smb2_util_close(tree, h1);
4287
4288 ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
4289 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4290
4291 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
4292 0, 60, 16, 8, type_creator);
4293 torture_assert_goto(tctx, ret == true, ret, done, "FinderInfo changed");
4294
4295 ZERO_STRUCT(create);
4296 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4297 create.in.desired_access = SEC_FILE_ALL;
4298 create.in.fname = sname;
4299 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4300 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4301
4302 status = smb2_create(tree, mem_ctx, &create);
4303 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4304
4305 h1 = create.out.file.handle;
4306
4307 /*
4308 * Delete stream via setinfo end-of-file info to 0, should
4309 * return success but stream MUST NOT deleted
4310 */
4311 ZERO_STRUCT(sfinfo);
4312 sfinfo.generic.in.file.handle = h1;
4313 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
4314 sfinfo.position_information.in.position = 0;
4315 status = smb2_setinfo_file(tree, &sfinfo);
4316 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set eof 0 failed");
4317
4318 smb2_util_close(tree, h1);
4319
4320 ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
4321 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4322
4323 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
4324 0, 60, 16, 8, type_creator);
4325 torture_assert_goto(tctx, ret == true, ret, done, "FinderInfo changed");
4326
4327 done:
4328 smb2_util_unlink(tree, fname);
4329 smb2_util_rmdir(tree, BASEDIR);
4330 return ret;
4331 }
4332
4333 static bool test_afpinfo_all0(struct torture_context *tctx,
4334 struct smb2_tree *tree)
4335 {
4336 bool ret = true;
4337 NTSTATUS status;
4338 struct smb2_create create;
4339 struct smb2_handle h1 = {{0}};
4340 struct smb2_handle baseh = {{0}};
4341 union smb_setfileinfo setfinfo;
4342 union smb_fileinfo getfinfo;
4343 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4344 const char *fname = BASEDIR "\\file";
4345 const char *sname = BASEDIR "\\file" AFPINFO_STREAM;
4346 const char *type_creator = "SMB,OLE!";
4347 AfpInfo *info = NULL;
4348 char *infobuf = NULL;
4349 const char *streams_basic[] = {
4350 "::$DATA"
4351 };
4352 const char *streams_afpinfo[] = {
4353 "::$DATA",
4354 AFPINFO_STREAM
4355 };
4356
4357 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
4358
4359 torture_comment(tctx, "Write all 0 to AFP_AfpInfo and see what happens\n");
4360
4361 smb2_deltree(tree, BASEDIR);
4362 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4363 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
4364 smb2_util_close(tree, h1);
4365 ret = torture_setup_file(mem_ctx, tree, fname, false);
4366 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4367
4368 info = torture_afpinfo_new(mem_ctx);
4369 torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
4370 memcpy(info->afpi_FinderInfo, type_creator, 8);
4371 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
4372 torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
4373
4374 ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
4375 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4376
4377 /* Write all 0 to AFP_AfpInfo */
4378 memset(info->afpi_FinderInfo, 0, AFP_FinderSize);
4379 infobuf = torture_afpinfo_pack(mem_ctx, info);
4380 torture_assert_not_null_goto(tctx, infobuf, ret, done,
4381 "torture_afpinfo_pack failed\n");
4382
4383 ZERO_STRUCT(create);
4384 create.in.desired_access = SEC_FILE_ALL;
4385 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4386 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4387 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
4388 create.in.fname = fname;
4389
4390 status = smb2_create(tree, mem_ctx, &create);
4391 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4392 "smb2_create failed\n");
4393 baseh = create.out.file.handle;
4394
4395 ZERO_STRUCT(create);
4396 create.in.desired_access = SEC_FILE_ALL;
4397 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4398 create.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
4399 create.in.fname = sname;
4400
4401 status = smb2_create(tree, mem_ctx, &create);
4402 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4403 "smb2_create failed\n");
4404 h1 = create.out.file.handle;
4405
4406 status = smb2_util_write(tree, h1, infobuf, 0, AFP_INFO_SIZE);
4407 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4408 "smb2_util_write failed\n");
4409
4410 /*
4411 * Get stream information on open handle, must return only default
4412 * stream, the AFP_AfpInfo stream must not be returned.
4413 */
4414
4415 ZERO_STRUCT(getfinfo);
4416 getfinfo.generic.level = RAW_FILEINFO_STREAM_INFORMATION;
4417 getfinfo.generic.in.file.handle = baseh;
4418
4419 status = smb2_getinfo_file(tree, tctx, &getfinfo);
4420 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4421 "get stream info\n");
4422
4423 torture_assert_int_equal_goto(tctx, getfinfo.stream_info.out.num_streams,
4424 1, ret, done, "stream count");
4425
4426 smb2_util_close(tree, baseh);
4427 ZERO_STRUCT(baseh);
4428
4429 /*
4430 * Try to set some file-basic-info (time) on the stream. This catches
4431 * naive implementation mistakes that simply deleted the backing store
4432 * from the filesystem in the zero-out step.
4433 */
4434
4435 ZERO_STRUCT(setfinfo);
4436 unix_to_nt_time(&setfinfo.basic_info.in.write_time, time(NULL));
4437 setfinfo.basic_info.in.attrib = 0x20;
4438 setfinfo.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
4439 setfinfo.generic.in.file.handle = h1;
4440
4441 status = smb2_setinfo_file(tree, &setfinfo);
4442 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4443 "smb2_getinfo_file failed\n");
4444
4445 ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
4446 torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
4447
4448 smb2_util_close(tree, h1);
4449 ZERO_STRUCT(h1);
4450
4451 ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
4452 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4453
4454 done:
4455 if (!smb2_util_handle_empty(h1)) {
4456 smb2_util_close(tree, h1);
4457 }
4458 if (!smb2_util_handle_empty(baseh)) {
4459 smb2_util_close(tree, baseh);
4460 }
4461 smb2_util_unlink(tree, fname);
4462 smb2_util_rmdir(tree, BASEDIR);
4463 return ret;
4464 }
4465
4466 static bool test_create_delete_on_close_resource(struct torture_context *tctx,
4467 struct smb2_tree *tree)
4468 {
4469 bool ret = true;
4470 NTSTATUS status;
4471 struct smb2_create create;
4472 struct smb2_handle h1;
4473 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4474 const char *fname = BASEDIR "\\file";
4475 const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
4476 const char *streams_basic[] = {
4477 "::$DATA"
4478 };
4479 const char *streams_afpresource[] = {
4480 "::$DATA",
4481 AFPRESOURCE_STREAM
4482 };
4483
4484 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
4485
4486 torture_comment(tctx, "Checking whether create with delete-on-close is ignored for AFP_AfpResource\n");
4487
4488 smb2_deltree(tree, BASEDIR);
4489 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4490 torture_assert_ntstatus_ok(tctx, status, "torture_smb2_testdir");
4491 smb2_util_close(tree, h1);
4492 ret = torture_setup_file(mem_ctx, tree, fname, false);
4493 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4494
4495 torture_comment(tctx, "Opening not existing AFP_AfpResource\n");
4496
4497 ZERO_STRUCT(create);
4498 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4499 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
4500 create.in.fname = sname;
4501
4502 status = smb2_create(tree, mem_ctx, &create);
4503 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4504 ret, done, "Got unexpected AFP_AfpResource stream");
4505
4506 ZERO_STRUCT(create);
4507 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4508 create.in.desired_access = SEC_FILE_ALL;
4509 create.in.fname = sname;
4510
4511 status = smb2_create(tree, mem_ctx, &create);
4512 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4513 ret, done, "Got unexpected AFP_AfpResource stream");
4514
4515 ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
4516 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4517
4518 torture_comment(tctx, "Trying to delete AFP_AfpResource via create with delete-on-close\n");
4519
4520 ret = write_stream(tree, __location__, tctx, mem_ctx,
4521 fname, AFPRESOURCE_STREAM_NAME,
4522 0, 10, "1234567890");
4523 torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
4524
4525 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM_NAME,
4526 0, 10, 0, 10, "1234567890");
4527 torture_assert_goto(tctx, ret == true, ret, done, "Bad content from AFP_AfpResource");
4528
4529 ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
4530 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4531
4532 ZERO_STRUCT(create);
4533 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4534 create.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
4535 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
4536 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4537 create.in.fname = sname;
4538 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4539
4540 status = smb2_create(tree, mem_ctx, &create);
4541 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4542
4543 h1 = create.out.file.handle;
4544 smb2_util_close(tree, h1);
4545
4546 ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
4547 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4548
4549 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM_NAME,
4550 0, 10, 0, 10, "1234567890");
4551 torture_assert_goto(tctx, ret == true, ret, done, "Bad content from AFP_AfpResource");
4552
4553 done:
4554 smb2_util_unlink(tree, fname);
4555 smb2_util_rmdir(tree, BASEDIR);
4556 return ret;
4557 }
4558
4559 static bool test_setinfo_delete_on_close_resource(struct torture_context *tctx,
4560 struct smb2_tree *tree)
4561 {
4562 bool ret = true;
4563 NTSTATUS status;
4564 struct smb2_create create;
4565 union smb_setfileinfo sfinfo;
4566 struct smb2_handle h1;
4567 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4568 const char *fname = BASEDIR "\\file";
4569 const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
4570 const char *streams_afpresource[] = {
4571 "::$DATA",
4572 AFPRESOURCE_STREAM
4573 };
4574
4575 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
4576
4577 torture_comment(tctx, "Trying to delete AFP_AfpResource via setinfo with delete-on-close\n");
4578
4579 smb2_deltree(tree, BASEDIR);
4580 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4581 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
4582 smb2_util_close(tree, h1);
4583 ret = torture_setup_file(mem_ctx, tree, fname, false);
4584 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4585
4586 ret = write_stream(tree, __location__, tctx, mem_ctx,
4587 fname, AFPRESOURCE_STREAM_NAME,
4588 10, 10, "1234567890");
4589 torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
4590
4591 ZERO_STRUCT(create);
4592 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4593 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
4594 create.in.fname = sname;
4595 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4596 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4597
4598 status = smb2_create(tree, mem_ctx, &create);
4599 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4600
4601 h1 = create.out.file.handle;
4602
4603 /* Try to delete stream via setinfo delete-on-close */
4604 ZERO_STRUCT(sfinfo);
4605 sfinfo.disposition_info.in.delete_on_close = 1;
4606 sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
4607 sfinfo.generic.in.file.handle = h1;
4608 status = smb2_setinfo_file(tree, &sfinfo);
4609 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set delete-on-close failed");
4610
4611 smb2_util_close(tree, h1);
4612
4613 ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
4614 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4615
4616 ZERO_STRUCT(create);
4617 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4618 create.in.desired_access = SEC_FILE_ALL;
4619 create.in.fname = sname;
4620 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4621 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4622 status = smb2_create(tree, mem_ctx, &create);
4623 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4624 "Got unexpected AFP_AfpResource stream");
4625
4626 done:
4627 smb2_util_unlink(tree, fname);
4628 smb2_util_rmdir(tree, BASEDIR);
4629 return ret;
4630 }
4631
4632 static bool test_setinfo_eof_resource(struct torture_context *tctx,
4633 struct smb2_tree *tree)
4634 {
4635 bool ret = true;
4636 NTSTATUS status;
4637 struct smb2_create create;
4638 union smb_setfileinfo sfinfo;
4639 union smb_fileinfo finfo;
4640 struct smb2_handle h1;
4641 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4642 const char *fname = BASEDIR "\\file";
4643 const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
4644 const char *streams_basic[] = {
4645 "::$DATA"
4646 };
4647
4648 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
4649
4650 ret = enable_aapl(tctx, tree);
4651 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
4652
4653 torture_comment(tctx, "Set AFP_AfpResource EOF to 1 and 0\n");
4654
4655 smb2_deltree(tree, BASEDIR);
4656 status = torture_smb2_testdir(tree, BASEDIR, &h1);
4657 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
4658 smb2_util_close(tree, h1);
4659 ret = torture_setup_file(mem_ctx, tree, fname, false);
4660 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4661
4662 ret = write_stream(tree, __location__, tctx, mem_ctx,
4663 fname, AFPRESOURCE_STREAM_NAME,
4664 10, 10, "1234567890");
4665 torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
4666
4667 ZERO_STRUCT(create);
4668 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4669 create.in.desired_access = SEC_FILE_ALL;
4670 create.in.fname = sname;
4671 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4672 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4673
4674 status = smb2_create(tree, mem_ctx, &create);
4675 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4676
4677 h1 = create.out.file.handle;
4678
4679 torture_comment(tctx, "Set AFP_AfpResource EOF to 1\n");
4680
4681 /* Test setinfo end-of-file info */
4682 ZERO_STRUCT(sfinfo);
4683 sfinfo.generic.in.file.handle = h1;
4684 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
4685 sfinfo.position_information.in.position = 1;
4686 status = smb2_setinfo_file(tree, &sfinfo);
4687 torture_assert_ntstatus_ok_goto(tctx, status,
4688 ret, done, "set eof 1 failed");
4689
4690 smb2_util_close(tree, h1);
4691
4692 /* Check size == 1 */
4693 ZERO_STRUCT(create);
4694 create.in.fname = sname;
4695 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4696 create.in.desired_access = SEC_FILE_ALL;
4697 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4698 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4699 status = smb2_create(tree, mem_ctx, &create);
4700 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4701
4702 h1 = create.out.file.handle;
4703
4704 ZERO_STRUCT(finfo);
4705 finfo.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
4706 finfo.generic.in.file.handle = h1;
4707 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
4708 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_getinfo_file failed");
4709
4710 smb2_util_close(tree, h1);
4711
4712 torture_assert_goto(tctx, finfo.all_info.out.size == 1, ret, done, "size != 1");
4713
4714 ZERO_STRUCT(create);
4715 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4716 create.in.desired_access = SEC_FILE_ALL;
4717 create.in.fname = sname;
4718 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4719 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4720
4721 status = smb2_create(tree, mem_ctx, &create);
4722 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4723
4724 h1 = create.out.file.handle;
4725
4726 /*
4727 * Delete stream via setinfo end-of-file info to 0, this
4728 * should delete the stream.
4729 */
4730 ZERO_STRUCT(sfinfo);
4731 sfinfo.generic.in.file.handle = h1;
4732 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
4733 sfinfo.position_information.in.position = 0;
4734 status = smb2_setinfo_file(tree, &sfinfo);
4735 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set eof 0 failed");
4736
4737 smb2_util_close(tree, h1);
4738
4739 ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
4740 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
4741
4742 ZERO_STRUCT(create);
4743 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4744 create.in.desired_access = SEC_FILE_ALL;
4745 create.in.fname = sname;
4746 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4747 create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
4748
4749 status = smb2_create(tree, mem_ctx, &create);
4750 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
4751 ret, done, "smb2_create failed");
4752
4753 done:
4754 smb2_util_unlink(tree, fname);
4755 smb2_util_rmdir(tree, BASEDIR);
4756 return ret;
4757 }
4758
4759 /*
4760 * This tests that right after creating the AFP_AfpInfo stream,
4761 * reading from the stream returns an empty, default metadata blob of
4762 * 60 bytes.
4763 *
4764 * NOTE: against OS X SMB server this only works if the read request
4765 * is compounded with the create that created the stream, is fails
4766 * otherwise. We don't care...
4767 */
4768 static bool test_null_afpinfo(struct torture_context *tctx,
4769 struct smb2_tree *tree)
4770 {
4771 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4772 const char *fname = "test_null_afpinfo";
4773 const char *sname = "test_null_afpinfo" AFPINFO_STREAM_NAME;
4774 NTSTATUS status;
4775 bool ret = true;
4776 struct smb2_request *req[3];
4777 struct smb2_handle handle;
4778 struct smb2_create create;
4779 struct smb2_read read;
4780 AfpInfo *afpinfo = NULL;
4781 char *afpinfo_buf = NULL;
4782 const char *type_creator = "SMB,OLE!";
4783 struct smb2_handle handle2;
4784 struct smb2_read r;
4785
4786 torture_comment(tctx, "Checking create of AfpInfo stream\n");
4787
4788 smb2_util_unlink(tree, fname);
4789
4790 ret = torture_setup_file(mem_ctx, tree, fname, false);
4791 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
4792
4793 ZERO_STRUCT(create);
4794 create.in.desired_access = SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA;
4795 create.in.share_access = FILE_SHARE_READ | FILE_SHARE_DELETE;
4796 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4797 create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
4798 create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
4799 create.in.fname = sname;
4800
4801 smb2_transport_compound_start(tree->session->transport, 2);
4802
4803 req[0] = smb2_create_send(tree, &create);
4804
4805 handle.data[0] = UINT64_MAX;
4806 handle.data[1] = UINT64_MAX;
4807
4808 smb2_transport_compound_set_related(tree->session->transport, true);
4809
4810 ZERO_STRUCT(read);
4811 read.in.file.handle = handle;
4812 read.in.length = AFP_INFO_SIZE;
4813 req[1] = smb2_read_send(tree, &read);
4814
4815 status = smb2_create_recv(req[0], tree, &create);
4816 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create_recv failed");
4817
4818 handle = create.out.file.handle;
4819
4820 status = smb2_read_recv(req[1], tree, &read);
4821 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_read_recv failed");
4822
4823 status = torture_smb2_testfile_access(tree, sname, &handle2,
4824 SEC_FILE_READ_DATA);
4825 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4826 "torture_smb2_testfile failed\n");
4827 r = (struct smb2_read) {
4828 .in.file.handle = handle2,
4829 .in.length = AFP_INFO_SIZE,
4830 };
4831
4832 status = smb2_read(tree, tree, &r);
4833 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4834 "torture_smb2_testfile failed\n");
4835 smb2_util_close(tree, handle2);
4836
4837 afpinfo = torture_afpinfo_new(mem_ctx);
4838 torture_assert_goto(tctx, afpinfo != NULL, ret, done, "torture_afpinfo_new failed");
4839
4840 memcpy(afpinfo->afpi_FinderInfo, type_creator, 8);
4841
4842 afpinfo_buf = torture_afpinfo_pack(tctx, afpinfo);
4843 torture_assert_goto(tctx, afpinfo_buf != NULL, ret, done, "torture_afpinfo_new failed");
4844
4845 status = smb2_util_write(tree, handle, afpinfo_buf, 0, AFP_INFO_SIZE);
4846 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_write failed");
4847
4848 smb2_util_close(tree, handle);
4849
4850 ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
4851 0, 60, 16, 8, type_creator);
4852 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
4853
4854 done:
4855 smb2_util_unlink(tree, fname);
4856 talloc_free(mem_ctx);
4857 return ret;
4858 }
4859
4860 static bool test_delete_file_with_rfork(struct torture_context *tctx,
4861 struct smb2_tree *tree)
4862 {
4863 const char *fname = "torture_write_rfork_io";
4864 const char *rfork_content = "1234567890";
4865 NTSTATUS status;
4866 bool ret = true;
4867
4868 smb2_util_unlink(tree, fname);
4869
4870 torture_comment(tctx, "Test deleting file with resource fork\n");
4871
4872 ret = torture_setup_file(tctx, tree, fname, false);
4873 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed\n");
4874
4875 ret = write_stream(tree, __location__, tctx, tctx,
4876 fname, AFPRESOURCE_STREAM_NAME,
4877 10, 10, rfork_content);
4878 torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed\n");
4879
4880 ret = check_stream(tree, __location__, tctx, tctx,
4881 fname, AFPRESOURCE_STREAM_NAME,
4882 0, 20, 10, 10, rfork_content);
4883 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed\n");
4884
4885 status = smb2_util_unlink(tree, fname);
4886 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "check_stream failed\n");
4887
4888 done:
4889 return ret;
4890 }
4891
4892 static bool test_rename_and_read_rsrc(struct torture_context *tctx,
4893 struct smb2_tree *tree)
4894 {
4895 bool ret = true;
4896 NTSTATUS status;
4897 struct smb2_create create, create2;
4898 struct smb2_handle h1, h2;
4899 const char *fname = "test_rename_openfile";
4900 const char *sname = "test_rename_openfile" AFPRESOURCE_STREAM_NAME;
4901 const char *fname_renamed = "test_rename_openfile_renamed";
4902 const char *data = "1234567890";
4903 union smb_setfileinfo sinfo;
4904 bool server_is_macos = torture_setting_bool(tctx, "osx", false);
4905 NTSTATUS expected_status;
4906
4907 ret = enable_aapl(tctx, tree);
4908 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
4909
4910 torture_comment(tctx, "Create file with resource fork\n");
4911
4912 ret = torture_setup_file(tctx, tree, fname, false);
4913 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
4914
4915 ret = write_stream(tree, __location__, tctx, tctx,
4916 fname, AFPRESOURCE_STREAM_NAME, 0, 10, data);
4917 torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
4918
4919 torture_comment(tctx, "Open resource fork\n");
4920
4921 ZERO_STRUCT(create);
4922 create.in.desired_access = SEC_FILE_ALL;
4923 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
4924 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4925 create.in.create_disposition = NTCREATEX_DISP_OPEN;
4926 create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
4927 create.in.fname = sname;
4928
4929 status = smb2_create(tree, tctx, &create);
4930 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4931
4932 h1 = create.out.file.handle;
4933
4934 torture_comment(tctx, "Rename base file\n");
4935
4936 ZERO_STRUCT(create2);
4937 create2.in.desired_access = SEC_FILE_ALL;
4938 create2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
4939 create2.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
4940 create2.in.create_disposition = NTCREATEX_DISP_OPEN;
4941 create2.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
4942 create2.in.fname = fname;
4943
4944 status = smb2_create(tree, tctx, &create2);
4945 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
4946
4947 h2 = create2.out.file.handle;
4948
4949 ZERO_STRUCT(sinfo);
4950 sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
4951 sinfo.rename_information.in.file.handle = h2;
4952 sinfo.rename_information.in.overwrite = 0;
4953 sinfo.rename_information.in.root_fid = 0;
4954 sinfo.rename_information.in.new_name = fname_renamed;
4955
4956 if (server_is_macos) {
4957 expected_status = NT_STATUS_SHARING_VIOLATION;
4958 } else {
4959 expected_status = NT_STATUS_ACCESS_DENIED;
4960 }
4961
4962 status = smb2_setinfo_file(tree, &sinfo);
4963 torture_assert_ntstatus_equal_goto(
4964 tctx, status, expected_status, ret, done,
4965 "smb2_setinfo_file failed");
4966
4967 smb2_util_close(tree, h2);
4968
4969 status = smb2_util_write(tree, h1, "foo", 0, 3);
4970 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
4971 "write failed\n");
4972
4973 smb2_util_close(tree, h1);
4974
4975 done:
4976 smb2_util_unlink(tree, fname);
4977 smb2_util_unlink(tree, fname_renamed);
4978
4979 return ret;
4980 }
4981
4982 static bool test_readdir_attr_illegal_ntfs(struct torture_context *tctx,
4983 struct smb2_tree *tree)
4984 {
4985 TALLOC_CTX *mem_ctx = talloc_new(tctx);
4986 const char *name = "test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */
4987 const char *fname = BASEDIR "\\test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */
4988 NTSTATUS status;
4989 struct smb2_handle testdirh;
4990 bool ret = true;
4991 struct smb2_create io;
4992 AfpInfo *info;
4993 const char *type_creator = "SMB,OLE!";
4994 struct smb2_find f;
4995 unsigned int count;
4996 union smb_search_data *d;
4997 uint64_t rfork_len;
4998 unsigned int i;
4999
5000 smb2_deltree(tree, BASEDIR);
5001
5002 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
5003 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir failed");
5004 smb2_util_close(tree, testdirh);
5005
5006 torture_comment(tctx, "Enabling AAPL\n");
5007
5008 ret = enable_aapl(tctx, tree);
5009 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
5010
5011 /*
5012 * Now that Requested AAPL extensions are enabled, setup some
5013 * Mac files with metadata and resource fork
5014 */
5015
5016 torture_comment(tctx, "Preparing file\n");
5017
5018 ret = torture_setup_file(mem_ctx, tree, fname, false);
5019 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
5020
5021 info = torture_afpinfo_new(mem_ctx);
5022 torture_assert_not_null_goto(tctx, info, ret, done, "torture_afpinfo_new failed");
5023
5024 memcpy(info->afpi_FinderInfo, type_creator, 8);
5025 ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
5026 torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
5027
5028 ret = write_stream(tree, __location__, tctx, mem_ctx,
5029 fname, AFPRESOURCE_STREAM_NAME,
5030 0, 3, "foo");
5031 torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
5032
5033 /*
5034 * Ok, file is prepared, now call smb2/find
5035 */
5036
5037 torture_comment(tctx, "Issue find\n");
5038
5039 ZERO_STRUCT(io);
5040 io.in.desired_access = SEC_RIGHTS_DIR_READ;
5041 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
5042 io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
5043 io.in.share_access = (NTCREATEX_SHARE_ACCESS_READ |
5044 NTCREATEX_SHARE_ACCESS_WRITE |
5045 NTCREATEX_SHARE_ACCESS_DELETE);
5046 io.in.create_disposition = NTCREATEX_DISP_OPEN;
5047 io.in.fname = BASEDIR;
5048 status = smb2_create(tree, tctx, &io);
5049 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
5050
5051 ZERO_STRUCT(f);
5052 f.in.file.handle = io.out.file.handle;
5053 f.in.pattern = "*";
5054 f.in.max_response_size = 0x1000;
5055 f.in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO;
5056
5057 status = smb2_find_level(tree, tree, &f, &count, &d);
5058 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_find_level failed");
5059
5060 status = smb2_util_close(tree, io.out.file.handle);
5061 torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_close failed");
5062
5063 torture_comment(tctx, "Checking find response with enriched macOS metadata\n");
5064
5065 for (i = 0; i < count; i++) {
5066 const char *found = d[i].id_both_directory_info.name.s;
5067
5068 if (!strcmp(found, ".") || !strcmp(found, ".."))
5069 continue;
5070 if (strncmp(found, "._", 2) == 0) {
5071 continue;
5072 }
5073 break;
5074 }
5075
5076 torture_assert_str_equal_goto(tctx,
5077 d[i].id_both_directory_info.name.s, name,
5078 ret, done, "bad name");
5079
5080 rfork_len = BVAL(d[i].id_both_directory_info.short_name_buf, 0);
5081 torture_assert_int_equal_goto(tctx, rfork_len, 3, ret, done, "bad resource fork length");
5082
5083 torture_assert_mem_equal_goto(tctx, type_creator,
5084 d[i].id_both_directory_info.short_name_buf + 8,
5085 8, ret, done, "Bad FinderInfo");
5086 done:
5087 smb2_util_unlink(tree, fname);
5088 smb2_deltree(tree, BASEDIR);
5089 talloc_free(mem_ctx);
5090 return ret;
5091 }
5092
5093 static bool test_invalid_afpinfo(struct torture_context *tctx,
5094 struct smb2_tree *tree1,
5095 struct smb2_tree *tree2)
5096 {
5097 const char *fname = "filtest_invalid_afpinfo";
5098 const char *sname = "filtest_invalid_afpinfo" AFPINFO_STREAM_NAME;
5099 struct smb2_create create;
5100 const char *streams_basic[] = {
5101 "::$DATA"
5102 };
5103 const char *streams_afpinfo[] = {
5104 "::$DATA",
5105 AFPINFO_STREAM
5106 };
5107 NTSTATUS status;
5108 bool ret = true;
5109
5110 if (tree2 == NULL) {
5111 torture_skip_goto(tctx, done, "need second share without fruit\n");
5112 }
5113
5114 torture_comment(tctx, "Testing invalid AFP_AfpInfo stream\n");
5115
5116 ret = torture_setup_file(tctx, tree2, fname, false);
5117 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
5118
5119 ret = write_stream(tree2, __location__, tctx, tctx,
5120 fname, AFPINFO_STREAM_NAME,
5121 0, 3, "foo");
5122 torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
5123
5124 ret = check_stream_list(tree2, tctx, fname, 2, streams_afpinfo, false);
5125 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
5126
5127 torture_comment(tctx, "Listing streams, bad AFPINFO stream must not be present\n");
5128
5129 ret = check_stream_list(tree1, tctx, fname, 1, streams_basic, false);
5130 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
5131
5132 torture_comment(tctx, "Try to open AFPINFO stream, must fail\n");
5133
5134 ZERO_STRUCT(create);
5135 create.in.desired_access = SEC_FILE_ALL;
5136 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
5137 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
5138 create.in.create_disposition = NTCREATEX_DISP_OPEN;
5139 create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
5140 create.in.fname = sname;
5141
5142 status = smb2_create(tree1, tctx, &create);
5143 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
5144 ret, done, "Stream still around?");
5145
5146 done:
5147 smb2_util_unlink(tree1, fname);
5148 return ret;
5149 }
5150
5151 static bool test_writing_afpinfo(struct torture_context *tctx,
5152 struct smb2_tree *tree)
5153 {
5154 const char *fname = "filtest_invalid_afpinfo";
5155 const char *sname = "filtest_invalid_afpinfo" AFPINFO_STREAM;
5156 const char *streams_afpinfo[] = {
5157 "::$DATA",
5158 AFPINFO_STREAM
5159 };
5160 bool ret = true;
5161 static AfpInfo *afpi = NULL;
5162 char *buf = NULL;
5163 char *afpi_buf = NULL;
5164 char *zero_buf = NULL;
5165 bool broken_osx = torture_setting_bool(tctx, "broken_osx_45759458", false);
5166 off_t min_offset_for_2streams = 16;
5167 int i;
5168 NTSTATUS status;
5169 struct test_sizes {
5170 off_t offset;
5171 size_t size;
5172 bool expected_result;
5173 } test_sizes[] = {
5174 { 0, 1, false},
5175 { 0, 2, false},
5176 { 0, 3, true},
5177 { 0, 4, true},
5178 { 0, 14, true},
5179 { 0, 15, true},
5180 { 0, 16, true},
5181 { 0, 24, true},
5182 { 0, 34, true},
5183 { 0, 44, true},
5184 { 0, 54, true},
5185 { 0, 55, true},
5186 { 0, 56, true},
5187 { 0, 57, true},
5188 { 0, 58, true},
5189 { 0, 59, true},
5190 { 0, 60, true},
5191 { 0, 61, true},
5192 { 0, 64, true},
5193 { 0, 1024, true},
5194 { 0, 10064, true},
5195
5196 { 1, 1, false},
5197 { 1, 2, false},
5198 { 1, 3, false},
5199 { 1, 4, false},
5200 { 1, 14, false},
5201 { 1, 15, false},
5202 { 1, 16, false},
5203 { 1, 24, false},
5204 { 1, 34, false},
5205 { 1, 44, false},
5206 { 1, 54, false},
5207 { 1, 55, false},
5208 { 1, 56, false},
5209 { 1, 57, false},
5210 { 1, 58, false},
5211 { 1, 59, false},
5212 { 1, 60, true},
5213 { 1, 61, true},
5214 { 1, 1024, true},
5215 { 1, 10064, true},
5216
5217 { 30, 1, false},
5218 { 30, 2, false},
5219 { 30, 3, false},
5220 { 30, 4, false},
5221 { 30, 14, false},
5222 { 30, 15, false},
5223 { 30, 16, false},
5224 { 30, 24, false},
5225 { 30, 34, false},
5226 { 30, 44, false},
5227 { 30, 54, false},
5228 { 30, 55, false},
5229 { 30, 56, false},
5230 { 30, 57, false},
5231 { 30, 58, false},
5232 { 30, 59, false},
5233 { 30, 60, true},
5234 { 30, 61, true},
5235 { 30, 1024, true},
5236 { 30, 10064, true},
5237
5238 { 58, 1, false},
5239 { 58, 2, false},
5240 { 58, 3, false},
5241 { 58, 4, false},
5242 { 58, 14, false},
5243 { 58, 15, false},
5244 { 58, 16, false},
5245 { 58, 24, false},
5246 { 58, 34, false},
5247 { 58, 44, false},
5248 { 58, 54, false},
5249 { 58, 55, false},
5250 { 58, 56, false},
5251 { 58, 57, false},
5252 { 58, 58, false},
5253 { 58, 59, false},
5254 { 58, 60, true},
5255 { 58, 61, true},
5256 { 58, 1024, true},
5257 { 58, 10064, true},
5258
5259 { 59, 1, false},
5260 { 59, 2, false},
5261 { 59, 3, false},
5262 { 59, 4, false},
5263 { 59, 14, false},
5264 { 59, 15, false},
5265 { 59, 16, false},
5266 { 59, 24, false},
5267 { 59, 34, false},
5268 { 59, 44, false},
5269 { 59, 54, false},
5270 { 59, 55, false},
5271 { 59, 56, false},
5272 { 59, 57, false},
5273 { 59, 58, false},
5274 { 59, 59, false},
5275 { 59, 60, true},
5276 { 59, 61, true},
5277 { 59, 1024, true},
5278 { 59, 10064, true},
5279
5280 { 60, 1, false},
5281 { 60, 2, false},
5282 { 60, 3, false},
5283 { 60, 4, false},
5284 { 60, 14, false},
5285 { 60, 15, false},
5286 { 60, 16, false},
5287 { 60, 24, false},
5288 { 60, 34, false},
5289 { 60, 44, false},
5290 { 60, 54, false},
5291 { 60, 55, false},
5292 { 60, 56, false},
5293 { 60, 57, false},
5294 { 60, 58, false},
5295 { 60, 59, false},
5296 { 60, 60, true},
5297 { 60, 61, true},
5298 { 60, 1024, true},
5299 { 60, 10064, true},
5300
5301 { 61, 1, false},
5302 { 61, 2, false},
5303 { 61, 3, false},
5304 { 61, 4, false},
5305 { 61, 14, false},
5306 { 61, 15, false},
5307 { 61, 16, false},
5308 { 61, 24, false},
5309 { 61, 34, false},
5310 { 61, 44, false},
5311 { 61, 54, false},
5312 { 61, 55, false},
5313 { 61, 56, false},
5314 { 61, 57, false},
5315 { 61, 58, false},
5316 { 61, 59, false},
5317 { 61, 60, true},
5318 { 61, 61, true},
5319 { 61, 1024, true},
5320 { 61, 10064, true},
5321
5322 { 10000, 1, false},
5323 { 10000, 2, false},
5324 { 10000, 3, false},
5325 { 10000, 4, false},
5326 { 10000, 14, false},
5327 { 10000, 15, false},
5328 { 10000, 16, false},
5329 { 10000, 24, false},
5330 { 10000, 34, false},
5331 { 10000, 44, false},
5332 { 10000, 54, false},
5333 { 10000, 55, false},
5334 { 10000, 56, false},
5335 { 10000, 57, false},
5336 { 10000, 58, false},
5337 { 10000, 59, false},
5338 { 10000, 60, true},
5339 { 10000, 61, true},
5340 { 10000, 1024, true},
5341 { 10000, 10064, true},
5342
5343 { -1, 0, false},
5344 };
5345
5346 afpi = torture_afpinfo_new(tctx);
5347 torture_assert_not_null_goto(tctx, afpi, ret, done,
5348 "torture_afpinfo_new failed\n");
5349
5350 memcpy(afpi->afpi_FinderInfo, "FOO BAR ", 8);
5351
5352 buf = torture_afpinfo_pack(afpi, afpi);
5353 torture_assert_not_null_goto(tctx, buf, ret, done,
5354 "torture_afpinfo_pack failed\n");
5355
5356 afpi_buf = talloc_zero_array(tctx, char, 10064);
5357 torture_assert_not_null_goto(tctx, afpi_buf, ret, done,
5358 "talloc_zero_array failed\n");
5359 memcpy(afpi_buf, buf, 60);
5360
5361 zero_buf = talloc_zero_array(tctx, char, 10064);
5362 torture_assert_not_null_goto(tctx, zero_buf, ret, done,
5363 "talloc_zero_array failed\n");
5364
5365 ret = torture_setup_file(tctx, tree, fname, false);
5366 torture_assert_goto(tctx, ret == true, ret, done,
5367 "torture_setup_file\n");
5368
5369 for (i = 0; test_sizes[i].offset != -1; i++) {
5370 struct smb2_handle h;
5371 struct smb2_create c;
5372 int expected_num_streams;
5373 size_t fi_check_size;
5374
5375 torture_comment(tctx,
5376 "Test %d: offset=%jd size=%zu result=%s\n",
5377 i,
5378 (intmax_t)test_sizes[i].offset,
5379 test_sizes[i].size,
5380 test_sizes[i].expected_result ? "true":"false");
5381
5382
5383 c = (struct smb2_create) {
5384 .in.desired_access = SEC_FILE_WRITE_DATA,
5385 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
5386 .in.create_disposition = NTCREATEX_DISP_OPEN_IF,
5387 .in.fname = sname,
5388 };
5389
5390 status = smb2_create(tree, tree, &c);
5391 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
5392 "smb2_create\n");
5393 h = c.out.file.handle;
5394
5395 status = smb2_util_write(tree,
5396 h,
5397 zero_buf,
5398 test_sizes[i].offset,
5399 test_sizes[i].size);
5400 torture_assert_ntstatus_equal_goto(
5401 tctx, status, NT_STATUS_INVALID_PARAMETER,
5402 ret, done, "smb2_util_write\n");
5403
5404 status = smb2_util_write(tree,
5405 h,
5406 afpi_buf,
5407 test_sizes[i].offset,
5408 test_sizes[i].size);
5409 smb2_util_close(tree, h);
5410 if (test_sizes[i].expected_result == true) {
5411 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
5412 "smb2_util_write\n");
5413 } else {
5414 torture_assert_ntstatus_equal_goto(
5415 tctx, status, NT_STATUS_INVALID_PARAMETER,
5416 ret, done, "smb2_util_write\n");
5417 }
5418
5419 if (broken_osx) {
5420 /*
5421 * Currently macOS has a bug (Radar #45759458) where it
5422 * writes more bytes then requested from uninitialized
5423 * memory to the filesystem. That means it will likely
5424 * write data to FinderInfo so the stream is not empty
5425 * and thus listed when the number of streams is
5426 * queried.
5427 */
5428 min_offset_for_2streams = 2;
5429 }
5430
5431 if ((test_sizes[i].expected_result == true) &&
5432 (test_sizes[i].size > min_offset_for_2streams))
5433 {
5434 expected_num_streams = 2;
5435 } else {
5436 expected_num_streams = 1;
5437 }
5438
5439 ret = check_stream_list(tree, tctx, fname,
5440 expected_num_streams,
5441 streams_afpinfo, false);
5442 torture_assert_goto(tctx, ret == true, ret, done,
5443 "Bad streams\n");
5444
5445 if (test_sizes[i].expected_result == false) {
5446 continue;
5447 }
5448
5449 if (test_sizes[i].size <= 16) {
5450 /*
5451 * FinderInfo with the "FOO BAR " string we wrote above
5452 * would start at offset 16. Check whether this test
5453 * wrote 1 byte or more.
5454 */
5455 goto next;
5456 }
5457
5458 fi_check_size = test_sizes[i].size - 16;
5459 fi_check_size = MIN(fi_check_size, 8);
5460
5461 ret = check_stream(tree, __location__,
5462 tctx, tctx,
5463 fname, AFPINFO_STREAM,
5464 0, 60, 16, fi_check_size, "FOO BAR ");
5465 torture_assert_goto(tctx, ret == true, ret, done,
5466 "Bad streams\n");
5467
5468 next:
5469 status = smb2_util_unlink(tree, sname);
5470 if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
5471 bool missing_ok;
5472
5473 missing_ok = test_sizes[i].expected_result == false;
5474 missing_ok |= test_sizes[i].size <= 16;
5475
5476 torture_assert_goto(tctx, missing_ok,
5477 ret, done, "smb2_util_unlink\n");
5478 }
5479 }
5480
5481 done:
5482 smb2_util_unlink(tree, fname);
5483 return ret;
5484 }
5485
5486 static bool test_zero_file_id(struct torture_context *tctx,
5487 struct smb2_tree *tree)
5488 {
5489 const char *fname = "filtest_file_id";
5490 struct smb2_create create = {0};
5491 NTSTATUS status;
5492 bool ret = true;
5493 uint8_t zero_file_id[8] = {0};
5494
5495 torture_comment(tctx, "Testing zero file id\n");
5496
5497 ret = torture_setup_file(tctx, tree, fname, false);
5498 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
5499
5500 ZERO_STRUCT(create);
5501 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
5502 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
5503 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
5504 create.in.create_disposition = NTCREATEX_DISP_OPEN;
5505 create.in.fname = fname;
5506 create.in.query_on_disk_id = true;
5507
5508 status = smb2_create(tree, tctx, &create);
5509 torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, ret,
5510 done,
5511 "test file could not be opened");
5512 torture_assert_mem_not_equal_goto(tctx, create.out.on_disk_id,
5513 zero_file_id, 8, ret, done,
5514 "unexpected zero file id");
5515
5516 smb2_util_close(tree, create.out.file.handle);
5517
5518 ret = enable_aapl(tctx, tree);
5519 torture_assert(tctx, ret == true, "enable_aapl failed");
5520
5521 ZERO_STRUCT(create);
5522 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
5523 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
5524 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
5525 create.in.create_disposition = NTCREATEX_DISP_OPEN;
5526 create.in.fname = fname;
5527 create.in.query_on_disk_id = true;
5528
5529 status = smb2_create(tree, tctx, &create);
5530 torture_assert_ntstatus_equal_goto(
5531 tctx, status, NT_STATUS_OK, ret, done,
5532 "test file could not be opened with AAPL");
5533 torture_assert_mem_equal_goto(tctx, create.out.on_disk_id, zero_file_id,
5534 8, ret, done, "non-zero file id");
5535
5536 smb2_util_close(tree, create.out.file.handle);
5537
5538 done:
5539 smb2_util_unlink(tree, fname);
5540 return ret;
5541 }
5542
5543 static bool copy_one_stream(struct torture_context *torture,
5544 struct smb2_tree *tree,
5545 TALLOC_CTX *tmp_ctx,
5546 const char *src_sname,
5547 const char *dst_sname)
5548 {
5549 struct smb2_handle src_h = {{0}};
5550 struct smb2_handle dest_h = {{0}};
5551 NTSTATUS status;
5552 union smb_ioctl io;
5553 struct srv_copychunk_copy cc_copy;
5554 struct srv_copychunk_rsp cc_rsp;
5555 enum ndr_err_code ndr_ret;
5556 bool ok = false;
5557
5558 ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
5559 1, /* 1 chunk */
5560 src_sname,
5561 &src_h, 256, /* fill 256 byte src file */
5562 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
5563 dst_sname,
5564 &dest_h, 0, /* 0 byte dest file */
5565 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
5566 &cc_copy,
5567 &io);
5568 torture_assert_goto(torture, ok == true, ok, done,
5569 "setup copy chunk error\n");
5570
5571 /* copy all src file data (via a single chunk desc) */
5572 cc_copy.chunks[0].source_off = 0;
5573 cc_copy.chunks[0].target_off = 0;
5574 cc_copy.chunks[0].length = 256;
5575
5576 ndr_ret = ndr_push_struct_blob(
5577 &io.smb2.in.out, tmp_ctx, &cc_copy,
5578 (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
5579
5580 torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
5581 "ndr_push_srv_copychunk_copy\n");
5582
5583 status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
5584 torture_assert_ntstatus_ok_goto(torture, status, ok, done,
5585 "FSCTL_SRV_COPYCHUNK\n");
5586
5587 ndr_ret = ndr_pull_struct_blob(
5588 &io.smb2.out.out, tmp_ctx, &cc_rsp,
5589 (ndr_pull_flags_fn_t)ndr_pull_srv_copychunk_rsp);
5590
5591 torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
5592 "ndr_pull_srv_copychunk_rsp\n");
5593
5594 ok = check_copy_chunk_rsp(torture, &cc_rsp,
5595 1, /* chunks written */
5596 0, /* chunk bytes unsuccessfully written */
5597 256); /* total bytes written */
5598 torture_assert_goto(torture, ok == true, ok, done,
5599 "bad copy chunk response data\n");
5600
5601 ok = check_pattern(torture, tree, tmp_ctx, dest_h, 0, 256, 0);
5602 if (!ok) {
5603 torture_fail(torture, "inconsistent file data\n");
5604 }
5605
5606 done:
5607 if (!smb2_util_handle_empty(src_h)) {
5608 smb2_util_close(tree, src_h);
5609 }
5610 if (!smb2_util_handle_empty(dest_h)) {
5611 smb2_util_close(tree, dest_h);
5612 }
5613
5614 return ok;
5615 }
5616
5617 static bool copy_finderinfo_stream(struct torture_context *torture,
5618 struct smb2_tree *tree,
5619 TALLOC_CTX *tmp_ctx,
5620 const char *src_name,
5621 const char *dst_name)
5622 {
5623 struct smb2_handle src_h = {{0}};
5624 struct smb2_handle dest_h = {{0}};
5625 NTSTATUS status;
5626 union smb_ioctl io;
5627 struct srv_copychunk_copy cc_copy;
5628 struct srv_copychunk_rsp cc_rsp;
5629 enum ndr_err_code ndr_ret;
5630 const char *type_creator = "SMB,OLE!";
5631 AfpInfo *info = NULL;
5632 const char *src_name_afpinfo = NULL;
5633 const char *dst_name_afpinfo = NULL;
5634 bool ok = false;
5635
5636 src_name_afpinfo = talloc_asprintf(tmp_ctx, "%s%s", src_name,
5637 AFPINFO_STREAM);
5638 torture_assert_not_null_goto(torture, src_name_afpinfo, ok, done,
5639 "talloc_asprintf failed\n");
5640
5641 dst_name_afpinfo = talloc_asprintf(tmp_ctx, "%s%s", dst_name,
5642 AFPINFO_STREAM);
5643 torture_assert_not_null_goto(torture, dst_name_afpinfo, ok, done,
5644 "talloc_asprintf failed\n");
5645
5646 info = torture_afpinfo_new(tmp_ctx);
5647 torture_assert_not_null_goto(torture, info, ok, done,
5648 "torture_afpinfo_new failed\n");
5649
5650 memcpy(info->afpi_FinderInfo, type_creator, 8);
5651 ok = torture_write_afpinfo(tree, torture, tmp_ctx, src_name, info);
5652 torture_assert_goto(torture, ok == true, ok, done,
5653 "torture_write_afpinfo failed\n");
5654
5655 ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
5656 1, /* 1 chunk */
5657 src_name_afpinfo,
5658 &src_h, 0,
5659 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
5660 dst_name_afpinfo,
5661 &dest_h, 0,
5662 SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
5663 &cc_copy,
5664 &io);
5665 torture_assert_goto(torture, ok == true, ok, done,
5666 "setup copy chunk error\n");
5667
5668 /* copy all src file data (via a single chunk desc) */
5669 cc_copy.chunks[0].source_off = 0;
5670 cc_copy.chunks[0].target_off = 0;
5671 cc_copy.chunks[0].length = 60;
5672
5673 ndr_ret = ndr_push_struct_blob(
5674 &io.smb2.in.out, tmp_ctx, &cc_copy,
5675 (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
5676
5677 torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
5678 "ndr_push_srv_copychunk_copy\n");
5679
5680 status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
5681 torture_assert_ntstatus_ok_goto(torture, status, ok, done,
5682 "FSCTL_SRV_COPYCHUNK\n");
5683
5684 ndr_ret = ndr_pull_struct_blob(
5685 &io.smb2.out.out, tmp_ctx, &cc_rsp,
5686 (ndr_pull_flags_fn_t)ndr_pull_srv_copychunk_rsp);
5687
5688 torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
5689 "ndr_pull_srv_copychunk_rsp\n");
5690
5691 smb2_util_close(tree, src_h);
5692 ZERO_STRUCT(src_h);
5693 smb2_util_close(tree, dest_h);
5694 ZERO_STRUCT(dest_h);
5695
5696 ok = check_copy_chunk_rsp(torture, &cc_rsp,
5697 1, /* chunks written */
5698 0, /* chunk bytes unsuccessfully written */
5699 60); /* total bytes written */
5700 torture_assert_goto(torture, ok == true, ok, done,
5701 "bad copy chunk response data\n");
5702
5703 ok = check_stream(tree, __location__, torture, tmp_ctx,
5704 dst_name, AFPINFO_STREAM,
5705 0, 60, 16, 8, type_creator);
5706 torture_assert_goto(torture, ok == true, ok, done, "check_stream failed\n");
5707
5708 done:
5709 if (!smb2_util_handle_empty(src_h)) {
5710 smb2_util_close(tree, src_h);
5711 }
5712 if (!smb2_util_handle_empty(dest_h)) {
5713 smb2_util_close(tree, dest_h);
5714 }
5715
5716 return ok;
5717 }
5718
5719 static bool test_copy_chunk_streams(struct torture_context *torture,
5720 struct smb2_tree *tree)
5721 {
5722 const char *src_name = "src";
5723 const char *dst_name = "dst";
5724 struct names {
5725 const char *src_sname;
5726 const char *dst_sname;
5727 } names[] = {
5728 { "src:foo", "dst:foo" },
5729 { "src" AFPRESOURCE_STREAM, "dst" AFPRESOURCE_STREAM }
5730 };
5731 size_t i;
5732 TALLOC_CTX *tmp_ctx = NULL;
5733 bool ok = false;
5734
5735 tmp_ctx = talloc_new(tree);
5736 torture_assert_not_null_goto(torture, tmp_ctx, ok, done,
5737 "torture_setup_file\n");
5738
5739 smb2_util_unlink(tree, src_name);
5740 smb2_util_unlink(tree, dst_name);
5741
5742 ok = torture_setup_file(torture, tree, src_name, false);
5743 torture_assert_goto(torture, ok == true, ok, done, "torture_setup_file\n");
5744 ok = torture_setup_file(torture, tree, dst_name, false);
5745 torture_assert_goto(torture, ok == true, ok, done, "torture_setup_file\n");
5746
5747 for (i = 0; i < ARRAY_SIZE(names); i++) {
5748 ok = copy_one_stream(torture, tree, tmp_ctx,
5749 names[i].src_sname,
5750 names[i].dst_sname);
5751 torture_assert_goto(torture, ok == true, ok, done,
5752 "copy_one_stream failed\n");
5753 }
5754
5755 ok = copy_finderinfo_stream(torture, tree, tmp_ctx,
5756 src_name, dst_name);
5757 torture_assert_goto(torture, ok == true, ok, done,
5758 "copy_finderinfo_stream failed\n");
5759
5760 done:
5761 smb2_util_unlink(tree, src_name);
5762 smb2_util_unlink(tree, dst_name);
5763 talloc_free(tmp_ctx);
5764 return ok;
5765 }
5766
5767 /*
5768 * Ensure this security descriptor has exactly one mode, uid
5769 * and gid.
5770 */
5771
5772 static NTSTATUS check_nfs_sd(const struct security_descriptor *psd)
5773 {
5774 uint32_t i;
5775 bool got_one_mode = false;
5776 bool got_one_uid = false;
5777 bool got_one_gid = false;
5778
5779 if (psd->dacl == NULL) {
5780 return NT_STATUS_INVALID_SECURITY_DESCR;
5781 }
5782
5783 for (i = 0; i < psd->dacl->num_aces; i++) {
5784 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Mode,
5785 &psd->dacl->aces[i].trustee) == 0) {
5786 if (got_one_mode == true) {
5787 /* Can't have more than one. */
5788 return NT_STATUS_INVALID_SECURITY_DESCR;
5789 }
5790 got_one_mode = true;
5791 }
5792 }
5793 for (i = 0; i < psd->dacl->num_aces; i++) {
5794 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Users,
5795 &psd->dacl->aces[i].trustee) == 0) {
5796 if (got_one_uid == true) {
5797 /* Can't have more than one. */
5798 return NT_STATUS_INVALID_SECURITY_DESCR;
5799 }
5800 got_one_uid = true;
5801 }
5802 }
5803 for (i = 0; i < psd->dacl->num_aces; i++) {
5804 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Groups,
5805 &psd->dacl->aces[i].trustee) == 0) {
5806 if (got_one_gid == true) {
5807 /* Can't have more than one. */
5808 return NT_STATUS_INVALID_SECURITY_DESCR;
5809 }
5810 got_one_gid = true;
5811 }
5812 }
5813 /* Must have at least one of each. */
5814 if (got_one_mode == false ||
5815 got_one_uid == false ||
5816 got_one_gid == false) {
5817 return NT_STATUS_INVALID_SECURITY_DESCR;
5818 }
5819 return NT_STATUS_OK;
5820 }
5821
5822 static bool test_nfs_aces(struct torture_context *tctx,
5823 struct smb2_tree *tree)
5824 {
5825 TALLOC_CTX *mem_ctx = talloc_new(tctx);
5826 struct security_ace ace;
5827 struct dom_sid sid;
5828 const char *fname = BASEDIR "\\nfs_aces.txt";
5829 struct smb2_handle h = {{0}};
5830 union smb_fileinfo finfo2;
5831 union smb_setfileinfo set;
5832 struct security_descriptor *psd = NULL;
5833 NTSTATUS status;
5834 bool ret = true;
5835 bool is_osx = torture_setting_bool(tctx, "osx", false);
5836
5837 if (is_osx) {
5838 torture_skip(tctx, "Test only works with Samba\n");
5839 }
5840
5841 ret = enable_aapl(tctx, tree);
5842 torture_assert(tctx, ret == true, "enable_aapl failed");
5843
5844 /* clean slate ...*/
5845 smb2_util_unlink(tree, fname);
5846 smb2_deltree(tree, fname);
5847 smb2_deltree(tree, BASEDIR);
5848
5849 status = torture_smb2_testdir(tree, BASEDIR, &h);
5850 CHECK_STATUS(status, NT_STATUS_OK);
5851 smb2_util_close(tree, h);
5852
5853 /* Create a test file. */
5854 status = torture_smb2_testfile_access(tree,
5855 fname,
5856 &h,
5857 SEC_STD_READ_CONTROL |
5858 SEC_STD_WRITE_DAC |
5859 SEC_RIGHTS_FILE_ALL);
5860 CHECK_STATUS(status, NT_STATUS_OK);
5861
5862 /* Get the ACL. */
5863 finfo2.query_secdesc.in.secinfo_flags =
5864 SECINFO_OWNER |
5865 SECINFO_GROUP |
5866 SECINFO_DACL;
5867 finfo2.generic.level = RAW_FILEINFO_SEC_DESC;
5868 finfo2.generic.in.file.handle = h;
5869 status = smb2_getinfo_file(tree, tctx, &finfo2);
5870 CHECK_STATUS(status, NT_STATUS_OK);
5871
5872 psd = finfo2.query_secdesc.out.sd;
5873
5874 /* Ensure we have only single mode/uid/gid NFS entries. */
5875 status = check_nfs_sd(psd);
5876 if (!NT_STATUS_IS_OK(status)) {
5877 NDR_PRINT_DEBUG(
5878 security_descriptor,
5879 discard_const_p(struct security_descriptor, psd));
5880 }
5881 CHECK_STATUS(status, NT_STATUS_OK);
5882
5883 /* Add a couple of extra NFS uids and gids. */
5884 sid_compose(&sid, &global_sid_Unix_NFS_Users, 27);
5885 init_sec_ace(&ace, &sid, SEC_ACE_TYPE_ACCESS_DENIED, 0, 0);
5886 status = security_descriptor_dacl_add(psd, &ace);
5887 CHECK_STATUS(status, NT_STATUS_OK);
5888 status = security_descriptor_dacl_add(psd, &ace);
5889 CHECK_STATUS(status, NT_STATUS_OK);
5890
5891 sid_compose(&sid, &global_sid_Unix_NFS_Groups, 300);
5892 init_sec_ace(&ace, &sid, SEC_ACE_TYPE_ACCESS_DENIED, 0, 0);
5893 status = security_descriptor_dacl_add(psd, &ace);
5894 CHECK_STATUS(status, NT_STATUS_OK);
5895 status = security_descriptor_dacl_add(psd, &ace);
5896 CHECK_STATUS(status, NT_STATUS_OK);
5897
5898 /* Now set on the file handle. */
5899 set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
5900 set.set_secdesc.in.file.handle = h;
5901 set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
5902 set.set_secdesc.in.sd = psd;
5903 status = smb2_setinfo_file(tree, &set);
5904 CHECK_STATUS(status, NT_STATUS_OK);
5905
5906 /* Get the ACL again. */
5907 finfo2.query_secdesc.in.secinfo_flags =
5908 SECINFO_OWNER |
5909 SECINFO_GROUP |
5910 SECINFO_DACL;
5911 finfo2.generic.level = RAW_FILEINFO_SEC_DESC;
5912 finfo2.generic.in.file.handle = h;
5913 status = smb2_getinfo_file(tree, tctx, &finfo2);
5914 CHECK_STATUS(status, NT_STATUS_OK);
5915
5916 psd = finfo2.query_secdesc.out.sd;
5917
5918 /* Ensure we have only single mode/uid/gid NFS entries. */
5919 status = check_nfs_sd(psd);
5920 if (!NT_STATUS_IS_OK(status)) {
5921 NDR_PRINT_DEBUG(
5922 security_descriptor,
5923 discard_const_p(struct security_descriptor, psd));
5924 }
5925 CHECK_STATUS(status, NT_STATUS_OK);
5926
5927 done:
5928 if (!smb2_util_handle_empty(h)) {
5929 smb2_util_close(tree, h);
5930 }
5931 smb2_util_unlink(tree, fname);
5932 smb2_deltree(tree, fname);
5933 smb2_deltree(tree, BASEDIR);
5934 talloc_free(mem_ctx);
5935 return ret;
5936 }
5937
5938 static bool test_setinfo_stream_eof(struct torture_context *tctx,
5939 struct smb2_tree *tree)
5940 {
5941 bool ret = true;
5942 NTSTATUS status;
5943 struct smb2_create create;
5944 union smb_setfileinfo sfinfo;
5945 union smb_fileinfo finfo;
5946 struct smb2_handle h1;
5947 TALLOC_CTX *mem_ctx = talloc_new(tctx);
5948 const char *fname = BASEDIR "\\file";
5949 const char *sname = BASEDIR "\\file:foo";
5950
5951 torture_assert_goto(tctx, mem_ctx != NULL, ret, done,
5952 "talloc_new failed\n");
5953
5954 ret = enable_aapl(tctx, tree);
5955 torture_assert(tctx, ret == true, "enable_aapl failed");
5956
5957 torture_comment(tctx, "Test setting EOF on a stream\n");
5958
5959 smb2_deltree(tree, BASEDIR);
5960 status = torture_smb2_testdir(tree, BASEDIR, &h1);
5961 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
5962 "torture_smb2_testdir\n");
5963 smb2_util_close(tree, h1);
5964
5965 status = torture_smb2_testfile(tree, fname, &h1);
5966 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
5967 "torture_smb2_testfile failed\n");
5968 smb2_util_close(tree, h1);
5969
5970 status = torture_smb2_testfile_access(tree, sname, &h1,
5971 SEC_FILE_WRITE_DATA);
5972 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
5973 "torture_smb2_testfile failed\n");
5974
5975 status = smb2_util_write(tree, h1, "1234567890", 0, 10);
5976 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
5977 "smb2_util_write failed\n");
5978 smb2_util_close(tree, h1);
5979
5980 /*
5981 * Test setting EOF to 21
5982 */
5983
5984 torture_comment(tctx, "Setting stream EOF to 21\n");
5985
5986 status = torture_smb2_testfile_access(tree, sname, &h1,
5987 SEC_FILE_WRITE_DATA);
5988 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
5989 "torture_smb2_testfile failed\n");
5990
5991 ZERO_STRUCT(sfinfo);
5992 sfinfo.generic.in.file.handle = h1;
5993 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
5994 sfinfo.position_information.in.position = 21;
5995 status = smb2_setinfo_file(tree, &sfinfo);
5996 torture_assert_ntstatus_ok_goto(tctx, status,
5997 ret, done, "set EOF 21 failed\n");
5998
5999 smb2_util_close(tree, h1);
6000
6001 status = torture_smb2_testfile_access(tree, sname, &h1,
6002 SEC_FILE_WRITE_DATA);
6003 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6004 "torture_smb2_testfile failed\n");
6005
6006 ZERO_STRUCT(finfo);
6007 finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
6008 finfo.generic.in.file.handle = h1;
6009 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
6010 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6011 "smb2_getinfo_file failed");
6012
6013 smb2_util_close(tree, h1);
6014
6015 torture_assert_goto(tctx, finfo.standard_info.out.size == 21,
6016 ret, done, "size != 21\n");
6017
6018 /*
6019 * Test setting EOF to 0
6020 */
6021
6022 torture_comment(tctx, "Setting stream EOF to 0\n");
6023
6024 status = torture_smb2_testfile_access(tree, sname, &h1,
6025 SEC_FILE_WRITE_DATA);
6026 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6027 "torture_smb2_testfile failed\n");
6028
6029 ZERO_STRUCT(sfinfo);
6030 sfinfo.generic.in.file.handle = h1;
6031 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
6032 sfinfo.position_information.in.position = 0;
6033 status = smb2_setinfo_file(tree, &sfinfo);
6034 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6035 "set eof 0 failed\n");
6036
6037 ZERO_STRUCT(create);
6038 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
6039 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
6040 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
6041 create.in.create_disposition = NTCREATEX_DISP_OPEN;
6042 create.in.fname = sname;
6043
6044 status = smb2_create(tree, tctx, &create);
6045 torture_assert_ntstatus_equal_goto(
6046 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
6047 "Unexpected status\n");
6048
6049 smb2_util_close(tree, h1);
6050
6051 ZERO_STRUCT(create);
6052 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
6053 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
6054 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
6055 create.in.create_disposition = NTCREATEX_DISP_OPEN;
6056 create.in.fname = sname;
6057
6058 status = smb2_create(tree, tctx, &create);
6059 torture_assert_ntstatus_equal_goto(
6060 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
6061 "Unexpected status\n");
6062
6063 status = torture_smb2_testfile_access(tree, sname, &h1,
6064 SEC_FILE_WRITE_DATA);
6065 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6066 "torture_smb2_testfile failed\n");
6067
6068 ZERO_STRUCT(finfo);
6069 finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
6070 finfo.generic.in.file.handle = h1;
6071 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
6072 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6073 "smb2_getinfo_file failed\n");
6074
6075 smb2_util_close(tree, h1);
6076
6077 torture_assert_goto(tctx, finfo.standard_info.out.size == 0,
6078 ret, done, "size != 0\n");
6079
6080 /*
6081 * Test setinfo end-of-file info to 1
6082 */
6083
6084 torture_comment(tctx, "Setting stream EOF to 1\n");
6085
6086 status = torture_smb2_testfile_access(tree, sname, &h1,
6087 SEC_FILE_WRITE_DATA);
6088 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6089 "torture_smb2_testfile failed\n");
6090
6091 ZERO_STRUCT(sfinfo);
6092 sfinfo.generic.in.file.handle = h1;
6093 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
6094 sfinfo.position_information.in.position = 1;
6095 status = smb2_setinfo_file(tree, &sfinfo);
6096 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6097 "set EOF 1 failed\n");
6098
6099 smb2_util_close(tree, h1);
6100
6101 status = torture_smb2_testfile_access(tree, sname, &h1,
6102 SEC_FILE_WRITE_DATA);
6103 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6104 "torture_smb2_testfile failed\n");
6105
6106 ZERO_STRUCT(finfo);
6107 finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
6108 finfo.generic.in.file.handle = h1;
6109 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
6110 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6111 "smb2_getinfo_file failed\n");
6112
6113 smb2_util_close(tree, h1);
6114
6115 torture_assert_goto(tctx, finfo.standard_info.out.size == 1,
6116 ret, done, "size != 1\n");
6117
6118 /*
6119 * Test setting EOF to 0 with AAPL enabled, should delete stream
6120 */
6121
6122 torture_comment(tctx, "Enabling AAPL extensions\n");
6123
6124 ret = enable_aapl(tctx, tree);
6125 torture_assert(tctx, ret == true, "enable_aapl failed\n");
6126
6127 torture_comment(tctx, "Setting stream EOF to 0\n");
6128 status = torture_smb2_testfile_access(tree, sname, &h1,
6129 SEC_FILE_WRITE_DATA);
6130 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6131 "torture_smb2_testfile failed\n");
6132
6133 ZERO_STRUCT(sfinfo);
6134 sfinfo.generic.in.file.handle = h1;
6135 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
6136 sfinfo.position_information.in.position = 0;
6137 status = smb2_setinfo_file(tree, &sfinfo);
6138 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6139 "set eof 0 failed\n");
6140
6141 ZERO_STRUCT(create);
6142 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
6143 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
6144 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
6145 create.in.create_disposition = NTCREATEX_DISP_OPEN;
6146 create.in.fname = sname;
6147
6148 status = smb2_create(tree, tctx, &create);
6149 torture_assert_ntstatus_equal_goto(
6150 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
6151 "Unexpected status\n");
6152
6153 smb2_util_close(tree, h1);
6154
6155 ZERO_STRUCT(create);
6156 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
6157 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
6158 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
6159 create.in.create_disposition = NTCREATEX_DISP_OPEN;
6160 create.in.fname = sname;
6161
6162 status = smb2_create(tree, tctx, &create);
6163 torture_assert_ntstatus_equal_goto(
6164 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
6165 "Unexpected status\n");
6166
6167 torture_comment(
6168 tctx, "Setting main file EOF to 1 to force 0-truncate\n");
6169
6170 status = torture_smb2_testfile_access(
6171 tree,
6172 fname,
6173 &h1,
6174 SEC_FILE_WRITE_DATA);
6175 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6176 "torture_smb2_testfile failed\n");
6177
6178 ZERO_STRUCT(sfinfo);
6179 sfinfo.generic.in.file.handle = h1;
6180 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
6181 sfinfo.position_information.in.position = 1;
6182 status = smb2_setinfo_file(tree, &sfinfo);
6183 torture_assert_ntstatus_ok_goto(
6184 tctx,
6185 status,
6186 ret,
6187 done,
6188 "set eof 1 failed\n");
6189
6190 sfinfo.position_information.in.position = 0;
6191 status = smb2_setinfo_file(tree, &sfinfo);
6192 torture_assert_ntstatus_ok_goto(
6193 tctx,
6194 status,
6195 ret,
6196 done,
6197 "set eof 0 failed\n");
6198
6199 smb2_util_close(tree, h1);
6200
6201 ZERO_STRUCT(create);
6202 create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
6203 create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
6204 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
6205 create.in.create_disposition = NTCREATEX_DISP_OPEN;
6206 create.in.fname = fname;
6207
6208 status = smb2_create(tree, tctx, &create);
6209 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6210 "torture_smb2_testfile failed\n");
6211 smb2_util_close(tree, h1);
6212
6213 torture_comment(tctx, "Writing to stream after setting EOF to 0\n");
6214 status = torture_smb2_testfile_access(tree, sname, &h1,
6215 SEC_FILE_WRITE_DATA);
6216 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6217 "torture_smb2_testfile failed\n");
6218
6219 status = smb2_util_write(tree, h1, "1234567890", 0, 10);
6220 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6221 "smb2_util_write failed\n");
6222
6223 ZERO_STRUCT(sfinfo);
6224 sfinfo.generic.in.file.handle = h1;
6225 sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
6226 sfinfo.position_information.in.position = 0;
6227 status = smb2_setinfo_file(tree, &sfinfo);
6228 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6229 "set eof 0 failed\n");
6230
6231 status = smb2_util_write(tree, h1, "1234567890", 0, 10);
6232 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6233 "smb2_util_write failed\n");
6234
6235 smb2_util_close(tree, h1);
6236
6237 done:
6238 smb2_util_unlink(tree, fname);
6239 smb2_util_rmdir(tree, BASEDIR);
6240 return ret;
6241 }
6242
6243 #define MAX_STREAMS 16
6244
6245 struct tcase {
6246 const char *name;
6247 uint32_t access;
6248 const char *write_data;
6249 size_t write_size;
6250 struct tcase_results {
6251 size_t size;
6252 NTSTATUS initial_status;
6253 NTSTATUS final_status;
6254 int num_streams_open_handle;
6255 const char *streams_open_handle[MAX_STREAMS];
6256 int num_streams_closed_handle;
6257 const char *streams_closed_handle[MAX_STREAMS];
6258 } create, write, overwrite, eof, doc;
6259 };
6260
6261 typedef enum {T_CREATE, T_WRITE, T_OVERWRITE, T_EOF, T_DOC} subtcase_t;
6262
6263 static bool test_empty_stream_do_checks(
6264 struct torture_context *tctx,
6265 struct smb2_tree *tree,
6266 struct smb2_tree *tree2,
6267 struct tcase *tcase,
6268 TALLOC_CTX *mem_ctx,
6269 struct smb2_handle baseh,
6270 struct smb2_handle streamh,
6271 subtcase_t subcase)
6272 {
6273 bool ret = false;
6274 NTSTATUS status;
6275 struct smb2_handle h1;
6276 union smb_fileinfo finfo;
6277 struct tcase_results *tcase_results = NULL;
6278
6279 switch (subcase) {
6280 case T_CREATE:
6281 tcase_results = &tcase->create;
6282 break;
6283 case T_OVERWRITE:
6284 tcase_results = &tcase->overwrite;
6285 break;
6286 case T_WRITE:
6287 tcase_results = &tcase->write;
6288 break;
6289 case T_EOF:
6290 tcase_results = &tcase->eof;
6291 break;
6292 case T_DOC:
6293 tcase_results = &tcase->doc;
6294 break;
6295 }
6296
6297 finfo = (union smb_fileinfo) {
6298 .generic.level = RAW_FILEINFO_STANDARD_INFORMATION,
6299 .generic.in.file.handle = streamh,
6300 };
6301
6302 /*
6303 * Test: check size, same client
6304 */
6305
6306 status = smb2_getinfo_file(tree, mem_ctx, &finfo);
6307 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6308 "torture_smb2_testfile failed\n");
6309
6310 torture_assert_int_equal_goto(tctx, finfo.standard_info.out.size,
6311 tcase_results->size,
6312 ret, done, "Wrong size\n");
6313
6314 /*
6315 * Test: open, same client
6316 */
6317
6318 status = torture_smb2_open(tree, tcase->name,
6319 SEC_FILE_READ_ATTRIBUTE, &h1);
6320 torture_assert_ntstatus_equal_goto(tctx, status,
6321 tcase_results->initial_status,
6322 ret, done,
6323 "smb2_create failed\n");
6324 if (NT_STATUS_IS_OK(status)) {
6325 status = smb2_util_close(tree, h1);
6326 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6327 "smb2_util_close failed\n");
6328 }
6329
6330 /*
6331 * Test: check streams, same client
6332 */
6333
6334 ret = check_stream_list_handle(tree, tctx, baseh,
6335 tcase_results->num_streams_open_handle,
6336 tcase_results->streams_open_handle,
6337 false);
6338 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
6339
6340 /*
6341 * Test: open, different client
6342 */
6343
6344 status = torture_smb2_open(tree2, tcase->name,
6345 SEC_FILE_READ_ATTRIBUTE, &h1);
6346 torture_assert_ntstatus_equal_goto(tctx, status,
6347 tcase_results->initial_status,
6348 ret, done,
6349 "smb2_create failed\n");
6350 if (NT_STATUS_IS_OK(status)) {
6351 finfo = (union smb_fileinfo) {
6352 .generic.level = RAW_FILEINFO_STANDARD_INFORMATION,
6353 .generic.in.file.handle = h1,
6354 };
6355
6356 /*
6357 * Test: check size, different client
6358 */
6359
6360 status = smb2_getinfo_file(tree2, mem_ctx, &finfo);
6361 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6362 "smb2_getinfo_file failed\n");
6363
6364 torture_assert_int_equal_goto(tctx, finfo.standard_info.out.size,
6365 tcase_results->size,
6366 ret, done, "Wrong size\n");
6367
6368 /*
6369 * Test: check streams, different client
6370 */
6371
6372 ret = check_stream_list(tree2, tctx, BASEDIR "\\file",
6373 tcase_results->num_streams_open_handle,
6374 tcase_results->streams_open_handle,
6375 false);
6376 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
6377
6378 status = smb2_util_close(tree2, h1);
6379 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6380 "smb2_util_close failed\n");
6381 }
6382
6383 status = smb2_util_close(tree, streamh);
6384 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6385 "smb2_util_close failed\n");
6386
6387 /*
6388 * Test: open after close, same client
6389 */
6390
6391 status = torture_smb2_open(tree, tcase->name,
6392 SEC_FILE_READ_DATA, &h1);
6393 torture_assert_ntstatus_equal_goto(tctx, status,
6394 tcase_results->final_status,
6395 ret, done,
6396 "smb2_create failed\n");
6397 if (NT_STATUS_IS_OK(status)) {
6398 status = smb2_util_close(tree, h1);
6399 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6400 "smb2_util_close failed\n");
6401 }
6402
6403 /*
6404 * Test: open after close, different client
6405 */
6406
6407 status = torture_smb2_open(tree2, tcase->name,
6408 SEC_FILE_READ_DATA, &h1);
6409 torture_assert_ntstatus_equal_goto(tctx, status,
6410 tcase_results->final_status,
6411 ret, done,
6412 "smb2_create failed\n");
6413 if (NT_STATUS_IS_OK(status)) {
6414 status = smb2_util_close(tree2, h1);
6415 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6416 "smb2_util_close failed\n");
6417 }
6418
6419 /*
6420 * Test: check streams after close, same client
6421 */
6422
6423 ret = check_stream_list_handle(tree, tctx, baseh,
6424 tcase_results->num_streams_closed_handle,
6425 tcase_results->streams_closed_handle,
6426 false);
6427 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
6428
6429 ret = true;
6430
6431 done:
6432 smb2_util_close(tree, streamh);
6433 smb2_util_close(tree, baseh);
6434 return ret;
6435 }
6436
6437 static bool test_empty_stream_do_one(
6438 struct torture_context *tctx,
6439 struct smb2_tree *tree,
6440 struct smb2_tree *tree2,
6441 struct tcase *tcase)
6442 {
6443 bool ret = false;
6444 NTSTATUS status;
6445 struct smb2_handle baseh = {{0}};
6446 struct smb2_handle streamh;
6447 struct smb2_create create;
6448 union smb_setfileinfo sfinfo;
6449 TALLOC_CTX *mem_ctx = talloc_new(tctx);
6450
6451 torture_comment(tctx, "Testing stream [%s]\n", tcase->name);
6452
6453 torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new\n");
6454
6455 /*
6456 * Subtest: create
6457 */
6458 torture_comment(tctx, "Subtest: T_CREATE\n");
6459
6460 status = smb2_util_unlink(tree, BASEDIR "\\file");
6461 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6462 "smb2_util_unlink failed\n");
6463
6464 status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
6465 &baseh, SEC_FILE_ALL);
6466 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6467 "torture_smb2_testfile_access failed\n");
6468
6469 status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
6470 tcase->access);
6471 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6472 "torture_smb2_testfile_access failed\n");
6473
6474 ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
6475 mem_ctx, baseh, streamh, T_CREATE);
6476 torture_assert_goto(tctx, ret, ret, done, "test failed\n");
6477
6478 if (!(tcase->access & SEC_FILE_WRITE_DATA)) {
6479 /*
6480 * All subsequent tests require write access
6481 */
6482 ret = true;
6483 goto done;
6484 }
6485
6486 /*
6487 * Subtest: create and write
6488 */
6489 torture_comment(tctx, "Subtest: T_WRITE\n");
6490
6491 status = smb2_util_unlink(tree, BASEDIR "\\file");
6492 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6493 "smb2_util_unlink failed\n");
6494
6495 status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
6496 &baseh, SEC_FILE_ALL);
6497 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6498 "torture_smb2_testfile_access failed\n");
6499
6500 status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
6501 tcase->access);
6502 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6503 "torture_smb2_testfile_access failed\n");
6504
6505 status = smb2_util_write(tree, streamh, tcase->write_data, 0,
6506 tcase->write_size);
6507 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6508 "torture_smb2_open failed\n");
6509
6510 ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
6511 mem_ctx, baseh, streamh, T_WRITE);
6512 torture_assert_goto(tctx, ret, ret, done, "test failed\n");
6513
6514 /*
6515 * Subtest: overwrite
6516 */
6517 torture_comment(tctx, "Subtest: T_OVERWRITE\n");
6518
6519 status = smb2_util_unlink(tree, BASEDIR "\\file");
6520 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6521 "smb2_util_unlink failed\n");
6522
6523 status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
6524 &baseh, SEC_FILE_ALL);
6525 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6526 "torture_smb2_testfile_access failed\n");
6527
6528 create = (struct smb2_create) {
6529 .in.desired_access = SEC_FILE_ALL,
6530 .in.share_access = NTCREATEX_SHARE_ACCESS_MASK,
6531 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
6532 .in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF,
6533 .in.fname = tcase->name,
6534 };
6535
6536 status = smb2_create(tree, tctx, &create);
6537 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6538 "torture_smb2_testfile failed\n");
6539 streamh = create.out.file.handle;
6540
6541 ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
6542 mem_ctx, baseh, streamh, T_OVERWRITE);
6543 torture_assert_goto(tctx, ret, ret, done, "test failed\n");
6544
6545 /*
6546 * Subtest: setinfo EOF 0
6547 */
6548 torture_comment(tctx, "Subtest: T_EOF\n");
6549
6550 status = smb2_util_unlink(tree, BASEDIR "\\file");
6551 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6552 "smb2_util_unlink failed\n");
6553
6554 status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
6555 &baseh, SEC_FILE_ALL);
6556 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6557 "torture_smb2_testfile_access failed\n");
6558
6559 status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
6560 tcase->access);
6561 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6562 "torture_smb2_testfile_access failed\n");
6563
6564 status = smb2_util_write(tree, streamh, tcase->write_data, 0,
6565 tcase->write_size);
6566 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6567 "torture_smb2_open failed\n");
6568
6569 sfinfo = (union smb_setfileinfo) {
6570 .end_of_file_info.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION,
6571 .end_of_file_info.in.file.handle = streamh,
6572 .end_of_file_info.in.size = 0,
6573 };
6574 status = smb2_setinfo_file(tree, &sfinfo);
6575 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6576 "set eof 0 failed\n");
6577
6578 ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
6579 mem_ctx, baseh, streamh, T_EOF);
6580 torture_assert_goto(tctx, ret, ret, done, "test failed\n");
6581
6582 /*
6583 * Subtest: delete-on-close
6584 */
6585 torture_comment(tctx, "Subtest: T_DOC\n");
6586
6587 status = smb2_util_unlink(tree, BASEDIR "\\file");
6588 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6589 "smb2_util_unlink failed\n");
6590
6591 status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
6592 &baseh, SEC_FILE_ALL);
6593 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6594 "torture_smb2_testfile_access failed\n");
6595
6596 status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
6597 tcase->access);
6598 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6599 "torture_smb2_testfile_access failed\n");
6600
6601 status = smb2_util_write(tree, streamh, tcase->write_data, 0,
6602 tcase->write_size);
6603 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6604 "torture_smb2_open failed\n");
6605
6606 sfinfo = (union smb_setfileinfo) {
6607 .disposition_info.level = RAW_SFILEINFO_DISPOSITION_INFORMATION,
6608 .disposition_info.in.file.handle = streamh,
6609 .disposition_info.in.delete_on_close = true,
6610 };
6611 status = smb2_setinfo_file(tree, &sfinfo);
6612 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6613 "set eof 0 failed\n");
6614
6615 ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
6616 mem_ctx, baseh, streamh,
6617 T_DOC);
6618 torture_assert_goto(tctx, ret, ret, done, "test failed\n");
6619
6620 ret = true;
6621
6622 done:
6623 smb2_util_close(tree, baseh);
6624 TALLOC_FREE(mem_ctx);
6625 return ret;
6626 }
6627
6628 static bool test_empty_stream(struct torture_context *tctx,
6629 struct smb2_tree *tree)
6630 {
6631 struct smb2_tree *tree2 = NULL;
6632 struct tcase *tcase = NULL;
6633 const char *fname = BASEDIR "\\file";
6634 struct smb2_handle h1;
6635 bool ret = true;
6636 NTSTATUS status;
6637 AfpInfo ai = (AfpInfo) {
6638 .afpi_Signature = AFP_Signature,
6639 .afpi_Version = AFP_Version,
6640 .afpi_BackupTime = AFP_BackupTime,
6641 .afpi_FinderInfo = "FOO BAR ",
6642 };
6643 char *ai_blob = torture_afpinfo_pack(tctx, &ai);
6644 struct tcase tcase_afpinfo_ro = (struct tcase) {
6645 .name = BASEDIR "\\file" AFPINFO_STREAM,
6646 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE,
6647 .create = {
6648 .size = 60,
6649 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6650 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6651 .num_streams_open_handle = 1,
6652 .num_streams_closed_handle = 1,
6653 .streams_open_handle = {"::$DATA"},
6654 .streams_closed_handle = {"::$DATA"},
6655 },
6656 };
6657 struct tcase tcase_afpinfo_rw = (struct tcase) {
6658 .name = BASEDIR "\\file" AFPINFO_STREAM,
6659 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_DATA|SEC_STD_DELETE,
6660 .write_data = ai_blob,
6661 .write_size = AFP_INFO_SIZE,
6662 .create = {
6663 .size = 60,
6664 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6665 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6666 .num_streams_open_handle = 1,
6667 .num_streams_closed_handle = 1,
6668 .streams_open_handle = {"::$DATA"},
6669 .streams_closed_handle = {"::$DATA"},
6670 },
6671 .write = {
6672 .size = 60,
6673 .initial_status = NT_STATUS_OK,
6674 .final_status = NT_STATUS_OK,
6675 .num_streams_open_handle = 2,
6676 .num_streams_closed_handle = 2,
6677 .streams_open_handle = {"::$DATA", AFPINFO_STREAM},
6678 .streams_closed_handle = {"::$DATA", AFPINFO_STREAM},
6679 },
6680 .overwrite = {
6681 .size = 60,
6682 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6683 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6684 .num_streams_open_handle = 1,
6685 .num_streams_closed_handle = 1,
6686 .streams_open_handle = {"::$DATA"},
6687 .streams_closed_handle = {"::$DATA"},
6688 },
6689 .eof = {
6690 .size = 60,
6691 .initial_status = NT_STATUS_OK,
6692 .final_status = NT_STATUS_OK,
6693 .num_streams_open_handle = 2,
6694 .num_streams_closed_handle = 2,
6695 .streams_open_handle = {"::$DATA", AFPINFO_STREAM},
6696 .streams_closed_handle = {"::$DATA", AFPINFO_STREAM},
6697 },
6698 .doc = {
6699 .size = 60,
6700 .initial_status = NT_STATUS_DELETE_PENDING,
6701 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6702 .num_streams_open_handle = 2,
6703 .num_streams_closed_handle = 1,
6704 .streams_open_handle = {"::$DATA", AFPINFO_STREAM},
6705 .streams_closed_handle = {"::$DATA"},
6706 },
6707 };
6708
6709 struct tcase tcase_afpresource_ro = (struct tcase) {
6710 .name = BASEDIR "\\file" AFPRESOURCE_STREAM,
6711 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE,
6712 .create = {
6713 .size = 0,
6714 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6715 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6716 .num_streams_open_handle = 1,
6717 .num_streams_closed_handle = 1,
6718 .streams_open_handle = {"::$DATA"},
6719 .streams_closed_handle = {"::$DATA"},
6720 },
6721 };
6722 struct tcase tcase_afpresource_rw = (struct tcase) {
6723 .name = BASEDIR "\\file" AFPRESOURCE_STREAM,
6724 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_DATA|SEC_STD_DELETE,
6725 .write_data = "foo",
6726 .write_size = 3,
6727 .create = {
6728 .size = 0,
6729 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6730 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6731 .num_streams_open_handle = 1,
6732 .num_streams_closed_handle = 1,
6733 .streams_open_handle = {"::$DATA"},
6734 .streams_closed_handle = {"::$DATA"},
6735 },
6736 .write = {
6737 .size = 3,
6738 .initial_status = NT_STATUS_OK,
6739 .final_status = NT_STATUS_OK,
6740 .num_streams_open_handle = 2,
6741 .num_streams_closed_handle = 2,
6742 .streams_open_handle = {"::$DATA", AFPRESOURCE_STREAM},
6743 .streams_closed_handle = {"::$DATA", AFPRESOURCE_STREAM},
6744 },
6745 .overwrite = {
6746 .size = 0,
6747 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6748 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6749 .num_streams_open_handle = 1,
6750 .num_streams_closed_handle = 1,
6751 .streams_open_handle = {"::$DATA"},
6752 .streams_closed_handle = {"::$DATA"},
6753 },
6754 .eof = {
6755 .size = 0,
6756 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6757 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6758 .num_streams_open_handle = 1,
6759 .num_streams_closed_handle = 1,
6760 .streams_open_handle = {"::$DATA"},
6761 .streams_closed_handle = {"::$DATA"},
6762 },
6763 .doc = {
6764 .size = 3,
6765 .initial_status = NT_STATUS_DELETE_PENDING,
6766 .final_status = NT_STATUS_OK,
6767 .num_streams_open_handle = 2,
6768 .num_streams_closed_handle = 2,
6769 .streams_open_handle = {"::$DATA", AFPRESOURCE_STREAM},
6770 .streams_closed_handle = {"::$DATA", AFPRESOURCE_STREAM},
6771 },
6772 };
6773
6774 struct tcase tcase_foo_ro = (struct tcase) {
6775 .name = BASEDIR "\\file:foo",
6776 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE,
6777 .write_data = "foo",
6778 .write_size = 3,
6779 .create = {
6780 .size = 0,
6781 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6782 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6783 .num_streams_open_handle = 1,
6784 .num_streams_closed_handle = 1,
6785 .streams_open_handle = {"::$DATA"},
6786 .streams_closed_handle = {"::$DATA"},
6787 },
6788 };
6789
6790 struct tcase tcase_foo_rw = (struct tcase) {
6791 .name = BASEDIR "\\file:foo",
6792 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_DATA|SEC_STD_DELETE,
6793 .write_data = "foo",
6794 .write_size = 3,
6795 .create = {
6796 .size = 0,
6797 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6798 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6799 .num_streams_open_handle = 1,
6800 .num_streams_closed_handle = 1,
6801 .streams_open_handle = {"::$DATA"},
6802 .streams_closed_handle = {"::$DATA"},
6803 },
6804 .write = {
6805 .size = 3,
6806 .initial_status = NT_STATUS_OK,
6807 .final_status = NT_STATUS_OK,
6808 .num_streams_open_handle = 2,
6809 .num_streams_closed_handle = 2,
6810 .streams_open_handle = {"::$DATA", ":foo:$DATA"},
6811 .streams_closed_handle = {"::$DATA", ":foo:$DATA"},
6812 },
6813 .overwrite = {
6814 .size = 0,
6815 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6816 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6817 .num_streams_open_handle = 1,
6818 .num_streams_closed_handle = 1,
6819 .streams_open_handle = {"::$DATA"},
6820 .streams_closed_handle = {"::$DATA"},
6821 },
6822 .eof = {
6823 .size = 0,
6824 .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6825 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6826 .num_streams_open_handle = 1,
6827 .num_streams_closed_handle = 1,
6828 .streams_open_handle = {"::$DATA"},
6829 .streams_closed_handle = {"::$DATA"},
6830 },
6831 .doc = {
6832 .size = 3,
6833 .initial_status = NT_STATUS_DELETE_PENDING,
6834 .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
6835 .num_streams_open_handle = 2,
6836 .num_streams_closed_handle = 1,
6837 .streams_open_handle = {"::$DATA", ":foo:$DATA"},
6838 .streams_closed_handle = {"::$DATA"},
6839 },
6840 };
6841
6842 struct tcase tcases[] = {
6843 tcase_afpinfo_ro,
6844 tcase_afpinfo_rw,
6845 tcase_afpresource_ro,
6846 tcase_afpresource_rw,
6847 tcase_foo_ro,
6848 tcase_foo_rw,
6849 {0}
6850 };
6851
6852 ret = torture_smb2_connection(tctx, &tree2);
6853 torture_assert_goto(tctx, ret == true, ret, done,
6854 "torture_smb2_connection failed\n");
6855
6856 ret = enable_aapl(tctx, tree);
6857 torture_assert(tctx, ret == true, "enable_aapl failed\n");
6858
6859 ret = enable_aapl(tctx, tree2);
6860 torture_assert(tctx, ret == true, "enable_aapl failed\n");
6861
6862 smb2_deltree(tree, BASEDIR);
6863
6864 status = torture_smb2_testdir(tree, BASEDIR, &h1);
6865 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6866 "torture_smb2_testdir\n");
6867 smb2_util_close(tree, h1);
6868
6869 for (tcase = &tcases[0]; tcase->name != NULL; tcase++) {
6870 ret = torture_setup_file(tctx, tree, fname, false);
6871 torture_assert_goto(tctx, ret == true, ret, done,
6872 "torture_setup_file failed\n");
6873
6874 ret = test_empty_stream_do_one(tctx, tree, tree2, tcase);
6875 torture_assert_goto(tctx, ret == true, ret, done,
6876 "subtest failed\n");
6877
6878 status = smb2_util_unlink(tree, fname);
6879 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
6880 "smb2_util_unlink failed\n");
6881 }
6882
6883 done:
6884 smb2_deltree(tree, BASEDIR);
6885 TALLOC_FREE(tree2);
6886 return ret;
6887 }
6888
6889 /*
6890 -------------------------------------------------------------------------------
6891 MagicNumber: 00051607 : AppleDouble
6892 Version : 00020000 : Version 2
6893 Filler : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
6894 Num. of ent: 0002 : 2
6895
6896 -------------------------------------------------------------------------------
6897 Entry ID : 00000009 : Finder Info
6898 Offset : 00000032 : 50
6899 Length : 00000EB0 : 3760
6900
6901 -DInfo-----:
6902 Rect top : 0000 : 0
6903 Rect left : 0000 : 0
6904 Rect bottom: 0000 : 0
6905 Rect right : 0000 : 0
6906 isAlias : 0
6907 Invisible : 0
6908 hasBundle : 0
6909 nameLocked : 0
6910 Stationery : 0
6911 CustomIcon : 0
6912 Reserved : 0
6913 Inited : 1
6914 NoINITS : 0
6915 Shared : 0
6916 SwitchLaunc: 0
6917 Hidden Ext : 0
6918 color : 000 : none
6919 isOnDesk : 0
6920 Location v : 0000 : 0
6921 Location h : 0000 : 0
6922 View : 0000 : ..
6923
6924 -DXInfo----:
6925 Scroll v : 0000 : 0
6926 Scroll h : 0000 : 0
6927 Rsvd|OpnChn: 00000000 : 0
6928 AreInvalid : 0
6929 unknown bit: 0
6930 unknown bit: 0
6931 unknown bit: 0
6932 unknown bit: 0
6933 unknown bit: 0
6934 unknown bit: 0
6935 CustomBadge: 0
6936 ObjctIsBusy: 0
6937 unknown bit: 0
6938 unknown bit: 0
6939 unknown bit: 0
6940 unknown bit: 0
6941 RoutingInfo: 0
6942 unknown bit: 0
6943 unknown bit: 0
6944 Comment : 0000 : ..
6945 PutAway : 00000000 : 0
6946
6947 -EA--------:
6948 pad : 0000 : ..
6949 magic : 41545452 : ATTR
6950 debug_tag : 0081714C : 8483148
6951 total_size : 00000EE2 : 3810
6952 data_start : 00000098 : 152
6953 data_length: 00000039 : 57
6954 reserved[0]: 00000000 : ....
6955 reserved[1]: 00000000 : ....
6956 reserved[2]: 00000000 : ....
6957 flags : 0000 : ..
6958 num_attrs : 0001 : 1
6959 -EA ENTRY--:
6960 offset : 00000098 : 152
6961 length : 00000039 : 57
6962 flags : 0000 : ..
6963 namelen : 15 : 21
6964 -EA NAME---: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
6965 00000000 : 63 6F 6D 2E 61 70 70 6C 65 2E 71 75 61 72 61 6E : com.apple.quaran
6966 00000010 : 74 69 6E 65 00 : tine.
6967 -EA VALUE--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
6968 00000000 : 30 30 38 31 3B 36 32 65 61 33 37 66 64 3B 43 68 : 0081;62ea37fd;Ch
6969 00000010 : 72 6F 6D 65 3B 42 35 39 46 42 39 45 44 2D 35 41 : rome;B59FB9ED-5A
6970 00000020 : 32 39 2D 34 45 35 42 2D 38 35 36 43 2D 37 45 44 : 29-4E5B-856C-7ED
6971 00000030 : 30 45 46 45 41 37 30 41 43 : 0EFEA70AC
6972
6973 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
6974 00000000 : 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 : ................
6975 00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6976 00000020 : 00 00 41 54 54 52 00 81 71 4C 00 00 0E E2 00 00 : ..ATTR..qL......
6977 00000030 : 00 98 00 00 00 39 00 00 00 00 00 00 00 00 00 00 : .....9..........
6978 00000040 : 00 00 00 00 00 01 00 00 00 98 00 00 00 39 00 00 : .............9..
6979 00000050 : 15 63 6F 6D 2E 61 70 70 6C 65 2E 71 75 61 72 61 : .com.apple.quara
6980 00000060 : 6E 74 69 6E 65 00 30 30 38 31 3B 36 32 65 61 33 : ntine.0081;62ea3
6981 00000070 : 37 66 64 3B 43 68 72 6F 6D 65 3B 42 35 39 46 42 : 7fd;Chrome;B59FB
6982 00000080 : 39 45 44 2D 35 41 32 39 2D 34 45 35 42 2D 38 35 : 9ED-5A29-4E5B-85
6983 00000090 : 36 43 2D 37 45 44 30 45 46 45 41 37 30 41 43 00 : 6C-7ED0EFEA70AC.
6984 000000A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6985 000000B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6986 000000C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6987 000000D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6988 000000E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6989 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6990 00000100 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6991 00000110 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6992 00000120 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6993 00000130 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6994 00000140 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6995 00000150 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6996 00000160 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6997 00000170 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6998 00000180 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
6999 00000190 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7000 000001A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7001 000001B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7002 000001C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7003 000001D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7004 000001E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7005 000001F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7006 00000200 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7007 00000210 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7008 00000220 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7009 00000230 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7010 00000240 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7011 00000250 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7012 00000260 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7013 00000270 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7014 00000280 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7015 00000290 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7016 000002A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7017 000002B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7018 000002C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7019 000002D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7020 000002E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7021 000002F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7022 00000300 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7023 00000310 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7024 00000320 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7025 00000330 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7026 00000340 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7027 00000350 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7028 00000360 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7029 00000370 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7030 00000380 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7031 00000390 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7032 000003A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7033 000003B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7034 000003C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7035 000003D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7036 000003E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7037 000003F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7038 00000400 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7039 00000410 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7040 00000420 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7041 00000430 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7042 00000440 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7043 00000450 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7044 00000460 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7045 00000470 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7046 00000480 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7047 00000490 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7048 000004A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7049 000004B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7050 000004C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7051 000004D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7052 000004E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7053 000004F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7054 00000500 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7055 00000510 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7056 00000520 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7057 00000530 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7058 00000540 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7059 00000550 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7060 00000560 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7061 00000570 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7062 00000580 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7063 00000590 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7064 000005A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7065 000005B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7066 000005C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7067 000005D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7068 000005E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7069 000005F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7070 00000600 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7071 00000610 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7072 00000620 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7073 00000630 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7074 00000640 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7075 00000650 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7076 00000660 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7077 00000670 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7078 00000680 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7079 00000690 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7080 000006A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7081 000006B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7082 000006C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7083 000006D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7084 000006E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7085 000006F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7086 00000700 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7087 00000710 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7088 00000720 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7089 00000730 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7090 00000740 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7091 00000750 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7092 00000760 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7093 00000770 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7094 00000780 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7095 00000790 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7096 000007A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7097 000007B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7098 000007C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7099 000007D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7100 000007E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7101 000007F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7102 00000800 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7103 00000810 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7104 00000820 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7105 00000830 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7106 00000840 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7107 00000850 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7108 00000860 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7109 00000870 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7110 00000880 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7111 00000890 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7112 000008A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7113 000008B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7114 000008C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7115 000008D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7116 000008E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7117 000008F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7118 00000900 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7119 00000910 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7120 00000920 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7121 00000930 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7122 00000940 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7123 00000950 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7124 00000960 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7125 00000970 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7126 00000980 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7127 00000990 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7128 000009A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7129 000009B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7130 000009C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7131 000009D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7132 000009E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7133 000009F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7134 00000A00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7135 00000A10 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7136 00000A20 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7137 00000A30 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7138 00000A40 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7139 00000A50 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7140 00000A60 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7141 00000A70 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7142 00000A80 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7143 00000A90 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7144 00000AA0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7145 00000AB0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7146 00000AC0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7147 00000AD0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7148 00000AE0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7149 00000AF0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7150 00000B00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7151 00000B10 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7152 00000B20 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7153 00000B30 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7154 00000B40 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7155 00000B50 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7156 00000B60 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7157 00000B70 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7158 00000B80 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7159 00000B90 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7160 00000BA0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7161 00000BB0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7162 00000BC0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7163 00000BD0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7164 00000BE0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7165 00000BF0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7166 00000C00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7167 00000C10 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7168 00000C20 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7169 00000C30 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7170 00000C40 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7171 00000C50 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7172 00000C60 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7173 00000C70 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7174 00000C80 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7175 00000C90 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7176 00000CA0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7177 00000CB0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7178 00000CC0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7179 00000CD0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7180 00000CE0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7181 00000CF0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7182 00000D00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7183 00000D10 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7184 00000D20 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7185 00000D30 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7186 00000D40 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7187 00000D50 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7188 00000D60 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7189 00000D70 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7190 00000D80 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7191 00000D90 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7192 00000DA0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7193 00000DB0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7194 00000DC0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7195 00000DD0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7196 00000DE0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7197 00000DF0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7198 00000E00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7199 00000E10 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7200 00000E20 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7201 00000E30 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7202 00000E40 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7203 00000E50 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7204 00000E60 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7205 00000E70 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7206 00000E80 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7207 00000E90 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7208 00000EA0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7209
7210 -------------------------------------------------------------------------------
7211 Entry ID : 00000002 : Resource Fork
7212 Offset : 00000EE2 : 3810
7213 Length : 0000011E : 286
7214
7215 -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
7216 00000000 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
7217 00000010 : 54 68 69 73 20 72 65 73 6F 75 72 63 65 20 66 6F : This resource fo
7218 00000020 : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
7219 00000030 : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 : left blank ..
7220 00000040 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7221 00000050 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7222 00000060 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7223 00000070 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7224 00000080 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7225 00000090 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7226 000000A0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7227 000000B0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7228 000000C0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7229 000000D0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7230 000000E0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7231 000000F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
7232 00000100 : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
7233 00000110 : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF : ..............
7234 */
7235
7236 static char osx_adouble_dir_w_xattr[] = {
7237 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
7238 0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
7239 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
7240 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
7241 0x00, 0x32, 0x00, 0x00, 0x0e, 0xb0, 0x00, 0x00,
7242 0x00, 0x02, 0x00, 0x00, 0x0e, 0xe2, 0x00, 0x00,
7243 0x01, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7244 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
7245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7247 0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52,
7248 0x00, 0x81, 0x71, 0x4c, 0x00, 0x00, 0x0e, 0xe2,
7249 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x39,
7250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
7252 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x39,
7253 0x00, 0x00, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x61,
7254 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x71, 0x75, 0x61,
7255 0x72, 0x61, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x00,
7256 0x30, 0x30, 0x38, 0x31, 0x3b, 0x36, 0x32, 0x65,
7257 0x61, 0x33, 0x37, 0x66, 0x64, 0x3b, 0x43, 0x68,
7258 0x72, 0x6f, 0x6d, 0x65, 0x3b, 0x42, 0x35, 0x39,
7259 0x46, 0x42, 0x39, 0x45, 0x44, 0x2d, 0x35, 0x41,
7260 0x32, 0x39, 0x2d, 0x34, 0x45, 0x35, 0x42, 0x2d,
7261 0x38, 0x35, 0x36, 0x43, 0x2d, 0x37, 0x45, 0x44,
7262 0x30, 0x45, 0x46, 0x45, 0x41, 0x37, 0x30, 0x41,
7263 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7275 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7282 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7295 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7305 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7307 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7308 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7309 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7316 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7317 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7354 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7355 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7359 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7380 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7404 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7406 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7413 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7417 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7418 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7422 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7427 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7429 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7433 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7435 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7436 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7438 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7439 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7440 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7443 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7444 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7447 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7466 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7467 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7468 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7469 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7470 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7471 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7472 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7473 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7475 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7476 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7477 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7483 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7484 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7485 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7486 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7487 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7489 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7490 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7491 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7492 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7500 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7501 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7504 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7507 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7510 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7516 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7517 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7519 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7521 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7522 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7523 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7524 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7525 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7527 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7532 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7533 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7535 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7537 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7543 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7544 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7545 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7548 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7549 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7550 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7551 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7552 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7553 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7557 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7558 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7559 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7560 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7561 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7562 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7563 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7564 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7567 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7568 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7569 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7570 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7571 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7572 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7573 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7574 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7575 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7576 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7577 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7578 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7579 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7580 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7581 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7582 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7583 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7584 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7585 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7587 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7588 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7593 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7594 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7596 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7597 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7598 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7599 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7600 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7601 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7602 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7603 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7604 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7605 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7606 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7607 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7608 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7609 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7613 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7614 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7615 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7616 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7619 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7620 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7621 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7622 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7623 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7624 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7625 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7626 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7628 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7629 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7630 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7631 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7632 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7633 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7634 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7635 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7636 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7637 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7642 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7644 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7646 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7651 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7652 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7657 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7658 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7659 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7660 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7662 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7663 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7664 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7665 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7666 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7668 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7669 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7670 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7671 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7672 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7673 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7674 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7675 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7676 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7677 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7678 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7679 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7680 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7681 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7682 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7683 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7684 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7685 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7686 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7687 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7688 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7689 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7690 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7692 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7693 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7694 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7695 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7696 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7697 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7698 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7699 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7700 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7701 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7702 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7703 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7704 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7705 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7706 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7707 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7708 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7711 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7712 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7713 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
7714 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7715 0x00, 0x1e, 0x54, 0x68, 0x69, 0x73, 0x20, 0x72,
7716 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20,
7717 0x66, 0x6f, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
7718 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
7719 0x6c, 0x79, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20,
7720 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x20, 0x20,
7721 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7723 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7724 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7725 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7726 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7727 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7728 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7729 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7730 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7731 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7732 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7733 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7734 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7735 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7736 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7737 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7738 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7739 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7740 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7741 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7742 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7743 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7744 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7745 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
7746 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7747 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7748 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0xff, 0xff
7749 };
7750
7751 static bool test_delete_trigger_convert_sharing_violation(
7752 struct torture_context *tctx,
7753 struct smb2_tree *tree1)
7754 {
7755 TALLOC_CTX *mem_ctx = talloc_new(tctx);
7756 const char *dirname = BASEDIR "\\dir";
7757 const char *adname = BASEDIR "\\._dir";
7758 struct smb2_handle testdirh;
7759 struct smb2_create create;
7760 AfpInfo *info = NULL;
7761 bool ret = true;
7762 NTSTATUS status;
7763
7764 smb2_deltree(tree1, BASEDIR);
7765
7766 status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
7767 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7768 "torture_smb2_testdir failed\n");
7769 smb2_util_close(tree1, testdirh);
7770
7771 status = torture_smb2_testdir(tree1, dirname, &testdirh);
7772 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7773 "torture_smb2_testdir failed\n");
7774 smb2_util_close(tree1, testdirh);
7775
7776 ret = torture_setup_file(tctx, tree1, adname, false);
7777 torture_assert_goto(tctx, ret == true, ret, done,
7778 "torture_setup_file failed\n");
7779
7780 ret = write_stream(tree1, __location__, tctx, mem_ctx,
7781 adname, NULL, 0,
7782 sizeof(osx_adouble_dir_w_xattr),
7783 osx_adouble_dir_w_xattr);
7784 torture_assert_goto(tctx, ret == true, ret, done,
7785 "write_stream failed\n");
7786
7787 /*
7788 * 1) Create a non-empty AFP_AfpInfo stream
7789 */
7790
7791 info = torture_afpinfo_new(mem_ctx);
7792 torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
7793
7794 /* Set "Inited" flag (any other would do too) */
7795 info->afpi_FinderInfo[8] = 0x01;
7796
7797 ret = torture_write_afpinfo(tree1, tctx, mem_ctx, dirname, info);
7798 torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
7799
7800 ret = write_stream(tree1, __location__, tctx, mem_ctx,
7801 adname, NULL, 0,
7802 sizeof(osx_adouble_dir_w_xattr),
7803 osx_adouble_dir_w_xattr);
7804 torture_assert_goto(tctx, ret == true, ret, done,
7805 "write_stream failed\n");
7806
7807 /*
7808 * 2) Create a second stream
7809 */
7810
7811 ret = write_stream(tree1, __location__, tctx, mem_ctx,
7812 dirname, ":org.samba.boom", 0,
7813 strlen("boom"),
7814 "boom");
7815 torture_assert_goto(tctx, ret == true, ret, done,
7816 "write_stream failed\n");
7817
7818 create = (struct smb2_create) {
7819 .in.desired_access = SEC_STD_DELETE,
7820 .in.create_options = NTCREATEX_OPTIONS_DIRECTORY,
7821 .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY,
7822 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
7823 .in.create_disposition = NTCREATEX_DISP_OPEN,
7824 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
7825 .in.fname = dirname,
7826 };
7827
7828 status = smb2_create(tree1, tctx, &create);
7829 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7830 "smb2_create failed\n");
7831
7832 status = smb2_util_close(tree1, create.out.file.handle);
7833 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7834 "smb2_util_close failed");
7835
7836 done:
7837 smb2_deltree(tree1, BASEDIR);
7838 talloc_free(mem_ctx);
7839 return ret;
7840 }
7841
7842 /*
7843 test exclusive byte range lock on read-only file
7844 */
7845 static bool test_readonly_exclusive_lock(struct torture_context *tctx,
7846 struct smb2_tree *tree)
7847 {
7848 NTSTATUS status;
7849 bool ret = true;
7850 struct smb2_handle h = {};
7851 struct smb2_create create;
7852 struct smb2_lock lock;
7853 struct smb2_lock_element lock_element;
7854 const char *fname = "readonly_lock_test.txt";
7855
7856 torture_comment(tctx, "Testing exclusive lock on read-only opened file\n");
7857
7858 ret = enable_aapl(tctx, tree);
7859 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
7860
7861 /* Clean up any existing file */
7862 smb2_util_unlink(tree, fname);
7863
7864 /* Create the file first with write access to ensure it exists */
7865 ZERO_STRUCT(create);
7866 create.in.desired_access = SEC_RIGHTS_FILE_ALL;
7867 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
7868 create.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
7869 NTCREATEX_SHARE_ACCESS_WRITE |
7870 NTCREATEX_SHARE_ACCESS_DELETE;
7871 create.in.create_disposition = NTCREATEX_DISP_CREATE;
7872 create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
7873 create.in.security_flags = 0;
7874 create.in.fname = fname;
7875
7876 status = smb2_create(tree, tctx, &create);
7877 CHECK_STATUS(status, NT_STATUS_OK);
7878
7879 /* Write some data to the file */
7880 status = smb2_util_write(tree, create.out.file.handle, "test data", 0, 9);
7881 CHECK_STATUS(status, NT_STATUS_OK);
7882
7883 /* Close the file */
7884 status = smb2_util_close(tree, create.out.file.handle);
7885 CHECK_STATUS(status, NT_STATUS_OK);
7886
7887 /* Now open the file read-only */
7888 ZERO_STRUCT(create);
7889 create.in.desired_access = SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE;
7890 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
7891 create.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
7892 NTCREATEX_SHARE_ACCESS_WRITE |
7893 NTCREATEX_SHARE_ACCESS_DELETE;
7894 create.in.create_disposition = NTCREATEX_DISP_OPEN;
7895 create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
7896 create.in.security_flags = 0;
7897 create.in.fname = fname;
7898
7899 status = smb2_create(tree, tctx, &create);
7900 CHECK_STATUS(status, NT_STATUS_OK);
7901 h = create.out.file.handle;
7902
7903 torture_comment(tctx, "File opened read-only successfully\n");
7904
7905 /* Attempt to set an exclusive byte-range lock */
7906 ZERO_STRUCT(lock);
7907 ZERO_STRUCT(lock_element);
7908
7909 lock.in.lock_count = 1;
7910 lock.in.lock_sequence = 0;
7911 lock.in.file.handle = h;
7912 lock.in.locks = &lock_element;
7913
7914 lock_element.offset = 0;
7915 lock_element.length = 100;
7916 lock_element.flags = SMB2_LOCK_FLAG_EXCLUSIVE | SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
7917
7918 torture_comment(tctx, "Attempting to set exclusive lock on read-only file\n");
7919
7920 status = smb2_lock(tree, &lock);
7921 CHECK_STATUS(status, NT_STATUS_OK);
7922
7923 done:
7924 /* Close the file */
7925 smb2_util_close(tree, h);
7926
7927 /* Clean up */
7928 smb2_util_unlink(tree, fname);
7929
7930 return ret;
7931 }
7932
7933 /*
7934 * Test case-insensitive file finding with AAPL extensions
7935 * Add this function to source4/torture/vfs/fruit.c
7936 */
7937
7938 static bool test_case_insensitive_find(struct torture_context *tctx,
7939 struct smb2_tree *tree)
7940 {
7941 NTSTATUS status;
7942 bool ret = true;
7943 const char *fname = "TestFile.txt";
7944 const char *fname_upper = "TESTFILE.TXT";
7945 struct smb2_handle testdirh;
7946 struct smb2_handle h1;
7947 struct smb2_create create;
7948 struct smb2_find f;
7949 union smb_search_data *d;
7950 uint_t count;
7951
7952 smb2_deltree(tree, BASEDIR);
7953
7954 status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
7955 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7956 "torture_smb2_testdir failed");
7957
7958 /* Enable AAPL extensions */
7959 ret = enable_aapl(tctx, tree);
7960 torture_assert_goto(tctx, ret, ret, done,
7961 "enable_aapl failed");
7962
7963 /* Create test file */
7964 ZERO_STRUCT(create);
7965 create.in.desired_access = SEC_RIGHTS_FILE_ALL;
7966 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
7967 create.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
7968 NTCREATEX_SHARE_ACCESS_WRITE |
7969 NTCREATEX_SHARE_ACCESS_DELETE;
7970 create.in.create_disposition = NTCREATEX_DISP_CREATE;
7971 create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
7972 create.in.fname = talloc_asprintf(tctx, "%s\\%s", BASEDIR, fname);
7973
7974 status = smb2_create(tree, tctx, &create);
7975 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7976 talloc_asprintf(tctx, "failed to create %s", fname));
7977 h1 = create.out.file.handle;
7978
7979 /* Close the file */
7980 status = smb2_util_close(tree, h1);
7981 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7982 "failed to close test file");
7983
7984 /* Search for file using different case */
7985 f = (struct smb2_find) {
7986 .in.file.handle = testdirh,
7987 .in.pattern = fname_upper,
7988 .in.max_response_size = 0x1000,
7989 .in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO,
7990 };
7991
7992 status = smb2_find_level(tree, tctx, &f, &count, &d);
7993 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
7994 talloc_asprintf(tctx, "smb2_find_level failed searching for %s", fname_upper));
7995
7996 /* Verify we found exactly one file */
7997 torture_assert_int_equal_goto(tctx, count, 1, ret, done,
7998 talloc_asprintf(tctx, "Expected 1 file, got %u", count));
7999
8000 /* Verify the filename matches our original file (case may differ) */
8001 torture_assert_str_equal_goto(tctx,
8002 d[0].id_both_directory_info.name.s, fname, ret, done,
8003 talloc_asprintf(tctx, "Found file name '%s' doesn't match expected '%s'",
8004 d[0].directory_info.name.s, fname));
8005
8006 torture_comment(tctx, "Case-insensitive find test passed: "
8007 "searched for '%s', found '%s'\n",
8008 fname_upper, d[0].id_both_directory_info.name.s);
8009
8010 done:
8011 smb2_util_close(tree, testdirh);
8012 smb2_deltree(tree, BASEDIR);
8013 return ret;
8014 }
8015
8016 /*
8017 * Note: This test depends on "vfs objects = catia fruit streams_xattr". For
8018 * some tests torture must be run on the host it tests and takes an additional
8019 * argument with the local path to the share:
8020 * "--option=torture:localdir=<SHAREPATH>".
8021 *
8022 * When running against an OS X SMB server add "--option=torture:osx=true"
8023 */
8024 struct torture_suite *torture_vfs_fruit(TALLOC_CTX *ctx)
8025 {
8026 struct torture_suite *suite = torture_suite_create(
8027 ctx, "fruit");
8028
8029 suite->description = talloc_strdup(suite, "vfs_fruit tests");
8030
8031 torture_suite_add_1smb2_test(suite, "copyfile", test_copyfile);
8032 torture_suite_add_1smb2_test(suite, "read metadata", test_read_afpinfo);
8033 torture_suite_add_1smb2_test(suite, "write metadata", test_write_atalk_metadata);
8034 torture_suite_add_1smb2_test(suite, "resource fork IO", test_write_atalk_rfork_io);
8035 torture_suite_add_1smb2_test(suite, "SMB2/CREATE context AAPL", test_aapl);
8036 torture_suite_add_1smb2_test(suite, "stream names", test_stream_names);
8037 torture_suite_add_1smb2_test(suite, "truncate resource fork to 0 bytes", test_rfork_truncate);
8038 torture_suite_add_1smb2_test(suite, "opening and creating resource fork", test_rfork_create);
8039 torture_suite_add_1smb2_test(suite, "fsync_resource_fork", test_rfork_fsync);
8040 torture_suite_add_1smb2_test(suite, "File without AFP_AfpInfo", test_afpinfo_enoent);
8041 torture_suite_add_1smb2_test(suite, "create delete-on-close AFP_AfpInfo", test_create_delete_on_close);
8042 torture_suite_add_1smb2_test(suite, "setinfo delete-on-close AFP_AfpInfo", test_setinfo_delete_on_close);
8043 torture_suite_add_1smb2_test(suite, "setinfo eof AFP_AfpInfo", test_setinfo_eof);
8044 torture_suite_add_1smb2_test(suite, "delete AFP_AfpInfo by writing all 0", test_afpinfo_all0);
8045 torture_suite_add_1smb2_test(suite, "create delete-on-close AFP_AfpResource", test_create_delete_on_close_resource);
8046 torture_suite_add_1smb2_test(suite, "setinfo delete-on-close AFP_AfpResource", test_setinfo_delete_on_close_resource);
8047 torture_suite_add_1smb2_test(suite, "setinfo eof AFP_AfpResource", test_setinfo_eof_resource);
8048 torture_suite_add_1smb2_test(suite, "setinfo eof stream", test_setinfo_stream_eof);
8049 torture_suite_add_1smb2_test(suite, "null afpinfo", test_null_afpinfo);
8050 torture_suite_add_1smb2_test(suite, "delete", test_delete_file_with_rfork);
8051 torture_suite_add_1smb2_test(suite, "read open rsrc after rename", test_rename_and_read_rsrc);
8052 torture_suite_add_1smb2_test(suite, "readdir_attr with names with illegal ntfs characters", test_readdir_attr_illegal_ntfs);
8053 torture_suite_add_2ns_smb2_test(suite, "invalid AFP_AfpInfo", test_invalid_afpinfo);
8054 torture_suite_add_1smb2_test(suite, "creating rsrc with read-only access", test_rfork_create_ro);
8055 torture_suite_add_1smb2_test(suite, "copy-chunk streams", test_copy_chunk_streams);
8056 torture_suite_add_1smb2_test(suite, "OS X AppleDouble file conversion", test_adouble_conversion);
8057 torture_suite_add_1smb2_test(suite, "NFS ACE entries", test_nfs_aces);
8058 torture_suite_add_1smb2_test(suite, "OS X AppleDouble file conversion without embedded xattr", test_adouble_conversion_wo_xattr);
8059 torture_suite_add_1smb2_test(suite, "empty_stream", test_empty_stream);
8060 torture_suite_add_1smb2_test(suite, "writing_afpinfo", test_writing_afpinfo);
8061 torture_suite_add_1smb2_test(suite, "delete_trigger_convert_sharing_violation", test_delete_trigger_convert_sharing_violation);
8062 torture_suite_add_1smb2_test(suite, "readonly-exclusive-lock", test_readonly_exclusive_lock);
8063 torture_suite_add_1smb2_test(suite, "case_insensitive_find", test_case_insensitive_find);
8064 return suite;
8065 }
8066
8067 static bool test_stream_names_local(struct torture_context *tctx,
8068 struct smb2_tree *tree)
8069 {
8070 TALLOC_CTX *mem_ctx = talloc_new(tctx);
8071 NTSTATUS status;
8072 struct smb2_create create;
8073 struct smb2_handle h;
8074 const char *fname = BASEDIR "\\stream_names.txt";
8075 const char *sname1;
8076 bool ret;
8077 /* UTF8 private use are starts at 0xef 0x80 0x80 (0xf000) */
8078 const char *streams[] = {
8079 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
8080 ":bar" "\xef\x80\xa2" "baz:$DATA", /* "bar:baz:$DATA" */
8081 "::$DATA"
8082 };
8083 const char *localdir = NULL;
8084
8085 localdir = torture_setting_string(tctx, "localdir", NULL);
8086 if (localdir == NULL) {
8087 torture_skip(tctx, "Need localdir for test");
8088 }
8089
8090 sname1 = talloc_asprintf(mem_ctx, "%s%s", fname, streams[0]);
8091
8092 /* clean slate ...*/
8093 smb2_util_unlink(tree, fname);
8094 smb2_deltree(tree, fname);
8095 smb2_deltree(tree, BASEDIR);
8096
8097 status = torture_smb2_testdir(tree, BASEDIR, &h);
8098 CHECK_STATUS(status, NT_STATUS_OK);
8099 smb2_util_close(tree, h);
8100
8101 torture_comment(tctx, "(%s) testing stream names\n", __location__);
8102 ZERO_STRUCT(create);
8103 create.in.desired_access = SEC_FILE_WRITE_DATA;
8104 create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
8105 create.in.share_access =
8106 NTCREATEX_SHARE_ACCESS_DELETE|
8107 NTCREATEX_SHARE_ACCESS_READ|
8108 NTCREATEX_SHARE_ACCESS_WRITE;
8109 create.in.create_disposition = NTCREATEX_DISP_CREATE;
8110 create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
8111 create.in.fname = sname1;
8112
8113 status = smb2_create(tree, mem_ctx, &create);
8114 CHECK_STATUS(status, NT_STATUS_OK);
8115
8116 status = smb2_util_write(tree, create.out.file.handle, "foo", 0, 3);
8117 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8118 "smb2_util_write failed\n");
8119
8120 smb2_util_close(tree, create.out.file.handle);
8121
8122 ret = torture_setup_local_xattr(tctx, "localdir", BASEDIR "/stream_names.txt",
8123 "user.DosStream.bar:baz:$DATA",
8124 "data", strlen("data")+1);
8125 CHECK_VALUE(ret, true);
8126
8127 ret = check_stream_list(tree, tctx, fname, 3, streams, false);
8128 CHECK_VALUE(ret, true);
8129
8130 done:
8131 status = smb2_util_unlink(tree, fname);
8132 smb2_deltree(tree, BASEDIR);
8133 talloc_free(mem_ctx);
8134
8135 return ret;
8136 }
8137
8138 static bool test_fruit_locking_conflict(struct torture_context *tctx,
8139 struct smb2_tree *tree,
8140 struct smb2_tree *tree2)
8141 {
8142 TALLOC_CTX *mem_ctx;
8143 struct smb2_create create;
8144 struct smb2_handle h;
8145 struct smb2_lock lck;
8146 struct smb2_lock_element el;
8147 const char *fname = BASEDIR "\\locking_conflict.txt";
8148 NTSTATUS status;
8149 bool ret = false;
8150
8151 mem_ctx = talloc_new(tctx);
8152 torture_assert_not_null(tctx, mem_ctx, "talloc_new failed");
8153
8154 /* clean slate ...*/
8155 smb2_util_unlink(tree, fname);
8156 smb2_deltree(tree, fname);
8157 smb2_deltree(tree, BASEDIR);
8158
8159 status = torture_smb2_testdir(tree, BASEDIR, &h);
8160 CHECK_STATUS(status, NT_STATUS_OK);
8161 smb2_util_close(tree, h);
8162
8163 create = (struct smb2_create) {
8164 .in.desired_access = SEC_RIGHTS_FILE_READ,
8165 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
8166 .in.share_access =
8167 NTCREATEX_SHARE_ACCESS_READ|
8168 NTCREATEX_SHARE_ACCESS_WRITE,
8169 .in.create_disposition = NTCREATEX_DISP_CREATE,
8170 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
8171 .in.fname = fname,
8172 };
8173
8174 status = smb2_create(tree, mem_ctx, &create);
8175 CHECK_STATUS(status, NT_STATUS_OK);
8176 h = create.out.file.handle;
8177
8178 /* Add AD_FILELOCK_RSRC_DENY_WR lock. */
8179 el = (struct smb2_lock_element) {
8180 .offset = 0x7ffffffffffffffc,
8181 .length = 1,
8182 .flags = SMB2_LOCK_FLAG_EXCLUSIVE,
8183 };
8184 lck = (struct smb2_lock) {
8185 .in.lock_count = 1,
8186 .in.file.handle = h,
8187 .in.locks = &el,
8188 };
8189
8190 /*
8191 * Lock up to and including:
8192 * AD_FILELOCK_OPEN_WR
8193 * AD_FILELOCK_OPEN_RD
8194 * This is designed to cause a NetAtalk
8195 * locking conflict on the next open,
8196 * even though the share modes are
8197 * compatible.
8198 */
8199 status = smb2_lock(tree, &lck);
8200 CHECK_STATUS(status, NT_STATUS_OK);
8201
8202 el = (struct smb2_lock_element) {
8203 .offset = 0,
8204 .length = 0x7ffffffffffffff7,
8205 .flags = SMB2_LOCK_FLAG_EXCLUSIVE,
8206 };
8207 status = smb2_lock(tree, &lck);
8208 CHECK_STATUS(status, NT_STATUS_OK);
8209
8210 create = (struct smb2_create) {
8211 .in.desired_access =
8212 SEC_RIGHTS_FILE_READ|SEC_RIGHTS_FILE_WRITE,
8213 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
8214 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
8215 .in.create_disposition = NTCREATEX_DISP_OPEN,
8216 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
8217 .in.fname = fname,
8218 };
8219
8220 /*
8221 * Open on the second tree - ensure we are
8222 * emulating trying to access with a NetATalk
8223 * process with an existing open/deny mode.
8224 */
8225 status = smb2_create(tree2, mem_ctx, &create);
8226 CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
8227
8228 {
8229 struct smb2_close cl = {
8230 .level = RAW_CLOSE_SMB2,
8231 .in.file.handle = h,
8232 };
8233 smb2_close(tree, &cl);
8234 }
8235
8236 ret = true;
8237 done:
8238 return ret;
8239 }
8240
8241 struct torture_suite *torture_vfs_fruit_netatalk(TALLOC_CTX *ctx)
8242 {
8243 struct torture_suite *suite = torture_suite_create(
8244 ctx, "fruit_netatalk");
8245
8246 suite->description = talloc_strdup(suite, "vfs_fruit tests for Netatalk interop that require fruit:metadata=netatalk");
8247
8248 torture_suite_add_1smb2_test(suite, "read netatalk metadata", test_read_netatalk_metadata);
8249 torture_suite_add_1smb2_test(suite, "stream names with locally created xattr", test_stream_names_local);
8250 torture_suite_add_2smb2_test(
8251 suite, "locking conflict", test_fruit_locking_conflict);
8252
8253 return suite;
8254 }
8255
8256 struct torture_suite *torture_vfs_fruit_file_id(TALLOC_CTX *ctx)
8257 {
8258 struct torture_suite *suite =
8259 torture_suite_create(ctx, "fruit_file_id");
8260
8261 suite->description =
8262 talloc_strdup(suite, "vfs_fruit tests for on-disk file ID that "
8263 "require fruit:zero_file_id=yes");
8264
8265 torture_suite_add_1smb2_test(suite, "zero file id if AAPL negotiated",
8266 test_zero_file_id);
8267
8268 return suite;
8269 }
8270
8271 static bool test_timemachine_volsize(struct torture_context *tctx,
8272 struct smb2_tree *tree)
8273 {
8274 TALLOC_CTX *mem_ctx = talloc_new(tctx);
8275 struct smb2_handle h = {{0}};
8276 union smb_fsinfo fsinfo;
8277 NTSTATUS status;
8278 bool ok = true;
8279 const char *info_plist =
8280 "<dict>\n"
8281 " <key>band-size</key>\n"
8282 " <integer>8192</integer>\n"
8283 "</dict>\n";
8284
8285 smb2_deltree(tree, "test.sparsebundle");
8286
8287 ok = enable_aapl(tctx, tree);
8288 torture_assert_goto(tctx, ok, ok, done, "enable_aapl failed");
8289
8290 status = smb2_util_mkdir(tree, "test.sparsebundle");
8291 torture_assert_ntstatus_ok_goto(tctx, status, ok, done,
8292 "smb2_util_mkdir\n");
8293
8294 ok = write_stream(tree, __location__, tctx, mem_ctx,
8295 "test.sparsebundle/Info.plist", NULL,
8296 0, strlen(info_plist), info_plist);
8297 torture_assert_goto(tctx, ok, ok, done, "write_stream failed\n");
8298
8299 status = smb2_util_mkdir(tree, "test.sparsebundle/bands");
8300 torture_assert_ntstatus_ok_goto(tctx, status, ok, done,
8301 "smb2_util_mkdir\n");
8302
8303 status = smb2_util_roothandle(tree, &h);
8304 torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle");
8305
8306 /* Test that smbd does not crash if number of bands is 0 */
8307 ZERO_STRUCT(fsinfo);
8308 fsinfo.generic.level = RAW_QFS_SIZE_INFORMATION;
8309 fsinfo.generic.handle = h;
8310
8311 status = smb2_getinfo_fs(tree, tree, &fsinfo);
8312 torture_assert_ntstatus_ok(tctx, status, "smb2_getinfo_fs failed");
8313
8314 /* Setup 2 bands and test again */
8315 ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/1", false);
8316 torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n");
8317
8318 ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/2", false);
8319 torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n");
8320
8321 ZERO_STRUCT(fsinfo);
8322 fsinfo.generic.level = RAW_QFS_SIZE_INFORMATION;
8323 fsinfo.generic.handle = h;
8324
8325 status = smb2_getinfo_fs(tree, tree, &fsinfo);
8326 torture_assert_ntstatus_ok(tctx, status, "smb2_getinfo_fs failed");
8327
8328 torture_comment(tctx, "sectors_per_unit: %" PRIu32"\n"
8329 "bytes_per_sector: %" PRIu32"\n"
8330 "total_alloc_units: %" PRIu64"\n"
8331 "avail_alloc_units: %" PRIu64"\n",
8332 fsinfo.size_info.out.sectors_per_unit,
8333 fsinfo.size_info.out.bytes_per_sector,
8334 fsinfo.size_info.out.total_alloc_units,
8335 fsinfo.size_info.out.avail_alloc_units);
8336
8337 /*
8338 * Let me explain the numbers:
8339 *
8340 * - the share is set to "fruit:time machine max size = 32K"
8341 * - we've faked a bandsize of 8 K in the Info.plist file
8342 * - we've created two bands files
8343 * - one allocation unit is made of two sectors with 512 B each
8344 * => we've consumed 16 allocation units, there should be 16 free
8345 */
8346
8347 torture_assert_goto(tctx, fsinfo.size_info.out.sectors_per_unit == 2,
8348 ok, done, "Bad sectors_per_unit");
8349
8350 torture_assert_goto(tctx, fsinfo.size_info.out.bytes_per_sector == 512,
8351 ok, done, "Bad bytes_per_sector");
8352
8353 torture_assert_goto(tctx, fsinfo.size_info.out.total_alloc_units == 32,
8354 ok, done, "Bad total_alloc_units");
8355
8356 torture_assert_goto(tctx, fsinfo.size_info.out.avail_alloc_units == 16,
8357 ok, done, "Bad avail_alloc_units");
8358
8359 done:
8360 if (!smb2_util_handle_empty(h)) {
8361 smb2_util_close(tree, h);
8362 }
8363 smb2_deltree(tree, "test.sparsebundle");
8364 talloc_free(mem_ctx);
8365 return ok;
8366 }
8367
8368 struct torture_suite *torture_vfs_fruit_timemachine(TALLOC_CTX *ctx)
8369 {
8370 struct torture_suite *suite = torture_suite_create(
8371 ctx, "fruit_timemachine");
8372
8373 suite->description = talloc_strdup(
8374 suite, "vfs_fruit tests for TimeMachine");
8375
8376 torture_suite_add_1smb2_test(suite, "Timemachine-volsize",
8377 test_timemachine_volsize);
8378
8379 return suite;
8380 }
8381
8382 static bool test_convert_xattr_and_empty_rfork_then_delete(
8383 struct torture_context *tctx,
8384 struct smb2_tree *tree1,
8385 struct smb2_tree *tree2)
8386 {
8387 TALLOC_CTX *mem_ctx = talloc_new(tctx);
8388 const char *fname = BASEDIR "\\test_adouble_conversion";
8389 const char *adname = BASEDIR "/._test_adouble_conversion";
8390 const char *rfork = BASEDIR "\\test_adouble_conversion" AFPRESOURCE_STREAM_NAME;
8391 NTSTATUS status;
8392 struct smb2_handle testdirh;
8393 bool ret = true;
8394 const char *streams[] = {
8395 "::$DATA",
8396 AFPINFO_STREAM,
8397 ":com.apple.metadata" "\xef\x80\xa2" "_kMDItemUserTags:$DATA",
8398 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
8399 };
8400 struct smb2_create create;
8401 struct smb2_find find;
8402 unsigned int count;
8403 union smb_search_data *d;
8404 bool delete_empty_adfiles;
8405 int expected_num_files;
8406
8407 delete_empty_adfiles = torture_setting_bool(tctx,
8408 "delete_empty_adfiles",
8409 false);
8410
8411 smb2_deltree(tree1, BASEDIR);
8412
8413 status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
8414 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8415 "torture_smb2_testdir failed\n");
8416 smb2_util_close(tree1, testdirh);
8417
8418 ret = torture_setup_file(tctx, tree1, fname, false);
8419 torture_assert_goto(tctx, ret == true, ret, done,
8420 "torture_setup_file failed\n");
8421
8422 ret = torture_setup_file(tctx, tree1, adname, false);
8423 torture_assert_goto(tctx, ret == true, ret, done,
8424 "torture_setup_file failed\n");
8425
8426 ret = write_stream(tree1, __location__, tctx, mem_ctx,
8427 adname, NULL,
8428 0, sizeof(osx_adouble_w_xattr), osx_adouble_w_xattr);
8429 torture_assert_goto(tctx, ret == true, ret, done,
8430 "write_stream failed\n");
8431
8432 ret = enable_aapl(tctx, tree2);
8433 torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
8434
8435 /*
8436 * Issue a smb2_find(), this triggers the server-side conversion
8437 */
8438
8439 create = (struct smb2_create) {
8440 .in.desired_access = SEC_RIGHTS_DIR_READ,
8441 .in.create_options = NTCREATEX_OPTIONS_DIRECTORY,
8442 .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY,
8443 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
8444 .in.create_disposition = NTCREATEX_DISP_OPEN,
8445 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
8446 .in.fname = BASEDIR,
8447 };
8448
8449 status = smb2_create(tree2, tctx, &create);
8450 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8451 "smb2_create failed\n");
8452
8453 find = (struct smb2_find) {
8454 .in.file.handle = create.out.file.handle,
8455 .in.pattern = "*",
8456 .in.max_response_size = 0x1000,
8457 .in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO,
8458 };
8459
8460 status = smb2_find_level(tree2, tree2, &find, &count, &d);
8461 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8462 "smb2_find_level failed\n");
8463
8464 status = smb2_util_close(tree2, create.out.file.handle);
8465 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8466 "smb2_util_close failed");
8467
8468 /*
8469 * Check number of streams
8470 */
8471
8472 ret = check_stream_list(tree2, tctx, fname, 4, streams, false);
8473 torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
8474
8475 /*
8476 * Check Resource Fork is gone
8477 */
8478
8479 create = (struct smb2_create) {
8480 .in.desired_access = SEC_RIGHTS_FILE_READ|SEC_RIGHTS_FILE_WRITE,
8481 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
8482 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
8483 .in.create_disposition = NTCREATEX_DISP_OPEN,
8484 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
8485 .in.fname = rfork,
8486 };
8487
8488 status = smb2_create(tree2, mem_ctx, &create);
8489 torture_assert_ntstatus_equal_goto(
8490 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
8491 ret, done, "Bad smb2_create return\n");
8492
8493 /*
8494 * Check xattr data has been migrated from the AppleDouble file to
8495 * streams.
8496 */
8497
8498 ret = check_stream(tree2, __location__, tctx, mem_ctx,
8499 fname, AFPINFO_STREAM,
8500 0, 60, 16, 8, "TESTSLOW");
8501 torture_assert_goto(tctx, ret == true, ret, done,
8502 "check AFPINFO_STREAM failed\n");
8503
8504 ret = check_stream(tree2, __location__, tctx, mem_ctx,
8505 fname, ":foo" "\xef\x80\xa2" "bar", /* foo:bar */
8506 0, 3, 0, 3, "baz");
8507 torture_assert_goto(tctx, ret == true, ret, done,
8508 "check foo stream failed\n");
8509
8510 /*
8511 * Now check number of files. If delete_empty_adfiles is set, the
8512 * AppleDouble files should have been deleted.
8513 */
8514
8515 create = (struct smb2_create) {
8516 .in.desired_access = SEC_RIGHTS_DIR_READ,
8517 .in.create_options = NTCREATEX_OPTIONS_DIRECTORY,
8518 .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY,
8519 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
8520 .in.create_disposition = NTCREATEX_DISP_OPEN,
8521 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
8522 .in.fname = BASEDIR,
8523 };
8524
8525 status = smb2_create(tree2, tctx, &create);
8526 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8527 "smb2_create failed\n");
8528
8529 find = (struct smb2_find) {
8530 .in.file.handle = create.out.file.handle,
8531 .in.pattern = "*",
8532 .in.max_response_size = 0x1000,
8533 .in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO,
8534 };
8535
8536 status = smb2_find_level(tree2, tree2, &find, &count, &d);
8537 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8538 "smb2_find_level failed\n");
8539
8540 status = smb2_util_close(tree2, create.out.file.handle);
8541 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8542 "smb2_util_close failed");
8543
8544 if (delete_empty_adfiles) {
8545 expected_num_files = 3;
8546 } else {
8547 expected_num_files = 4;
8548 }
8549 torture_assert_int_equal_goto(tctx, count, expected_num_files, ret, done,
8550 "Wrong number of files\n");
8551
8552 done:
8553 smb2_deltree(tree1, BASEDIR);
8554 talloc_free(mem_ctx);
8555 return ret;
8556 }
8557
8558 struct torture_suite *torture_vfs_fruit_conversion(TALLOC_CTX *ctx)
8559 {
8560 struct torture_suite *suite = torture_suite_create(
8561 ctx, "fruit_conversion");
8562
8563 suite->description = talloc_strdup(
8564 suite, "vfs_fruit conversion tests");
8565
8566 torture_suite_add_2ns_smb2_test(
8567 suite, "convert_xattr_and_empty_rfork_then_delete",
8568 test_convert_xattr_and_empty_rfork_then_delete);
8569
8570 return suite;
8571 }
8572
8573 /*
8574 * The buf below contains the following AppleDouble encoded data:
8575 *
8576 * -----------------------------------------------------------------------------
8577 * MagicNumber: 00051607 : AppleDouble
8578 * Version : 00020000 : Version 2
8579 * Filler : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
8580 * Num. of ent: 0002 : 2
8581 *
8582 * -----------------------------------------------------------------------------
8583 * Entry ID : 00000002 : Resource Fork
8584 * Offset : 0000009A : 154
8585 * Length : 00000004 : 4
8586 *
8587 * -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
8588 * 00000000 : 62 61 72 00 : bar.
8589 *
8590 * -----------------------------------------------------------------------------
8591 * Entry ID : 00000009 : Finder Info
8592 * Offset : 00000032 : 50
8593 * Length : 00000068 : 104
8594 *
8595 * -FInfo-----:
8596 * Type : 464F4F20 : FOO
8597 * Creator : 42415220 : BAR
8598 * isAlias : 0
8599 * Invisible : 0
8600 * hasBundle : 0
8601 * nameLocked : 0
8602 * Stationery : 0
8603 * CustomIcon : 0
8604 * Reserved : 0
8605 * Inited : 0
8606 * NoINITS : 0
8607 * Shared : 0
8608 * SwitchLaunc: 0
8609 * Hidden Ext : 0
8610 * color : 000 : none
8611 * isOnDesk : 0
8612 * Location v : 0000 : 0
8613 * Location h : 0000 : 0
8614 * Fldr : 0000 : ..
8615 *
8616 * -FXInfo----:
8617 * Rsvd|IconID: 0000 : 0
8618 * Rsvd : 0000 : ..
8619 * Rsvd : 0000 : ..
8620 * Rsvd : 0000 : ..
8621 * AreInvalid : 0
8622 * unknown bit: 0
8623 * unknown bit: 0
8624 * unknown bit: 0
8625 * unknown bit: 0
8626 * unknown bit: 0
8627 * unknown bit: 0
8628 * CustomBadge: 0
8629 * ObjctIsBusy: 0
8630 * unknown bit: 0
8631 * unknown bit: 0
8632 * unknown bit: 0
8633 * unknown bit: 0
8634 * RoutingInfo: 0
8635 * unknown bit: 0
8636 * unknown bit: 0
8637 * Rsvd|commnt: 0000 : 0
8638 * PutAway : 00000000 : 0
8639 *
8640 * -EA--------:
8641 * pad : 0000 :
8642 * magic : 41545452 : ATTR
8643 * debug_tag : 00000000 : 0
8644 * total_size : 0000009A : 154
8645 * data_start : 00000096 : 150
8646 * data_length: 00000004 : 4
8647 * reserved[0]: 00000000 : ....
8648 * reserved[1]: 00000000 : ....
8649 * reserved[2]: 00000000 : ....
8650 * flags : 0000 : ..
8651 * num_attrs : 0001 : 1
8652 * -EA ENTRY--:
8653 * offset : 00000096 : 150
8654 * length : 00000004 : 4
8655 * flags : 0000 : ..
8656 * namelen : 13 : 19
8657 * -EA NAME---: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
8658 * 00000000 : 6F 72 67 2E 73 61 6D 62 61 EF 80 A2 77 6F 6F 68 : org.samba...wooh
8659 * 00000010 : 6F 6F 00 : oo.
8660 * -EA VALUE--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
8661 * 00000000 : 62 61 72 00 : bar.
8662 *
8663 * -RAW DUMP--: 0 1 2 3 4 5 6 7 8 9 A B C D E F : (ASCII)
8664 * 00000000 : 46 4F 4F 20 42 41 52 20 00 00 00 00 00 00 00 00 : FOO BAR ........
8665 * 00000010 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
8666 * 00000020 : 00 00 41 54 54 52 00 00 00 00 00 00 00 9A 00 00 : baATTR..........
8667 * 00000030 : 00 96 00 00 00 04 00 00 00 00 00 00 00 00 00 00 : ................
8668 * 00000040 : 00 00 00 00 00 01 00 00 00 96 00 00 00 04 00 00 : ................
8669 * 00000050 : 13 6F 72 67 2E 73 61 6D 62 61 EF 80 A2 77 6F 6F : .org.samba...woo
8670 * 00000060 : 68 6F 6F 00 62 61 72 00 : hoo.bar.
8671 *
8672 * It was created with:
8673 *
8674 * $ hexdump -ve '"\t" 7/1 "0x%02x, " 1/1 " 0x%02x," "\n"'
8675 */
8676 static char unconvert_adfile_data[] = {
8677 0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
8678 0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
8679 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
8680 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
8681 0x00, 0x98, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
8682 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
8683 0x00, 0x66, 0x46, 0x4f, 0x4f, 0x20, 0x42, 0x41,
8684 0x52, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8685 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8686 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8687 0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52,
8688 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98,
8689 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x04,
8690 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
8692 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x04,
8693 0x00, 0x00, 0x11, 0x6f, 0x72, 0x67, 0x2e, 0x73,
8694 0x61, 0x6d, 0x62, 0x61, 0x3a, 0x77, 0x6f, 0x6f,
8695 0x68, 0x6f, 0x6f, 0x00, 0x62, 0x61, 0x72, 0x00,
8696 0x62, 0x61, 0x72, 0x00
8697 };
8698
8699 static bool test_unconvert(struct torture_context *tctx,
8700 struct smb2_tree *tree1,
8701 struct smb2_tree *tree2)
8702 {
8703 const char *fname = BASEDIR "\\unconvert";
8704 const char *adname = BASEDIR "\\._unconvert";
8705 const char *net = NULL;
8706 const char *share = NULL;
8707 AfpInfo *afpi = NULL;
8708 char *cmd = NULL;
8709 struct smb2_handle h1;
8710 union smb_fileinfo finfo;
8711 size_t adsize;
8712 NTSTATUS status;
8713 int result;
8714 bool ret = true;
8715
8716 torture_assert_not_null_goto(tctx, tree2, ret, done,
8717 "Need a second share without fruit\n");
8718
8719 net = torture_setting_string(tctx, "net", NULL);
8720 torture_assert_not_null_goto(tctx, net, ret, done,
8721 "Need path to 'net'");
8722
8723 share = torture_setting_string(tctx, "sharename", NULL);
8724 torture_assert_not_null_goto(tctx, share, ret, done,
8725 "Need sharename");
8726
8727 torture_comment(tctx, "Testing unconvert\n");
8728
8729 smb2_deltree(tree1, BASEDIR);
8730
8731 status = torture_smb2_testdir(tree1, BASEDIR, &h1);
8732 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8733 "torture_smb2_testdir\n");
8734 smb2_util_close(tree1, h1);
8735
8736 ret = torture_setup_file(tctx, tree1, fname, false);
8737 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
8738
8739 afpi = torture_afpinfo_new(tctx);
8740 torture_assert_not_null_goto(tctx, afpi, ret, done,
8741 "torture_afpinfo_new failed\n");
8742
8743 memcpy(afpi->afpi_FinderInfo, "FOO BAR ", 8);
8744
8745 ret = torture_write_afpinfo(tree1, tctx, tctx, fname, afpi);
8746 torture_assert_goto(tctx, ret == true, ret, done,
8747 "torture_write_afpinfo failed\n");
8748
8749 ret = write_stream(tree1, __location__, tctx, tctx,
8750 fname,
8751 /*
8752 * \xef\x80\xa2 is ':' mapped to Unicoe private range
8753 */
8754 ":org.samba" "\xef\x80\xa2" "woohoo",
8755 0, 4, "bar");
8756 torture_assert_goto(tctx, ret == true, ret, done,
8757 "write_stream failed\n");
8758
8759 ret = write_stream(tree1, __location__, tctx, tctx,
8760 fname, AFPRESOURCE_STREAM_NAME,
8761 0, 4, "bar");
8762 torture_assert_goto(tctx, ret == true, ret, done,
8763 "write_stream failed\n");
8764
8765 cmd = talloc_asprintf(tctx,
8766 "%s --recursive vfs stream2adouble %s %s/",
8767 net,
8768 share,
8769 BASEDIR);
8770 torture_assert_not_null_goto(tctx, cmd, ret, done,
8771 "talloc_asprintf failed\n");
8772
8773 torture_comment(tctx, "cmd: %s\n", cmd);
8774
8775 result = system(cmd);
8776 torture_assert_int_equal_goto(tctx, result, 0, ret, done,
8777 "command failed\n");
8778
8779 status = torture_smb2_testfile(tree2, adname, &h1);
8780 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8781 "torture_smb2_testfile failed\n");
8782
8783 finfo = (union smb_fileinfo) {
8784 .generic.level = RAW_FILEINFO_ALL_INFORMATION,
8785 .generic.in.file.handle = h1,
8786 };
8787
8788 status = smb2_getinfo_file(tree2, tctx, &finfo);
8789 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8790 "torture_smb2_testdir\n");
8791 smb2_util_close(tree2, h1);
8792
8793 adsize = finfo.all_info.out.size;
8794 torture_assert_int_equal_goto(tctx, adsize,
8795 sizeof(unconvert_adfile_data),
8796 ret, done, "wrong size\n");
8797
8798 ret = check_stream(tree2, __location__, tctx, tctx,
8799 adname, "", 0, adsize, 0, adsize,
8800 unconvert_adfile_data);
8801 torture_assert_goto(tctx, ret == true, ret, done,
8802 "check_stream failed\n");
8803
8804 done:
8805 // smb2_deltree(tree1, BASEDIR);
8806 return ret;
8807 }
8808
8809 struct torture_suite *torture_vfs_fruit_unfruit(TALLOC_CTX *ctx)
8810 {
8811 struct torture_suite *suite = torture_suite_create(
8812 ctx, "unfruit");
8813
8814 suite->description = talloc_strdup(
8815 suite, "test converting back to AppleDouble");
8816
8817 torture_suite_add_2ns_smb2_test(suite,
8818 "unconvert",
8819 test_unconvert);
8820
8821 return suite;
8822 }
8823
8824 /*
8825 * Write an invalid AFP_AfpInfo stream header
8826 */
8827 bool test_fruit_validate_afpinfo(struct torture_context *tctx,
8828 struct smb2_tree *tree)
8829 {
8830 bool expect_invalid_param = torture_setting_bool(tctx, "validate_afpinfo", true);
8831 const char *fname = "test_fruit_validate_afpinfo";
8832 const char *sname = "test_fruit_validate_afpinfo" AFPINFO_STREAM_NAME;
8833 struct smb2_handle handle;
8834 AfpInfo *afpinfo = NULL;
8835 char *afpinfo_buf = NULL;
8836 uint8_t valbuf[8];
8837 NTSTATUS status;
8838 bool ret = true;
8839
8840 torture_comment(tctx, "Checking create of AfpInfo stream\n");
8841
8842 smb2_util_unlink(tree, fname);
8843
8844 ret = torture_setup_file(tctx, tree, fname, false);
8845 torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
8846
8847 afpinfo = torture_afpinfo_new(tctx);
8848 torture_assert_not_null_goto(tctx, afpinfo, ret, done,
8849 "torture_afpinfo_new failed\n");
8850
8851 memcpy(afpinfo->afpi_FinderInfo, "FOO BAR ", 8);
8852
8853 ret = torture_write_afpinfo(tree, tctx, tctx, fname, afpinfo);
8854 torture_assert_goto(tctx, ret == true, ret, done,
8855 "torture_write_afpinfo failed\n");
8856
8857 afpinfo_buf = talloc_zero_size(tctx, 60);
8858 torture_assert_goto(tctx, afpinfo_buf != NULL, ret, done,
8859 "torture_afpinfo_new failed");
8860 memcpy(afpinfo_buf + 16, "FOO ", 4);
8861
8862 status = torture_smb2_testfile_access(
8863 tree, sname, &handle, SEC_FILE_ALL);
8864 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8865 "smb2_create failed\n");
8866
8867 status = smb2_util_write(tree, handle, afpinfo_buf, 0, AFP_INFO_SIZE);
8868 if (expect_invalid_param) {
8869 torture_assert_ntstatus_equal_goto(
8870 tctx, status, NT_STATUS_INVALID_PARAMETER, ret, done,
8871 "write didn't fail as expected\n");
8872 } else {
8873 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
8874 "smb2_util_write failed");
8875 }
8876
8877 smb2_util_close(tree, handle);
8878
8879 /*
8880 * Verify the server fixed the header
8881 */
8882 PUSH_BE_U32(valbuf, 0, AFP_Signature);
8883 PUSH_BE_U32(valbuf + 4, 0, AFP_Version);
8884 ret = check_stream(tree, __location__, tctx, tctx, fname,
8885 AFPINFO_STREAM, 0, 60, 0, 8, (char *)valbuf);
8886 torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
8887
8888 done:
8889 smb2_util_unlink(tree, fname);
8890 return ret;
8891 }