LCOV - code coverage report
Current view: top level - source4/torture/vfs - fruit.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 65 2815 2.3 %
Date: 2024-06-13 04:01:37 Functions: 6 71 8.5 %

          Line data    Source code
       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           0 : static int qsort_string(char * const *s1, char * const *s2)
      74             : {
      75           0 :         return strcmp(*s1, *s2);
      76             : }
      77             : 
      78           0 : static int qsort_stream(const struct stream_struct * s1, const struct stream_struct *s2)
      79             : {
      80           0 :         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             : 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           0 : static AfpInfo *torture_afpinfo_new(TALLOC_CTX *mem_ctx)
    1694             : {
    1695             :         AfpInfo *info;
    1696             : 
    1697           0 :         info = talloc_zero(mem_ctx, AfpInfo);
    1698           0 :         if (info == NULL) {
    1699           0 :                 return NULL;
    1700             :         }
    1701             : 
    1702           0 :         info->afpi_Signature = AFP_Signature;
    1703           0 :         info->afpi_Version = AFP_Version;
    1704           0 :         info->afpi_BackupTime = AFP_BackupTime;
    1705             : 
    1706           0 :         return info;
    1707             : }
    1708             : 
    1709             : /**
    1710             :  * Pack AfpInfo into a talloced buffer
    1711             :  **/
    1712           0 : static char *torture_afpinfo_pack(TALLOC_CTX *mem_ctx,
    1713             :                                   AfpInfo *info)
    1714             : {
    1715             :         char *buf;
    1716             : 
    1717           0 :         buf = talloc_zero_array(mem_ctx, char, AFP_INFO_SIZE);
    1718           0 :         if (buf == NULL) {
    1719           0 :                 return NULL;
    1720             :         }
    1721             : 
    1722           0 :         RSIVAL(buf, 0, info->afpi_Signature);
    1723           0 :         RSIVAL(buf, 4, info->afpi_Version);
    1724           0 :         RSIVAL(buf, 12, info->afpi_BackupTime);
    1725           0 :         memcpy(buf + 16, info->afpi_FinderInfo, sizeof(info->afpi_FinderInfo));
    1726             : 
    1727           0 :         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           0 : 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           0 :         bool ret = true;
    1756             : 
    1757           0 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, AFPINFO_STREAM_NAME);
    1758           0 :         if (full_name == NULL) {
    1759           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1760           0 :             return false;
    1761             :         }
    1762           0 :         ZERO_STRUCT(io);
    1763           0 :         io.in.desired_access = SEC_FILE_WRITE_DATA;
    1764           0 :         io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1765           0 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    1766           0 :         io.in.create_options = 0;
    1767           0 :         io.in.fname = full_name;
    1768             : 
    1769           0 :         status = smb2_create(tree, mem_ctx, &io);
    1770           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    1771             : 
    1772           0 :         handle = io.out.file.handle;
    1773             : 
    1774           0 :         infobuf = torture_afpinfo_pack(mem_ctx, info);
    1775           0 :         if (infobuf == NULL) {
    1776           0 :                 return false;
    1777             :         }
    1778             : 
    1779           0 :         status = smb2_util_write(tree, handle, infobuf, 0, AFP_INFO_SIZE);
    1780           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    1781             : 
    1782           0 :         smb2_util_close(tree, handle);
    1783             : 
    1784           0 : done:
    1785           0 :         return ret;
    1786             : }
    1787             : 
    1788             : /**
    1789             :  * Read 'count' bytes at 'offset' from stream 'fname:sname' and
    1790             :  * compare against buffer 'value'
    1791             :  **/
    1792           0 : 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           0 :         bool ret = true;
    1810             : 
    1811           0 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
    1812           0 :         if (full_name == NULL) {
    1813           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1814           0 :             return false;
    1815             :         }
    1816           0 :         ZERO_STRUCT(create);
    1817           0 :         create.in.desired_access = SEC_FILE_READ_DATA;
    1818           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1819           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    1820           0 :         create.in.fname = full_name;
    1821             : 
    1822           0 :         torture_comment(tctx, "Open stream %s\n", full_name);
    1823             : 
    1824           0 :         status = smb2_create(tree, mem_ctx, &create);
    1825           0 :         if (!NT_STATUS_IS_OK(status)) {
    1826           0 :                 if (value == NULL) {
    1827           0 :                         TALLOC_FREE(full_name);
    1828           0 :                         return true;
    1829             :                 }
    1830           0 :                 torture_comment(tctx, "Unable to open stream %s: %s\n",
    1831             :                         full_name, nt_errstr(status));
    1832           0 :                 TALLOC_FREE(full_name);
    1833           0 :                 return false;
    1834             :         }
    1835             : 
    1836           0 :         handle = create.out.file.handle;
    1837           0 :         if (value == NULL) {
    1838           0 :                 TALLOC_FREE(full_name);
    1839           0 :                 smb2_util_close(tree, handle);
    1840           0 :                 return true;
    1841             :         }
    1842             : 
    1843           0 :         ZERO_STRUCT(r);
    1844           0 :         r.in.file.handle = handle;
    1845           0 :         r.in.length      = read_count;
    1846           0 :         r.in.offset      = read_offset;
    1847             : 
    1848           0 :         status = smb2_read(tree, tree, &r);
    1849             : 
    1850           0 :         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           0 :         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           0 :         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           0 : done:
    1865           0 :         TALLOC_FREE(full_name);
    1866           0 :         smb2_util_close(tree, handle);
    1867           0 :         return ret;
    1868             : }
    1869             : 
    1870             : /**
    1871             :  * Read 'count' bytes at 'offset' from stream 'fname:sname' and
    1872             :  * compare against buffer 'value'
    1873             :  **/
    1874           0 : 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           0 :         bool ret = true;
    1889             : 
    1890           0 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
    1891           0 :         if (full_name == NULL) {
    1892           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1893           0 :             return -1;
    1894             :         }
    1895           0 :         ZERO_STRUCT(create);
    1896           0 :         create.in.desired_access = SEC_FILE_READ_DATA;
    1897           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1898           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    1899           0 :         create.in.fname = full_name;
    1900             : 
    1901           0 :         torture_comment(tctx, "Open stream %s\n", full_name);
    1902             : 
    1903           0 :         status = smb2_create(tree, mem_ctx, &create);
    1904           0 :         if (!NT_STATUS_IS_OK(status)) {
    1905           0 :                 torture_comment(tctx, "Unable to open stream %s: %s\n",
    1906             :                                 full_name, nt_errstr(status));
    1907           0 :                 return -1;
    1908             :         }
    1909             : 
    1910           0 :         handle = create.out.file.handle;
    1911             : 
    1912           0 :         ZERO_STRUCT(r);
    1913           0 :         r.in.file.handle = handle;
    1914           0 :         r.in.length      = read_count;
    1915           0 :         r.in.offset      = read_offset;
    1916             : 
    1917           0 :         status = smb2_read(tree, tree, &r);
    1918           0 :         if (!NT_STATUS_IS_OK(status)) {
    1919           0 :                 CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
    1920             :         }
    1921             : 
    1922           0 :         smb2_util_close(tree, handle);
    1923             : 
    1924           0 : done:
    1925           0 :         if (ret == false) {
    1926           0 :                 return -1;
    1927             :         }
    1928           0 :         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           0 : 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           0 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname ? sname : "");
    1951           0 :         if (full_name == NULL) {
    1952           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1953           0 :             return false;
    1954             :         }
    1955           0 :         ZERO_STRUCT(create);
    1956           0 :         create.in.desired_access = SEC_FILE_WRITE_DATA;
    1957           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1958           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    1959           0 :         create.in.fname = full_name;
    1960             : 
    1961           0 :         status = smb2_create(tree, mem_ctx, &create);
    1962           0 :         if (!NT_STATUS_IS_OK(status)) {
    1963           0 :                 if (value == NULL) {
    1964           0 :                         return true;
    1965             :                 } else {
    1966           0 :                         torture_comment(tctx, "Unable to open stream %s: %s\n",
    1967             :                             full_name, nt_errstr(status));
    1968           0 :                         return false;
    1969             :                 }
    1970             :         }
    1971             : 
    1972           0 :         handle = create.out.file.handle;
    1973           0 :         if (value == NULL) {
    1974           0 :                 return true;
    1975             :         }
    1976             : 
    1977           0 :         status = smb2_util_write(tree, handle, value, offset, size);
    1978             : 
    1979           0 :         if (!NT_STATUS_IS_OK(status)) {
    1980           0 :                 torture_comment(tctx, "(%s) Failed to write %lu bytes to "
    1981             :                     "stream '%s'\n", location, (long)size, full_name);
    1982           0 :                 return false;
    1983             :         }
    1984             : 
    1985           0 :         smb2_util_close(tree, handle);
    1986           0 :         return true;
    1987             : }
    1988             : 
    1989           0 : 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           0 :         int ret = true;
    1997             :         int result;
    1998             :         const char *spath;
    1999             :         char *path;
    2000             : 
    2001           0 :         spath = torture_setting_string(tctx, path_option, NULL);
    2002           0 :         if (spath == NULL) {
    2003           0 :                 printf("No sharepath for option %s\n", path_option);
    2004           0 :                 return false;
    2005             :         }
    2006             : 
    2007           0 :         path = talloc_asprintf(tctx, "%s/%s", spath, name);
    2008             : 
    2009           0 :         result = setxattr(path, xattr, metadata, size, 0);
    2010           0 :         if (result != 0) {
    2011           0 :                 ret = false;
    2012             :         }
    2013             : 
    2014           0 :         TALLOC_FREE(path);
    2015             : 
    2016           0 :         return ret;
    2017             : }
    2018             : 
    2019             : /**
    2020             :  * Create a file or directory
    2021             :  **/
    2022           0 : 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           0 :         smb2_util_unlink(tree, name);
    2029           0 :         ZERO_STRUCT(io);
    2030           0 :         io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
    2031           0 :         io.in.file_attributes   = FILE_ATTRIBUTE_NORMAL;
    2032           0 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    2033           0 :         io.in.share_access =
    2034             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    2035             :                 NTCREATEX_SHARE_ACCESS_READ|
    2036             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2037           0 :         io.in.create_options = 0;
    2038           0 :         io.in.fname = name;
    2039           0 :         if (dir) {
    2040           0 :                 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    2041           0 :                 io.in.share_access &= ~NTCREATEX_SHARE_ACCESS_DELETE;
    2042           0 :                 io.in.file_attributes   = FILE_ATTRIBUTE_DIRECTORY;
    2043           0 :                 io.in.create_disposition = NTCREATEX_DISP_CREATE;
    2044             :         }
    2045             : 
    2046           0 :         status = smb2_create(tree, mem_ctx, &io);
    2047           0 :         if (!NT_STATUS_IS_OK(status)) {
    2048           0 :                 return false;
    2049             :         }
    2050             : 
    2051           0 :         status = smb2_util_close(tree, io.out.file.handle);
    2052           0 :         if (!NT_STATUS_IS_OK(status)) {
    2053           0 :                 return false;
    2054             :         }
    2055             : 
    2056           0 :         return true;
    2057             : }
    2058             : 
    2059           0 : static bool enable_aapl(struct torture_context *tctx,
    2060             :                         struct smb2_tree *tree)
    2061             : {
    2062           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2063             :         NTSTATUS status;
    2064           0 :         bool ret = true;
    2065             :         struct smb2_create io;
    2066             :         DATA_BLOB data;
    2067           0 :         struct smb2_create_blob *aapl = NULL;
    2068             :         uint32_t aapl_server_caps;
    2069           0 :         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           0 :         bool is_osx_server = torture_setting_bool(tctx, "osx", false);
    2074             : 
    2075           0 :         ZERO_STRUCT(io);
    2076           0 :         io.in.desired_access     = SEC_FLAG_MAXIMUM_ALLOWED;
    2077           0 :         io.in.file_attributes    = FILE_ATTRIBUTE_DIRECTORY;
    2078           0 :         io.in.create_disposition = NTCREATEX_DISP_OPEN;
    2079           0 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
    2080             :                               NTCREATEX_SHARE_ACCESS_READ |
    2081             :                               NTCREATEX_SHARE_ACCESS_WRITE);
    2082           0 :         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           0 :         data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
    2091           0 :         SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
    2092           0 :         SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS |
    2093             :                              SMB2_CRTCTX_AAPL_VOLUME_CAPS |
    2094             :                              SMB2_CRTCTX_AAPL_MODEL_INFO));
    2095           0 :         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           0 :         status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
    2100           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create_blob_add");
    2101             : 
    2102           0 :         status = smb2_create(tree, tctx, &io);
    2103           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2104             : 
    2105           0 :         status = smb2_util_close(tree, io.out.file.handle);
    2106           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_close");
    2107             : 
    2108             :         /*
    2109             :          * Now check returned AAPL context
    2110             :          */
    2111           0 :         torture_comment(tctx, "Comparing returned AAPL capabilities\n");
    2112             : 
    2113           0 :         aapl = smb2_create_blob_find(&io.out.blobs,
    2114             :                                      SMB2_CREATE_TAG_AAPL);
    2115           0 :         torture_assert_goto(tctx, aapl != NULL, ret, done, "missing AAPL context");
    2116             : 
    2117           0 :         if (!is_osx_server) {
    2118             :                 size_t expected_aapl_ctx_size;
    2119             : 
    2120           0 :                 expected_aapl_ctx_size = strlen("MacSamba") * 2 + 40;
    2121             : 
    2122           0 :                 torture_assert_goto(
    2123             :                         tctx, aapl->data.length == expected_aapl_ctx_size,
    2124             :                         ret, done, "bad AAPL size");
    2125             :         }
    2126             : 
    2127           0 :         aapl_server_caps = BVAL(aapl->data.data, 16);
    2128           0 :         torture_assert_goto(tctx, aapl_server_caps == expected_scaps,
    2129             :                             ret, done, "bad AAPL caps");
    2130             : 
    2131           0 : done:
    2132           0 :         talloc_free(mem_ctx);
    2133           0 :         return ret;
    2134             : }
    2135             : 
    2136           0 : static bool test_read_netatalk_metadata(struct torture_context *tctx,
    2137             :                                         struct smb2_tree *tree)
    2138             : {
    2139           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2140           0 :         const char *fname = BASEDIR "\\torture_read_metadata";
    2141             :         NTSTATUS status;
    2142             :         struct smb2_handle testdirh;
    2143           0 :         bool ret = true;
    2144             :         ssize_t len;
    2145           0 :         const char *localdir = NULL;
    2146             : 
    2147           0 :         torture_comment(tctx, "Checking metadata access\n");
    2148             : 
    2149           0 :         localdir = torture_setting_string(tctx, "localdir", NULL);
    2150           0 :         if (localdir == NULL) {
    2151           0 :                 torture_skip(tctx, "Need localdir for test");
    2152             :         }
    2153             : 
    2154           0 :         smb2_util_unlink(tree, fname);
    2155             : 
    2156           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2157           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2158           0 :         smb2_util_close(tree, testdirh);
    2159             : 
    2160           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2161           0 :         if (ret == false) {
    2162           0 :                 goto done;
    2163             :         }
    2164             : 
    2165           0 :         ret = torture_setup_local_xattr(tctx, "localdir",
    2166             :                                         BASEDIR "/torture_read_metadata",
    2167             :                                         AFPINFO_EA_NETATALK,
    2168             :                                         metadata_xattr, sizeof(metadata_xattr));
    2169           0 :         if (ret == false) {
    2170           0 :                 goto done;
    2171             :         }
    2172             : 
    2173           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2174             :                            0, 60, 0, 4, "AFP");
    2175           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2176             : 
    2177           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2178             :                            0, 60, 16, 8, "BARRFOOO");
    2179           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2180             : 
    2181           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2182             :                            16, 8, 0, 3, "AFP");
    2183           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2184             : 
    2185             :         /* Check reading offset and read size > sizeof(AFPINFO_STREAM) */
    2186             : 
    2187           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2188             :                           AFPINFO_STREAM, 0, 61);
    2189           0 :         CHECK_VALUE(len, 60);
    2190             : 
    2191           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2192             :                           AFPINFO_STREAM, 59, 2);
    2193           0 :         CHECK_VALUE(len, 2);
    2194             : 
    2195           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2196             :                           AFPINFO_STREAM, 60, 1);
    2197           0 :         CHECK_VALUE(len, 1);
    2198             : 
    2199           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2200             :                           AFPINFO_STREAM, 61, 1);
    2201           0 :         CHECK_VALUE(len, 0);
    2202             : 
    2203           0 : done:
    2204           0 :         smb2_deltree(tree, BASEDIR);
    2205           0 :         talloc_free(mem_ctx);
    2206           0 :         return ret;
    2207             : }
    2208             : 
    2209           0 : static bool test_read_afpinfo(struct torture_context *tctx,
    2210             :                               struct smb2_tree *tree)
    2211             : {
    2212           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2213           0 :         const char *fname = BASEDIR "\\torture_read_metadata";
    2214             :         NTSTATUS status;
    2215             :         struct smb2_handle testdirh;
    2216           0 :         bool ret = true;
    2217             :         ssize_t len;
    2218             :         AfpInfo *info;
    2219           0 :         const char *type_creator = "SMB,OLE!";
    2220             : 
    2221           0 :         torture_comment(tctx, "Checking metadata access\n");
    2222             : 
    2223           0 :         smb2_util_unlink(tree, fname);
    2224             : 
    2225           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2226           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir failed");
    2227           0 :         smb2_util_close(tree, testdirh);
    2228             : 
    2229           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2230           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
    2231             : 
    2232           0 :         info = torture_afpinfo_new(mem_ctx);
    2233           0 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    2234             : 
    2235           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    2236           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    2237           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    2238             : 
    2239           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2240             :                            0, 60, 0, 4, "AFP");
    2241           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2242             : 
    2243           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2244             :                            0, 60, 16, 8, type_creator);
    2245           0 :         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           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2253             :                            16, 8, 0, 8, "AFP\0\0\0\001\0");
    2254           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2255             : 
    2256           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2257             :                           AFPINFO_STREAM, 0, 61);
    2258           0 :         torture_assert_goto(tctx, len == 60, ret, done, "read_stream failed");
    2259             : 
    2260           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2261             :                           AFPINFO_STREAM, 59, 2);
    2262           0 :         torture_assert_goto(tctx, len == 2, ret, done, "read_stream failed");
    2263             : 
    2264           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2265             :                            59, 2, 0, 2, "AF");
    2266           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2267             : 
    2268           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2269             :                           AFPINFO_STREAM, 60, 1);
    2270           0 :         torture_assert_goto(tctx, len == 1, ret, done, "read_stream failed");
    2271             : 
    2272           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2273             :                            60, 1, 0, 1, "A");
    2274           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2275             : 
    2276           0 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2277             :                           AFPINFO_STREAM, 61, 1);
    2278           0 :         torture_assert_goto(tctx, len == 0, ret, done, "read_stream failed");
    2279             : 
    2280           0 : done:
    2281           0 :         smb2_util_unlink(tree, fname);
    2282           0 :         smb2_deltree(tree, BASEDIR);
    2283           0 :         talloc_free(mem_ctx);
    2284           0 :         return ret;
    2285             : }
    2286             : 
    2287           0 : static bool test_write_atalk_metadata(struct torture_context *tctx,
    2288             :                                       struct smb2_tree *tree)
    2289             : {
    2290           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2291           0 :         const char *fname = BASEDIR "\\torture_write_metadata";
    2292           0 :         const char *type_creator = "SMB,OLE!";
    2293             :         NTSTATUS status;
    2294             :         struct smb2_handle testdirh;
    2295           0 :         bool ret = true;
    2296             :         AfpInfo *info;
    2297             : 
    2298           0 :         smb2_deltree(tree, BASEDIR);
    2299           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2300           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2301           0 :         smb2_util_close(tree, testdirh);
    2302             : 
    2303           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2304           0 :         if (ret == false) {
    2305           0 :                 goto done;
    2306             :         }
    2307             : 
    2308           0 :         info = torture_afpinfo_new(mem_ctx);
    2309           0 :         if (info == NULL) {
    2310           0 :                 goto done;
    2311             :         }
    2312             : 
    2313           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    2314           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    2315           0 :         ret &= check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2316             :                             0, 60, 16, 8, type_creator);
    2317             : 
    2318           0 : done:
    2319           0 :         smb2_util_unlink(tree, fname);
    2320           0 :         smb2_deltree(tree, BASEDIR);
    2321           0 :         talloc_free(mem_ctx);
    2322           0 :         return ret;
    2323             : }
    2324             : 
    2325           0 : static bool test_write_atalk_rfork_io(struct torture_context *tctx,
    2326             :                                       struct smb2_tree *tree)
    2327             : {
    2328           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2329           0 :         const char *fname = BASEDIR "\\torture_write_rfork_io";
    2330           0 :         const char *rfork = BASEDIR "\\torture_write_rfork_io" AFPRESOURCE_STREAM_NAME;
    2331           0 :         const char *rfork_content = "1234567890";
    2332             :         NTSTATUS status;
    2333             :         struct smb2_handle testdirh;
    2334           0 :         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           0 :         smb2_util_unlink(tree, fname);
    2342             : 
    2343           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2344           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2345           0 :         smb2_util_close(tree, testdirh);
    2346             : 
    2347           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2348           0 :         if (ret == false) {
    2349           0 :                 goto done;
    2350             :         }
    2351             : 
    2352           0 :         torture_comment(tctx, "(%s) writing to resource fork\n",
    2353             :             __location__);
    2354             : 
    2355           0 :         ret &= write_stream(tree, __location__, tctx, mem_ctx,
    2356             :                             fname, AFPRESOURCE_STREAM_NAME,
    2357             :                             10, 10, rfork_content);
    2358             : 
    2359           0 :         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           0 :         ZERO_STRUCT(io);
    2366           0 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2367           0 :         io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
    2368             :                 SEC_FILE_WRITE_ATTRIBUTE;
    2369           0 :         io.smb2.in.fname = rfork;
    2370           0 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2371           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2372           0 :         filehandle = io.smb2.out.file.handle;
    2373             : 
    2374           0 :         torture_comment(tctx, "(%s) check resource fork size after write\n",
    2375             :             __location__);
    2376             : 
    2377           0 :         ZERO_STRUCT(finfo);
    2378           0 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2379           0 :         finfo.generic.in.file.handle = filehandle;
    2380           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2381           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2382           0 :         if (finfo.all_info.out.size != 20) {
    2383           0 :                 torture_result(tctx, TORTURE_FAIL,
    2384             :                                "(%s) Incorrect resource fork size\n",
    2385             :                                __location__);
    2386           0 :                 ret = false;
    2387           0 :                 smb2_util_close(tree, filehandle);
    2388           0 :                 goto done;
    2389             :         }
    2390           0 :         smb2_util_close(tree, filehandle);
    2391             : 
    2392             :         /* Write at large offset */
    2393             : 
    2394           0 :         torture_comment(tctx, "(%s) writing to resource fork at large offset\n",
    2395             :                         __location__);
    2396             : 
    2397           0 :         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           0 :         ZERO_STRUCT(io);
    2404           0 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2405           0 :         io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
    2406             :                 SEC_FILE_WRITE_ATTRIBUTE;
    2407           0 :         io.smb2.in.fname = rfork;
    2408           0 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2409           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2410           0 :         filehandle = io.smb2.out.file.handle;
    2411             : 
    2412           0 :         torture_comment(tctx, "(%s) check resource fork size after write\n",
    2413             :             __location__);
    2414             : 
    2415           0 :         ZERO_STRUCT(finfo);
    2416           0 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2417           0 :         finfo.generic.in.file.handle = filehandle;
    2418           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2419           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2420           0 :         if (finfo.all_info.out.size != 64*1024*1024 + 10) {
    2421           0 :                 torture_result(tctx, TORTURE_FAIL,
    2422             :                                "(%s) Incorrect resource fork size\n",
    2423             :                                __location__);
    2424           0 :                 ret = false;
    2425           0 :                 smb2_util_close(tree, filehandle);
    2426           0 :                 goto done;
    2427             :         }
    2428           0 :         smb2_util_close(tree, filehandle);
    2429             : 
    2430           0 :         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           0 :         torture_comment(tctx, "(%s) truncate resource fork and check size\n",
    2437             :                         __location__);
    2438             : 
    2439           0 :         ZERO_STRUCT(io);
    2440           0 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2441           0 :         io.smb2.in.desired_access = SEC_FILE_ALL;
    2442           0 :         io.smb2.in.fname = rfork;
    2443           0 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2444           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2445           0 :         filehandle = io.smb2.out.file.handle;
    2446             : 
    2447           0 :         ZERO_STRUCT(sinfo);
    2448           0 :         sinfo.end_of_file_info.level =
    2449             :                 RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    2450           0 :         sinfo.end_of_file_info.in.file.handle = filehandle;
    2451           0 :         sinfo.end_of_file_info.in.size = 1;
    2452           0 :         status = smb2_setinfo_file(tree, &sinfo);
    2453           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2454             : 
    2455           0 :         smb2_util_close(tree, filehandle);
    2456             : 
    2457             :         /* Now check size */
    2458           0 :         ZERO_STRUCT(io);
    2459           0 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2460           0 :         io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
    2461             :                 SEC_FILE_WRITE_ATTRIBUTE;
    2462           0 :         io.smb2.in.fname = rfork;
    2463           0 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2464           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2465           0 :         filehandle = io.smb2.out.file.handle;
    2466             : 
    2467           0 :         ZERO_STRUCT(finfo);
    2468           0 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2469           0 :         finfo.generic.in.file.handle = filehandle;
    2470           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2471           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2472           0 :         if (finfo.all_info.out.size != 1) {
    2473           0 :                 torture_result(tctx, TORTURE_FAIL,
    2474             :                                "(%s) Incorrect resource fork size\n",
    2475             :                                __location__);
    2476           0 :                 ret = false;
    2477           0 :                 smb2_util_close(tree, filehandle);
    2478           0 :                 goto done;
    2479             :         }
    2480           0 :         smb2_util_close(tree, filehandle);
    2481             : 
    2482           0 : done:
    2483           0 :         smb2_util_unlink(tree, fname);
    2484           0 :         smb2_deltree(tree, BASEDIR);
    2485           0 :         talloc_free(mem_ctx);
    2486           0 :         return ret;
    2487             : }
    2488             : 
    2489           0 : static bool test_rfork_truncate(struct torture_context *tctx,
    2490             :                                 struct smb2_tree *tree)
    2491             : {
    2492           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2493           0 :         const char *fname = BASEDIR "\\torture_rfork_truncate";
    2494           0 :         const char *rfork = BASEDIR "\\torture_rfork_truncate" AFPRESOURCE_STREAM;
    2495           0 :         const char *rfork_content = "1234567890";
    2496             :         NTSTATUS status;
    2497             :         struct smb2_handle testdirh;
    2498           0 :         bool ret = true;
    2499             :         struct smb2_create create;
    2500             :         struct smb2_handle fh1, fh2, fh3;
    2501             :         union smb_setfileinfo sinfo;
    2502             : 
    2503           0 :         ret = enable_aapl(tctx, tree);
    2504           0 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    2505             : 
    2506           0 :         smb2_util_unlink(tree, fname);
    2507             : 
    2508           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2509           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    2510           0 :         smb2_util_close(tree, testdirh);
    2511             : 
    2512           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2513           0 :         if (ret == false) {
    2514           0 :                 goto done;
    2515             :         }
    2516             : 
    2517           0 :         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           0 :         torture_comment(tctx, "(%s) truncate resource fork to size 0\n",
    2524             :                         __location__);
    2525             : 
    2526           0 :         ZERO_STRUCT(create);
    2527           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2528           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2529           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2530           0 :         create.in.fname               = fname;
    2531           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2532             :                 NTCREATEX_SHARE_ACCESS_READ |
    2533             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2534           0 :         status = smb2_create(tree, mem_ctx, &create);
    2535           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2536           0 :         fh1 = create.out.file.handle;
    2537             : 
    2538           0 :         ZERO_STRUCT(create);
    2539           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2540           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2541           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2542           0 :         create.in.fname               = rfork;
    2543           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2544             :                 NTCREATEX_SHARE_ACCESS_READ |
    2545             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2546           0 :         status = smb2_create(tree, mem_ctx, &create);
    2547           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2548           0 :         fh2 = create.out.file.handle;
    2549             : 
    2550           0 :         ZERO_STRUCT(sinfo);
    2551           0 :         sinfo.end_of_file_info.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    2552           0 :         sinfo.end_of_file_info.in.file.handle = fh2;
    2553           0 :         sinfo.end_of_file_info.in.size = 0;
    2554           0 :         status = smb2_setinfo_file(tree, &sinfo);
    2555           0 :         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           0 :         ZERO_STRUCT(create);
    2561           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2562           0 :         create.in.desired_access      = SEC_FILE_ALL;
    2563           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2564           0 :         create.in.fname               = rfork;
    2565           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2566             :                 NTCREATEX_SHARE_ACCESS_READ |
    2567             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2568           0 :         status = smb2_create(tree, mem_ctx, &create);
    2569           0 :         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           0 :         ZERO_STRUCT(create);
    2579           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2580           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2581           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2582           0 :         create.in.fname               = rfork;
    2583           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2584             :                 NTCREATEX_SHARE_ACCESS_READ |
    2585             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2586           0 :         status = smb2_create(tree, mem_ctx, &create);
    2587           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2588           0 :         fh3 = create.out.file.handle;
    2589             : 
    2590           0 :         status = smb2_util_write(tree, fh3, "foo", 0, 3);
    2591           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_write");
    2592             : 
    2593           0 :         smb2_util_close(tree, fh3);
    2594           0 :         smb2_util_close(tree, fh2);
    2595           0 :         smb2_util_close(tree, fh1);
    2596             : 
    2597           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM,
    2598             :                            0, 3, 0, 3, "foo");
    2599           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream");
    2600             : 
    2601           0 : done:
    2602           0 :         smb2_util_unlink(tree, fname);
    2603           0 :         smb2_deltree(tree, BASEDIR);
    2604           0 :         talloc_free(mem_ctx);
    2605           0 :         return ret;
    2606             : }
    2607             : 
    2608           0 : static bool test_rfork_create(struct torture_context *tctx,
    2609             :                               struct smb2_tree *tree)
    2610             : {
    2611           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2612           0 :         const char *fname = BASEDIR "\\torture_rfork_create";
    2613           0 :         const char *rfork = BASEDIR "\\torture_rfork_create" AFPRESOURCE_STREAM;
    2614             :         NTSTATUS status;
    2615             :         struct smb2_handle testdirh;
    2616           0 :         bool ret = true;
    2617             :         struct smb2_create create;
    2618             :         struct smb2_handle fh1;
    2619           0 :         const char *streams[] = {
    2620             :                 "::$DATA"
    2621             :         };
    2622             :         union smb_fileinfo finfo;
    2623             : 
    2624           0 :         ret = enable_aapl(tctx, tree);
    2625           0 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    2626             : 
    2627           0 :         smb2_util_unlink(tree, fname);
    2628             : 
    2629           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2630           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    2631           0 :         smb2_util_close(tree, testdirh);
    2632             : 
    2633           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2634           0 :         if (ret == false) {
    2635           0 :                 goto done;
    2636             :         }
    2637             : 
    2638           0 :         torture_comment(tctx, "(%s) open rfork, should return ENOENT\n",
    2639             :                         __location__);
    2640             : 
    2641           0 :         ZERO_STRUCT(create);
    2642           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2643           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2644           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2645           0 :         create.in.fname               = rfork;
    2646           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2647             :                 NTCREATEX_SHARE_ACCESS_READ |
    2648             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2649           0 :         status = smb2_create(tree, mem_ctx, &create);
    2650           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
    2651             : 
    2652           0 :         torture_comment(tctx, "(%s) create resource fork\n", __location__);
    2653             : 
    2654           0 :         ZERO_STRUCT(create);
    2655           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2656           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2657           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2658           0 :         create.in.fname               = rfork;
    2659           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2660             :                 NTCREATEX_SHARE_ACCESS_READ |
    2661             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2662           0 :         status = smb2_create(tree, mem_ctx, &create);
    2663           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2664           0 :         fh1 = create.out.file.handle;
    2665             : 
    2666           0 :         torture_comment(tctx, "(%s) getinfo on create handle\n",
    2667             :                         __location__);
    2668             : 
    2669           0 :         ZERO_STRUCT(finfo);
    2670           0 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2671           0 :         finfo.generic.in.file.handle = fh1;
    2672           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2673           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_getinfo_file");
    2674           0 :         if (finfo.all_info.out.size != 0) {
    2675           0 :                 torture_result(tctx, TORTURE_FAIL,
    2676             :                                "(%s) Incorrect resource fork size\n",
    2677             :                                __location__);
    2678           0 :                 ret = false;
    2679           0 :                 smb2_util_close(tree, fh1);
    2680           0 :                 goto done;
    2681             :         }
    2682             : 
    2683           0 :         torture_comment(tctx, "(%s) open rfork, should still return ENOENT\n",
    2684             :                         __location__);
    2685             : 
    2686           0 :         ZERO_STRUCT(create);
    2687           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2688           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2689           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2690           0 :         create.in.fname               = rfork;
    2691           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2692             :                 NTCREATEX_SHARE_ACCESS_READ |
    2693             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2694           0 :         status = smb2_create(tree, mem_ctx, &create);
    2695           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
    2696             : 
    2697           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams, false);
    2698           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    2699             : 
    2700           0 :         torture_comment(tctx, "(%s) close empty created rfork, open should return ENOENT\n",
    2701             :                         __location__);
    2702             : 
    2703           0 :         ZERO_STRUCT(create);
    2704           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2705           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2706           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2707           0 :         create.in.fname               = rfork;
    2708           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2709             :                 NTCREATEX_SHARE_ACCESS_READ |
    2710             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2711           0 :         status = smb2_create(tree, mem_ctx, &create);
    2712           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
    2713             : 
    2714           0 : done:
    2715           0 :         smb2_util_unlink(tree, fname);
    2716           0 :         smb2_deltree(tree, BASEDIR);
    2717           0 :         talloc_free(mem_ctx);
    2718           0 :         return ret;
    2719             : }
    2720             : 
    2721             : /*
    2722             :  * BUG: https://bugzilla.samba.org/show_bug.cgi?id=15182
    2723             :  */
    2724             : 
    2725           0 : static bool test_rfork_fsync(struct torture_context *tctx,
    2726             :                               struct smb2_tree *tree)
    2727             : {
    2728           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2729           0 :         const char *fname = BASEDIR "\\torture_rfork_fsync";
    2730           0 :         const char *rfork = BASEDIR "\\torture_rfork_fsync" AFPRESOURCE_STREAM;
    2731             :         NTSTATUS status;
    2732             :         struct smb2_handle testdirh;
    2733           0 :         bool ret = true;
    2734             :         struct smb2_create create;
    2735             :         struct smb2_handle fh1;
    2736             :         struct smb2_flush f;
    2737             : 
    2738           0 :         ZERO_STRUCT(fh1);
    2739             : 
    2740           0 :         ret = enable_aapl(tctx, tree);
    2741           0 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    2742             : 
    2743           0 :         smb2_util_unlink(tree, fname);
    2744             : 
    2745           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2746           0 :         torture_assert_ntstatus_ok_goto(tctx,
    2747             :                                         status,
    2748             :                                         ret,
    2749             :                                         done,
    2750             :                                         "torture_smb2_testdir");
    2751           0 :         smb2_util_close(tree, testdirh);
    2752             : 
    2753           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2754           0 :         if (ret == false) {
    2755           0 :                 goto done;
    2756             :         }
    2757             : 
    2758           0 :         torture_comment(tctx, "(%s) create resource fork %s\n",
    2759             :                 __location__,
    2760             :                 rfork);
    2761             : 
    2762           0 :         ZERO_STRUCT(create);
    2763           0 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2764           0 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2765           0 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2766           0 :         create.in.fname               = rfork;
    2767           0 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2768             :                 NTCREATEX_SHARE_ACCESS_READ |
    2769             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2770           0 :         status = smb2_create(tree, mem_ctx, &create);
    2771           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2772           0 :         fh1 = create.out.file.handle;
    2773             : 
    2774           0 :         torture_comment(tctx, "(%s) Write 10 bytes to resource fork %s\n",
    2775             :                 __location__,
    2776             :                 rfork);
    2777             : 
    2778           0 :         status = smb2_util_write(tree, fh1, "1234567890", 0, 10);
    2779           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2780             :                                         "smb2_util_write failed\n");
    2781             : 
    2782           0 :         torture_comment(tctx, "(%s) fsync on resource fork %s\n",
    2783             :                 __location__,
    2784             :                 rfork);
    2785             : 
    2786           0 :         f.in.file.handle = fh1;
    2787           0 :         status = smb2_flush(tree, &f);
    2788           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2789             :                                         "smb2_flush failed\n");
    2790             : 
    2791           0 : done:
    2792             : 
    2793           0 :         smb2_util_close(tree, fh1);
    2794           0 :         smb2_util_unlink(tree, fname);
    2795           0 :         smb2_deltree(tree, BASEDIR);
    2796           0 :         talloc_free(mem_ctx);
    2797           0 :         return ret;
    2798             : }
    2799             : 
    2800           0 : static bool test_rfork_create_ro(struct torture_context *tctx,
    2801             :                                  struct smb2_tree *tree)
    2802             : {
    2803           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2804           0 :         const char *fname = BASEDIR "\\torture_rfork_create";
    2805           0 :         const char *rfork = BASEDIR "\\torture_rfork_create" AFPRESOURCE_STREAM;
    2806             :         NTSTATUS status;
    2807             :         struct smb2_handle testdirh;
    2808           0 :         bool ret = true;
    2809             :         struct smb2_create create;
    2810             : 
    2811           0 :         smb2_util_unlink(tree, fname);
    2812           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2813           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2814             :                 "torture_smb2_testdir\n");
    2815           0 :         smb2_util_close(tree, testdirh);
    2816             : 
    2817           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2818           0 :         if (ret == false) {
    2819           0 :                 goto done;
    2820             :         }
    2821             : 
    2822           0 :         torture_comment(tctx, "(%s) Try opening read-only with "
    2823             :                         "open_if create disposition, should work\n",
    2824             :                         __location__);
    2825             : 
    2826           0 :         ZERO_STRUCT(create);
    2827           0 :         create.in.fname = rfork;
    2828           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    2829           0 :         create.in.desired_access = SEC_FILE_READ_DATA | SEC_STD_READ_CONTROL;
    2830           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    2831           0 :         create.in.share_access = FILE_SHARE_READ | FILE_SHARE_DELETE;
    2832           0 :         status = smb2_create(tree, mem_ctx, &(create));
    2833           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2834             :                 "smb2_create failed\n");
    2835             : 
    2836           0 :         smb2_util_close(tree, create.out.file.handle);
    2837             : 
    2838           0 : done:
    2839           0 :         smb2_util_unlink(tree, fname);
    2840           0 :         smb2_deltree(tree, BASEDIR);
    2841           0 :         talloc_free(mem_ctx);
    2842           0 :         return ret;
    2843             : }
    2844             : 
    2845           0 : static bool test_adouble_conversion(struct torture_context *tctx,
    2846             :                                     struct smb2_tree *tree)
    2847             : {
    2848           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2849           0 :         const char *fname = BASEDIR "\\test_adouble_conversion";
    2850           0 :         const char *adname = BASEDIR "/._test_adouble_conversion";
    2851             :         NTSTATUS status;
    2852             :         struct smb2_handle testdirh;
    2853           0 :         bool ret = true;
    2854           0 :         const char data[] = {
    2855             :                 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
    2856             :                 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
    2857             :         };
    2858           0 :         size_t datalen = sizeof(data);
    2859           0 :         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           0 :         bool is_osx = torture_setting_bool(tctx, "osx", false);
    2867             : 
    2868           0 :         if (is_osx) {
    2869           0 :                 torture_skip(tctx, "Test only works with Samba\n");
    2870             :         }
    2871             : 
    2872           0 :         smb2_deltree(tree, BASEDIR);
    2873             : 
    2874           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2875           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    2876           0 :         smb2_util_close(tree, testdirh);
    2877             : 
    2878           0 :         ret = torture_setup_file(tctx, tree, fname, false);
    2879           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2880             :                             "torture_setup_file failed\n");
    2881             : 
    2882           0 :         ret = torture_setup_file(tctx, tree, adname, false);
    2883           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2884             :                             "torture_setup_file failed\n");
    2885             : 
    2886           0 :         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           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2892             :                             "write_stream failed\n");
    2893             : 
    2894           0 :         torture_comment(tctx, "(%s) test OS X AppleDouble conversion\n",
    2895             :             __location__);
    2896             : 
    2897           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    2898             :                            fname, AFPRESOURCE_STREAM,
    2899             :                            16, datalen, 0, datalen, data);
    2900           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2901             :                             "check AFPRESOURCE_STREAM failed\n");
    2902             : 
    2903           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    2904             :                            fname, AFPINFO_STREAM,
    2905             :                            0, 60, 16, 8, "TESTSLOW");
    2906           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2907             :                             "check AFPINFO_STREAM failed\n");
    2908             : 
    2909           0 :         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           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2913             :                             "check foo:bar stream failed\n");
    2914             : 
    2915           0 :         ret = check_stream_list(tree, tctx, fname, 5, streams, false);
    2916           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    2917             : 
    2918           0 : done:
    2919           0 :         smb2_deltree(tree, BASEDIR);
    2920           0 :         talloc_free(mem_ctx);
    2921           0 :         return ret;
    2922             : }
    2923             : 
    2924             : /*
    2925             :  * Test conversion of AppleDouble file without embedded xattr data
    2926             :  */
    2927           0 : static bool test_adouble_conversion_wo_xattr(struct torture_context *tctx,
    2928             :                                              struct smb2_tree *tree)
    2929             : {
    2930           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2931           0 :         const char *fname = BASEDIR "\\test_adouble_conversion";
    2932           0 :         const char *adname = BASEDIR "/._test_adouble_conversion";
    2933             :         NTSTATUS status;
    2934             :         struct smb2_handle testdirh;
    2935           0 :         bool ret = true;
    2936           0 :         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           0 :         const char data[] = {
    2946             :                 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
    2947             :                 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
    2948             :         };
    2949           0 :         size_t datalen = sizeof(data);
    2950           0 :         bool is_osx = torture_setting_bool(tctx, "osx", false);
    2951             : 
    2952           0 :         if (is_osx) {
    2953           0 :                 torture_skip(tctx, "Test only works with Samba\n");
    2954             :         }
    2955             : 
    2956           0 :         smb2_deltree(tree, BASEDIR);
    2957             : 
    2958           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2959           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2960             :                                         "torture_smb2_testdir failed\n");
    2961           0 :         smb2_util_close(tree, testdirh);
    2962             : 
    2963           0 :         ret = torture_setup_file(tctx, tree, fname, false);
    2964           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2965             :                             "torture_setup_file failed\n");
    2966             : 
    2967           0 :         ret = torture_setup_file(tctx, tree, adname, false);
    2968           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2969             :                             "torture_setup_file failed\n");
    2970             : 
    2971           0 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    2972             :                            adname, NULL, 0,
    2973             :                            sizeof(osx_adouble_without_xattr),
    2974             :                            osx_adouble_without_xattr);
    2975           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    2976             :                             "write_stream failed\n");
    2977             : 
    2978           0 :         ret = enable_aapl(tctx, tree);
    2979           0 :         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           0 :         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           0 :         status = smb2_create(tree, tctx, &create);
    2996           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2997             :                                         "smb2_create failed\n");
    2998             : 
    2999           0 :         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           0 :         status = smb2_find_level(tree, tree, &find, &count, &d);
    3007           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3008             :                                         "smb2_find_level failed\n");
    3009             : 
    3010           0 :         status = smb2_util_close(tree, create.out.file.handle);
    3011           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3012             :                                         "smb2_util_close failed");
    3013             : 
    3014             :         /*
    3015             :          * Check number of streams
    3016             :          */
    3017             : 
    3018           0 :         ret = check_stream_list(tree, tctx, fname, 3, streams, false);
    3019           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    3020             : 
    3021             : 
    3022             :         /*
    3023             :          * Check Resourcefork data can be read.
    3024             :          */
    3025             : 
    3026           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    3027             :                            fname, AFPRESOURCE_STREAM,
    3028             :                            16, datalen, 0, datalen, data);
    3029           0 :         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           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    3037             :                            fname, AFPINFO_STREAM,
    3038             :                            0, 60, 16, 8, "WAVEPTul");
    3039           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    3040             :                             "check AFPINFO_STREAM failed\n");
    3041             : 
    3042           0 : done:
    3043           0 :         smb2_deltree(tree, BASEDIR);
    3044           0 :         talloc_free(mem_ctx);
    3045           0 :         return ret;
    3046             : }
    3047             : 
    3048           0 : static bool test_aapl(struct torture_context *tctx,
    3049             :                       struct smb2_tree *tree)
    3050             : {
    3051           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    3052           0 :         const char *fname = BASEDIR "\\test_aapl";
    3053             :         NTSTATUS status;
    3054             :         struct smb2_handle testdirh;
    3055           0 :         bool ret = true;
    3056             :         struct smb2_create io;
    3057             :         DATA_BLOB data;
    3058           0 :         struct smb2_create_blob *aapl = NULL;
    3059             :         AfpInfo *info;
    3060           0 :         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           0 :         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           0 :         bool is_osx_server = torture_setting_bool(tctx, "osx", false);
    3073             : 
    3074           0 :         smb2_deltree(tree, BASEDIR);
    3075             : 
    3076           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    3077           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3078           0 :         smb2_util_close(tree, testdirh);
    3079             : 
    3080           0 :         ZERO_STRUCT(io);
    3081           0 :         io.in.desired_access     = SEC_FLAG_MAXIMUM_ALLOWED;
    3082           0 :         io.in.file_attributes    = FILE_ATTRIBUTE_NORMAL;
    3083           0 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    3084           0 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
    3085             :                               NTCREATEX_SHARE_ACCESS_READ |
    3086             :                               NTCREATEX_SHARE_ACCESS_WRITE);
    3087           0 :         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           0 :         data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
    3096           0 :         SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
    3097           0 :         SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS |
    3098             :                              SMB2_CRTCTX_AAPL_VOLUME_CAPS |
    3099             :                              SMB2_CRTCTX_AAPL_MODEL_INFO));
    3100           0 :         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           0 :         torture_comment(tctx, "Testing SMB2 create context AAPL\n");
    3105           0 :         status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
    3106           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3107             : 
    3108           0 :         status = smb2_create(tree, tctx, &io);
    3109           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3110           0 :         status = smb2_util_close(tree, io.out.file.handle);
    3111           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3112             : 
    3113             :         /*
    3114             :          * Now check returned AAPL context
    3115             :          */
    3116           0 :         torture_comment(tctx, "Comparing returned AAPL capabilities\n");
    3117             : 
    3118           0 :         aapl = smb2_create_blob_find(&io.out.blobs,
    3119             :                                      SMB2_CREATE_TAG_AAPL);
    3120             : 
    3121           0 :         if (aapl == NULL) {
    3122           0 :                 torture_result(tctx, TORTURE_FAIL,
    3123             :                                "(%s) unexpectedly no AAPL capabilities were returned.",
    3124             :                                __location__);
    3125           0 :                 ret = false;
    3126           0 :                 goto done;
    3127             :         }
    3128             : 
    3129           0 :         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           0 :                 expected_aapl_ctx_size = strlen("MacSamba") * 2 + 40;
    3148             : 
    3149           0 :                 size_ok = aapl->data.length == expected_aapl_ctx_size;
    3150           0 :                 torture_assert_goto(tctx, size_ok, ret, done, "bad AAPL size");
    3151             :         }
    3152             : 
    3153           0 :         aapl_cmd = IVAL(aapl->data.data, 0);
    3154           0 :         if (aapl_cmd != SMB2_CRTCTX_AAPL_SERVER_QUERY) {
    3155           0 :                 torture_result(tctx, TORTURE_FAIL,
    3156             :                                "(%s) unexpected cmd: %d",
    3157             :                                __location__, (int)aapl_cmd);
    3158           0 :                 ret = false;
    3159           0 :                 goto done;
    3160             :         }
    3161             : 
    3162           0 :         aapl_reply_bitmap = BVAL(aapl->data.data, 8);
    3163           0 :         if (aapl_reply_bitmap != (SMB2_CRTCTX_AAPL_SERVER_CAPS |
    3164             :                                   SMB2_CRTCTX_AAPL_VOLUME_CAPS |
    3165             :                                   SMB2_CRTCTX_AAPL_MODEL_INFO)) {
    3166           0 :                 torture_result(tctx, TORTURE_FAIL,
    3167             :                                "(%s) unexpected reply_bitmap: %d",
    3168             :                                __location__, (int)aapl_reply_bitmap);
    3169           0 :                 ret = false;
    3170           0 :                 goto done;
    3171             :         }
    3172             : 
    3173           0 :         aapl_server_caps = BVAL(aapl->data.data, 16);
    3174           0 :         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           0 :                 torture_result(tctx, TORTURE_FAIL,
    3179             :                                "(%s) unexpected server_caps: %d",
    3180             :                                __location__, (int)aapl_server_caps);
    3181           0 :                 ret = false;
    3182           0 :                 goto done;
    3183             :         }
    3184             : 
    3185           0 :         if (is_osx_server) {
    3186           0 :                 expected_vol_caps = 5;
    3187             :         }
    3188           0 :         aapl_vol_caps = BVAL(aapl->data.data, 24);
    3189           0 :         if (aapl_vol_caps != expected_vol_caps) {
    3190             :                 /* this will fail on a case insensitive fs ... */
    3191           0 :                 torture_result(tctx, TORTURE_FAIL,
    3192             :                                 "(%s) unexpected vol_caps: %d",
    3193             :                                 __location__, (int)aapl_vol_caps);
    3194             :         }
    3195             : 
    3196           0 :         ret = convert_string_talloc(mem_ctx,
    3197             :                                     CH_UTF16LE, CH_UNIX,
    3198           0 :                                     aapl->data.data + 40, 10,
    3199             :                                     &model, NULL);
    3200           0 :         if (ret == false) {
    3201           0 :                 torture_result(tctx, TORTURE_FAIL,
    3202             :                                "(%s) convert_string_talloc() failed",
    3203             :                                __location__);
    3204           0 :                 goto done;
    3205             :         }
    3206           0 :         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           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    3213           0 :         if (ret == false) {
    3214           0 :                 torture_result(tctx, TORTURE_FAIL,
    3215             :                                "(%s) torture_setup_file() failed",
    3216             :                                __location__);
    3217           0 :                 goto done;
    3218             :         }
    3219             : 
    3220           0 :         info = torture_afpinfo_new(mem_ctx);
    3221           0 :         if (info == NULL) {
    3222           0 :                 torture_result(tctx, TORTURE_FAIL,
    3223             :                                "(%s) torture_afpinfo_new() failed",
    3224             :                                __location__);
    3225           0 :                 ret = false;
    3226           0 :                 goto done;
    3227             :         }
    3228             : 
    3229           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    3230           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    3231           0 :         if (ret == false) {
    3232           0 :                 torture_result(tctx, TORTURE_FAIL,
    3233             :                                "(%s) torture_write_afpinfo() failed",
    3234             :                                __location__);
    3235           0 :                 goto done;
    3236             :         }
    3237             : 
    3238           0 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    3239             :                            fname, AFPRESOURCE_STREAM_NAME,
    3240             :                            0, 3, "foo");
    3241           0 :         if (ret == false) {
    3242           0 :                 torture_result(tctx, TORTURE_FAIL,
    3243             :                                "(%s) write_stream() failed",
    3244             :                                __location__);
    3245           0 :                 goto done;
    3246             :         }
    3247             : 
    3248             :         /*
    3249             :          * Ok, file is prepared, now call smb2/find
    3250             :          */
    3251             : 
    3252           0 :         ZERO_STRUCT(io);
    3253           0 :         io.in.desired_access = SEC_RIGHTS_DIR_READ;
    3254           0 :         io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    3255           0 :         io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    3256           0 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_READ |
    3257             :                               NTCREATEX_SHARE_ACCESS_WRITE |
    3258             :                               NTCREATEX_SHARE_ACCESS_DELETE);
    3259           0 :         io.in.create_disposition = NTCREATEX_DISP_OPEN;
    3260           0 :         io.in.fname = BASEDIR;
    3261           0 :         status = smb2_create(tree, tctx, &io);
    3262           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3263             : 
    3264           0 :         ZERO_STRUCT(f);
    3265           0 :         f.in.file.handle        = io.out.file.handle;
    3266           0 :         f.in.pattern            = "test_aapl";
    3267           0 :         f.in.continue_flags     = SMB2_CONTINUE_FLAG_SINGLE;
    3268           0 :         f.in.max_response_size  = 0x1000;
    3269           0 :         f.in.level              = SMB2_FIND_ID_BOTH_DIRECTORY_INFO;
    3270             : 
    3271           0 :         status = smb2_find_level(tree, tree, &f, &count, &d);
    3272           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3273             : 
    3274           0 :         status = smb2_util_close(tree, io.out.file.handle);
    3275           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3276             : 
    3277           0 :         if (strcmp(d[0].id_both_directory_info.name.s, "test_aapl") != 0) {
    3278           0 :                 torture_result(tctx, TORTURE_FAIL,
    3279             :                                "(%s) write_stream() failed",
    3280             :                                __location__);
    3281           0 :                 ret = false;
    3282           0 :                 goto done;
    3283             :         }
    3284             : 
    3285           0 :         if (d[0].id_both_directory_info.short_name.private_length != 24) {
    3286           0 :                 torture_result(tctx, TORTURE_FAIL,
    3287             :                                "(%s) bad short_name length %" PRIu32 ", expected 24",
    3288           0 :                                __location__, d[0].id_both_directory_info.short_name.private_length);
    3289           0 :                 ret = false;
    3290           0 :                 goto done;
    3291             :         }
    3292             : 
    3293           0 :         torture_comment(tctx, "short_name buffer:\n");
    3294           0 :         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           0 :         torture_comment(tctx, "mac_access: %" PRIx32 "\n",
    3303           0 :                         d[0].id_both_directory_info.ea_size);
    3304             : 
    3305           0 :         rfork_len = BVAL(d[0].id_both_directory_info.short_name_buf, 0);
    3306           0 :         if (rfork_len != 3) {
    3307           0 :                 torture_result(tctx, TORTURE_FAIL,
    3308             :                                "(%s) expected resource fork length 3, got: %" PRIu64,
    3309             :                                __location__, rfork_len);
    3310           0 :                 ret = false;
    3311           0 :                 goto done;
    3312             :         }
    3313             : 
    3314           0 :         memcpy(type_creator_buf, d[0].id_both_directory_info.short_name_buf + 8, 8);
    3315           0 :         type_creator_buf[8] = 0;
    3316           0 :         if (strcmp(type_creator, type_creator_buf) != 0) {
    3317           0 :                 torture_result(tctx, TORTURE_FAIL,
    3318             :                                "(%s) expected type/creator \"%s\" , got: %s",
    3319             :                                __location__, type_creator, type_creator_buf);
    3320           0 :                 ret = false;
    3321           0 :                 goto done;
    3322             :         }
    3323             : 
    3324           0 : done:
    3325           0 :         smb2_util_unlink(tree, fname);
    3326           0 :         smb2_deltree(tree, BASEDIR);
    3327           0 :         talloc_free(mem_ctx);
    3328           0 :         return ret;
    3329             : }
    3330             : 
    3331           0 : static uint64_t patt_hash(uint64_t off)
    3332             : {
    3333           0 :         return off;
    3334             : }
    3335             : 
    3336           0 : 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           0 :         uint64_t io_sz = MIN(1024 * 64, len);
    3345             : 
    3346           0 :         if (len == 0) {
    3347           0 :                 return true;
    3348             :         }
    3349             : 
    3350           0 :         torture_assert(torture, (len % 8) == 0, "invalid write len");
    3351             : 
    3352           0 :         buf = talloc_zero_size(mem_ctx, io_sz);
    3353           0 :         torture_assert(torture, (buf != NULL), "no memory for file data buf");
    3354             : 
    3355           0 :         while (len > 0) {
    3356           0 :                 for (i = 0; i <= io_sz - 8; i += 8) {
    3357           0 :                         SBVAL(buf, i, patt_hash(patt_off));
    3358           0 :                         patt_off += 8;
    3359             :                 }
    3360             : 
    3361           0 :                 status = smb2_util_write(tree, h,
    3362             :                                          buf, off, io_sz);
    3363           0 :                 torture_assert_ntstatus_ok(torture, status, "file write");
    3364             : 
    3365           0 :                 len -= io_sz;
    3366           0 :                 off += io_sz;
    3367             :         }
    3368             : 
    3369           0 :         talloc_free(buf);
    3370             : 
    3371           0 :         return true;
    3372             : }
    3373             : 
    3374           0 : 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           0 :         if (len == 0) {
    3380           0 :                 return true;
    3381             :         }
    3382             : 
    3383           0 :         torture_assert(torture, (len % 8) == 0, "invalid read len");
    3384             : 
    3385           0 :         while (len > 0) {
    3386             :                 uint64_t i;
    3387             :                 struct smb2_read r;
    3388             :                 NTSTATUS status;
    3389           0 :                 uint64_t io_sz = MIN(1024 * 64, len);
    3390             : 
    3391           0 :                 ZERO_STRUCT(r);
    3392           0 :                 r.in.file.handle = h;
    3393           0 :                 r.in.length      = io_sz;
    3394           0 :                 r.in.offset      = off;
    3395           0 :                 status = smb2_read(tree, mem_ctx, &r);
    3396           0 :                 torture_assert_ntstatus_ok(torture, status, "read");
    3397             : 
    3398           0 :                 torture_assert_u64_equal(torture, r.out.data.length, io_sz,
    3399             :                                          "read data len mismatch");
    3400             : 
    3401           0 :                 for (i = 0; i <= io_sz - 8; i += 8, patt_off += 8) {
    3402           0 :                         uint64_t data = BVAL(r.out.data.data, i);
    3403           0 :                         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           0 :                 talloc_free(r.out.data.data);
    3409           0 :                 len -= io_sz;
    3410           0 :                 off += io_sz;
    3411             :         }
    3412             : 
    3413           0 :         return true;
    3414             : }
    3415             : 
    3416           0 : 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           0 :         ZERO_STRUCT(io);
    3427           0 :         io.in.desired_access = desired_access;
    3428           0 :         io.in.file_attributes = file_attributes;
    3429           0 :         io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    3430           0 :         io.in.share_access =
    3431             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    3432             :                 NTCREATEX_SHARE_ACCESS_READ|
    3433             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    3434           0 :         if (file_attributes & FILE_ATTRIBUTE_DIRECTORY) {
    3435           0 :                 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    3436             :         }
    3437           0 :         io.in.fname = fname;
    3438             : 
    3439           0 :         status = smb2_create(tree, mem_ctx, &io);
    3440           0 :         torture_assert_ntstatus_ok(torture, status, "file create");
    3441             : 
    3442           0 :         *fh = io.out.file.handle;
    3443             : 
    3444           0 :         return true;
    3445             : }
    3446             : 
    3447           0 : 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           0 :         ok = test_setup_open(torture, tree, mem_ctx,
    3458             :                              fname,
    3459             :                              fh,
    3460             :                              desired_access,
    3461             :                              file_attributes);
    3462           0 :         torture_assert(torture, ok, "file open");
    3463             : 
    3464           0 :         if (size > 0) {
    3465           0 :                 ok = write_pattern(torture, tree, mem_ctx, *fh, 0, size, 0);
    3466           0 :                 torture_assert(torture, ok, "write pattern");
    3467             :         }
    3468           0 :         return true;
    3469             : }
    3470             : 
    3471           0 : 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           0 :         ok = test_setup_create_fill(torture, tree, mem_ctx, src_name,
    3491             :                                     src_h, src_size, src_desired_access,
    3492             :                                     FILE_ATTRIBUTE_NORMAL);
    3493           0 :         torture_assert(torture, ok, "src file create fill");
    3494             : 
    3495           0 :         ok = test_setup_create_fill(torture, tree, mem_ctx, dst_name,
    3496             :                                     dest_h, dest_size, dest_desired_access,
    3497             :                                     FILE_ATTRIBUTE_NORMAL);
    3498           0 :         torture_assert(torture, ok, "dest file create fill");
    3499             : 
    3500           0 :         ZERO_STRUCTPN(io);
    3501           0 :         io->smb2.level = RAW_IOCTL_SMB2;
    3502           0 :         io->smb2.in.file.handle = *src_h;
    3503           0 :         io->smb2.in.function = FSCTL_SRV_REQUEST_RESUME_KEY;
    3504             :         /* Allow for Key + ContextLength + Context */
    3505           0 :         io->smb2.in.max_output_response = 32;
    3506           0 :         io->smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
    3507             : 
    3508           0 :         status = smb2_ioctl(tree, mem_ctx, &io->smb2);
    3509           0 :         torture_assert_ntstatus_ok(torture, status,
    3510             :                                    "FSCTL_SRV_REQUEST_RESUME_KEY");
    3511             : 
    3512           0 :         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           0 :         torture_assert_ndr_success(torture, ndr_ret,
    3516             :                                    "ndr_pull_req_resume_key_rsp");
    3517             : 
    3518           0 :         ZERO_STRUCTPN(io);
    3519           0 :         io->smb2.level = RAW_IOCTL_SMB2;
    3520           0 :         io->smb2.in.file.handle = *dest_h;
    3521           0 :         io->smb2.in.function = FSCTL_SRV_COPYCHUNK;
    3522           0 :         io->smb2.in.max_output_response = sizeof(struct srv_copychunk_rsp);
    3523           0 :         io->smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
    3524             : 
    3525           0 :         ZERO_STRUCTPN(cc_copy);
    3526           0 :         memcpy(cc_copy->source_key, res_key.resume_key, ARRAY_SIZE(cc_copy->source_key));
    3527           0 :         cc_copy->chunk_count = nchunks;
    3528           0 :         cc_copy->chunks = talloc_zero_array(mem_ctx, struct srv_copychunk, nchunks);
    3529           0 :         torture_assert(torture, (cc_copy->chunks != NULL), "no memory for chunks");
    3530             : 
    3531           0 :         return true;
    3532             : }
    3533             : 
    3534             : 
    3535           0 : 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           0 :         torture_assert_int_equal(torture, cc_rsp->chunks_written,
    3542             :                                  ex_chunks_written, "num chunks");
    3543           0 :         torture_assert_int_equal(torture, cc_rsp->chunk_bytes_written,
    3544             :                                  ex_chunk_bytes_written, "chunk bytes written");
    3545           0 :         torture_assert_int_equal(torture, cc_rsp->total_bytes_written,
    3546             :                                  ex_total_bytes_written, "chunk total bytes");
    3547           0 :         return true;
    3548             : }
    3549             : 
    3550           0 : static bool neg_aapl_copyfile(struct torture_context *tctx,
    3551             :                               struct smb2_tree *tree,
    3552             :                               uint64_t flags)
    3553             : {
    3554           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    3555           0 :         const char *fname = "aapl";
    3556             :         NTSTATUS status;
    3557             :         struct smb2_create io;
    3558             :         DATA_BLOB data;
    3559           0 :         struct smb2_create_blob *aapl = NULL;
    3560             :         uint32_t aapl_cmd;
    3561             :         uint32_t aapl_reply_bitmap;
    3562             :         uint32_t aapl_server_caps;
    3563           0 :         bool ret = true;
    3564             : 
    3565           0 :         ZERO_STRUCT(io);
    3566           0 :         io.in.desired_access     = SEC_FLAG_MAXIMUM_ALLOWED;
    3567           0 :         io.in.file_attributes    = FILE_ATTRIBUTE_NORMAL;
    3568           0 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    3569           0 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
    3570             :                               NTCREATEX_SHARE_ACCESS_READ |
    3571             :                               NTCREATEX_SHARE_ACCESS_WRITE);
    3572           0 :         io.in.fname = fname;
    3573             : 
    3574           0 :         data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
    3575           0 :         SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
    3576           0 :         SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS));
    3577           0 :         SBVAL(data.data, 16, flags);
    3578             : 
    3579           0 :         status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
    3580           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3581             : 
    3582           0 :         status = smb2_create(tree, tctx, &io);
    3583           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3584             : 
    3585           0 :         aapl = smb2_create_blob_find(&io.out.blobs,
    3586             :                                      SMB2_CREATE_TAG_AAPL);
    3587           0 :         if (aapl == NULL) {
    3588           0 :                 ret = false;
    3589           0 :                 goto done;
    3590             : 
    3591             :         }
    3592           0 :         if (aapl->data.length < 24) {
    3593           0 :                 ret = false;
    3594           0 :                 goto done;
    3595             :         }
    3596             : 
    3597           0 :         aapl_cmd = IVAL(aapl->data.data, 0);
    3598           0 :         if (aapl_cmd != SMB2_CRTCTX_AAPL_SERVER_QUERY) {
    3599           0 :                 torture_result(tctx, TORTURE_FAIL,
    3600             :                                "(%s) unexpected cmd: %d",
    3601             :                                __location__, (int)aapl_cmd);
    3602           0 :                 ret = false;
    3603           0 :                 goto done;
    3604             :         }
    3605             : 
    3606           0 :         aapl_reply_bitmap = BVAL(aapl->data.data, 8);
    3607           0 :         if (!(aapl_reply_bitmap & SMB2_CRTCTX_AAPL_SERVER_CAPS)) {
    3608           0 :                 torture_result(tctx, TORTURE_FAIL,
    3609             :                                "(%s) unexpected reply_bitmap: %d",
    3610             :                                __location__, (int)aapl_reply_bitmap);
    3611           0 :                 ret = false;
    3612           0 :                 goto done;
    3613             :         }
    3614             : 
    3615           0 :         aapl_server_caps = BVAL(aapl->data.data, 16);
    3616           0 :         if (!(aapl_server_caps & flags)) {
    3617           0 :                 torture_result(tctx, TORTURE_FAIL,
    3618             :                                "(%s) unexpected server_caps: %d",
    3619             :                                __location__, (int)aapl_server_caps);
    3620           0 :                 ret = false;
    3621           0 :                 goto done;
    3622             :         }
    3623             : 
    3624           0 : done:
    3625           0 :         status = smb2_util_close(tree, io.out.file.handle);
    3626           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3627             : 
    3628           0 :         smb2_util_unlink(tree, "aapl");
    3629           0 :         talloc_free(mem_ctx);
    3630           0 :         return ret;
    3631             : }
    3632             : 
    3633           0 : 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           0 :         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           0 :         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           0 :         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           0 :         if (!ok) {
    3665           0 :                 torture_fail_goto(torture, done, "setup copy chunk error");
    3666             :         }
    3667             : 
    3668           0 :         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           0 :         torture_assert_ndr_success(torture, ndr_ret,
    3672             :                                    "ndr_push_srv_copychunk_copy");
    3673             : 
    3674           0 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    3675           0 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done, "FSCTL_SRV_COPYCHUNK");
    3676             : 
    3677           0 :         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           0 :         torture_assert_ndr_success(torture, ndr_ret,
    3681             :                                    "ndr_pull_srv_copychunk_rsp");
    3682             : 
    3683           0 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    3684             :                                   0,    /* chunks written */
    3685             :                                   0,    /* chunk bytes unsuccessfully written */
    3686             :                                   0); /* total bytes written */
    3687           0 :         if (!ok) {
    3688           0 :                 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           0 :         ok = neg_aapl_copyfile(torture, tree,
    3696             :                                SMB2_CRTCTX_AAPL_SUPPORTS_OSX_COPYFILE);
    3697           0 :         if (!ok) {
    3698           0 :                 torture_skip_goto(torture, done, "missing AAPL copyfile");
    3699             :                 goto done;
    3700             :         }
    3701             : 
    3702           0 :         smb2_util_close(tree, src_h);
    3703           0 :         smb2_util_close(tree, dest_h);
    3704           0 :         smb2_util_unlink(tree, FNAME_CC_SRC);
    3705           0 :         smb2_util_unlink(tree, FNAME_CC_DST);
    3706             : 
    3707           0 :         ok = torture_setup_file(tmp_ctx, tree, FNAME_CC_SRC, false);
    3708           0 :         if (!ok) {
    3709           0 :                 torture_fail(torture, "setup file error");
    3710             :         }
    3711           0 :         ok = write_stream(tree, __location__, torture, tmp_ctx,
    3712             :                             FNAME_CC_SRC, AFPRESOURCE_STREAM,
    3713             :                             10, 10, "1234567890");
    3714           0 :         if (!ok) {
    3715           0 :                 torture_fail(torture, "setup stream error");
    3716             :         }
    3717             : 
    3718           0 :         ok = write_stream(tree, __location__, torture, tmp_ctx,
    3719             :                             FNAME_CC_SRC, sname,
    3720             :                             10, 10, "abcdefghij");
    3721           0 :         torture_assert_goto(torture, ok == true, ok, done, "write_stream failed\n");
    3722             : 
    3723           0 :         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           0 :         if (!ok) {
    3734           0 :                 torture_fail_goto(torture, done, "setup copy chunk error");
    3735             :         }
    3736             : 
    3737           0 :         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           0 :         torture_assert_ndr_success(torture, ndr_ret,
    3741             :                                    "ndr_push_srv_copychunk_copy");
    3742             : 
    3743           0 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    3744           0 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done, "FSCTL_SRV_COPYCHUNK");
    3745             : 
    3746           0 :         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           0 :         torture_assert_ndr_success(torture, ndr_ret,
    3750             :                                    "ndr_pull_srv_copychunk_rsp");
    3751             : 
    3752           0 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    3753             :                                   0,    /* chunks written */
    3754             :                                   0,    /* chunk bytes unsuccessfully written */
    3755             :                                   4096); /* total bytes written */
    3756           0 :         if (!ok) {
    3757           0 :                 torture_fail_goto(torture, done, "bad copy chunk response data");
    3758             :         }
    3759             : 
    3760           0 :         ok = test_setup_open(torture, tree, tmp_ctx, FNAME_CC_DST, &dest_h,
    3761             :                              SEC_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL);
    3762           0 :         if (!ok) {
    3763           0 :                 torture_fail_goto(torture, done,"open failed");
    3764             :         }
    3765           0 :         ok = check_pattern(torture, tree, tmp_ctx, dest_h, 0, 4096, 0);
    3766           0 :         if (!ok) {
    3767           0 :                 torture_fail_goto(torture, done, "inconsistent file data");
    3768             :         }
    3769             : 
    3770           0 :         ok = check_stream(tree, __location__, torture, tmp_ctx,
    3771             :                             FNAME_CC_DST, AFPRESOURCE_STREAM,
    3772             :                             0, 20, 10, 10, "1234567890");
    3773           0 :         if (!ok) {
    3774           0 :                 torture_fail_goto(torture, done, "inconsistent stream data");
    3775             :         }
    3776             : 
    3777           0 :         ok = check_stream(tree, __location__, torture, tmp_ctx,
    3778             :                             FNAME_CC_DST, sname,
    3779             :                             0, 20, 10, 10, "abcdefghij");
    3780           0 :         torture_assert_goto(torture, ok == true, ok, done, "check_stream failed\n");
    3781             : 
    3782           0 : done:
    3783           0 :         smb2_util_close(tree, src_h);
    3784           0 :         smb2_util_close(tree, dest_h);
    3785           0 :         smb2_util_unlink(tree, FNAME_CC_SRC);
    3786           0 :         smb2_util_unlink(tree, FNAME_CC_DST);
    3787           0 :         talloc_free(tmp_ctx);
    3788           0 :         return true;
    3789             : }
    3790             : 
    3791           0 : 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           0 :         bool ret = true;
    3799             :         union smb_fileinfo finfo;
    3800             :         NTSTATUS status;
    3801             :         int i;
    3802           0 :         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           0 :         ZERO_STRUCT(h);
    3809           0 :         torture_assert_goto(tctx, tmp_ctx != NULL, ret, done, "talloc_new failed");
    3810             : 
    3811           0 :         ZERO_STRUCT(create);
    3812           0 :         create.in.fname = fname;
    3813           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    3814           0 :         create.in.desired_access = SEC_FILE_ALL;
    3815           0 :         create.in.create_options = is_dir ? NTCREATEX_OPTIONS_DIRECTORY : 0;
    3816           0 :         create.in.file_attributes = is_dir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
    3817           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    3818           0 :         status = smb2_create(tree, tmp_ctx, &create);
    3819           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    3820           0 :         h = create.out.file.handle;
    3821             : 
    3822           0 :         finfo.generic.level = RAW_FILEINFO_STREAM_INFORMATION;
    3823           0 :         finfo.generic.in.file.handle = h;
    3824             : 
    3825           0 :         status = smb2_getinfo_file(tree, tctx, &finfo);
    3826           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "get stream info");
    3827             : 
    3828           0 :         smb2_util_close(tree, h);
    3829             : 
    3830           0 :         torture_assert_int_equal_goto(tctx, finfo.stream_info.out.num_streams, num_exp,
    3831             :                                       ret, done, "stream count");
    3832             : 
    3833           0 :         if (num_exp == 0) {
    3834           0 :                 TALLOC_FREE(tmp_ctx);
    3835           0 :                 goto done;
    3836             :         }
    3837             : 
    3838           0 :         exp_sort = talloc_memdup(tmp_ctx, exp, num_exp * sizeof(*exp));
    3839           0 :         torture_assert_goto(tctx, exp_sort != NULL, ret, done, __location__);
    3840             : 
    3841           0 :         TYPESAFE_QSORT(exp_sort, num_exp, qsort_string);
    3842             : 
    3843           0 :         stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams,
    3844             :                                     finfo.stream_info.out.num_streams *
    3845             :                                     sizeof(*stream_sort));
    3846           0 :         torture_assert_goto(tctx, stream_sort != NULL, ret, done, __location__);
    3847             : 
    3848           0 :         TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream);
    3849             : 
    3850           0 :         for (i=0; i<num_exp; i++) {
    3851           0 :                 torture_comment(tctx, "i[%d] exp[%s] got[%s]\n",
    3852           0 :                                 i, exp_sort[i], stream_sort[i].stream_name.s);
    3853           0 :                 torture_assert_str_equal_goto(tctx, stream_sort[i].stream_name.s, exp_sort[i],
    3854             :                                               ret, done, "stream name");
    3855             :         }
    3856             : 
    3857           0 : done:
    3858           0 :         TALLOC_FREE(tmp_ctx);
    3859           0 :         return ret;
    3860             : }
    3861             : 
    3862           0 : 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           0 :         bool ret = true;
    3870             :         union smb_fileinfo finfo;
    3871             :         NTSTATUS status;
    3872             :         int i;
    3873           0 :         TALLOC_CTX *tmp_ctx = talloc_new(tctx);
    3874             :         char **exp_sort;
    3875             :         struct stream_struct *stream_sort;
    3876             : 
    3877           0 :         torture_assert_goto(tctx, tmp_ctx != NULL, ret, done,
    3878             :                             "talloc_new failed\n");
    3879             : 
    3880           0 :         finfo = (union smb_fileinfo) {
    3881             :                 .stream_info.level = RAW_FILEINFO_STREAM_INFORMATION,
    3882             :                 .stream_info.in.file.handle = h,
    3883             :         };
    3884             : 
    3885           0 :         status = smb2_getinfo_file(tree, tctx, &finfo);
    3886           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3887             :                                         "get stream info\n");
    3888             : 
    3889           0 :         torture_assert_int_equal_goto(tctx, finfo.stream_info.out.num_streams,
    3890             :                                       num_exp, ret, done, "stream count\n");
    3891             : 
    3892           0 :         if (num_exp == 0) {
    3893           0 :                 TALLOC_FREE(tmp_ctx);
    3894           0 :                 goto done;
    3895             :         }
    3896             : 
    3897           0 :         exp_sort = talloc_memdup(tmp_ctx, exp, num_exp * sizeof(*exp));
    3898           0 :         torture_assert_goto(tctx, exp_sort != NULL, ret, done, __location__);
    3899             : 
    3900           0 :         TYPESAFE_QSORT(exp_sort, num_exp, qsort_string);
    3901             : 
    3902           0 :         stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams,
    3903             :                                     finfo.stream_info.out.num_streams *
    3904             :                                     sizeof(*stream_sort));
    3905           0 :         torture_assert_goto(tctx, stream_sort != NULL, ret, done, __location__);
    3906             : 
    3907           0 :         TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream);
    3908             : 
    3909           0 :         for (i=0; i<num_exp; i++) {
    3910           0 :                 torture_comment(tctx, "i[%d] exp[%s] got[%s]\n",
    3911           0 :                                 i, exp_sort[i], stream_sort[i].stream_name.s);
    3912           0 :                 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           0 : done:
    3918           0 :         TALLOC_FREE(tmp_ctx);
    3919           0 :         return ret;
    3920             : }
    3921             : 
    3922             : /*
    3923             :   test stream names
    3924             : */
    3925           0 : static bool test_stream_names(struct torture_context *tctx,
    3926             :                               struct smb2_tree *tree)
    3927             : {
    3928           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    3929             :         NTSTATUS status;
    3930             :         struct smb2_create create;
    3931             :         struct smb2_handle h;
    3932           0 :         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           0 :         const char *streams[] = {
    3937             :                 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
    3938             :                 "::$DATA"
    3939             :         };
    3940             : 
    3941           0 :         sname1 = talloc_asprintf(mem_ctx, "%s%s", fname, streams[0]);
    3942             : 
    3943             :         /* clean slate ...*/
    3944           0 :         smb2_util_unlink(tree, fname);
    3945           0 :         smb2_deltree(tree, fname);
    3946           0 :         smb2_deltree(tree, BASEDIR);
    3947             : 
    3948           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    3949           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3950           0 :         smb2_util_close(tree, h);
    3951             : 
    3952           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    3953           0 :         torture_assert_goto(tctx, ret, ret, done, "torture_setup_file");
    3954             : 
    3955           0 :         torture_comment(tctx, "(%s) testing stream names\n", __location__);
    3956           0 :         ZERO_STRUCT(create);
    3957           0 :         create.in.desired_access = SEC_FILE_WRITE_DATA;
    3958           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    3959           0 :         create.in.share_access =
    3960             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    3961             :                 NTCREATEX_SHARE_ACCESS_READ|
    3962             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    3963           0 :         create.in.create_disposition = NTCREATEX_DISP_CREATE;
    3964           0 :         create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    3965           0 :         create.in.fname = sname1;
    3966             : 
    3967           0 :         status = smb2_create(tree, mem_ctx, &create);
    3968           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    3969             : 
    3970           0 :         status = smb2_util_write(tree, create.out.file.handle, "foo", 0, 3);
    3971           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3972             :                                         "smb2_util_write failed\n");
    3973             : 
    3974           0 :         smb2_util_close(tree, create.out.file.handle);
    3975             : 
    3976           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams, false);
    3977           0 :         CHECK_VALUE(ret, true);
    3978             : 
    3979           0 : done:
    3980           0 :         status = smb2_util_unlink(tree, fname);
    3981           0 :         smb2_deltree(tree, BASEDIR);
    3982           0 :         talloc_free(mem_ctx);
    3983             : 
    3984           0 :         return ret;
    3985             : }
    3986             : 
    3987             : /* Renaming a directory with open file, should work for OS X AAPL clients */
    3988           0 : static bool test_rename_dir_openfile(struct torture_context *torture,
    3989             :                                      struct smb2_tree *tree)
    3990             : {
    3991           0 :         bool ret = true;
    3992             :         NTSTATUS status;
    3993             :         union smb_open io;
    3994             :         union smb_close cl;
    3995             :         union smb_setfileinfo sinfo;
    3996             :         struct smb2_handle d1, h1;
    3997           0 :         const char *renamedir = BASEDIR "-new";
    3998           0 :         bool server_is_osx = torture_setting_bool(torture, "osx", false);
    3999             : 
    4000           0 :         smb2_deltree(tree, BASEDIR);
    4001           0 :         smb2_util_rmdir(tree, BASEDIR);
    4002           0 :         smb2_deltree(tree, renamedir);
    4003             : 
    4004           0 :         ZERO_STRUCT(io.smb2);
    4005           0 :         io.generic.level = RAW_OPEN_SMB2;
    4006           0 :         io.smb2.in.create_flags = 0;
    4007           0 :         io.smb2.in.desired_access = 0x0017019f;
    4008           0 :         io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    4009           0 :         io.smb2.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    4010           0 :         io.smb2.in.share_access = 0;
    4011           0 :         io.smb2.in.alloc_size = 0;
    4012           0 :         io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
    4013           0 :         io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    4014           0 :         io.smb2.in.security_flags = 0;
    4015           0 :         io.smb2.in.fname = BASEDIR;
    4016             : 
    4017           0 :         status = smb2_create(tree, torture, &(io.smb2));
    4018           0 :         torture_assert_ntstatus_ok(torture, status, "smb2_create dir");
    4019           0 :         d1 = io.smb2.out.file.handle;
    4020             : 
    4021           0 :         ZERO_STRUCT(io.smb2);
    4022           0 :         io.generic.level = RAW_OPEN_SMB2;
    4023           0 :         io.smb2.in.create_flags = 0;
    4024           0 :         io.smb2.in.desired_access = 0x0017019f;
    4025           0 :         io.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
    4026           0 :         io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4027           0 :         io.smb2.in.share_access = 0;
    4028           0 :         io.smb2.in.alloc_size = 0;
    4029           0 :         io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
    4030           0 :         io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    4031           0 :         io.smb2.in.security_flags = 0;
    4032           0 :         io.smb2.in.fname = BASEDIR "\\file.txt";
    4033             : 
    4034           0 :         status = smb2_create(tree, torture, &(io.smb2));
    4035           0 :         torture_assert_ntstatus_ok(torture, status, "smb2_create file");
    4036           0 :         h1 = io.smb2.out.file.handle;
    4037             : 
    4038           0 :         if (!server_is_osx) {
    4039           0 :                 torture_comment(torture, "Renaming directory without AAPL, must fail\n");
    4040             : 
    4041           0 :                 ZERO_STRUCT(sinfo);
    4042           0 :                 sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
    4043           0 :                 sinfo.rename_information.in.file.handle = d1;
    4044           0 :                 sinfo.rename_information.in.overwrite = 0;
    4045           0 :                 sinfo.rename_information.in.root_fid = 0;
    4046           0 :                 sinfo.rename_information.in.new_name = renamedir;
    4047           0 :                 status = smb2_setinfo_file(tree, &sinfo);
    4048             : 
    4049           0 :                 torture_assert_ntstatus_equal(torture, status,
    4050             :                                               NT_STATUS_ACCESS_DENIED,
    4051             :                                               "smb2_setinfo_file");
    4052             :         }
    4053             : 
    4054           0 :         status = smb2_util_close(tree, d1);
    4055           0 :         torture_assert_ntstatus_ok(torture, status, "smb2_util_close\n");
    4056           0 :         ZERO_STRUCT(d1);
    4057             : 
    4058           0 :         torture_comment(torture, "Enabling AAPL\n");
    4059             : 
    4060           0 :         ret = enable_aapl(torture, tree);
    4061           0 :         torture_assert(torture, ret == true, "enable_aapl failed");
    4062             : 
    4063           0 :         torture_comment(torture, "Renaming directory with AAPL\n");
    4064             : 
    4065           0 :         ZERO_STRUCT(io.smb2);
    4066           0 :         io.generic.level = RAW_OPEN_SMB2;
    4067           0 :         io.smb2.in.desired_access = 0x0017019f;
    4068           0 :         io.smb2.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    4069           0 :         io.smb2.in.share_access = 0;
    4070           0 :         io.smb2.in.alloc_size = 0;
    4071           0 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    4072           0 :         io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    4073           0 :         io.smb2.in.security_flags = 0;
    4074           0 :         io.smb2.in.fname = BASEDIR;
    4075             : 
    4076           0 :         status = smb2_create(tree, torture, &(io.smb2));
    4077           0 :         torture_assert_ntstatus_ok(torture, status, "smb2_create dir");
    4078           0 :         d1 = io.smb2.out.file.handle;
    4079             : 
    4080           0 :         ZERO_STRUCT(sinfo);
    4081           0 :         sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
    4082           0 :         sinfo.rename_information.in.file.handle = d1;
    4083           0 :         sinfo.rename_information.in.overwrite = 0;
    4084           0 :         sinfo.rename_information.in.root_fid = 0;
    4085           0 :         sinfo.rename_information.in.new_name = renamedir;
    4086             : 
    4087           0 :         status = smb2_setinfo_file(tree, &sinfo);
    4088           0 :         torture_assert_ntstatus_ok(torture, status, "smb2_setinfo_file");
    4089             : 
    4090           0 :         ZERO_STRUCT(cl.smb2);
    4091           0 :         cl.smb2.level = RAW_CLOSE_SMB2;
    4092           0 :         cl.smb2.in.file.handle = d1;
    4093           0 :         status = smb2_close(tree, &(cl.smb2));
    4094           0 :         torture_assert_ntstatus_ok(torture, status, "smb2_close");
    4095           0 :         ZERO_STRUCT(d1);
    4096             : 
    4097           0 :         cl.smb2.in.file.handle = h1;
    4098           0 :         status = smb2_close(tree, &(cl.smb2));
    4099           0 :         torture_assert_ntstatus_ok(torture, status, "smb2_close");
    4100           0 :         ZERO_STRUCT(h1);
    4101             : 
    4102           0 :         torture_comment(torture, "Cleaning up\n");
    4103             : 
    4104           0 :         if (h1.data[0] || h1.data[1]) {
    4105           0 :                 ZERO_STRUCT(cl.smb2);
    4106           0 :                 cl.smb2.level = RAW_CLOSE_SMB2;
    4107           0 :                 cl.smb2.in.file.handle = h1;
    4108           0 :                 status = smb2_close(tree, &(cl.smb2));
    4109             :         }
    4110             : 
    4111           0 :         smb2_util_unlink(tree, BASEDIR "\\file.txt");
    4112           0 :         smb2_util_unlink(tree, BASEDIR "-new\\file.txt");
    4113           0 :         smb2_deltree(tree, renamedir);
    4114           0 :         smb2_deltree(tree, BASEDIR);
    4115           0 :         return ret;
    4116             : }
    4117             : 
    4118           0 : static bool test_afpinfo_enoent(struct torture_context *tctx,
    4119             :                                 struct smb2_tree *tree)
    4120             : {
    4121           0 :         bool ret = true;
    4122             :         NTSTATUS status;
    4123             :         struct smb2_create create;
    4124             :         struct smb2_handle h1;
    4125           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4126           0 :         const char *fname = BASEDIR "\\file";
    4127           0 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4128             : 
    4129           0 :         torture_comment(tctx, "Opening file without AFP_AfpInfo\n");
    4130             : 
    4131           0 :         smb2_deltree(tree, BASEDIR);
    4132           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4133           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4134           0 :         smb2_util_close(tree, h1);
    4135           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4136           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4137             : 
    4138           0 :         torture_comment(tctx, "Opening not existing AFP_AfpInfo\n");
    4139             : 
    4140           0 :         ZERO_STRUCT(create);
    4141           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4142           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
    4143           0 :         create.in.fname = sname;
    4144             : 
    4145           0 :         status = smb2_create(tree, mem_ctx, &create);
    4146           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4147             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4148             : 
    4149           0 : done:
    4150           0 :         smb2_util_unlink(tree, fname);
    4151           0 :         smb2_util_rmdir(tree, BASEDIR);
    4152           0 :         return ret;
    4153             : }
    4154             : 
    4155           0 : static bool test_create_delete_on_close(struct torture_context *tctx,
    4156             :                                         struct smb2_tree *tree)
    4157             : {
    4158           0 :         bool ret = true;
    4159             :         NTSTATUS status;
    4160             :         struct smb2_create create;
    4161             :         struct smb2_handle h1;
    4162           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4163           0 :         const char *fname = BASEDIR "\\file";
    4164           0 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4165           0 :         const char *type_creator = "SMB,OLE!";
    4166           0 :         AfpInfo *info = NULL;
    4167           0 :         const char *streams_basic[] = {
    4168             :                 "::$DATA"
    4169             :         };
    4170           0 :         const char *streams_afpinfo[] = {
    4171             :                 "::$DATA",
    4172             :                 AFPINFO_STREAM
    4173             :         };
    4174             : 
    4175           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4176             : 
    4177           0 :         torture_comment(tctx, "Checking whether create with delete-on-close work with AFP_AfpInfo\n");
    4178             : 
    4179           0 :         smb2_deltree(tree, BASEDIR);
    4180           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4181           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4182           0 :         smb2_util_close(tree, h1);
    4183           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4184           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4185             : 
    4186           0 :         torture_comment(tctx, "Opening not existing AFP_AfpInfo\n");
    4187             : 
    4188           0 :         ZERO_STRUCT(create);
    4189           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4190           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
    4191           0 :         create.in.fname = sname;
    4192             : 
    4193           0 :         status = smb2_create(tree, mem_ctx, &create);
    4194           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4195             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4196             : 
    4197           0 :         ZERO_STRUCT(create);
    4198           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4199           0 :         create.in.desired_access = SEC_FILE_ALL;
    4200           0 :         create.in.fname = sname;
    4201             : 
    4202           0 :         status = smb2_create(tree, mem_ctx, &create);
    4203           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4204             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4205             : 
    4206           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4207           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4208             : 
    4209           0 :         torture_comment(tctx, "Deleting AFP_AfpInfo via create with delete-on-close\n");
    4210             : 
    4211           0 :         info = torture_afpinfo_new(mem_ctx);
    4212           0 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4213             : 
    4214           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4215           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4216           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4217             : 
    4218           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4219             :                            0, 60, 16, 8, type_creator);
    4220           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad type/creator in AFP_AfpInfo");
    4221             : 
    4222           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4223           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4224             : 
    4225           0 :         ZERO_STRUCT(create);
    4226           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4227           0 :         create.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
    4228           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4229           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4230           0 :         create.in.fname = sname;
    4231           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4232             : 
    4233           0 :         status = smb2_create(tree, mem_ctx, &create);
    4234           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4235             : 
    4236           0 :         h1 = create.out.file.handle;
    4237           0 :         smb2_util_close(tree, h1);
    4238             : 
    4239           0 :         ZERO_STRUCT(create);
    4240           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4241           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    4242           0 :         create.in.fname = sname;
    4243           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4244           0 :         status = smb2_create(tree, mem_ctx, &create);
    4245           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4246             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4247             : 
    4248           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4249           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4250             : 
    4251           0 : done:
    4252           0 :         smb2_util_unlink(tree, fname);
    4253           0 :         smb2_util_rmdir(tree, BASEDIR);
    4254           0 :         return ret;
    4255             : }
    4256             : 
    4257           0 : static bool test_setinfo_delete_on_close(struct torture_context *tctx,
    4258             :                                          struct smb2_tree *tree)
    4259             : {
    4260           0 :         bool ret = true;
    4261             :         NTSTATUS status;
    4262             :         struct smb2_create create;
    4263             :         union smb_setfileinfo sfinfo;
    4264             :         struct smb2_handle h1;
    4265           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4266           0 :         const char *fname = BASEDIR "\\file";
    4267           0 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4268           0 :         const char *type_creator = "SMB,OLE!";
    4269           0 :         AfpInfo *info = NULL;
    4270           0 :         const char *streams[] = {
    4271             :                 AFPINFO_STREAM,
    4272             :                 "::$DATA"
    4273             :         };
    4274           0 :         const char *streams_basic[] = {
    4275             :                 "::$DATA"
    4276             :         };
    4277             : 
    4278           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4279             : 
    4280           0 :         torture_comment(tctx, "Deleting AFP_AfpInfo via setinfo with delete-on-close\n");
    4281             : 
    4282           0 :         smb2_deltree(tree, BASEDIR);
    4283           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4284           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4285           0 :         smb2_util_close(tree, h1);
    4286           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4287           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4288             : 
    4289           0 :         info = torture_afpinfo_new(mem_ctx);
    4290           0 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4291           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4292           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4293           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4294             : 
    4295           0 :         ZERO_STRUCT(create);
    4296           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4297           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4298           0 :         create.in.fname = sname;
    4299           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4300           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4301             : 
    4302           0 :         status = smb2_create(tree, mem_ctx, &create);
    4303           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4304             : 
    4305           0 :         h1 = create.out.file.handle;
    4306             : 
    4307             :         /* Delete stream via setinfo delete-on-close */
    4308           0 :         ZERO_STRUCT(sfinfo);
    4309           0 :         sfinfo.disposition_info.in.delete_on_close = 1;
    4310           0 :         sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
    4311           0 :         sfinfo.generic.in.file.handle = h1;
    4312           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    4313           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set delete-on-close failed");
    4314             : 
    4315           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams, false);
    4316           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4317             : 
    4318           0 :         ZERO_STRUCT(create);
    4319           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4320           0 :         create.in.desired_access = SEC_FILE_ALL;
    4321           0 :         create.in.fname = sname;
    4322           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4323           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4324           0 :         status = smb2_create(tree, mem_ctx, &create);
    4325           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_DELETE_PENDING,
    4326             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4327             : 
    4328           0 :         smb2_util_close(tree, h1);
    4329             : 
    4330           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4331           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4332             : 
    4333           0 :         ZERO_STRUCT(create);
    4334           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4335           0 :         create.in.desired_access = SEC_FILE_ALL;
    4336           0 :         create.in.fname = sname;
    4337           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4338           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4339           0 :         status = smb2_create(tree, mem_ctx, &create);
    4340           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4341             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4342             : 
    4343           0 : done:
    4344           0 :         smb2_util_unlink(tree, fname);
    4345           0 :         smb2_util_rmdir(tree, BASEDIR);
    4346           0 :         return ret;
    4347             : }
    4348             : 
    4349           0 : static bool test_setinfo_eof(struct torture_context *tctx,
    4350             :                              struct smb2_tree *tree)
    4351             : {
    4352           0 :         bool ret = true;
    4353             :         NTSTATUS status;
    4354             :         struct smb2_create create;
    4355             :         union smb_setfileinfo sfinfo;
    4356             :         struct smb2_handle h1;
    4357           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4358           0 :         const char *fname = BASEDIR "\\file";
    4359           0 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4360           0 :         const char *type_creator = "SMB,OLE!";
    4361           0 :         AfpInfo *info = NULL;
    4362           0 :         const char *streams_afpinfo[] = {
    4363             :                 "::$DATA",
    4364             :                 AFPINFO_STREAM
    4365             :         };
    4366             : 
    4367           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4368             : 
    4369           0 :         torture_comment(tctx, "Set AFP_AfpInfo EOF to 61, 1 and 0\n");
    4370             : 
    4371           0 :         smb2_deltree(tree, BASEDIR);
    4372           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4373           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4374           0 :         smb2_util_close(tree, h1);
    4375           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4376           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4377             : 
    4378           0 :         info = torture_afpinfo_new(mem_ctx);
    4379           0 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4380           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4381           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4382           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4383             : 
    4384           0 :         ZERO_STRUCT(create);
    4385           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4386           0 :         create.in.desired_access = SEC_FILE_ALL;
    4387           0 :         create.in.fname = sname;
    4388           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4389           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4390             : 
    4391           0 :         status = smb2_create(tree, mem_ctx, &create);
    4392           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4393             : 
    4394           0 :         h1 = create.out.file.handle;
    4395             : 
    4396           0 :         torture_comment(tctx, "Set AFP_AfpInfo EOF to 61\n");
    4397             : 
    4398             :         /* Test setinfo end-of-file info */
    4399           0 :         ZERO_STRUCT(sfinfo);
    4400           0 :         sfinfo.generic.in.file.handle = h1;
    4401           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4402           0 :         sfinfo.position_information.in.position = 61;
    4403           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    4404           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_ALLOTTED_SPACE_EXCEEDED,
    4405             :                                            ret, done, "set eof 61 failed");
    4406             : 
    4407           0 :         torture_comment(tctx, "Set AFP_AfpInfo EOF to 1\n");
    4408             : 
    4409             :         /* Truncation returns success, but has no effect */
    4410           0 :         ZERO_STRUCT(sfinfo);
    4411           0 :         sfinfo.generic.in.file.handle = h1;
    4412           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4413           0 :         sfinfo.position_information.in.position = 1;
    4414           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    4415           0 :         torture_assert_ntstatus_ok_goto(tctx, status,
    4416             :                                         ret, done, "set eof 1 failed");
    4417           0 :         smb2_util_close(tree, h1);
    4418             : 
    4419           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4420           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4421             : 
    4422           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4423             :                            0, 60, 16, 8, type_creator);
    4424           0 :         torture_assert_goto(tctx, ret == true, ret, done, "FinderInfo changed");
    4425             : 
    4426           0 :         ZERO_STRUCT(create);
    4427           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4428           0 :         create.in.desired_access = SEC_FILE_ALL;
    4429           0 :         create.in.fname = sname;
    4430           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4431           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4432             : 
    4433           0 :         status = smb2_create(tree, mem_ctx, &create);
    4434           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4435             : 
    4436           0 :         h1 = create.out.file.handle;
    4437             : 
    4438             :         /*
    4439             :          * Delete stream via setinfo end-of-file info to 0, should
    4440             :          * return success but stream MUST NOT deleted
    4441             :          */
    4442           0 :         ZERO_STRUCT(sfinfo);
    4443           0 :         sfinfo.generic.in.file.handle = h1;
    4444           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4445           0 :         sfinfo.position_information.in.position = 0;
    4446           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    4447           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set eof 0 failed");
    4448             : 
    4449           0 :         smb2_util_close(tree, h1);
    4450             : 
    4451           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4452           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4453             : 
    4454           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4455             :                            0, 60, 16, 8, type_creator);
    4456           0 :         torture_assert_goto(tctx, ret == true, ret, done, "FinderInfo changed");
    4457             : 
    4458           0 : done:
    4459           0 :         smb2_util_unlink(tree, fname);
    4460           0 :         smb2_util_rmdir(tree, BASEDIR);
    4461           0 :         return ret;
    4462             : }
    4463             : 
    4464           0 : static bool test_afpinfo_all0(struct torture_context *tctx,
    4465             :                               struct smb2_tree *tree)
    4466             : {
    4467           0 :         bool ret = true;
    4468             :         NTSTATUS status;
    4469             :         struct smb2_create create;
    4470           0 :         struct smb2_handle h1 = {{0}};
    4471           0 :         struct smb2_handle baseh = {{0}};
    4472             :         union smb_setfileinfo setfinfo;
    4473             :         union smb_fileinfo getfinfo;
    4474           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4475           0 :         const char *fname = BASEDIR "\\file";
    4476           0 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM;
    4477           0 :         const char *type_creator = "SMB,OLE!";
    4478           0 :         AfpInfo *info = NULL;
    4479           0 :         char *infobuf = NULL;
    4480           0 :         const char *streams_basic[] = {
    4481             :                 "::$DATA"
    4482             :         };
    4483           0 :         const char *streams_afpinfo[] = {
    4484             :                 "::$DATA",
    4485             :                 AFPINFO_STREAM
    4486             :         };
    4487             : 
    4488           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4489             : 
    4490           0 :         torture_comment(tctx, "Write all 0 to AFP_AfpInfo and see what happens\n");
    4491             : 
    4492           0 :         smb2_deltree(tree, BASEDIR);
    4493           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4494           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4495           0 :         smb2_util_close(tree, h1);
    4496           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4497           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4498             : 
    4499           0 :         info = torture_afpinfo_new(mem_ctx);
    4500           0 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4501           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4502           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4503           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4504             : 
    4505           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4506           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4507             : 
    4508             :         /* Write all 0 to AFP_AfpInfo */
    4509           0 :         memset(info->afpi_FinderInfo, 0, AFP_FinderSize);
    4510           0 :         infobuf = torture_afpinfo_pack(mem_ctx, info);
    4511           0 :         torture_assert_not_null_goto(tctx, infobuf, ret, done,
    4512             :                                      "torture_afpinfo_pack failed\n");
    4513             : 
    4514           0 :         ZERO_STRUCT(create);
    4515           0 :         create.in.desired_access = SEC_FILE_ALL;
    4516           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4517           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4518           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    4519           0 :         create.in.fname = fname;
    4520             : 
    4521           0 :         status = smb2_create(tree, mem_ctx, &create);
    4522           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4523             :                                         "smb2_create failed\n");
    4524           0 :         baseh = create.out.file.handle;
    4525             : 
    4526           0 :         ZERO_STRUCT(create);
    4527           0 :         create.in.desired_access = SEC_FILE_ALL;
    4528           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4529           0 :         create.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    4530           0 :         create.in.fname = sname;
    4531             : 
    4532           0 :         status = smb2_create(tree, mem_ctx, &create);
    4533           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4534             :                                         "smb2_create failed\n");
    4535           0 :         h1 = create.out.file.handle;
    4536             : 
    4537           0 :         status = smb2_util_write(tree, h1, infobuf, 0, AFP_INFO_SIZE);
    4538           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4539             :                                         "smb2_util_write failed\n");
    4540             : 
    4541             :         /*
    4542             :          * Get stream information on open handle, must return only default
    4543             :          * stream, the AFP_AfpInfo stream must not be returned.
    4544             :          */
    4545             : 
    4546           0 :         ZERO_STRUCT(getfinfo);
    4547           0 :         getfinfo.generic.level = RAW_FILEINFO_STREAM_INFORMATION;
    4548           0 :         getfinfo.generic.in.file.handle = baseh;
    4549             : 
    4550           0 :         status = smb2_getinfo_file(tree, tctx, &getfinfo);
    4551           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4552             :                                         "get stream info\n");
    4553             : 
    4554           0 :         torture_assert_int_equal_goto(tctx, getfinfo.stream_info.out.num_streams,
    4555             :                                       1, ret, done, "stream count");
    4556             : 
    4557           0 :         smb2_util_close(tree, baseh);
    4558           0 :         ZERO_STRUCT(baseh);
    4559             : 
    4560             :         /*
    4561             :          * Try to set some file-basic-info (time) on the stream. This catches
    4562             :          * naive implementation mistakes that simply deleted the backing store
    4563             :          * from the filesystem in the zero-out step.
    4564             :          */
    4565             : 
    4566           0 :         ZERO_STRUCT(setfinfo);
    4567           0 :         unix_to_nt_time(&setfinfo.basic_info.in.write_time, time(NULL));
    4568           0 :         setfinfo.basic_info.in.attrib = 0x20;
    4569           0 :         setfinfo.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
    4570           0 :         setfinfo.generic.in.file.handle = h1;
    4571             : 
    4572           0 :         status = smb2_setinfo_file(tree, &setfinfo);
    4573           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4574             :                                         "smb2_getinfo_file failed\n");
    4575             : 
    4576           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4577           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    4578             : 
    4579           0 :         smb2_util_close(tree, h1);
    4580           0 :         ZERO_STRUCT(h1);
    4581             : 
    4582           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4583           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4584             : 
    4585           0 : done:
    4586           0 :         if (!smb2_util_handle_empty(h1)) {
    4587           0 :                 smb2_util_close(tree, h1);
    4588             :         }
    4589           0 :         if (!smb2_util_handle_empty(baseh)) {
    4590           0 :                 smb2_util_close(tree, baseh);
    4591             :         }
    4592           0 :         smb2_util_unlink(tree, fname);
    4593           0 :         smb2_util_rmdir(tree, BASEDIR);
    4594           0 :         return ret;
    4595             : }
    4596             : 
    4597           0 : static bool test_create_delete_on_close_resource(struct torture_context *tctx,
    4598             :                                                  struct smb2_tree *tree)
    4599             : {
    4600           0 :         bool ret = true;
    4601             :         NTSTATUS status;
    4602             :         struct smb2_create create;
    4603             :         struct smb2_handle h1;
    4604           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4605           0 :         const char *fname = BASEDIR "\\file";
    4606           0 :         const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
    4607           0 :         const char *streams_basic[] = {
    4608             :                 "::$DATA"
    4609             :         };
    4610           0 :         const char *streams_afpresource[] = {
    4611             :                 "::$DATA",
    4612             :                 AFPRESOURCE_STREAM
    4613             :         };
    4614             : 
    4615           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4616             : 
    4617           0 :         torture_comment(tctx, "Checking whether create with delete-on-close is ignored for AFP_AfpResource\n");
    4618             : 
    4619           0 :         smb2_deltree(tree, BASEDIR);
    4620           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4621           0 :         torture_assert_ntstatus_ok(tctx, status, "torture_smb2_testdir");
    4622           0 :         smb2_util_close(tree, h1);
    4623           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4624           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4625             : 
    4626           0 :         torture_comment(tctx, "Opening not existing AFP_AfpResource\n");
    4627             : 
    4628           0 :         ZERO_STRUCT(create);
    4629           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4630           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
    4631           0 :         create.in.fname = sname;
    4632             : 
    4633           0 :         status = smb2_create(tree, mem_ctx, &create);
    4634           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4635             :                                            ret, done, "Got unexpected AFP_AfpResource stream");
    4636             : 
    4637           0 :         ZERO_STRUCT(create);
    4638           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4639           0 :         create.in.desired_access = SEC_FILE_ALL;
    4640           0 :         create.in.fname = sname;
    4641             : 
    4642           0 :         status = smb2_create(tree, mem_ctx, &create);
    4643           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4644             :                                            ret, done, "Got unexpected AFP_AfpResource stream");
    4645             : 
    4646           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4647           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4648             : 
    4649           0 :         torture_comment(tctx, "Trying to delete AFP_AfpResource via create with delete-on-close\n");
    4650             : 
    4651           0 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    4652             :                            fname, AFPRESOURCE_STREAM_NAME,
    4653             :                            0, 10, "1234567890");
    4654           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
    4655             : 
    4656           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM_NAME,
    4657             :                            0, 10, 0, 10, "1234567890");
    4658           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad content from AFP_AfpResource");
    4659             : 
    4660           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
    4661           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4662             : 
    4663           0 :         ZERO_STRUCT(create);
    4664           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4665           0 :         create.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
    4666           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4667           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4668           0 :         create.in.fname = sname;
    4669           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4670             : 
    4671           0 :         status = smb2_create(tree, mem_ctx, &create);
    4672           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4673             : 
    4674           0 :         h1 = create.out.file.handle;
    4675           0 :         smb2_util_close(tree, h1);
    4676             : 
    4677           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
    4678           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4679             : 
    4680           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM_NAME,
    4681             :                            0, 10, 0, 10, "1234567890");
    4682           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad content from AFP_AfpResource");
    4683             : 
    4684           0 : done:
    4685           0 :         smb2_util_unlink(tree, fname);
    4686           0 :         smb2_util_rmdir(tree, BASEDIR);
    4687           0 :         return ret;
    4688             : }
    4689             : 
    4690           0 : static bool test_setinfo_delete_on_close_resource(struct torture_context *tctx,
    4691             :                                                   struct smb2_tree *tree)
    4692             : {
    4693           0 :         bool ret = true;
    4694             :         NTSTATUS status;
    4695             :         struct smb2_create create;
    4696             :         union smb_setfileinfo sfinfo;
    4697             :         struct smb2_handle h1;
    4698           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4699           0 :         const char *fname = BASEDIR "\\file";
    4700           0 :         const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
    4701           0 :         const char *streams_afpresource[] = {
    4702             :                 "::$DATA",
    4703             :                 AFPRESOURCE_STREAM
    4704             :         };
    4705             : 
    4706           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4707             : 
    4708           0 :         torture_comment(tctx, "Trying to delete AFP_AfpResource via setinfo with delete-on-close\n");
    4709             : 
    4710           0 :         smb2_deltree(tree, BASEDIR);
    4711           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4712           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4713           0 :         smb2_util_close(tree, h1);
    4714           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4715           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4716             : 
    4717           0 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    4718             :                            fname, AFPRESOURCE_STREAM_NAME,
    4719             :                            10, 10, "1234567890");
    4720           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
    4721             : 
    4722           0 :         ZERO_STRUCT(create);
    4723           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4724           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4725           0 :         create.in.fname = sname;
    4726           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4727           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4728             : 
    4729           0 :         status = smb2_create(tree, mem_ctx, &create);
    4730           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4731             : 
    4732           0 :         h1 = create.out.file.handle;
    4733             : 
    4734             :         /* Try to delete stream via setinfo delete-on-close */
    4735           0 :         ZERO_STRUCT(sfinfo);
    4736           0 :         sfinfo.disposition_info.in.delete_on_close = 1;
    4737           0 :         sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
    4738           0 :         sfinfo.generic.in.file.handle = h1;
    4739           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    4740           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set delete-on-close failed");
    4741             : 
    4742           0 :         smb2_util_close(tree, h1);
    4743             : 
    4744           0 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
    4745           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4746             : 
    4747           0 :         ZERO_STRUCT(create);
    4748           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4749           0 :         create.in.desired_access = SEC_FILE_ALL;
    4750           0 :         create.in.fname = sname;
    4751           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4752           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4753           0 :         status = smb2_create(tree, mem_ctx, &create);
    4754           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4755             :                                         "Got unexpected AFP_AfpResource stream");
    4756             : 
    4757           0 : done:
    4758           0 :         smb2_util_unlink(tree, fname);
    4759           0 :         smb2_util_rmdir(tree, BASEDIR);
    4760           0 :         return ret;
    4761             : }
    4762             : 
    4763           0 : static bool test_setinfo_eof_resource(struct torture_context *tctx,
    4764             :                                       struct smb2_tree *tree)
    4765             : {
    4766           0 :         bool ret = true;
    4767             :         NTSTATUS status;
    4768             :         struct smb2_create create;
    4769             :         union smb_setfileinfo sfinfo;
    4770             :         union smb_fileinfo finfo;
    4771             :         struct smb2_handle h1;
    4772           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4773           0 :         const char *fname = BASEDIR "\\file";
    4774           0 :         const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
    4775           0 :         const char *streams_basic[] = {
    4776             :                 "::$DATA"
    4777             :         };
    4778             : 
    4779           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4780             : 
    4781           0 :         ret = enable_aapl(tctx, tree);
    4782           0 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    4783             : 
    4784           0 :         torture_comment(tctx, "Set AFP_AfpResource EOF to 1 and 0\n");
    4785             : 
    4786           0 :         smb2_deltree(tree, BASEDIR);
    4787           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4788           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4789           0 :         smb2_util_close(tree, h1);
    4790           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4791           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4792             : 
    4793           0 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    4794             :                            fname, AFPRESOURCE_STREAM_NAME,
    4795             :                            10, 10, "1234567890");
    4796           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
    4797             : 
    4798           0 :         ZERO_STRUCT(create);
    4799           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4800           0 :         create.in.desired_access = SEC_FILE_ALL;
    4801           0 :         create.in.fname = sname;
    4802           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4803           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4804             : 
    4805           0 :         status = smb2_create(tree, mem_ctx, &create);
    4806           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4807             : 
    4808           0 :         h1 = create.out.file.handle;
    4809             : 
    4810           0 :         torture_comment(tctx, "Set AFP_AfpResource EOF to 1\n");
    4811             : 
    4812             :         /* Test setinfo end-of-file info */
    4813           0 :         ZERO_STRUCT(sfinfo);
    4814           0 :         sfinfo.generic.in.file.handle = h1;
    4815           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4816           0 :         sfinfo.position_information.in.position = 1;
    4817           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    4818           0 :         torture_assert_ntstatus_ok_goto(tctx, status,
    4819             :                                         ret, done, "set eof 1 failed");
    4820             : 
    4821           0 :         smb2_util_close(tree, h1);
    4822             : 
    4823             :         /* Check size == 1 */
    4824           0 :         ZERO_STRUCT(create);
    4825           0 :         create.in.fname = sname;
    4826           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4827           0 :         create.in.desired_access = SEC_FILE_ALL;
    4828           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4829           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4830           0 :         status = smb2_create(tree, mem_ctx, &create);
    4831           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4832             : 
    4833           0 :         h1 = create.out.file.handle;
    4834             : 
    4835           0 :         ZERO_STRUCT(finfo);
    4836           0 :         finfo.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
    4837           0 :         finfo.generic.in.file.handle = h1;
    4838           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    4839           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_getinfo_file failed");
    4840             : 
    4841           0 :         smb2_util_close(tree, h1);
    4842             : 
    4843           0 :         torture_assert_goto(tctx, finfo.all_info.out.size == 1, ret, done, "size != 1");
    4844             : 
    4845           0 :         ZERO_STRUCT(create);
    4846           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4847           0 :         create.in.desired_access = SEC_FILE_ALL;
    4848           0 :         create.in.fname = sname;
    4849           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4850           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4851             : 
    4852           0 :         status = smb2_create(tree, mem_ctx, &create);
    4853           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4854             : 
    4855           0 :         h1 = create.out.file.handle;
    4856             : 
    4857             :         /*
    4858             :          * Delete stream via setinfo end-of-file info to 0, this
    4859             :          * should delete the stream.
    4860             :          */
    4861           0 :         ZERO_STRUCT(sfinfo);
    4862           0 :         sfinfo.generic.in.file.handle = h1;
    4863           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4864           0 :         sfinfo.position_information.in.position = 0;
    4865           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    4866           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set eof 0 failed");
    4867             : 
    4868           0 :         smb2_util_close(tree, h1);
    4869             : 
    4870           0 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4871           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4872             : 
    4873           0 :         ZERO_STRUCT(create);
    4874           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4875           0 :         create.in.desired_access = SEC_FILE_ALL;
    4876           0 :         create.in.fname = sname;
    4877           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4878           0 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4879             : 
    4880           0 :         status = smb2_create(tree, mem_ctx, &create);
    4881           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4882             :                                            ret, done, "smb2_create failed");
    4883             : 
    4884           0 : done:
    4885           0 :         smb2_util_unlink(tree, fname);
    4886           0 :         smb2_util_rmdir(tree, BASEDIR);
    4887           0 :         return ret;
    4888             : }
    4889             : 
    4890             : /*
    4891             :  * This tests that right after creating the AFP_AfpInfo stream,
    4892             :  * reading from the stream returns an empty, default metadata blob of
    4893             :  * 60 bytes.
    4894             :  *
    4895             :  * NOTE: against OS X SMB server this only works if the read request
    4896             :  * is compounded with the create that created the stream, is fails
    4897             :  * otherwise. We don't care...
    4898             :  */
    4899           0 : static bool test_null_afpinfo(struct torture_context *tctx,
    4900             :                               struct smb2_tree *tree)
    4901             : {
    4902           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4903           0 :         const char *fname = "test_null_afpinfo";
    4904           0 :         const char *sname = "test_null_afpinfo" AFPINFO_STREAM_NAME;
    4905             :         NTSTATUS status;
    4906           0 :         bool ret = true;
    4907             :         struct smb2_request *req[3];
    4908             :         struct smb2_handle handle;
    4909             :         struct smb2_create create;
    4910             :         struct smb2_read read;
    4911           0 :         AfpInfo *afpinfo = NULL;
    4912           0 :         char *afpinfo_buf = NULL;
    4913           0 :         const char *type_creator = "SMB,OLE!";
    4914             :         struct smb2_handle handle2;
    4915             :         struct smb2_read r;
    4916             : 
    4917           0 :         torture_comment(tctx, "Checking create of AfpInfo stream\n");
    4918             : 
    4919           0 :         smb2_util_unlink(tree, fname);
    4920             : 
    4921           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4922           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
    4923             : 
    4924           0 :         ZERO_STRUCT(create);
    4925           0 :         create.in.desired_access = SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA;
    4926           0 :         create.in.share_access = FILE_SHARE_READ | FILE_SHARE_DELETE;
    4927           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4928           0 :         create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    4929           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    4930           0 :         create.in.fname = sname;
    4931             : 
    4932           0 :         smb2_transport_compound_start(tree->session->transport, 2);
    4933             : 
    4934           0 :         req[0] = smb2_create_send(tree, &create);
    4935             : 
    4936           0 :         handle.data[0] = UINT64_MAX;
    4937           0 :         handle.data[1] = UINT64_MAX;
    4938             : 
    4939           0 :         smb2_transport_compound_set_related(tree->session->transport, true);
    4940             : 
    4941           0 :         ZERO_STRUCT(read);
    4942           0 :         read.in.file.handle = handle;
    4943           0 :         read.in.length = AFP_INFO_SIZE;
    4944           0 :         req[1] = smb2_read_send(tree, &read);
    4945             : 
    4946           0 :         status = smb2_create_recv(req[0], tree, &create);
    4947           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create_recv failed");
    4948             : 
    4949           0 :         handle = create.out.file.handle;
    4950             : 
    4951           0 :         status = smb2_read_recv(req[1], tree, &read);
    4952           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_read_recv failed");
    4953             : 
    4954           0 :         status = torture_smb2_testfile_access(tree, sname, &handle2,
    4955             :                                               SEC_FILE_READ_DATA);
    4956           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4957             :                                         "torture_smb2_testfile failed\n");
    4958           0 :         r = (struct smb2_read) {
    4959             :                 .in.file.handle = handle2,
    4960             :                 .in.length      = AFP_INFO_SIZE,
    4961             :         };
    4962             : 
    4963           0 :         status = smb2_read(tree, tree, &r);
    4964           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4965             :                                         "torture_smb2_testfile failed\n");
    4966           0 :         smb2_util_close(tree, handle2);
    4967             : 
    4968           0 :         afpinfo = torture_afpinfo_new(mem_ctx);
    4969           0 :         torture_assert_goto(tctx, afpinfo != NULL, ret, done, "torture_afpinfo_new failed");
    4970             : 
    4971           0 :         memcpy(afpinfo->afpi_FinderInfo, type_creator, 8);
    4972             : 
    4973           0 :         afpinfo_buf = torture_afpinfo_pack(tctx, afpinfo);
    4974           0 :         torture_assert_goto(tctx, afpinfo_buf != NULL, ret, done, "torture_afpinfo_new failed");
    4975             : 
    4976           0 :         status = smb2_util_write(tree, handle, afpinfo_buf, 0, AFP_INFO_SIZE);
    4977           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_write failed");
    4978             : 
    4979           0 :         smb2_util_close(tree, handle);
    4980             : 
    4981           0 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4982             :                            0, 60, 16, 8, type_creator);
    4983           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    4984             : 
    4985           0 : done:
    4986           0 :         smb2_util_unlink(tree, fname);
    4987           0 :         talloc_free(mem_ctx);
    4988           0 :         return ret;
    4989             : }
    4990             : 
    4991           0 : static bool test_delete_file_with_rfork(struct torture_context *tctx,
    4992             :                                         struct smb2_tree *tree)
    4993             : {
    4994           0 :         const char *fname = "torture_write_rfork_io";
    4995           0 :         const char *rfork_content = "1234567890";
    4996             :         NTSTATUS status;
    4997           0 :         bool ret = true;
    4998             : 
    4999           0 :         smb2_util_unlink(tree, fname);
    5000             : 
    5001           0 :         torture_comment(tctx, "Test deleting file with resource fork\n");
    5002             : 
    5003           0 :         ret = torture_setup_file(tctx, tree, fname, false);
    5004           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed\n");
    5005             : 
    5006           0 :         ret = write_stream(tree, __location__, tctx, tctx,
    5007             :                            fname, AFPRESOURCE_STREAM_NAME,
    5008             :                            10, 10, rfork_content);
    5009           0 :         torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed\n");
    5010             : 
    5011           0 :         ret = check_stream(tree, __location__, tctx, tctx,
    5012             :                            fname, AFPRESOURCE_STREAM_NAME,
    5013             :                            0, 20, 10, 10, rfork_content);
    5014           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed\n");
    5015             : 
    5016           0 :         status = smb2_util_unlink(tree, fname);
    5017           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "check_stream failed\n");
    5018             : 
    5019           0 : done:
    5020           0 :         return ret;
    5021             : }
    5022             : 
    5023           0 : static bool test_rename_and_read_rsrc(struct torture_context *tctx,
    5024             :                                       struct smb2_tree *tree)
    5025             : {
    5026           0 :         bool ret = true;
    5027             :         NTSTATUS status;
    5028             :         struct smb2_create create, create2;
    5029             :         struct smb2_handle h1, h2;
    5030           0 :         const char *fname = "test_rename_openfile";
    5031           0 :         const char *sname = "test_rename_openfile" AFPRESOURCE_STREAM_NAME;
    5032           0 :         const char *fname_renamed = "test_rename_openfile_renamed";
    5033           0 :         const char *data = "1234567890";
    5034             :         union smb_setfileinfo sinfo;
    5035           0 :         bool server_is_macos = torture_setting_bool(tctx, "osx", false);
    5036             :         NTSTATUS expected_status;
    5037             : 
    5038           0 :         ret = enable_aapl(tctx, tree);
    5039           0 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    5040             : 
    5041           0 :         torture_comment(tctx, "Create file with resource fork\n");
    5042             : 
    5043           0 :         ret = torture_setup_file(tctx, tree, fname, false);
    5044           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    5045             : 
    5046           0 :         ret = write_stream(tree, __location__, tctx, tctx,
    5047             :                            fname, AFPRESOURCE_STREAM_NAME, 0, 10, data);
    5048           0 :         torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
    5049             : 
    5050           0 :         torture_comment(tctx, "Open resource fork\n");
    5051             : 
    5052           0 :         ZERO_STRUCT(create);
    5053           0 :         create.in.desired_access = SEC_FILE_ALL;
    5054           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5055           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5056           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5057           0 :         create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    5058           0 :         create.in.fname = sname;
    5059             : 
    5060           0 :         status = smb2_create(tree, tctx, &create);
    5061           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    5062             : 
    5063           0 :         h1 = create.out.file.handle;
    5064             : 
    5065           0 :         torture_comment(tctx, "Rename base file\n");
    5066             : 
    5067           0 :         ZERO_STRUCT(create2);
    5068           0 :         create2.in.desired_access = SEC_FILE_ALL;
    5069           0 :         create2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5070           0 :         create2.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5071           0 :         create2.in.create_disposition = NTCREATEX_DISP_OPEN;
    5072           0 :         create2.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    5073           0 :         create2.in.fname = fname;
    5074             : 
    5075           0 :         status = smb2_create(tree, tctx, &create2);
    5076           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    5077             : 
    5078           0 :         h2 = create2.out.file.handle;
    5079             : 
    5080           0 :         ZERO_STRUCT(sinfo);
    5081           0 :         sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
    5082           0 :         sinfo.rename_information.in.file.handle = h2;
    5083           0 :         sinfo.rename_information.in.overwrite = 0;
    5084           0 :         sinfo.rename_information.in.root_fid = 0;
    5085           0 :         sinfo.rename_information.in.new_name = fname_renamed;
    5086             : 
    5087           0 :         if (server_is_macos) {
    5088           0 :                 expected_status = NT_STATUS_SHARING_VIOLATION;
    5089             :         } else {
    5090           0 :                 expected_status = NT_STATUS_ACCESS_DENIED;
    5091             :         }
    5092             : 
    5093           0 :         status = smb2_setinfo_file(tree, &sinfo);
    5094           0 :         torture_assert_ntstatus_equal_goto(
    5095             :                 tctx, status, expected_status, ret, done,
    5096             :                 "smb2_setinfo_file failed");
    5097             : 
    5098           0 :         smb2_util_close(tree, h2);
    5099             : 
    5100           0 :         status = smb2_util_write(tree, h1, "foo", 0, 3);
    5101           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    5102             :                                         "write failed\n");
    5103             : 
    5104           0 :         smb2_util_close(tree, h1);
    5105             : 
    5106           0 : done:
    5107           0 :         smb2_util_unlink(tree, fname);
    5108           0 :         smb2_util_unlink(tree, fname_renamed);
    5109             : 
    5110           0 :         return ret;
    5111             : }
    5112             : 
    5113           0 : static bool test_readdir_attr_illegal_ntfs(struct torture_context *tctx,
    5114             :                                            struct smb2_tree *tree)
    5115             : {
    5116           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    5117           0 :         const char *name = "test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */
    5118           0 :         const char *fname = BASEDIR "\\test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */
    5119             :         NTSTATUS status;
    5120             :         struct smb2_handle testdirh;
    5121           0 :         bool ret = true;
    5122             :         struct smb2_create io;
    5123             :         AfpInfo *info;
    5124           0 :         const char *type_creator = "SMB,OLE!";
    5125             :         struct smb2_find f;
    5126             :         unsigned int count;
    5127             :         union smb_search_data *d;
    5128             :         uint64_t rfork_len;
    5129             :         unsigned int i;
    5130             : 
    5131           0 :         smb2_deltree(tree, BASEDIR);
    5132             : 
    5133           0 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    5134           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir failed");
    5135           0 :         smb2_util_close(tree, testdirh);
    5136             : 
    5137           0 :         torture_comment(tctx, "Enabling AAPL\n");
    5138             : 
    5139           0 :         ret = enable_aapl(tctx, tree);
    5140           0 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    5141             : 
    5142             :         /*
    5143             :          * Now that Requested AAPL extensions are enabled, setup some
    5144             :          * Mac files with metadata and resource fork
    5145             :          */
    5146             : 
    5147           0 :         torture_comment(tctx, "Preparing file\n");
    5148             : 
    5149           0 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    5150           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
    5151             : 
    5152           0 :         info = torture_afpinfo_new(mem_ctx);
    5153           0 :         torture_assert_not_null_goto(tctx, info, ret, done, "torture_afpinfo_new failed");
    5154             : 
    5155           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    5156           0 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    5157           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    5158             : 
    5159           0 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    5160             :                            fname, AFPRESOURCE_STREAM_NAME,
    5161             :                            0, 3, "foo");
    5162           0 :         torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
    5163             : 
    5164             :         /*
    5165             :          * Ok, file is prepared, now call smb2/find
    5166             :          */
    5167             : 
    5168           0 :         torture_comment(tctx, "Issue find\n");
    5169             : 
    5170           0 :         ZERO_STRUCT(io);
    5171           0 :         io.in.desired_access = SEC_RIGHTS_DIR_READ;
    5172           0 :         io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    5173           0 :         io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    5174           0 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_READ |
    5175             :                               NTCREATEX_SHARE_ACCESS_WRITE |
    5176             :                               NTCREATEX_SHARE_ACCESS_DELETE);
    5177           0 :         io.in.create_disposition = NTCREATEX_DISP_OPEN;
    5178           0 :         io.in.fname = BASEDIR;
    5179           0 :         status = smb2_create(tree, tctx, &io);
    5180           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    5181             : 
    5182           0 :         ZERO_STRUCT(f);
    5183           0 :         f.in.file.handle        = io.out.file.handle;
    5184           0 :         f.in.pattern            = "*";
    5185           0 :         f.in.max_response_size  = 0x1000;
    5186           0 :         f.in.level              = SMB2_FIND_ID_BOTH_DIRECTORY_INFO;
    5187             : 
    5188           0 :         status = smb2_find_level(tree, tree, &f, &count, &d);
    5189           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_find_level failed");
    5190             : 
    5191           0 :         status = smb2_util_close(tree, io.out.file.handle);
    5192           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_close failed");
    5193             : 
    5194           0 :         torture_comment(tctx, "Checking find response with enriched macOS metadata\n");
    5195             : 
    5196           0 :         for (i = 0; i < count; i++) {
    5197           0 :                 const char *found = d[i].id_both_directory_info.name.s;
    5198             : 
    5199           0 :                 if (!strcmp(found, ".") || !strcmp(found, ".."))
    5200           0 :                         continue;
    5201           0 :                 if (strncmp(found, "._", 2) == 0) {
    5202           0 :                         continue;
    5203             :                 }
    5204           0 :                 break;
    5205             :         }
    5206             : 
    5207           0 :         torture_assert_str_equal_goto(tctx,
    5208             :                                       d[i].id_both_directory_info.name.s, name,
    5209             :                                       ret, done, "bad name");
    5210             : 
    5211           0 :         rfork_len = BVAL(d[i].id_both_directory_info.short_name_buf, 0);
    5212           0 :         torture_assert_int_equal_goto(tctx, rfork_len, 3, ret, done, "bad resource fork length");
    5213             : 
    5214           0 :         torture_assert_mem_equal_goto(tctx, type_creator,
    5215             :                                       d[i].id_both_directory_info.short_name_buf + 8,
    5216             :                                       8, ret, done, "Bad FinderInfo");
    5217           0 : done:
    5218           0 :         smb2_util_unlink(tree, fname);
    5219           0 :         smb2_deltree(tree, BASEDIR);
    5220           0 :         talloc_free(mem_ctx);
    5221           0 :         return ret;
    5222             : }
    5223             : 
    5224           0 : static bool test_invalid_afpinfo(struct torture_context *tctx,
    5225             :                                  struct smb2_tree *tree1,
    5226             :                                  struct smb2_tree *tree2)
    5227             : {
    5228           0 :         const char *fname = "filtest_invalid_afpinfo";
    5229           0 :         const char *sname = "filtest_invalid_afpinfo" AFPINFO_STREAM_NAME;
    5230             :         struct smb2_create create;
    5231           0 :         const char *streams_basic[] = {
    5232             :                 "::$DATA"
    5233             :         };
    5234           0 :         const char *streams_afpinfo[] = {
    5235             :                 "::$DATA",
    5236             :                 AFPINFO_STREAM
    5237             :         };
    5238             :         NTSTATUS status;
    5239           0 :         bool ret = true;
    5240             : 
    5241           0 :         if (tree2 == NULL) {
    5242           0 :                 torture_skip_goto(tctx, done, "need second share without fruit\n");
    5243             :         }
    5244             : 
    5245           0 :         torture_comment(tctx, "Testing invalid AFP_AfpInfo stream\n");
    5246             : 
    5247           0 :         ret = torture_setup_file(tctx, tree2, fname, false);
    5248           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    5249             : 
    5250           0 :         ret = write_stream(tree2, __location__, tctx, tctx,
    5251             :                            fname, AFPINFO_STREAM_NAME,
    5252             :                            0, 3, "foo");
    5253           0 :         torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
    5254             : 
    5255           0 :         ret = check_stream_list(tree2, tctx, fname, 2, streams_afpinfo, false);
    5256           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    5257             : 
    5258           0 :         torture_comment(tctx, "Listing streams, bad AFPINFO stream must not be present\n");
    5259             : 
    5260           0 :         ret = check_stream_list(tree1, tctx, fname, 1, streams_basic, false);
    5261           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    5262             : 
    5263           0 :         torture_comment(tctx, "Try to open AFPINFO stream, must fail\n");
    5264             : 
    5265           0 :         ZERO_STRUCT(create);
    5266           0 :         create.in.desired_access = SEC_FILE_ALL;
    5267           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5268           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5269           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5270           0 :         create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    5271           0 :         create.in.fname = sname;
    5272             : 
    5273           0 :         status = smb2_create(tree1, tctx, &create);
    5274           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    5275             :                                            ret, done, "Stream still around?");
    5276             : 
    5277           0 : done:
    5278           0 :         smb2_util_unlink(tree1, fname);
    5279           0 :         return ret;
    5280             : }
    5281             : 
    5282           0 : static bool test_writing_afpinfo(struct torture_context *tctx,
    5283             :                                  struct smb2_tree *tree)
    5284             : {
    5285           0 :         const char *fname = "filtest_invalid_afpinfo";
    5286           0 :         const char *sname = "filtest_invalid_afpinfo" AFPINFO_STREAM;
    5287           0 :         const char *streams_afpinfo[] = {
    5288             :                 "::$DATA",
    5289             :                 AFPINFO_STREAM
    5290             :         };
    5291           0 :         bool ret = true;
    5292             :         static AfpInfo *afpi = NULL;
    5293           0 :         char *buf = NULL;
    5294           0 :         char *afpi_buf = NULL;
    5295           0 :         char *zero_buf = NULL;
    5296           0 :         bool broken_osx = torture_setting_bool(tctx, "broken_osx_45759458", false);
    5297           0 :         off_t min_offset_for_2streams = 16;
    5298             :         int i;
    5299             :         NTSTATUS status;
    5300             :         struct test_sizes {
    5301             :                 off_t offset;
    5302             :                 size_t size;
    5303             :                 bool expected_result;
    5304           0 :         } test_sizes[] = {
    5305             :                 { 0, 1, false},
    5306             :                 { 0, 2, false},
    5307             :                 { 0, 3, true},
    5308             :                 { 0, 4, true},
    5309             :                 { 0, 14, true},
    5310             :                 { 0, 15, true},
    5311             :                 { 0, 16, true},
    5312             :                 { 0, 24, true},
    5313             :                 { 0, 34, true},
    5314             :                 { 0, 44, true},
    5315             :                 { 0, 54, true},
    5316             :                 { 0, 55, true},
    5317             :                 { 0, 56, true},
    5318             :                 { 0, 57, true},
    5319             :                 { 0, 58, true},
    5320             :                 { 0, 59, true},
    5321             :                 { 0, 60, true},
    5322             :                 { 0, 61, true},
    5323             :                 { 0, 64, true},
    5324             :                 { 0, 1024, true},
    5325             :                 { 0, 10064, true},
    5326             : 
    5327             :                 { 1, 1, false},
    5328             :                 { 1, 2, false},
    5329             :                 { 1, 3, false},
    5330             :                 { 1, 4, false},
    5331             :                 { 1, 14, false},
    5332             :                 { 1, 15, false},
    5333             :                 { 1, 16, false},
    5334             :                 { 1, 24, false},
    5335             :                 { 1, 34, false},
    5336             :                 { 1, 44, false},
    5337             :                 { 1, 54, false},
    5338             :                 { 1, 55, false},
    5339             :                 { 1, 56, false},
    5340             :                 { 1, 57, false},
    5341             :                 { 1, 58, false},
    5342             :                 { 1, 59, false},
    5343             :                 { 1, 60, true},
    5344             :                 { 1, 61, true},
    5345             :                 { 1, 1024, true},
    5346             :                 { 1, 10064, true},
    5347             : 
    5348             :                 { 30, 1, false},
    5349             :                 { 30, 2, false},
    5350             :                 { 30, 3, false},
    5351             :                 { 30, 4, false},
    5352             :                 { 30, 14, false},
    5353             :                 { 30, 15, false},
    5354             :                 { 30, 16, false},
    5355             :                 { 30, 24, false},
    5356             :                 { 30, 34, false},
    5357             :                 { 30, 44, false},
    5358             :                 { 30, 54, false},
    5359             :                 { 30, 55, false},
    5360             :                 { 30, 56, false},
    5361             :                 { 30, 57, false},
    5362             :                 { 30, 58, false},
    5363             :                 { 30, 59, false},
    5364             :                 { 30, 60, true},
    5365             :                 { 30, 61, true},
    5366             :                 { 30, 1024, true},
    5367             :                 { 30, 10064, true},
    5368             : 
    5369             :                 { 58, 1, false},
    5370             :                 { 58, 2, false},
    5371             :                 { 58, 3, false},
    5372             :                 { 58, 4, false},
    5373             :                 { 58, 14, false},
    5374             :                 { 58, 15, false},
    5375             :                 { 58, 16, false},
    5376             :                 { 58, 24, false},
    5377             :                 { 58, 34, false},
    5378             :                 { 58, 44, false},
    5379             :                 { 58, 54, false},
    5380             :                 { 58, 55, false},
    5381             :                 { 58, 56, false},
    5382             :                 { 58, 57, false},
    5383             :                 { 58, 58, false},
    5384             :                 { 58, 59, false},
    5385             :                 { 58, 60, true},
    5386             :                 { 58, 61, true},
    5387             :                 { 58, 1024, true},
    5388             :                 { 58, 10064, true},
    5389             : 
    5390             :                 { 59, 1, false},
    5391             :                 { 59, 2, false},
    5392             :                 { 59, 3, false},
    5393             :                 { 59, 4, false},
    5394             :                 { 59, 14, false},
    5395             :                 { 59, 15, false},
    5396             :                 { 59, 16, false},
    5397             :                 { 59, 24, false},
    5398             :                 { 59, 34, false},
    5399             :                 { 59, 44, false},
    5400             :                 { 59, 54, false},
    5401             :                 { 59, 55, false},
    5402             :                 { 59, 56, false},
    5403             :                 { 59, 57, false},
    5404             :                 { 59, 58, false},
    5405             :                 { 59, 59, false},
    5406             :                 { 59, 60, true},
    5407             :                 { 59, 61, true},
    5408             :                 { 59, 1024, true},
    5409             :                 { 59, 10064, true},
    5410             : 
    5411             :                 { 60, 1, false},
    5412             :                 { 60, 2, false},
    5413             :                 { 60, 3, false},
    5414             :                 { 60, 4, false},
    5415             :                 { 60, 14, false},
    5416             :                 { 60, 15, false},
    5417             :                 { 60, 16, false},
    5418             :                 { 60, 24, false},
    5419             :                 { 60, 34, false},
    5420             :                 { 60, 44, false},
    5421             :                 { 60, 54, false},
    5422             :                 { 60, 55, false},
    5423             :                 { 60, 56, false},
    5424             :                 { 60, 57, false},
    5425             :                 { 60, 58, false},
    5426             :                 { 60, 59, false},
    5427             :                 { 60, 60, true},
    5428             :                 { 60, 61, true},
    5429             :                 { 60, 1024, true},
    5430             :                 { 60, 10064, true},
    5431             : 
    5432             :                 { 61, 1, false},
    5433             :                 { 61, 2, false},
    5434             :                 { 61, 3, false},
    5435             :                 { 61, 4, false},
    5436             :                 { 61, 14, false},
    5437             :                 { 61, 15, false},
    5438             :                 { 61, 16, false},
    5439             :                 { 61, 24, false},
    5440             :                 { 61, 34, false},
    5441             :                 { 61, 44, false},
    5442             :                 { 61, 54, false},
    5443             :                 { 61, 55, false},
    5444             :                 { 61, 56, false},
    5445             :                 { 61, 57, false},
    5446             :                 { 61, 58, false},
    5447             :                 { 61, 59, false},
    5448             :                 { 61, 60, true},
    5449             :                 { 61, 61, true},
    5450             :                 { 61, 1024, true},
    5451             :                 { 61, 10064, true},
    5452             : 
    5453             :                 { 10000, 1, false},
    5454             :                 { 10000, 2, false},
    5455             :                 { 10000, 3, false},
    5456             :                 { 10000, 4, false},
    5457             :                 { 10000, 14, false},
    5458             :                 { 10000, 15, false},
    5459             :                 { 10000, 16, false},
    5460             :                 { 10000, 24, false},
    5461             :                 { 10000, 34, false},
    5462             :                 { 10000, 44, false},
    5463             :                 { 10000, 54, false},
    5464             :                 { 10000, 55, false},
    5465             :                 { 10000, 56, false},
    5466             :                 { 10000, 57, false},
    5467             :                 { 10000, 58, false},
    5468             :                 { 10000, 59, false},
    5469             :                 { 10000, 60, true},
    5470             :                 { 10000, 61, true},
    5471             :                 { 10000, 1024, true},
    5472             :                 { 10000, 10064, true},
    5473             : 
    5474             :                 { -1, 0, false},
    5475             :         };
    5476             : 
    5477           0 :         afpi = torture_afpinfo_new(tctx);
    5478           0 :         torture_assert_not_null_goto(tctx, afpi, ret, done,
    5479             :                                      "torture_afpinfo_new failed\n");
    5480             : 
    5481           0 :         memcpy(afpi->afpi_FinderInfo, "FOO BAR ", 8);
    5482             : 
    5483           0 :         buf = torture_afpinfo_pack(afpi, afpi);
    5484           0 :         torture_assert_not_null_goto(tctx, buf, ret, done,
    5485             :                                      "torture_afpinfo_pack failed\n");
    5486             : 
    5487           0 :         afpi_buf = talloc_zero_array(tctx, char, 10064);
    5488           0 :         torture_assert_not_null_goto(tctx, afpi_buf, ret, done,
    5489             :                                      "talloc_zero_array failed\n");
    5490           0 :         memcpy(afpi_buf, buf, 60);
    5491             : 
    5492           0 :         zero_buf = talloc_zero_array(tctx, char, 10064);
    5493           0 :         torture_assert_not_null_goto(tctx, zero_buf, ret, done,
    5494             :                                      "talloc_zero_array failed\n");
    5495             : 
    5496           0 :         ret = torture_setup_file(tctx, tree, fname, false);
    5497           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    5498             :                             "torture_setup_file\n");
    5499             : 
    5500           0 :         for (i = 0; test_sizes[i].offset != -1; i++) {
    5501             :                 struct smb2_handle h;
    5502             :                 struct smb2_create c;
    5503             :                 int expected_num_streams;
    5504             :                 size_t fi_check_size;
    5505             : 
    5506           0 :                 torture_comment(tctx,
    5507             :                                 "Test %d: offset=%jd size=%zu result=%s\n",
    5508             :                                 i,
    5509           0 :                                 (intmax_t)test_sizes[i].offset,
    5510             :                                 test_sizes[i].size,
    5511           0 :                                 test_sizes[i].expected_result ? "true":"false");
    5512             : 
    5513             : 
    5514           0 :                 c = (struct smb2_create) {
    5515             :                         .in.desired_access = SEC_FILE_WRITE_DATA,
    5516             :                         .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
    5517             :                         .in.create_disposition = NTCREATEX_DISP_OPEN_IF,
    5518             :                         .in.fname = sname,
    5519             :                 };
    5520             : 
    5521           0 :                 status = smb2_create(tree, tree, &c);
    5522           0 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    5523             :                                                 "smb2_create\n");
    5524           0 :                 h = c.out.file.handle;
    5525             : 
    5526           0 :                 status = smb2_util_write(tree,
    5527             :                                          h,
    5528             :                                          zero_buf,
    5529             :                                          test_sizes[i].offset,
    5530             :                                          test_sizes[i].size);
    5531           0 :                 torture_assert_ntstatus_equal_goto(
    5532             :                         tctx, status, NT_STATUS_INVALID_PARAMETER,
    5533             :                         ret, done, "smb2_util_write\n");
    5534             : 
    5535           0 :                 status = smb2_util_write(tree,
    5536             :                                          h,
    5537             :                                          afpi_buf,
    5538             :                                          test_sizes[i].offset,
    5539             :                                          test_sizes[i].size);
    5540           0 :                 smb2_util_close(tree, h);
    5541           0 :                 if (test_sizes[i].expected_result == true) {
    5542           0 :                         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    5543             :                                                         "smb2_util_write\n");
    5544             :                 } else {
    5545           0 :                         torture_assert_ntstatus_equal_goto(
    5546             :                                 tctx, status, NT_STATUS_INVALID_PARAMETER,
    5547             :                                 ret, done, "smb2_util_write\n");
    5548             :                 }
    5549             : 
    5550           0 :                 if (broken_osx) {
    5551             :                         /*
    5552             :                          * Currently macOS has a bug (Radar #45759458) where it
    5553             :                          * writes more bytes then requested from uninitialized
    5554             :                          * memory to the filesystem. That means it will likely
    5555             :                          * write data to FinderInfo so the stream is not empty
    5556             :                          * and thus listed when the number of streams is
    5557             :                          * queried.
    5558             :                          */
    5559           0 :                         min_offset_for_2streams = 2;
    5560             :                 }
    5561             : 
    5562           0 :                 if ((test_sizes[i].expected_result == true) &&
    5563           0 :                     (test_sizes[i].size > min_offset_for_2streams))
    5564             :                 {
    5565           0 :                         expected_num_streams = 2;
    5566             :                 } else {
    5567           0 :                         expected_num_streams = 1;
    5568             :                 }
    5569             : 
    5570           0 :                 ret = check_stream_list(tree, tctx, fname,
    5571             :                                         expected_num_streams,
    5572             :                                         streams_afpinfo, false);
    5573           0 :                 torture_assert_goto(tctx, ret == true, ret, done,
    5574             :                                     "Bad streams\n");
    5575             : 
    5576           0 :                 if (test_sizes[i].expected_result == false) {
    5577           0 :                         continue;
    5578             :                 }
    5579             : 
    5580           0 :                 if (test_sizes[i].size <= 16) {
    5581             :                         /*
    5582             :                          * FinderInfo with the "FOO BAR " string we wrote above
    5583             :                          * would start at offset 16. Check whether this test
    5584             :                          * wrote 1 byte or more.
    5585             :                          */
    5586           0 :                         goto next;
    5587             :                 }
    5588             : 
    5589           0 :                 fi_check_size = test_sizes[i].size - 16;
    5590           0 :                 fi_check_size = MIN(fi_check_size, 8);
    5591             : 
    5592           0 :                 ret = check_stream(tree, __location__,
    5593             :                                    tctx, tctx,
    5594             :                                    fname, AFPINFO_STREAM,
    5595             :                                    0, 60, 16, fi_check_size, "FOO BAR ");
    5596           0 :                 torture_assert_goto(tctx, ret == true, ret, done,
    5597             :                                     "Bad streams\n");
    5598             : 
    5599           0 : next:
    5600           0 :                 status = smb2_util_unlink(tree, sname);
    5601           0 :                 if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
    5602             :                         bool missing_ok;
    5603             : 
    5604           0 :                         missing_ok = test_sizes[i].expected_result == false;
    5605           0 :                         missing_ok |= test_sizes[i].size <= 16;
    5606             : 
    5607           0 :                         torture_assert_goto(tctx, missing_ok,
    5608             :                                             ret, done, "smb2_util_unlink\n");
    5609             :                 }
    5610             :         }
    5611             : 
    5612           0 : done:
    5613           0 :         smb2_util_unlink(tree, fname);
    5614           0 :         return ret;
    5615             : }
    5616             : 
    5617           0 : static bool test_zero_file_id(struct torture_context *tctx,
    5618             :                               struct smb2_tree *tree)
    5619             : {
    5620           0 :         const char *fname = "filtest_file_id";
    5621           0 :         struct smb2_create create = {0};
    5622             :         NTSTATUS status;
    5623           0 :         bool ret = true;
    5624           0 :         uint8_t zero_file_id[8] = {0};
    5625             : 
    5626           0 :         torture_comment(tctx, "Testing zero file id\n");
    5627             : 
    5628           0 :         ret = torture_setup_file(tctx, tree, fname, false);
    5629           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    5630             : 
    5631           0 :         ZERO_STRUCT(create);
    5632           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    5633           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5634           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5635           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5636           0 :         create.in.fname = fname;
    5637           0 :         create.in.query_on_disk_id = true;
    5638             : 
    5639           0 :         status = smb2_create(tree, tctx, &create);
    5640           0 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, ret,
    5641             :                                            done,
    5642             :                                            "test file could not be opened");
    5643           0 :         torture_assert_mem_not_equal_goto(tctx, create.out.on_disk_id,
    5644             :                                           zero_file_id, 8, ret, done,
    5645             :                                           "unexpected zero file id");
    5646             : 
    5647           0 :         smb2_util_close(tree, create.out.file.handle);
    5648             : 
    5649           0 :         ret = enable_aapl(tctx, tree);
    5650           0 :         torture_assert(tctx, ret == true, "enable_aapl failed");
    5651             : 
    5652           0 :         ZERO_STRUCT(create);
    5653           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    5654           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5655           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5656           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5657           0 :         create.in.fname = fname;
    5658           0 :         create.in.query_on_disk_id = true;
    5659             : 
    5660           0 :         status = smb2_create(tree, tctx, &create);
    5661           0 :         torture_assert_ntstatus_equal_goto(
    5662             :             tctx, status, NT_STATUS_OK, ret, done,
    5663             :             "test file could not be opened with AAPL");
    5664           0 :         torture_assert_mem_equal_goto(tctx, create.out.on_disk_id, zero_file_id,
    5665             :                                       8, ret, done, "non-zero file id");
    5666             : 
    5667           0 :         smb2_util_close(tree, create.out.file.handle);
    5668             : 
    5669           0 : done:
    5670           0 :         smb2_util_unlink(tree, fname);
    5671           0 :         return ret;
    5672             : }
    5673             : 
    5674           0 : static bool copy_one_stream(struct torture_context *torture,
    5675             :                             struct smb2_tree *tree,
    5676             :                             TALLOC_CTX *tmp_ctx,
    5677             :                             const char *src_sname,
    5678             :                             const char *dst_sname)
    5679             : {
    5680           0 :         struct smb2_handle src_h = {{0}};
    5681           0 :         struct smb2_handle dest_h = {{0}};
    5682             :         NTSTATUS status;
    5683             :         union smb_ioctl io;
    5684             :         struct srv_copychunk_copy cc_copy;
    5685             :         struct srv_copychunk_rsp cc_rsp;
    5686             :         enum ndr_err_code ndr_ret;
    5687           0 :         bool ok = false;
    5688             : 
    5689           0 :         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    5690             :                                    1, /* 1 chunk */
    5691             :                                    src_sname,
    5692             :                                    &src_h, 256, /* fill 256 byte src file */
    5693             :                                    SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
    5694             :                                    dst_sname,
    5695             :                                    &dest_h, 0,      /* 0 byte dest file */
    5696             :                                    SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
    5697             :                                    &cc_copy,
    5698             :                                    &io);
    5699           0 :         torture_assert_goto(torture, ok == true, ok, done,
    5700             :                             "setup copy chunk error\n");
    5701             : 
    5702             :         /* copy all src file data (via a single chunk desc) */
    5703           0 :         cc_copy.chunks[0].source_off = 0;
    5704           0 :         cc_copy.chunks[0].target_off = 0;
    5705           0 :         cc_copy.chunks[0].length = 256;
    5706             : 
    5707           0 :         ndr_ret = ndr_push_struct_blob(
    5708             :                 &io.smb2.in.out, tmp_ctx, &cc_copy,
    5709             :                 (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
    5710             : 
    5711           0 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5712             :                                    "ndr_push_srv_copychunk_copy\n");
    5713             : 
    5714           0 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    5715           0 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done,
    5716             :                                         "FSCTL_SRV_COPYCHUNK\n");
    5717             : 
    5718           0 :         ndr_ret = ndr_pull_struct_blob(
    5719             :                 &io.smb2.out.out, tmp_ctx, &cc_rsp,
    5720             :                 (ndr_pull_flags_fn_t)ndr_pull_srv_copychunk_rsp);
    5721             : 
    5722           0 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5723             :                                    "ndr_pull_srv_copychunk_rsp\n");
    5724             : 
    5725           0 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    5726             :                                   1,    /* chunks written */
    5727             :                                   0,    /* chunk bytes unsuccessfully written */
    5728             :                                   256); /* total bytes written */
    5729           0 :         torture_assert_goto(torture, ok == true, ok, done,
    5730             :                             "bad copy chunk response data\n");
    5731             : 
    5732           0 :         ok = check_pattern(torture, tree, tmp_ctx, dest_h, 0, 256, 0);
    5733           0 :         if (!ok) {
    5734           0 :                 torture_fail(torture, "inconsistent file data\n");
    5735             :         }
    5736             : 
    5737           0 : done:
    5738           0 :         if (!smb2_util_handle_empty(src_h)) {
    5739           0 :                 smb2_util_close(tree, src_h);
    5740             :         }
    5741           0 :         if (!smb2_util_handle_empty(dest_h)) {
    5742           0 :                 smb2_util_close(tree, dest_h);
    5743             :         }
    5744             : 
    5745           0 :         return ok;
    5746             : }
    5747             : 
    5748           0 : static bool copy_finderinfo_stream(struct torture_context *torture,
    5749             :                                    struct smb2_tree *tree,
    5750             :                                    TALLOC_CTX *tmp_ctx,
    5751             :                                    const char *src_name,
    5752             :                                    const char *dst_name)
    5753             : {
    5754           0 :         struct smb2_handle src_h = {{0}};
    5755           0 :         struct smb2_handle dest_h = {{0}};
    5756             :         NTSTATUS status;
    5757             :         union smb_ioctl io;
    5758             :         struct srv_copychunk_copy cc_copy;
    5759             :         struct srv_copychunk_rsp cc_rsp;
    5760             :         enum ndr_err_code ndr_ret;
    5761           0 :         const char *type_creator = "SMB,OLE!";
    5762           0 :         AfpInfo *info = NULL;
    5763           0 :         const char *src_name_afpinfo = NULL;
    5764           0 :         const char *dst_name_afpinfo = NULL;
    5765           0 :         bool ok = false;
    5766             : 
    5767           0 :         src_name_afpinfo = talloc_asprintf(tmp_ctx, "%s%s", src_name,
    5768             :                                            AFPINFO_STREAM);
    5769           0 :         torture_assert_not_null_goto(torture, src_name_afpinfo, ok, done,
    5770             :                                      "talloc_asprintf failed\n");
    5771             : 
    5772           0 :         dst_name_afpinfo = talloc_asprintf(tmp_ctx, "%s%s", dst_name,
    5773             :                                            AFPINFO_STREAM);
    5774           0 :         torture_assert_not_null_goto(torture, dst_name_afpinfo, ok, done,
    5775             :                                      "talloc_asprintf failed\n");
    5776             : 
    5777           0 :         info = torture_afpinfo_new(tmp_ctx);
    5778           0 :         torture_assert_not_null_goto(torture, info, ok, done,
    5779             :                                      "torture_afpinfo_new failed\n");
    5780             : 
    5781           0 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    5782           0 :         ok = torture_write_afpinfo(tree, torture, tmp_ctx, src_name, info);
    5783           0 :         torture_assert_goto(torture, ok == true, ok, done,
    5784             :                             "torture_write_afpinfo failed\n");
    5785             : 
    5786           0 :         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    5787             :                                    1, /* 1 chunk */
    5788             :                                    src_name_afpinfo,
    5789             :                                    &src_h, 0,
    5790             :                                    SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
    5791             :                                    dst_name_afpinfo,
    5792             :                                    &dest_h, 0,
    5793             :                                    SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA,
    5794             :                                    &cc_copy,
    5795             :                                    &io);
    5796           0 :         torture_assert_goto(torture, ok == true, ok, done,
    5797             :                             "setup copy chunk error\n");
    5798             : 
    5799             :         /* copy all src file data (via a single chunk desc) */
    5800           0 :         cc_copy.chunks[0].source_off = 0;
    5801           0 :         cc_copy.chunks[0].target_off = 0;
    5802           0 :         cc_copy.chunks[0].length = 60;
    5803             : 
    5804           0 :         ndr_ret = ndr_push_struct_blob(
    5805             :                 &io.smb2.in.out, tmp_ctx, &cc_copy,
    5806             :                 (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
    5807             : 
    5808           0 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5809             :                                    "ndr_push_srv_copychunk_copy\n");
    5810             : 
    5811           0 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    5812           0 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done,
    5813             :                                         "FSCTL_SRV_COPYCHUNK\n");
    5814             : 
    5815           0 :         ndr_ret = ndr_pull_struct_blob(
    5816             :                 &io.smb2.out.out, tmp_ctx, &cc_rsp,
    5817             :                 (ndr_pull_flags_fn_t)ndr_pull_srv_copychunk_rsp);
    5818             : 
    5819           0 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5820             :                                    "ndr_pull_srv_copychunk_rsp\n");
    5821             : 
    5822           0 :         smb2_util_close(tree, src_h);
    5823           0 :         ZERO_STRUCT(src_h);
    5824           0 :         smb2_util_close(tree, dest_h);
    5825           0 :         ZERO_STRUCT(dest_h);
    5826             : 
    5827           0 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    5828             :                                   1,    /* chunks written */
    5829             :                                   0,    /* chunk bytes unsuccessfully written */
    5830             :                                   60); /* total bytes written */
    5831           0 :         torture_assert_goto(torture, ok == true, ok, done,
    5832             :                             "bad copy chunk response data\n");
    5833             : 
    5834           0 :         ok = check_stream(tree, __location__, torture, tmp_ctx,
    5835             :                           dst_name, AFPINFO_STREAM,
    5836             :                           0, 60, 16, 8, type_creator);
    5837           0 :         torture_assert_goto(torture, ok == true, ok, done, "check_stream failed\n");
    5838             : 
    5839           0 : done:
    5840           0 :         if (!smb2_util_handle_empty(src_h)) {
    5841           0 :                 smb2_util_close(tree, src_h);
    5842             :         }
    5843           0 :         if (!smb2_util_handle_empty(dest_h)) {
    5844           0 :                 smb2_util_close(tree, dest_h);
    5845             :         }
    5846             : 
    5847           0 :         return ok;
    5848             : }
    5849             : 
    5850           0 : static bool test_copy_chunk_streams(struct torture_context *torture,
    5851             :                                     struct smb2_tree *tree)
    5852             : {
    5853           0 :         const char *src_name = "src";
    5854           0 :         const char *dst_name = "dst";
    5855             :         struct names {
    5856             :                 const char *src_sname;
    5857             :                 const char *dst_sname;
    5858           0 :         } names[] = {
    5859             :                 { "src:foo", "dst:foo" },
    5860             :                 { "src" AFPRESOURCE_STREAM, "dst" AFPRESOURCE_STREAM }
    5861             :         };
    5862             :         size_t i;
    5863           0 :         TALLOC_CTX *tmp_ctx = NULL;
    5864           0 :         bool ok = false;
    5865             : 
    5866           0 :         tmp_ctx = talloc_new(tree);
    5867           0 :         torture_assert_not_null_goto(torture, tmp_ctx, ok, done,
    5868             :                                      "torture_setup_file\n");
    5869             : 
    5870           0 :         smb2_util_unlink(tree, src_name);
    5871           0 :         smb2_util_unlink(tree, dst_name);
    5872             : 
    5873           0 :         ok = torture_setup_file(torture, tree, src_name, false);
    5874           0 :         torture_assert_goto(torture, ok == true, ok, done, "torture_setup_file\n");
    5875           0 :         ok = torture_setup_file(torture, tree, dst_name, false);
    5876           0 :         torture_assert_goto(torture, ok == true, ok, done, "torture_setup_file\n");
    5877             : 
    5878           0 :         for (i = 0; i < ARRAY_SIZE(names); i++) {
    5879           0 :                 ok = copy_one_stream(torture, tree, tmp_ctx,
    5880             :                                      names[i].src_sname,
    5881             :                                      names[i].dst_sname);
    5882           0 :                 torture_assert_goto(torture, ok == true, ok, done,
    5883             :                                     "copy_one_stream failed\n");
    5884             :         }
    5885             : 
    5886           0 :         ok = copy_finderinfo_stream(torture, tree, tmp_ctx,
    5887             :                                     src_name, dst_name);
    5888           0 :         torture_assert_goto(torture, ok == true, ok, done,
    5889             :                             "copy_finderinfo_stream failed\n");
    5890             : 
    5891           0 : done:
    5892           0 :         smb2_util_unlink(tree, src_name);
    5893           0 :         smb2_util_unlink(tree, dst_name);
    5894           0 :         talloc_free(tmp_ctx);
    5895           0 :         return ok;
    5896             : }
    5897             : 
    5898             : /*
    5899             :  * Ensure this security descriptor has exactly one mode, uid
    5900             :  * and gid.
    5901             :  */
    5902             : 
    5903           0 : static NTSTATUS check_nfs_sd(const struct security_descriptor *psd)
    5904             : {
    5905             :         uint32_t i;
    5906           0 :         bool got_one_mode = false;
    5907           0 :         bool got_one_uid = false;
    5908           0 :         bool got_one_gid = false;
    5909             : 
    5910           0 :         if (psd->dacl == NULL) {
    5911           0 :                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5912             :         }
    5913             : 
    5914           0 :         for (i = 0; i < psd->dacl->num_aces; i++) {
    5915           0 :                 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Mode,
    5916           0 :                                            &psd->dacl->aces[i].trustee) == 0) {
    5917           0 :                         if (got_one_mode == true) {
    5918             :                                 /* Can't have more than one. */
    5919           0 :                                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5920             :                         }
    5921           0 :                         got_one_mode = true;
    5922             :                 }
    5923             :         }
    5924           0 :         for (i = 0; i < psd->dacl->num_aces; i++) {
    5925           0 :                 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Users,
    5926           0 :                                            &psd->dacl->aces[i].trustee) == 0) {
    5927           0 :                         if (got_one_uid == true) {
    5928             :                                 /* Can't have more than one. */
    5929           0 :                                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5930             :                         }
    5931           0 :                         got_one_uid = true;
    5932             :                 }
    5933             :         }
    5934           0 :         for (i = 0; i < psd->dacl->num_aces; i++) {
    5935           0 :                 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Groups,
    5936           0 :                                            &psd->dacl->aces[i].trustee) == 0) {
    5937           0 :                         if (got_one_gid == true) {
    5938             :                                 /* Can't have more than one. */
    5939           0 :                                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5940             :                         }
    5941           0 :                         got_one_gid = true;
    5942             :                 }
    5943             :         }
    5944             :         /* Must have at least one of each. */
    5945           0 :         if (got_one_mode == false ||
    5946           0 :                         got_one_uid == false ||
    5947           0 :                         got_one_gid == false) {
    5948           0 :                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5949             :         }
    5950           0 :         return NT_STATUS_OK;
    5951             : }
    5952             : 
    5953           0 : static bool test_nfs_aces(struct torture_context *tctx,
    5954             :                           struct smb2_tree *tree)
    5955             : {
    5956           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    5957             :         struct security_ace ace;
    5958             :         struct dom_sid sid;
    5959           0 :         const char *fname = BASEDIR "\\nfs_aces.txt";
    5960           0 :         struct smb2_handle h = {{0}};
    5961             :         union smb_fileinfo finfo2;
    5962             :         union smb_setfileinfo set;
    5963           0 :         struct security_descriptor *psd = NULL;
    5964             :         NTSTATUS status;
    5965           0 :         bool ret = true;
    5966           0 :         bool is_osx = torture_setting_bool(tctx, "osx", false);
    5967             : 
    5968           0 :         if (is_osx) {
    5969           0 :                 torture_skip(tctx, "Test only works with Samba\n");
    5970             :         }
    5971             : 
    5972           0 :         ret = enable_aapl(tctx, tree);
    5973           0 :         torture_assert(tctx, ret == true, "enable_aapl failed");
    5974             : 
    5975             :         /* clean slate ...*/
    5976           0 :         smb2_util_unlink(tree, fname);
    5977           0 :         smb2_deltree(tree, fname);
    5978           0 :         smb2_deltree(tree, BASEDIR);
    5979             : 
    5980           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    5981           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    5982           0 :         smb2_util_close(tree, h);
    5983             : 
    5984             :         /* Create a test file. */
    5985           0 :         status = torture_smb2_testfile_access(tree,
    5986             :                                 fname,
    5987             :                                 &h,
    5988             :                                 SEC_STD_READ_CONTROL |
    5989             :                                 SEC_STD_WRITE_DAC |
    5990             :                                 SEC_RIGHTS_FILE_ALL);
    5991           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    5992             : 
    5993             :         /* Get the ACL. */
    5994           0 :         finfo2.query_secdesc.in.secinfo_flags =
    5995             :                 SECINFO_OWNER |
    5996             :                 SECINFO_GROUP |
    5997             :                 SECINFO_DACL;
    5998           0 :         finfo2.generic.level = RAW_FILEINFO_SEC_DESC;
    5999           0 :         finfo2.generic.in.file.handle = h;
    6000           0 :         status = smb2_getinfo_file(tree, tctx, &finfo2);
    6001           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6002             : 
    6003           0 :         psd = finfo2.query_secdesc.out.sd;
    6004             : 
    6005             :         /* Ensure we have only single mode/uid/gid NFS entries. */
    6006           0 :         status = check_nfs_sd(psd);
    6007           0 :         if (!NT_STATUS_IS_OK(status)) {
    6008           0 :                 NDR_PRINT_DEBUG(
    6009             :                         security_descriptor,
    6010             :                         discard_const_p(struct security_descriptor, psd));
    6011             :         }
    6012           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6013             : 
    6014             :         /* Add a couple of extra NFS uids and gids. */
    6015           0 :         sid_compose(&sid, &global_sid_Unix_NFS_Users, 27);
    6016           0 :         init_sec_ace(&ace, &sid, SEC_ACE_TYPE_ACCESS_DENIED, 0, 0);
    6017           0 :         status = security_descriptor_dacl_add(psd, &ace);
    6018           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6019           0 :         status = security_descriptor_dacl_add(psd, &ace);
    6020           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6021             : 
    6022           0 :         sid_compose(&sid, &global_sid_Unix_NFS_Groups, 300);
    6023           0 :         init_sec_ace(&ace, &sid, SEC_ACE_TYPE_ACCESS_DENIED, 0, 0);
    6024           0 :         status = security_descriptor_dacl_add(psd, &ace);
    6025           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6026           0 :         status = security_descriptor_dacl_add(psd, &ace);
    6027           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6028             : 
    6029             :         /* Now set on the file handle. */
    6030           0 :         set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
    6031           0 :         set.set_secdesc.in.file.handle = h;
    6032           0 :         set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
    6033           0 :         set.set_secdesc.in.sd = psd;
    6034           0 :         status = smb2_setinfo_file(tree, &set);
    6035           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6036             : 
    6037             :         /* Get the ACL again. */
    6038           0 :         finfo2.query_secdesc.in.secinfo_flags =
    6039             :                 SECINFO_OWNER |
    6040             :                 SECINFO_GROUP |
    6041             :                 SECINFO_DACL;
    6042           0 :         finfo2.generic.level = RAW_FILEINFO_SEC_DESC;
    6043           0 :         finfo2.generic.in.file.handle = h;
    6044           0 :         status = smb2_getinfo_file(tree, tctx, &finfo2);
    6045           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6046             : 
    6047           0 :         psd = finfo2.query_secdesc.out.sd;
    6048             : 
    6049             :         /* Ensure we have only single mode/uid/gid NFS entries. */
    6050           0 :         status = check_nfs_sd(psd);
    6051           0 :         if (!NT_STATUS_IS_OK(status)) {
    6052           0 :                 NDR_PRINT_DEBUG(
    6053             :                         security_descriptor,
    6054             :                         discard_const_p(struct security_descriptor, psd));
    6055             :         }
    6056           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    6057             : 
    6058           0 : done:
    6059           0 :         if (!smb2_util_handle_empty(h)) {
    6060           0 :                 smb2_util_close(tree, h);
    6061             :         }
    6062           0 :         smb2_util_unlink(tree, fname);
    6063           0 :         smb2_deltree(tree, fname);
    6064           0 :         smb2_deltree(tree, BASEDIR);
    6065           0 :         talloc_free(mem_ctx);
    6066           0 :         return ret;
    6067             : }
    6068             : 
    6069           0 : static bool test_setinfo_stream_eof(struct torture_context *tctx,
    6070             :                                     struct smb2_tree *tree)
    6071             : {
    6072           0 :         bool ret = true;
    6073             :         NTSTATUS status;
    6074             :         struct smb2_create create;
    6075             :         union smb_setfileinfo sfinfo;
    6076             :         union smb_fileinfo finfo;
    6077             :         struct smb2_handle h1;
    6078           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    6079           0 :         const char *fname = BASEDIR "\\file";
    6080           0 :         const char *sname = BASEDIR "\\file:foo";
    6081             : 
    6082           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done,
    6083             :                             "talloc_new failed\n");
    6084             : 
    6085           0 :         ret = enable_aapl(tctx, tree);
    6086           0 :         torture_assert(tctx, ret == true, "enable_aapl failed");
    6087             : 
    6088           0 :         torture_comment(tctx, "Test setting EOF on a stream\n");
    6089             : 
    6090           0 :         smb2_deltree(tree, BASEDIR);
    6091           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    6092           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6093             :                                         "torture_smb2_testdir\n");
    6094           0 :         smb2_util_close(tree, h1);
    6095             : 
    6096           0 :         status = torture_smb2_testfile(tree, fname, &h1);
    6097           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6098             :                                         "torture_smb2_testfile failed\n");
    6099           0 :         smb2_util_close(tree, h1);
    6100             : 
    6101           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6102             :                                               SEC_FILE_WRITE_DATA);
    6103           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6104             :                                         "torture_smb2_testfile failed\n");
    6105             : 
    6106           0 :         status = smb2_util_write(tree, h1, "1234567890", 0, 10);
    6107           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6108             :                                         "smb2_util_write failed\n");
    6109           0 :         smb2_util_close(tree, h1);
    6110             : 
    6111             :         /*
    6112             :          * Test setting EOF to 21
    6113             :          */
    6114             : 
    6115           0 :         torture_comment(tctx, "Setting stream EOF to 21\n");
    6116             : 
    6117           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6118             :                                               SEC_FILE_WRITE_DATA);
    6119           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6120             :                                         "torture_smb2_testfile failed\n");
    6121             : 
    6122           0 :         ZERO_STRUCT(sfinfo);
    6123           0 :         sfinfo.generic.in.file.handle = h1;
    6124           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6125           0 :         sfinfo.position_information.in.position = 21;
    6126           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6127           0 :         torture_assert_ntstatus_ok_goto(tctx, status,
    6128             :                                         ret, done, "set EOF 21 failed\n");
    6129             : 
    6130           0 :         smb2_util_close(tree, h1);
    6131             : 
    6132           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6133             :                                               SEC_FILE_WRITE_DATA);
    6134           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6135             :                                         "torture_smb2_testfile failed\n");
    6136             : 
    6137           0 :         ZERO_STRUCT(finfo);
    6138           0 :         finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
    6139           0 :         finfo.generic.in.file.handle = h1;
    6140           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6141           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6142             :                                         "smb2_getinfo_file failed");
    6143             : 
    6144           0 :         smb2_util_close(tree, h1);
    6145             : 
    6146           0 :         torture_assert_goto(tctx, finfo.standard_info.out.size == 21,
    6147             :                             ret, done, "size != 21\n");
    6148             : 
    6149             :         /*
    6150             :          * Test setting EOF to 0
    6151             :          */
    6152             : 
    6153           0 :         torture_comment(tctx, "Setting stream EOF to 0\n");
    6154             : 
    6155           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6156             :                                               SEC_FILE_WRITE_DATA);
    6157           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6158             :                                         "torture_smb2_testfile failed\n");
    6159             : 
    6160           0 :         ZERO_STRUCT(sfinfo);
    6161           0 :         sfinfo.generic.in.file.handle = h1;
    6162           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6163           0 :         sfinfo.position_information.in.position = 0;
    6164           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6165           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6166             :                                         "set eof 0 failed\n");
    6167             : 
    6168           0 :         ZERO_STRUCT(create);
    6169           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6170           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6171           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6172           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6173           0 :         create.in.fname = sname;
    6174             : 
    6175           0 :         status = smb2_create(tree, tctx, &create);
    6176           0 :         torture_assert_ntstatus_equal_goto(
    6177             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6178             :                 "Unexpected status\n");
    6179             : 
    6180           0 :         smb2_util_close(tree, h1);
    6181             : 
    6182           0 :         ZERO_STRUCT(create);
    6183           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6184           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6185           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6186           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6187           0 :         create.in.fname = sname;
    6188             : 
    6189           0 :         status = smb2_create(tree, tctx, &create);
    6190           0 :         torture_assert_ntstatus_equal_goto(
    6191             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6192             :                 "Unexpected status\n");
    6193             : 
    6194           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6195             :                                               SEC_FILE_WRITE_DATA);
    6196           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6197             :                                         "torture_smb2_testfile failed\n");
    6198             : 
    6199           0 :         ZERO_STRUCT(finfo);
    6200           0 :         finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
    6201           0 :         finfo.generic.in.file.handle = h1;
    6202           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6203           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6204             :                                         "smb2_getinfo_file failed\n");
    6205             : 
    6206           0 :         smb2_util_close(tree, h1);
    6207             : 
    6208           0 :         torture_assert_goto(tctx, finfo.standard_info.out.size == 0,
    6209             :                             ret, done, "size != 0\n");
    6210             : 
    6211             :         /*
    6212             :          * Test setinfo end-of-file info to 1
    6213             :          */
    6214             : 
    6215           0 :         torture_comment(tctx, "Setting stream EOF to 1\n");
    6216             : 
    6217           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6218             :                                               SEC_FILE_WRITE_DATA);
    6219           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6220             :                                         "torture_smb2_testfile failed\n");
    6221             : 
    6222           0 :         ZERO_STRUCT(sfinfo);
    6223           0 :         sfinfo.generic.in.file.handle = h1;
    6224           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6225           0 :         sfinfo.position_information.in.position = 1;
    6226           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6227           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6228             :                                         "set EOF 1 failed\n");
    6229             : 
    6230           0 :         smb2_util_close(tree, h1);
    6231             : 
    6232           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6233             :                                               SEC_FILE_WRITE_DATA);
    6234           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6235             :                                         "torture_smb2_testfile failed\n");
    6236             : 
    6237           0 :         ZERO_STRUCT(finfo);
    6238           0 :         finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
    6239           0 :         finfo.generic.in.file.handle = h1;
    6240           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6241           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6242             :                                         "smb2_getinfo_file failed\n");
    6243             : 
    6244           0 :         smb2_util_close(tree, h1);
    6245             : 
    6246           0 :         torture_assert_goto(tctx, finfo.standard_info.out.size == 1,
    6247             :                             ret, done, "size != 1\n");
    6248             : 
    6249             :         /*
    6250             :          * Test setting EOF to 0 with AAPL enabled, should delete stream
    6251             :          */
    6252             : 
    6253           0 :         torture_comment(tctx, "Enabling AAPL extensions\n");
    6254             : 
    6255           0 :         ret = enable_aapl(tctx, tree);
    6256           0 :         torture_assert(tctx, ret == true, "enable_aapl failed\n");
    6257             : 
    6258           0 :         torture_comment(tctx, "Setting stream EOF to 0\n");
    6259           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6260             :                                               SEC_FILE_WRITE_DATA);
    6261           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6262             :                                         "torture_smb2_testfile failed\n");
    6263             : 
    6264           0 :         ZERO_STRUCT(sfinfo);
    6265           0 :         sfinfo.generic.in.file.handle = h1;
    6266           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6267           0 :         sfinfo.position_information.in.position = 0;
    6268           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6269           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6270             :                                         "set eof 0 failed\n");
    6271             : 
    6272           0 :         ZERO_STRUCT(create);
    6273           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6274           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6275           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6276           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6277           0 :         create.in.fname = sname;
    6278             : 
    6279           0 :         status = smb2_create(tree, tctx, &create);
    6280           0 :         torture_assert_ntstatus_equal_goto(
    6281             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6282             :                 "Unexpected status\n");
    6283             : 
    6284           0 :         smb2_util_close(tree, h1);
    6285             : 
    6286           0 :         ZERO_STRUCT(create);
    6287           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6288           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6289           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6290           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6291           0 :         create.in.fname = sname;
    6292             : 
    6293           0 :         status = smb2_create(tree, tctx, &create);
    6294           0 :         torture_assert_ntstatus_equal_goto(
    6295             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6296             :                 "Unexpected status\n");
    6297             : 
    6298           0 :         torture_comment(
    6299             :                 tctx, "Setting main file EOF to 1 to force 0-truncate\n");
    6300             : 
    6301           0 :         status = torture_smb2_testfile_access(
    6302             :                 tree,
    6303             :                 fname,
    6304             :                 &h1,
    6305             :                 SEC_FILE_WRITE_DATA);
    6306           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6307             :                                         "torture_smb2_testfile failed\n");
    6308             : 
    6309           0 :         ZERO_STRUCT(sfinfo);
    6310           0 :         sfinfo.generic.in.file.handle = h1;
    6311           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6312           0 :         sfinfo.position_information.in.position = 1;
    6313           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6314           0 :         torture_assert_ntstatus_ok_goto(
    6315             :                 tctx,
    6316             :                 status,
    6317             :                 ret,
    6318             :                 done,
    6319             :                 "set eof 1 failed\n");
    6320             : 
    6321           0 :         sfinfo.position_information.in.position = 0;
    6322           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6323           0 :         torture_assert_ntstatus_ok_goto(
    6324             :                 tctx,
    6325             :                 status,
    6326             :                 ret,
    6327             :                 done,
    6328             :                 "set eof 0 failed\n");
    6329             : 
    6330           0 :         smb2_util_close(tree, h1);
    6331             : 
    6332           0 :         ZERO_STRUCT(create);
    6333           0 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6334           0 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6335           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6336           0 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6337           0 :         create.in.fname = fname;
    6338             : 
    6339           0 :         status = smb2_create(tree, tctx, &create);
    6340           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6341             :                                         "torture_smb2_testfile failed\n");
    6342           0 :         smb2_util_close(tree, h1);
    6343             : 
    6344           0 :         torture_comment(tctx, "Writing to stream after setting EOF to 0\n");
    6345           0 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6346             :                                               SEC_FILE_WRITE_DATA);
    6347           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6348             :                                         "torture_smb2_testfile failed\n");
    6349             : 
    6350           0 :         status = smb2_util_write(tree, h1, "1234567890", 0, 10);
    6351           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6352             :                                         "smb2_util_write failed\n");
    6353             : 
    6354           0 :         ZERO_STRUCT(sfinfo);
    6355           0 :         sfinfo.generic.in.file.handle = h1;
    6356           0 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6357           0 :         sfinfo.position_information.in.position = 0;
    6358           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6359           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6360             :                                         "set eof 0 failed\n");
    6361             : 
    6362           0 :         status = smb2_util_write(tree, h1, "1234567890", 0, 10);
    6363           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6364             :                                         "smb2_util_write failed\n");
    6365             : 
    6366           0 :         smb2_util_close(tree, h1);
    6367             : 
    6368           0 : done:
    6369           0 :         smb2_util_unlink(tree, fname);
    6370           0 :         smb2_util_rmdir(tree, BASEDIR);
    6371           0 :         return ret;
    6372             : }
    6373             : 
    6374             : #define MAX_STREAMS 16
    6375             : 
    6376             : struct tcase {
    6377             :         const char *name;
    6378             :         uint32_t access;
    6379             :         const char *write_data;
    6380             :         size_t write_size;
    6381             :         struct tcase_results {
    6382             :                 size_t size;
    6383             :                 NTSTATUS initial_status;
    6384             :                 NTSTATUS final_status;
    6385             :                 int num_streams_open_handle;
    6386             :                 const char *streams_open_handle[MAX_STREAMS];
    6387             :                 int num_streams_closed_handle;
    6388             :                 const char *streams_closed_handle[MAX_STREAMS];
    6389             :         } create, write, overwrite, eof, doc;
    6390             : };
    6391             : 
    6392             : typedef enum {T_CREATE, T_WRITE, T_OVERWRITE, T_EOF, T_DOC} subtcase_t;
    6393             : 
    6394           0 : static bool test_empty_stream_do_checks(
    6395             :         struct torture_context *tctx,
    6396             :         struct smb2_tree *tree,
    6397             :         struct smb2_tree *tree2,
    6398             :         struct tcase *tcase,
    6399             :         TALLOC_CTX *mem_ctx,
    6400             :         struct smb2_handle baseh,
    6401             :         struct smb2_handle streamh,
    6402             :         subtcase_t subcase)
    6403             : {
    6404           0 :         bool ret = false;
    6405             :         NTSTATUS status;
    6406             :         struct smb2_handle h1;
    6407             :         union smb_fileinfo finfo;
    6408           0 :         struct tcase_results *tcase_results = NULL;
    6409             : 
    6410           0 :         switch (subcase) {
    6411           0 :         case T_CREATE:
    6412           0 :                 tcase_results = &tcase->create;
    6413           0 :                 break;
    6414           0 :         case T_OVERWRITE:
    6415           0 :                 tcase_results = &tcase->overwrite;
    6416           0 :                 break;
    6417           0 :         case T_WRITE:
    6418           0 :                 tcase_results = &tcase->write;
    6419           0 :                 break;
    6420           0 :         case T_EOF:
    6421           0 :                 tcase_results = &tcase->eof;
    6422           0 :                 break;
    6423           0 :         case T_DOC:
    6424           0 :                 tcase_results = &tcase->doc;
    6425           0 :                 break;
    6426             :         }
    6427             : 
    6428           0 :         finfo = (union smb_fileinfo) {
    6429             :                 .generic.level = RAW_FILEINFO_STANDARD_INFORMATION,
    6430             :                 .generic.in.file.handle = streamh,
    6431             :         };
    6432             : 
    6433             :         /*
    6434             :          * Test: check size, same client
    6435             :          */
    6436             : 
    6437           0 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6438           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6439             :                                         "torture_smb2_testfile failed\n");
    6440             : 
    6441           0 :         torture_assert_int_equal_goto(tctx, finfo.standard_info.out.size,
    6442             :                                       tcase_results->size,
    6443             :                                       ret, done, "Wrong size\n");
    6444             : 
    6445             :         /*
    6446             :          * Test: open, same client
    6447             :          */
    6448             : 
    6449           0 :         status = torture_smb2_open(tree, tcase->name,
    6450             :                                    SEC_FILE_READ_ATTRIBUTE, &h1);
    6451           0 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6452             :                                            tcase_results->initial_status,
    6453             :                                            ret, done,
    6454             :                                            "smb2_create failed\n");
    6455           0 :         if (NT_STATUS_IS_OK(status)) {
    6456           0 :                 status = smb2_util_close(tree, h1);
    6457           0 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6458             :                                                 "smb2_util_close failed\n");
    6459             :         }
    6460             : 
    6461             :         /*
    6462             :          * Test: check streams, same client
    6463             :          */
    6464             : 
    6465           0 :         ret = check_stream_list_handle(tree, tctx, baseh,
    6466             :                                        tcase_results->num_streams_open_handle,
    6467           0 :                                        tcase_results->streams_open_handle,
    6468             :                                        false);
    6469           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    6470             : 
    6471             :         /*
    6472             :          * Test: open, different client
    6473             :          */
    6474             : 
    6475           0 :         status = torture_smb2_open(tree2, tcase->name,
    6476             :                                    SEC_FILE_READ_ATTRIBUTE, &h1);
    6477           0 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6478             :                                            tcase_results->initial_status,
    6479             :                                            ret, done,
    6480             :                                            "smb2_create failed\n");
    6481           0 :         if (NT_STATUS_IS_OK(status)) {
    6482           0 :                 finfo = (union smb_fileinfo) {
    6483             :                         .generic.level = RAW_FILEINFO_STANDARD_INFORMATION,
    6484             :                         .generic.in.file.handle = h1,
    6485             :                 };
    6486             : 
    6487             :                 /*
    6488             :                  * Test: check size, different client
    6489             :                  */
    6490             : 
    6491           0 :                 status = smb2_getinfo_file(tree2, mem_ctx, &finfo);
    6492           0 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6493             :                                                 "smb2_getinfo_file failed\n");
    6494             : 
    6495           0 :                 torture_assert_int_equal_goto(tctx, finfo.standard_info.out.size,
    6496             :                                               tcase_results->size,
    6497             :                                               ret, done, "Wrong size\n");
    6498             : 
    6499             :                 /*
    6500             :                  * Test: check streams, different client
    6501             :                  */
    6502             : 
    6503           0 :                 ret = check_stream_list(tree2, tctx, BASEDIR "\\file",
    6504             :                                         tcase_results->num_streams_open_handle,
    6505           0 :                                         tcase_results->streams_open_handle,
    6506             :                                         false);
    6507           0 :                 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    6508             : 
    6509           0 :                 status = smb2_util_close(tree2, h1);
    6510           0 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6511             :                                                 "smb2_util_close failed\n");
    6512             :         }
    6513             : 
    6514           0 :         status = smb2_util_close(tree, streamh);
    6515           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6516             :                                         "smb2_util_close failed\n");
    6517             : 
    6518             :         /*
    6519             :          * Test: open after close, same client
    6520             :          */
    6521             : 
    6522           0 :         status = torture_smb2_open(tree, tcase->name,
    6523             :                                    SEC_FILE_READ_DATA, &h1);
    6524           0 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6525             :                                            tcase_results->final_status,
    6526             :                                            ret, done,
    6527             :                                            "smb2_create failed\n");
    6528           0 :         if (NT_STATUS_IS_OK(status)) {
    6529           0 :                 status = smb2_util_close(tree, h1);
    6530           0 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6531             :                                                 "smb2_util_close failed\n");
    6532             :         }
    6533             : 
    6534             :         /*
    6535             :          * Test: open after close, different client
    6536             :          */
    6537             : 
    6538           0 :         status = torture_smb2_open(tree2, tcase->name,
    6539             :                                    SEC_FILE_READ_DATA, &h1);
    6540           0 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6541             :                                            tcase_results->final_status,
    6542             :                                            ret, done,
    6543             :                                            "smb2_create failed\n");
    6544           0 :         if (NT_STATUS_IS_OK(status)) {
    6545           0 :                 status = smb2_util_close(tree2, h1);
    6546           0 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6547             :                                                 "smb2_util_close failed\n");
    6548             :         }
    6549             : 
    6550             :         /*
    6551             :          * Test: check streams after close, same client
    6552             :          */
    6553             : 
    6554           0 :         ret = check_stream_list_handle(tree, tctx, baseh,
    6555             :                                        tcase_results->num_streams_closed_handle,
    6556           0 :                                        tcase_results->streams_closed_handle,
    6557             :                                        false);
    6558           0 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    6559             : 
    6560           0 :         ret = true;
    6561             : 
    6562           0 : done:
    6563           0 :         smb2_util_close(tree, streamh);
    6564           0 :         smb2_util_close(tree, baseh);
    6565           0 :         return ret;
    6566             : }
    6567             : 
    6568           0 : static bool test_empty_stream_do_one(
    6569             :         struct torture_context *tctx,
    6570             :         struct smb2_tree *tree,
    6571             :         struct smb2_tree *tree2,
    6572             :         struct tcase *tcase)
    6573             : {
    6574           0 :         bool ret = false;
    6575             :         NTSTATUS status;
    6576           0 :         struct smb2_handle baseh = {{0}};
    6577             :         struct smb2_handle streamh;
    6578             :         struct smb2_create create;
    6579             :         union smb_setfileinfo sfinfo;
    6580           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    6581             : 
    6582           0 :         torture_comment(tctx, "Testing stream [%s]\n", tcase->name);
    6583             : 
    6584           0 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new\n");
    6585             : 
    6586             :         /*
    6587             :          * Subtest: create
    6588             :          */
    6589           0 :         torture_comment(tctx, "Subtest: T_CREATE\n");
    6590             : 
    6591           0 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6592           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6593             :                                         "smb2_util_unlink failed\n");
    6594             : 
    6595           0 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6596             :                                               &baseh, SEC_FILE_ALL);
    6597           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6598             :                                         "torture_smb2_testfile_access failed\n");
    6599             : 
    6600           0 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6601             :                                               tcase->access);
    6602           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6603             :                                         "torture_smb2_testfile_access failed\n");
    6604             : 
    6605           0 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6606             :                                           mem_ctx, baseh, streamh, T_CREATE);
    6607           0 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6608             : 
    6609           0 :         if (!(tcase->access & SEC_FILE_WRITE_DATA)) {
    6610             :                 /*
    6611             :                  * All subsequent tests require write access
    6612             :                  */
    6613           0 :                 ret = true;
    6614           0 :                 goto done;
    6615             :         }
    6616             : 
    6617             :         /*
    6618             :          * Subtest: create and write
    6619             :          */
    6620           0 :         torture_comment(tctx, "Subtest: T_WRITE\n");
    6621             : 
    6622           0 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6623           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6624             :                                         "smb2_util_unlink failed\n");
    6625             : 
    6626           0 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6627             :                                               &baseh, SEC_FILE_ALL);
    6628           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6629             :                                         "torture_smb2_testfile_access failed\n");
    6630             : 
    6631           0 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6632             :                                               tcase->access);
    6633           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6634             :                                         "torture_smb2_testfile_access failed\n");
    6635             : 
    6636           0 :         status = smb2_util_write(tree, streamh, tcase->write_data, 0,
    6637             :                                  tcase->write_size);
    6638           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6639             :                                         "torture_smb2_open failed\n");
    6640             : 
    6641           0 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6642             :                                           mem_ctx, baseh, streamh, T_WRITE);
    6643           0 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6644             : 
    6645             :         /*
    6646             :          * Subtest: overwrite
    6647             :          */
    6648           0 :         torture_comment(tctx, "Subtest: T_OVERWRITE\n");
    6649             : 
    6650           0 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6651           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6652             :                                         "smb2_util_unlink failed\n");
    6653             : 
    6654           0 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6655             :                                               &baseh, SEC_FILE_ALL);
    6656           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6657             :                                         "torture_smb2_testfile_access failed\n");
    6658             : 
    6659           0 :         create = (struct smb2_create) {
    6660             :                 .in.desired_access = SEC_FILE_ALL,
    6661             :                 .in.share_access = NTCREATEX_SHARE_ACCESS_MASK,
    6662             :                 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
    6663             :                 .in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF,
    6664           0 :                 .in.fname = tcase->name,
    6665             :         };
    6666             : 
    6667           0 :         status = smb2_create(tree, tctx, &create);
    6668           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6669             :                                         "torture_smb2_testfile failed\n");
    6670           0 :         streamh = create.out.file.handle;
    6671             : 
    6672           0 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6673             :                                           mem_ctx, baseh, streamh, T_OVERWRITE);
    6674           0 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6675             : 
    6676             :         /*
    6677             :          * Subtest: setinfo EOF 0
    6678             :          */
    6679           0 :         torture_comment(tctx, "Subtest: T_EOF\n");
    6680             : 
    6681           0 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6682           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6683             :                                         "smb2_util_unlink failed\n");
    6684             : 
    6685           0 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6686             :                                               &baseh, SEC_FILE_ALL);
    6687           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6688             :                                         "torture_smb2_testfile_access failed\n");
    6689             : 
    6690           0 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6691             :                                               tcase->access);
    6692           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6693             :                                         "torture_smb2_testfile_access failed\n");
    6694             : 
    6695           0 :         status = smb2_util_write(tree, streamh, tcase->write_data, 0,
    6696             :                                  tcase->write_size);
    6697           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6698             :                                         "torture_smb2_open failed\n");
    6699             : 
    6700           0 :         sfinfo = (union smb_setfileinfo) {
    6701             :                 .end_of_file_info.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION,
    6702             :                 .end_of_file_info.in.file.handle = streamh,
    6703             :                 .end_of_file_info.in.size = 0,
    6704             :         };
    6705           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6706           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6707             :                                         "set eof 0 failed\n");
    6708             : 
    6709           0 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6710             :                                           mem_ctx, baseh, streamh, T_EOF);
    6711           0 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6712             : 
    6713             :         /*
    6714             :          * Subtest: delete-on-close
    6715             :          */
    6716           0 :         torture_comment(tctx, "Subtest: T_DOC\n");
    6717             : 
    6718           0 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6719           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6720             :                                         "smb2_util_unlink failed\n");
    6721             : 
    6722           0 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6723             :                                               &baseh, SEC_FILE_ALL);
    6724           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6725             :                                         "torture_smb2_testfile_access failed\n");
    6726             : 
    6727           0 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6728             :                                               tcase->access);
    6729           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6730             :                                         "torture_smb2_testfile_access failed\n");
    6731             : 
    6732           0 :         status = smb2_util_write(tree, streamh, tcase->write_data, 0,
    6733             :                                  tcase->write_size);
    6734           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6735             :                                         "torture_smb2_open failed\n");
    6736             : 
    6737           0 :         sfinfo = (union smb_setfileinfo) {
    6738             :                 .disposition_info.level = RAW_SFILEINFO_DISPOSITION_INFORMATION,
    6739             :                 .disposition_info.in.file.handle = streamh,
    6740             :                 .disposition_info.in.delete_on_close = true,
    6741             :         };
    6742           0 :         status = smb2_setinfo_file(tree, &sfinfo);
    6743           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6744             :                                         "set eof 0 failed\n");
    6745             : 
    6746           0 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6747             :                                           mem_ctx, baseh, streamh,
    6748             :                                           T_DOC);
    6749           0 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6750             : 
    6751           0 :         ret = true;
    6752             : 
    6753           0 : done:
    6754           0 :         smb2_util_close(tree, baseh);
    6755           0 :         TALLOC_FREE(mem_ctx);
    6756           0 :         return ret;
    6757             : }
    6758             : 
    6759           0 : static bool test_empty_stream(struct torture_context *tctx,
    6760             :                               struct smb2_tree *tree)
    6761             : {
    6762           0 :         struct smb2_tree *tree2 = NULL;
    6763           0 :         struct tcase *tcase = NULL;
    6764           0 :         const char *fname = BASEDIR "\\file";
    6765             :         struct smb2_handle h1;
    6766           0 :         bool ret = true;
    6767             :         NTSTATUS status;
    6768           0 :         AfpInfo ai = (AfpInfo) {
    6769             :                 .afpi_Signature = AFP_Signature,
    6770             :                 .afpi_Version = AFP_Version,
    6771             :                 .afpi_BackupTime = AFP_BackupTime,
    6772             :                 .afpi_FinderInfo = "FOO BAR ",
    6773             :         };
    6774           0 :         char *ai_blob = torture_afpinfo_pack(tctx, &ai);
    6775           0 :         struct tcase tcase_afpinfo_ro = (struct tcase) {
    6776             :                 .name = BASEDIR "\\file" AFPINFO_STREAM,
    6777             :                 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE,
    6778             :                 .create = {
    6779             :                         .size = 60,
    6780             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6781             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6782             :                         .num_streams_open_handle = 1,
    6783             :                         .num_streams_closed_handle = 1,
    6784             :                         .streams_open_handle = {"::$DATA"},
    6785             :                         .streams_closed_handle = {"::$DATA"},
    6786             :                 },
    6787             :         };
    6788           0 :         struct tcase tcase_afpinfo_rw = (struct tcase) {
    6789             :                 .name = BASEDIR "\\file" AFPINFO_STREAM,
    6790             :                 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_DATA|SEC_STD_DELETE,
    6791             :                 .write_data = ai_blob,
    6792             :                 .write_size = AFP_INFO_SIZE,
    6793             :                 .create = {
    6794             :                         .size = 60,
    6795             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6796             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6797             :                         .num_streams_open_handle = 1,
    6798             :                         .num_streams_closed_handle = 1,
    6799             :                         .streams_open_handle = {"::$DATA"},
    6800             :                         .streams_closed_handle = {"::$DATA"},
    6801             :                 },
    6802             :                 .write = {
    6803             :                         .size = 60,
    6804             :                         .initial_status = NT_STATUS_OK,
    6805             :                         .final_status = NT_STATUS_OK,
    6806             :                         .num_streams_open_handle = 2,
    6807             :                         .num_streams_closed_handle = 2,
    6808             :                         .streams_open_handle = {"::$DATA", AFPINFO_STREAM},
    6809             :                         .streams_closed_handle = {"::$DATA", AFPINFO_STREAM},
    6810             :                 },
    6811             :                 .overwrite = {
    6812             :                         .size = 60,
    6813             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6814             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6815             :                         .num_streams_open_handle = 1,
    6816             :                         .num_streams_closed_handle = 1,
    6817             :                         .streams_open_handle = {"::$DATA"},
    6818             :                         .streams_closed_handle = {"::$DATA"},
    6819             :                 },
    6820             :                 .eof = {
    6821             :                         .size = 60,
    6822             :                         .initial_status = NT_STATUS_OK,
    6823             :                         .final_status = NT_STATUS_OK,
    6824             :                         .num_streams_open_handle = 2,
    6825             :                         .num_streams_closed_handle = 2,
    6826             :                         .streams_open_handle = {"::$DATA", AFPINFO_STREAM},
    6827             :                         .streams_closed_handle = {"::$DATA", AFPINFO_STREAM},
    6828             :                 },
    6829             :                 .doc = {
    6830             :                         .size = 60,
    6831             :                         .initial_status = NT_STATUS_DELETE_PENDING,
    6832             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6833             :                         .num_streams_open_handle = 2,
    6834             :                         .num_streams_closed_handle = 1,
    6835             :                         .streams_open_handle = {"::$DATA", AFPINFO_STREAM},
    6836             :                         .streams_closed_handle = {"::$DATA"},
    6837             :                 },
    6838             :         };
    6839             : 
    6840           0 :         struct tcase tcase_afpresource_ro = (struct tcase) {
    6841             :                 .name = BASEDIR "\\file" AFPRESOURCE_STREAM,
    6842             :                 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE,
    6843             :                 .create = {
    6844             :                         .size = 0,
    6845             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6846             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6847             :                         .num_streams_open_handle = 1,
    6848             :                         .num_streams_closed_handle = 1,
    6849             :                         .streams_open_handle = {"::$DATA"},
    6850             :                         .streams_closed_handle = {"::$DATA"},
    6851             :                 },
    6852             :         };
    6853           0 :         struct tcase tcase_afpresource_rw = (struct tcase) {
    6854             :                 .name = BASEDIR "\\file" AFPRESOURCE_STREAM,
    6855             :                 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_DATA|SEC_STD_DELETE,
    6856             :                 .write_data = "foo",
    6857             :                 .write_size = 3,
    6858             :                 .create = {
    6859             :                         .size = 0,
    6860             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6861             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6862             :                         .num_streams_open_handle = 1,
    6863             :                         .num_streams_closed_handle = 1,
    6864             :                         .streams_open_handle = {"::$DATA"},
    6865             :                         .streams_closed_handle = {"::$DATA"},
    6866             :                 },
    6867             :                 .write = {
    6868             :                         .size = 3,
    6869             :                         .initial_status = NT_STATUS_OK,
    6870             :                         .final_status = NT_STATUS_OK,
    6871             :                         .num_streams_open_handle = 2,
    6872             :                         .num_streams_closed_handle = 2,
    6873             :                         .streams_open_handle = {"::$DATA", AFPRESOURCE_STREAM},
    6874             :                         .streams_closed_handle = {"::$DATA", AFPRESOURCE_STREAM},
    6875             :                 },
    6876             :                 .overwrite = {
    6877             :                         .size = 0,
    6878             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6879             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6880             :                         .num_streams_open_handle = 1,
    6881             :                         .num_streams_closed_handle = 1,
    6882             :                         .streams_open_handle = {"::$DATA"},
    6883             :                         .streams_closed_handle = {"::$DATA"},
    6884             :                 },
    6885             :                 .eof = {
    6886             :                         .size = 0,
    6887             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6888             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6889             :                         .num_streams_open_handle = 1,
    6890             :                         .num_streams_closed_handle = 1,
    6891             :                         .streams_open_handle = {"::$DATA"},
    6892             :                         .streams_closed_handle = {"::$DATA"},
    6893             :                 },
    6894             :                 .doc = {
    6895             :                         .size = 3,
    6896             :                         .initial_status = NT_STATUS_DELETE_PENDING,
    6897             :                         .final_status = NT_STATUS_OK,
    6898             :                         .num_streams_open_handle = 2,
    6899             :                         .num_streams_closed_handle = 2,
    6900             :                         .streams_open_handle = {"::$DATA", AFPRESOURCE_STREAM},
    6901             :                         .streams_closed_handle = {"::$DATA", AFPRESOURCE_STREAM},
    6902             :                 },
    6903             :         };
    6904             : 
    6905           0 :         struct tcase tcase_foo_ro = (struct tcase) {
    6906             :                 .name = BASEDIR "\\file:foo",
    6907             :                 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE,
    6908             :                 .write_data = "foo",
    6909             :                 .write_size = 3,
    6910             :                 .create = {
    6911             :                         .size = 0,
    6912             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6913             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6914             :                         .num_streams_open_handle = 1,
    6915             :                         .num_streams_closed_handle = 1,
    6916             :                         .streams_open_handle = {"::$DATA"},
    6917             :                         .streams_closed_handle = {"::$DATA"},
    6918             :                 },
    6919             :         };
    6920             : 
    6921           0 :         struct tcase tcase_foo_rw = (struct tcase) {
    6922             :                 .name = BASEDIR "\\file:foo",
    6923             :                 .access = SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_DATA|SEC_STD_DELETE,
    6924             :                 .write_data = "foo",
    6925             :                 .write_size = 3,
    6926             :                 .create = {
    6927             :                         .size = 0,
    6928             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6929             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6930             :                         .num_streams_open_handle = 1,
    6931             :                         .num_streams_closed_handle = 1,
    6932             :                         .streams_open_handle = {"::$DATA"},
    6933             :                         .streams_closed_handle = {"::$DATA"},
    6934             :                 },
    6935             :                 .write = {
    6936             :                         .size = 3,
    6937             :                         .initial_status = NT_STATUS_OK,
    6938             :                         .final_status = NT_STATUS_OK,
    6939             :                         .num_streams_open_handle = 2,
    6940             :                         .num_streams_closed_handle = 2,
    6941             :                         .streams_open_handle = {"::$DATA", ":foo:$DATA"},
    6942             :                         .streams_closed_handle = {"::$DATA", ":foo:$DATA"},
    6943             :                 },
    6944             :                 .overwrite = {
    6945             :                         .size = 0,
    6946             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6947             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6948             :                         .num_streams_open_handle = 1,
    6949             :                         .num_streams_closed_handle = 1,
    6950             :                         .streams_open_handle = {"::$DATA"},
    6951             :                         .streams_closed_handle = {"::$DATA"},
    6952             :                 },
    6953             :                 .eof = {
    6954             :                         .size = 0,
    6955             :                         .initial_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6956             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6957             :                         .num_streams_open_handle = 1,
    6958             :                         .num_streams_closed_handle = 1,
    6959             :                         .streams_open_handle = {"::$DATA"},
    6960             :                         .streams_closed_handle = {"::$DATA"},
    6961             :                 },
    6962             :                 .doc = {
    6963             :                         .size = 3,
    6964             :                         .initial_status = NT_STATUS_DELETE_PENDING,
    6965             :                         .final_status = NT_STATUS_OBJECT_NAME_NOT_FOUND,
    6966             :                         .num_streams_open_handle = 2,
    6967             :                         .num_streams_closed_handle = 1,
    6968             :                         .streams_open_handle = {"::$DATA", ":foo:$DATA"},
    6969             :                         .streams_closed_handle = {"::$DATA"},
    6970             :                 },
    6971             :         };
    6972             : 
    6973           0 :         struct tcase tcases[] = {
    6974             :                 tcase_afpinfo_ro,
    6975             :                 tcase_afpinfo_rw,
    6976             :                 tcase_afpresource_ro,
    6977             :                 tcase_afpresource_rw,
    6978             :                 tcase_foo_ro,
    6979             :                 tcase_foo_rw,
    6980             :                 {0}
    6981             :         };
    6982             : 
    6983           0 :         ret = torture_smb2_connection(tctx, &tree2);
    6984           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    6985             :                             "torture_smb2_connection failed\n");
    6986             : 
    6987           0 :         ret = enable_aapl(tctx, tree);
    6988           0 :         torture_assert(tctx, ret == true, "enable_aapl failed\n");
    6989             : 
    6990           0 :         ret = enable_aapl(tctx, tree2);
    6991           0 :         torture_assert(tctx, ret == true, "enable_aapl failed\n");
    6992             : 
    6993           0 :         smb2_deltree(tree, BASEDIR);
    6994             : 
    6995           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    6996           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6997             :                                         "torture_smb2_testdir\n");
    6998           0 :         smb2_util_close(tree, h1);
    6999             : 
    7000           0 :         for (tcase = &tcases[0]; tcase->name != NULL; tcase++) {
    7001           0 :                 ret = torture_setup_file(tctx, tree, fname, false);
    7002           0 :                 torture_assert_goto(tctx, ret == true, ret, done,
    7003             :                                     "torture_setup_file failed\n");
    7004             : 
    7005           0 :                 ret = test_empty_stream_do_one(tctx, tree, tree2, tcase);
    7006           0 :                 torture_assert_goto(tctx, ret == true, ret, done,
    7007             :                                     "subtest failed\n");
    7008             : 
    7009           0 :                 status = smb2_util_unlink(tree, fname);
    7010           0 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7011             :                                                 "smb2_util_unlink failed\n");
    7012             :         }
    7013             : 
    7014           0 : done:
    7015           0 :         smb2_deltree(tree, BASEDIR);
    7016           0 :         TALLOC_FREE(tree2);
    7017           0 :         return ret;
    7018             : }
    7019             : 
    7020             : /*
    7021             : -------------------------------------------------------------------------------
    7022             : MagicNumber: 00051607                                        : AppleDouble
    7023             : Version    : 00020000                                        : Version 2
    7024             : Filler     : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
    7025             : Num. of ent: 0002                                            : 2
    7026             : 
    7027             : -------------------------------------------------------------------------------
    7028             : Entry ID   : 00000009 : Finder Info
    7029             : Offset     : 00000032 : 50
    7030             : Length     : 00000EB0 : 3760
    7031             : 
    7032             : -DInfo-----:
    7033             : Rect top   : 0000     : 0
    7034             : Rect left  : 0000     : 0
    7035             : Rect bottom: 0000     : 0
    7036             : Rect right : 0000     : 0
    7037             : isAlias    : 0
    7038             : Invisible  : 0
    7039             : hasBundle  : 0
    7040             : nameLocked : 0
    7041             : Stationery : 0
    7042             : CustomIcon : 0
    7043             : Reserved   : 0
    7044             : Inited     : 1
    7045             : NoINITS    : 0
    7046             : Shared     : 0
    7047             : SwitchLaunc: 0
    7048             : Hidden Ext : 0
    7049             : color      : 000      : none
    7050             : isOnDesk   : 0
    7051             : Location v : 0000     : 0
    7052             : Location h : 0000     : 0
    7053             : View       : 0000     : ..
    7054             : 
    7055             : -DXInfo----:
    7056             : Scroll v   : 0000     : 0
    7057             : Scroll h   : 0000     : 0
    7058             : Rsvd|OpnChn: 00000000 : 0
    7059             : AreInvalid : 0
    7060             : unknown bit: 0
    7061             : unknown bit: 0
    7062             : unknown bit: 0
    7063             : unknown bit: 0
    7064             : unknown bit: 0
    7065             : unknown bit: 0
    7066             : CustomBadge: 0
    7067             : ObjctIsBusy: 0
    7068             : unknown bit: 0
    7069             : unknown bit: 0
    7070             : unknown bit: 0
    7071             : unknown bit: 0
    7072             : RoutingInfo: 0
    7073             : unknown bit: 0
    7074             : unknown bit: 0
    7075             : Comment    : 0000     : ..
    7076             : PutAway    : 00000000 : 0
    7077             : 
    7078             : -EA--------:
    7079             : pad        : 0000     : ..
    7080             : magic      : 41545452 : ATTR
    7081             : debug_tag  : 0081714C : 8483148
    7082             : total_size : 00000EE2 : 3810
    7083             : data_start : 00000098 : 152
    7084             : data_length: 00000039 : 57
    7085             : reserved[0]: 00000000 : ....
    7086             : reserved[1]: 00000000 : ....
    7087             : reserved[2]: 00000000 : ....
    7088             : flags      : 0000     : ..
    7089             : num_attrs  : 0001     : 1
    7090             : -EA ENTRY--:
    7091             : offset     : 00000098 : 152
    7092             : length     : 00000039 : 57
    7093             : flags      : 0000     : ..
    7094             : namelen    : 15       : 21
    7095             : -EA NAME---:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    7096             : 00000000   : 63 6F 6D 2E 61 70 70 6C 65 2E 71 75 61 72 61 6E : com.apple.quaran
    7097             : 00000010   : 74 69 6E 65 00                                  : tine.
    7098             : -EA VALUE--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    7099             : 00000000   : 30 30 38 31 3B 36 32 65 61 33 37 66 64 3B 43 68 : 0081;62ea37fd;Ch
    7100             : 00000010   : 72 6F 6D 65 3B 42 35 39 46 42 39 45 44 2D 35 41 : rome;B59FB9ED-5A
    7101             : 00000020   : 32 39 2D 34 45 35 42 2D 38 35 36 43 2D 37 45 44 : 29-4E5B-856C-7ED
    7102             : 00000030   : 30 45 46 45 41 37 30 41 43                      : 0EFEA70AC
    7103             : 
    7104             : -RAW DUMP--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    7105             : 00000000   : 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 : ................
    7106             : 00000010   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7107             : 00000020   : 00 00 41 54 54 52 00 81 71 4C 00 00 0E E2 00 00 : ..ATTR..qL......
    7108             : 00000030   : 00 98 00 00 00 39 00 00 00 00 00 00 00 00 00 00 : .....9..........
    7109             : 00000040   : 00 00 00 00 00 01 00 00 00 98 00 00 00 39 00 00 : .............9..
    7110             : 00000050   : 15 63 6F 6D 2E 61 70 70 6C 65 2E 71 75 61 72 61 : .com.apple.quara
    7111             : 00000060   : 6E 74 69 6E 65 00 30 30 38 31 3B 36 32 65 61 33 : ntine.0081;62ea3
    7112             : 00000070   : 37 66 64 3B 43 68 72 6F 6D 65 3B 42 35 39 46 42 : 7fd;Chrome;B59FB
    7113             : 00000080   : 39 45 44 2D 35 41 32 39 2D 34 45 35 42 2D 38 35 : 9ED-5A29-4E5B-85
    7114             : 00000090   : 36 43 2D 37 45 44 30 45 46 45 41 37 30 41 43 00 : 6C-7ED0EFEA70AC.
    7115             : 000000A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7116             : 000000B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7117             : 000000C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7118             : 000000D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7119             : 000000E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7120             : 000000F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7121             : 00000100   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7122             : 00000110   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7123             : 00000120   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7124             : 00000130   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7125             : 00000140   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7126             : 00000150   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7127             : 00000160   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7128             : 00000170   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7129             : 00000180   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7130             : 00000190   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7131             : 000001A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7132             : 000001B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7133             : 000001C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7134             : 000001D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7135             : 000001E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7136             : 000001F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7137             : 00000200   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7138             : 00000210   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7139             : 00000220   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7140             : 00000230   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7141             : 00000240   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7142             : 00000250   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7143             : 00000260   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7144             : 00000270   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7145             : 00000280   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7146             : 00000290   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7147             : 000002A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7148             : 000002B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7149             : 000002C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7150             : 000002D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7151             : 000002E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7152             : 000002F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7153             : 00000300   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7154             : 00000310   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7155             : 00000320   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7156             : 00000330   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7157             : 00000340   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7158             : 00000350   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7159             : 00000360   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7160             : 00000370   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7161             : 00000380   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7162             : 00000390   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7163             : 000003A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7164             : 000003B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7165             : 000003C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7166             : 000003D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7167             : 000003E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7168             : 000003F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7169             : 00000400   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7170             : 00000410   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7171             : 00000420   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7172             : 00000430   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7173             : 00000440   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7174             : 00000450   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7175             : 00000460   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7176             : 00000470   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7177             : 00000480   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7178             : 00000490   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7179             : 000004A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7180             : 000004B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7181             : 000004C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7182             : 000004D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7183             : 000004E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7184             : 000004F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7185             : 00000500   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7186             : 00000510   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7187             : 00000520   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7188             : 00000530   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7189             : 00000540   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7190             : 00000550   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7191             : 00000560   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7192             : 00000570   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7193             : 00000580   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7194             : 00000590   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7195             : 000005A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7196             : 000005B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7197             : 000005C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7198             : 000005D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7199             : 000005E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7200             : 000005F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7201             : 00000600   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7202             : 00000610   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7203             : 00000620   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7204             : 00000630   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7205             : 00000640   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7206             : 00000650   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7207             : 00000660   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7208             : 00000670   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7209             : 00000680   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7210             : 00000690   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7211             : 000006A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7212             : 000006B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7213             : 000006C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7214             : 000006D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7215             : 000006E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7216             : 000006F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7217             : 00000700   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7218             : 00000710   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7219             : 00000720   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7220             : 00000730   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7221             : 00000740   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7222             : 00000750   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7223             : 00000760   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7224             : 00000770   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7225             : 00000780   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7226             : 00000790   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7227             : 000007A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7228             : 000007B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7229             : 000007C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7230             : 000007D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7231             : 000007E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7232             : 000007F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7233             : 00000800   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7234             : 00000810   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7235             : 00000820   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7236             : 00000830   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7237             : 00000840   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7238             : 00000850   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7239             : 00000860   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7240             : 00000870   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7241             : 00000880   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7242             : 00000890   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7243             : 000008A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7244             : 000008B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7245             : 000008C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7246             : 000008D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7247             : 000008E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7248             : 000008F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7249             : 00000900   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7250             : 00000910   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7251             : 00000920   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7252             : 00000930   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7253             : 00000940   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7254             : 00000950   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7255             : 00000960   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7256             : 00000970   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7257             : 00000980   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7258             : 00000990   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7259             : 000009A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7260             : 000009B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7261             : 000009C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7262             : 000009D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7263             : 000009E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7264             : 000009F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7265             : 00000A00   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7266             : 00000A10   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7267             : 00000A20   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7268             : 00000A30   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7269             : 00000A40   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7270             : 00000A50   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7271             : 00000A60   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7272             : 00000A70   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7273             : 00000A80   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7274             : 00000A90   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7275             : 00000AA0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7276             : 00000AB0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7277             : 00000AC0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7278             : 00000AD0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7279             : 00000AE0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7280             : 00000AF0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7281             : 00000B00   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7282             : 00000B10   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7283             : 00000B20   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7284             : 00000B30   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7285             : 00000B40   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7286             : 00000B50   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7287             : 00000B60   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7288             : 00000B70   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7289             : 00000B80   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7290             : 00000B90   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7291             : 00000BA0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7292             : 00000BB0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7293             : 00000BC0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7294             : 00000BD0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7295             : 00000BE0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7296             : 00000BF0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7297             : 00000C00   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7298             : 00000C10   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7299             : 00000C20   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7300             : 00000C30   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7301             : 00000C40   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7302             : 00000C50   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7303             : 00000C60   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7304             : 00000C70   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7305             : 00000C80   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7306             : 00000C90   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7307             : 00000CA0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7308             : 00000CB0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7309             : 00000CC0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7310             : 00000CD0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7311             : 00000CE0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7312             : 00000CF0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7313             : 00000D00   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7314             : 00000D10   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7315             : 00000D20   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7316             : 00000D30   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7317             : 00000D40   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7318             : 00000D50   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7319             : 00000D60   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7320             : 00000D70   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7321             : 00000D80   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7322             : 00000D90   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7323             : 00000DA0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7324             : 00000DB0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7325             : 00000DC0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7326             : 00000DD0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7327             : 00000DE0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7328             : 00000DF0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7329             : 00000E00   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7330             : 00000E10   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7331             : 00000E20   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7332             : 00000E30   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7333             : 00000E40   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7334             : 00000E50   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7335             : 00000E60   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7336             : 00000E70   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7337             : 00000E80   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7338             : 00000E90   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7339             : 00000EA0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7340             : 
    7341             : -------------------------------------------------------------------------------
    7342             : Entry ID   : 00000002 : Resource Fork
    7343             : Offset     : 00000EE2 : 3810
    7344             : Length     : 0000011E : 286
    7345             : 
    7346             : -RAW DUMP--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    7347             : 00000000   : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
    7348             : 00000010   : 54 68 69 73 20 72 65 73 6F 75 72 63 65 20 66 6F : This resource fo
    7349             : 00000020   : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
    7350             : 00000030   : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 :  left blank   ..
    7351             : 00000040   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7352             : 00000050   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7353             : 00000060   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7354             : 00000070   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7355             : 00000080   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7356             : 00000090   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7357             : 000000A0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7358             : 000000B0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7359             : 000000C0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7360             : 000000D0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7361             : 000000E0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7362             : 000000F0   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    7363             : 00000100   : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
    7364             : 00000110   : 00 00 00 00 00 00 00 00 00 1C 00 1E FF FF       : ..............
    7365             : */
    7366             : 
    7367             : static char osx_adouble_dir_w_xattr[] = {
    7368             :         0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
    7369             :         0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
    7370             :         0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
    7371             :         0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
    7372             :         0x00, 0x32, 0x00, 0x00, 0x0e, 0xb0, 0x00, 0x00,
    7373             :         0x00, 0x02, 0x00, 0x00, 0x0e, 0xe2, 0x00, 0x00,
    7374             :         0x01, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7375             :         0x00, 0x00, 0x01, 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, 0x41, 0x54, 0x54, 0x52,
    7379             :         0x00, 0x81, 0x71, 0x4c, 0x00, 0x00, 0x0e, 0xe2,
    7380             :         0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x39,
    7381             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7382             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
    7383             :         0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x39,
    7384             :         0x00, 0x00, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x61,
    7385             :         0x70, 0x70, 0x6c, 0x65, 0x2e, 0x71, 0x75, 0x61,
    7386             :         0x72, 0x61, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x00,
    7387             :         0x30, 0x30, 0x38, 0x31, 0x3b, 0x36, 0x32, 0x65,
    7388             :         0x61, 0x33, 0x37, 0x66, 0x64, 0x3b, 0x43, 0x68,
    7389             :         0x72, 0x6f, 0x6d, 0x65, 0x3b, 0x42, 0x35, 0x39,
    7390             :         0x46, 0x42, 0x39, 0x45, 0x44, 0x2d, 0x35, 0x41,
    7391             :         0x32, 0x39, 0x2d, 0x34, 0x45, 0x35, 0x42, 0x2d,
    7392             :         0x38, 0x35, 0x36, 0x43, 0x2d, 0x37, 0x45, 0x44,
    7393             :         0x30, 0x45, 0x46, 0x45, 0x41, 0x37, 0x30, 0x41,
    7394             :         0x43, 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, 0x00, 0x00, 0x00, 0x00,
    7714             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7715             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7716             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7717             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7718             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7719             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7720             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    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, 0x00, 0x00, 0x00, 0x00,
    7746             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7747             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7748             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7749             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7750             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7751             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7752             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7753             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7754             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7755             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7756             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7757             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7758             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7759             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7760             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7761             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7762             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7763             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7764             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7765             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7766             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7767             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7768             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7769             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7770             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7771             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7772             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7773             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7774             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7775             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7776             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7777             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7778             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7779             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7780             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7781             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7782             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7783             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7784             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7785             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7786             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7787             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7788             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7789             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7790             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7791             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7792             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7793             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7794             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7795             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7796             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7797             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7798             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7799             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7800             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7801             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7802             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7803             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7804             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7805             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7806             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7807             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7808             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7809             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7810             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7811             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7812             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7813             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7814             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7815             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7816             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7817             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7818             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7819             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7820             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7821             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7822             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7823             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7824             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7825             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7826             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7827             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7828             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7829             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7830             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7831             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7832             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7833             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7834             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7835             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7836             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7837             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7838             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7839             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7840             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7841             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7842             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7843             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7844             :         0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    7845             :         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7846             :         0x00, 0x1e, 0x54, 0x68, 0x69, 0x73, 0x20, 0x72,
    7847             :         0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20,
    7848             :         0x66, 0x6f, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
    7849             :         0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
    7850             :         0x6c, 0x79, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20,
    7851             :         0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x20, 0x20,
    7852             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7853             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7854             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7855             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7856             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7857             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7858             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7859             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7860             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7861             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7862             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7863             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7864             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7865             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7866             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7867             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7868             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7869             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7870             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7871             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7872             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7873             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7874             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7875             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7876             :         0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    7877             :         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7878             :         0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    7879             :         0x00, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0xff, 0xff
    7880             : };
    7881             : 
    7882           0 : static bool test_delete_trigger_convert_sharing_violation(
    7883             :         struct torture_context *tctx,
    7884             :         struct smb2_tree *tree1)
    7885             : {
    7886           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    7887           0 :         const char *dirname = BASEDIR "\\dir";
    7888           0 :         const char *adname = BASEDIR "\\._dir";
    7889             :         struct smb2_handle testdirh;
    7890             :         struct smb2_create create;
    7891           0 :         AfpInfo *info = NULL;
    7892           0 :         bool ret = true;
    7893             :         NTSTATUS status;
    7894             : 
    7895           0 :         smb2_deltree(tree1, BASEDIR);
    7896             : 
    7897           0 :         status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
    7898           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7899             :                                         "torture_smb2_testdir failed\n");
    7900           0 :         smb2_util_close(tree1, testdirh);
    7901             : 
    7902           0 :         status = torture_smb2_testdir(tree1, dirname, &testdirh);
    7903           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7904             :                                         "torture_smb2_testdir failed\n");
    7905           0 :         smb2_util_close(tree1, testdirh);
    7906             : 
    7907           0 :         ret = torture_setup_file(tctx, tree1, adname, false);
    7908           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    7909             :                             "torture_setup_file failed\n");
    7910             : 
    7911           0 :         ret = write_stream(tree1, __location__, tctx, mem_ctx,
    7912             :                            adname, NULL, 0,
    7913             :                            sizeof(osx_adouble_dir_w_xattr),
    7914             :                            osx_adouble_dir_w_xattr);
    7915           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    7916             :                             "write_stream failed\n");
    7917             : 
    7918             :         /*
    7919             :          * 1) Create a non-empty AFP_AfpInfo stream
    7920             :          */
    7921             : 
    7922           0 :         info = torture_afpinfo_new(mem_ctx);
    7923           0 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    7924             : 
    7925             :         /* Set "Inited" flag (any other would do too) */
    7926           0 :         info->afpi_FinderInfo[8] = 0x01;
    7927             : 
    7928           0 :         ret = torture_write_afpinfo(tree1, tctx, mem_ctx, dirname, info);
    7929           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    7930             : 
    7931           0 :         ret = write_stream(tree1, __location__, tctx, mem_ctx,
    7932             :                            adname, NULL, 0,
    7933             :                            sizeof(osx_adouble_dir_w_xattr),
    7934             :                            osx_adouble_dir_w_xattr);
    7935           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    7936             :                             "write_stream failed\n");
    7937             : 
    7938             :         /*
    7939             :          * 2) Create a second stream
    7940             :          */
    7941             : 
    7942           0 :         ret = write_stream(tree1, __location__, tctx, mem_ctx,
    7943             :                            dirname, ":org.samba.boom", 0,
    7944             :                            strlen("boom"),
    7945             :                            "boom");
    7946           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    7947             :                             "write_stream failed\n");
    7948             : 
    7949           0 :         create = (struct smb2_create) {
    7950             :                 .in.desired_access = SEC_STD_DELETE,
    7951             :                 .in.create_options = NTCREATEX_OPTIONS_DIRECTORY,
    7952             :                 .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY,
    7953             :                 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
    7954             :                 .in.create_disposition = NTCREATEX_DISP_OPEN,
    7955             :                 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
    7956             :                 .in.fname = dirname,
    7957             :         };
    7958             : 
    7959           0 :         status = smb2_create(tree1, tctx, &create);
    7960           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7961             :                                         "smb2_create failed\n");
    7962             : 
    7963           0 :         status = smb2_util_close(tree1, create.out.file.handle);
    7964           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7965             :                                         "smb2_util_close failed");
    7966             : 
    7967           0 : done:
    7968           0 :         smb2_deltree(tree1, BASEDIR);
    7969           0 :         talloc_free(mem_ctx);
    7970           0 :         return ret;
    7971             : }
    7972             : 
    7973             : /*
    7974             :  * Note: This test depends on "vfs objects = catia fruit streams_xattr".  For
    7975             :  * some tests torture must be run on the host it tests and takes an additional
    7976             :  * argument with the local path to the share:
    7977             :  * "--option=torture:localdir=<SHAREPATH>".
    7978             :  *
    7979             :  * When running against an OS X SMB server add "--option=torture:osx=true"
    7980             :  */
    7981         964 : struct torture_suite *torture_vfs_fruit(TALLOC_CTX *ctx)
    7982             : {
    7983         964 :         struct torture_suite *suite = torture_suite_create(
    7984             :                 ctx, "fruit");
    7985             : 
    7986         964 :         suite->description = talloc_strdup(suite, "vfs_fruit tests");
    7987             : 
    7988         964 :         torture_suite_add_1smb2_test(suite, "copyfile", test_copyfile);
    7989         964 :         torture_suite_add_1smb2_test(suite, "read metadata", test_read_afpinfo);
    7990         964 :         torture_suite_add_1smb2_test(suite, "write metadata", test_write_atalk_metadata);
    7991         964 :         torture_suite_add_1smb2_test(suite, "resource fork IO", test_write_atalk_rfork_io);
    7992         964 :         torture_suite_add_1smb2_test(suite, "SMB2/CREATE context AAPL", test_aapl);
    7993         964 :         torture_suite_add_1smb2_test(suite, "stream names", test_stream_names);
    7994         964 :         torture_suite_add_1smb2_test(suite, "truncate resource fork to 0 bytes", test_rfork_truncate);
    7995         964 :         torture_suite_add_1smb2_test(suite, "opening and creating resource fork", test_rfork_create);
    7996         964 :         torture_suite_add_1smb2_test(suite, "fsync_resource_fork", test_rfork_fsync);
    7997         964 :         torture_suite_add_1smb2_test(suite, "rename_dir_openfile", test_rename_dir_openfile);
    7998         964 :         torture_suite_add_1smb2_test(suite, "File without AFP_AfpInfo", test_afpinfo_enoent);
    7999         964 :         torture_suite_add_1smb2_test(suite, "create delete-on-close AFP_AfpInfo", test_create_delete_on_close);
    8000         964 :         torture_suite_add_1smb2_test(suite, "setinfo delete-on-close AFP_AfpInfo", test_setinfo_delete_on_close);
    8001         964 :         torture_suite_add_1smb2_test(suite, "setinfo eof AFP_AfpInfo", test_setinfo_eof);
    8002         964 :         torture_suite_add_1smb2_test(suite, "delete AFP_AfpInfo by writing all 0", test_afpinfo_all0);
    8003         964 :         torture_suite_add_1smb2_test(suite, "create delete-on-close AFP_AfpResource", test_create_delete_on_close_resource);
    8004         964 :         torture_suite_add_1smb2_test(suite, "setinfo delete-on-close AFP_AfpResource", test_setinfo_delete_on_close_resource);
    8005         964 :         torture_suite_add_1smb2_test(suite, "setinfo eof AFP_AfpResource", test_setinfo_eof_resource);
    8006         964 :         torture_suite_add_1smb2_test(suite, "setinfo eof stream", test_setinfo_stream_eof);
    8007         964 :         torture_suite_add_1smb2_test(suite, "null afpinfo", test_null_afpinfo);
    8008         964 :         torture_suite_add_1smb2_test(suite, "delete", test_delete_file_with_rfork);
    8009         964 :         torture_suite_add_1smb2_test(suite, "read open rsrc after rename", test_rename_and_read_rsrc);
    8010         964 :         torture_suite_add_1smb2_test(suite, "readdir_attr with names with illegal ntfs characters", test_readdir_attr_illegal_ntfs);
    8011         964 :         torture_suite_add_2ns_smb2_test(suite, "invalid AFP_AfpInfo", test_invalid_afpinfo);
    8012         964 :         torture_suite_add_1smb2_test(suite, "creating rsrc with read-only access", test_rfork_create_ro);
    8013         964 :         torture_suite_add_1smb2_test(suite, "copy-chunk streams", test_copy_chunk_streams);
    8014         964 :         torture_suite_add_1smb2_test(suite, "OS X AppleDouble file conversion", test_adouble_conversion);
    8015         964 :         torture_suite_add_1smb2_test(suite, "NFS ACE entries", test_nfs_aces);
    8016         964 :         torture_suite_add_1smb2_test(suite, "OS X AppleDouble file conversion without embedded xattr", test_adouble_conversion_wo_xattr);
    8017         964 :         torture_suite_add_1smb2_test(suite, "empty_stream", test_empty_stream);
    8018         964 :         torture_suite_add_1smb2_test(suite, "writing_afpinfo", test_writing_afpinfo);
    8019         964 :         torture_suite_add_1smb2_test(suite, "delete_trigger_convert_sharing_violation", test_delete_trigger_convert_sharing_violation);
    8020             : 
    8021         964 :         return suite;
    8022             : }
    8023             : 
    8024           0 : static bool test_stream_names_local(struct torture_context *tctx,
    8025             :                                     struct smb2_tree *tree)
    8026             : {
    8027           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    8028             :         NTSTATUS status;
    8029             :         struct smb2_create create;
    8030             :         struct smb2_handle h;
    8031           0 :         const char *fname = BASEDIR "\\stream_names.txt";
    8032             :         const char *sname1;
    8033             :         bool ret;
    8034             :         /* UTF8 private use are starts at 0xef 0x80 0x80 (0xf000) */
    8035           0 :         const char *streams[] = {
    8036             :                 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
    8037             :                 ":bar" "\xef\x80\xa2" "baz:$DATA", /* "bar:baz:$DATA" */
    8038             :                 "::$DATA"
    8039             :         };
    8040           0 :         const char *localdir = NULL;
    8041             : 
    8042           0 :         localdir = torture_setting_string(tctx, "localdir", NULL);
    8043           0 :         if (localdir == NULL) {
    8044           0 :                 torture_skip(tctx, "Need localdir for test");
    8045             :         }
    8046             : 
    8047           0 :         sname1 = talloc_asprintf(mem_ctx, "%s%s", fname, streams[0]);
    8048             : 
    8049             :         /* clean slate ...*/
    8050           0 :         smb2_util_unlink(tree, fname);
    8051           0 :         smb2_deltree(tree, fname);
    8052           0 :         smb2_deltree(tree, BASEDIR);
    8053             : 
    8054           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    8055           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    8056           0 :         smb2_util_close(tree, h);
    8057             : 
    8058           0 :         torture_comment(tctx, "(%s) testing stream names\n", __location__);
    8059           0 :         ZERO_STRUCT(create);
    8060           0 :         create.in.desired_access = SEC_FILE_WRITE_DATA;
    8061           0 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    8062           0 :         create.in.share_access =
    8063             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    8064             :                 NTCREATEX_SHARE_ACCESS_READ|
    8065             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    8066           0 :         create.in.create_disposition = NTCREATEX_DISP_CREATE;
    8067           0 :         create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    8068           0 :         create.in.fname = sname1;
    8069             : 
    8070           0 :         status = smb2_create(tree, mem_ctx, &create);
    8071           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    8072             : 
    8073           0 :         status = smb2_util_write(tree, create.out.file.handle, "foo", 0, 3);
    8074           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8075             :                                         "smb2_util_write failed\n");
    8076             : 
    8077           0 :         smb2_util_close(tree, create.out.file.handle);
    8078             : 
    8079           0 :         ret = torture_setup_local_xattr(tctx, "localdir", BASEDIR "/stream_names.txt",
    8080             :                                         "user.DosStream.bar:baz:$DATA",
    8081             :                                         "data", strlen("data"));
    8082           0 :         CHECK_VALUE(ret, true);
    8083             : 
    8084           0 :         ret = check_stream_list(tree, tctx, fname, 3, streams, false);
    8085           0 :         CHECK_VALUE(ret, true);
    8086             : 
    8087           0 : done:
    8088           0 :         status = smb2_util_unlink(tree, fname);
    8089           0 :         smb2_deltree(tree, BASEDIR);
    8090           0 :         talloc_free(mem_ctx);
    8091             : 
    8092           0 :         return ret;
    8093             : }
    8094             : 
    8095           0 : static bool test_fruit_locking_conflict(struct torture_context *tctx,
    8096             :                                         struct smb2_tree *tree,
    8097             :                                         struct smb2_tree *tree2)
    8098             : {
    8099             :         TALLOC_CTX *mem_ctx;
    8100             :         struct smb2_create create;
    8101             :         struct smb2_handle h;
    8102             :         struct smb2_lock lck;
    8103             :         struct smb2_lock_element el;
    8104           0 :         const char *fname = BASEDIR "\\locking_conflict.txt";
    8105             :         NTSTATUS status;
    8106           0 :         bool ret = false;
    8107             : 
    8108           0 :         mem_ctx = talloc_new(tctx);
    8109           0 :         torture_assert_not_null(tctx, mem_ctx, "talloc_new failed");
    8110             : 
    8111             :         /* clean slate ...*/
    8112           0 :         smb2_util_unlink(tree, fname);
    8113           0 :         smb2_deltree(tree, fname);
    8114           0 :         smb2_deltree(tree, BASEDIR);
    8115             : 
    8116           0 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    8117           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    8118           0 :         smb2_util_close(tree, h);
    8119             : 
    8120           0 :         create = (struct smb2_create) {
    8121             :                 .in.desired_access = SEC_RIGHTS_FILE_READ,
    8122             :                 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
    8123             :                 .in.share_access =
    8124             :                 NTCREATEX_SHARE_ACCESS_READ|
    8125             :                 NTCREATEX_SHARE_ACCESS_WRITE,
    8126             :                 .in.create_disposition = NTCREATEX_DISP_CREATE,
    8127             :                 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
    8128             :                 .in.fname = fname,
    8129             :         };
    8130             : 
    8131           0 :         status = smb2_create(tree, mem_ctx, &create);
    8132           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    8133           0 :         h = create.out.file.handle;
    8134             : 
    8135             :         /* Add AD_FILELOCK_RSRC_DENY_WR lock. */
    8136           0 :         el = (struct smb2_lock_element) {
    8137             :                 .offset = 0xfffffffffffffffc,
    8138             :                 .length = 1,
    8139             :                 .flags = SMB2_LOCK_FLAG_EXCLUSIVE,
    8140             :         };
    8141           0 :         lck = (struct smb2_lock) {
    8142             :                 .in.lock_count = 1,
    8143             :                 .in.file.handle = h,
    8144             :                 .in.locks = &el,
    8145             :         };
    8146             : 
    8147             :         /*
    8148             :          * Lock up to and including:
    8149             :          * AD_FILELOCK_OPEN_WR
    8150             :          * AD_FILELOCK_OPEN_RD
    8151             :          * This is designed to cause a NetAtalk
    8152             :          * locking conflict on the next open,
    8153             :          * even though the share modes are
    8154             :          * compatible.
    8155             :          */
    8156           0 :         status = smb2_lock(tree, &lck);
    8157           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    8158             : 
    8159           0 :         el = (struct smb2_lock_element) {
    8160             :                 .offset = 0,
    8161             :                 .length = 0x7ffffffffffffff7,
    8162             :                 .flags = SMB2_LOCK_FLAG_EXCLUSIVE,
    8163             :         };
    8164           0 :         status = smb2_lock(tree, &lck);
    8165           0 :         CHECK_STATUS(status, NT_STATUS_OK);
    8166             : 
    8167           0 :         create = (struct smb2_create) {
    8168             :                 .in.desired_access =
    8169             :                 SEC_RIGHTS_FILE_READ|SEC_RIGHTS_FILE_WRITE,
    8170             :                 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
    8171             :                 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
    8172             :                 .in.create_disposition = NTCREATEX_DISP_OPEN,
    8173             :                 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
    8174             :                 .in.fname = fname,
    8175             :         };
    8176             : 
    8177             :         /*
    8178             :          * Open on the second tree - ensure we are
    8179             :          * emulating trying to access with a NetATalk
    8180             :          * process with an existing open/deny mode.
    8181             :          */
    8182           0 :         status = smb2_create(tree2, mem_ctx, &create);
    8183           0 :         CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
    8184             : 
    8185             :         {
    8186           0 :                 struct smb2_close cl = {
    8187             :                         .level = RAW_CLOSE_SMB2,
    8188             :                         .in.file.handle = h,
    8189             :                 };
    8190           0 :                 smb2_close(tree, &cl);
    8191             :         }
    8192             : 
    8193           0 :         ret = true;
    8194           0 : done:
    8195           0 :         return ret;
    8196             : }
    8197             : 
    8198         964 : struct torture_suite *torture_vfs_fruit_netatalk(TALLOC_CTX *ctx)
    8199             : {
    8200         964 :         struct torture_suite *suite = torture_suite_create(
    8201             :                 ctx, "fruit_netatalk");
    8202             : 
    8203         964 :         suite->description = talloc_strdup(suite, "vfs_fruit tests for Netatalk interop that require fruit:metadata=netatalk");
    8204             : 
    8205         964 :         torture_suite_add_1smb2_test(suite, "read netatalk metadata", test_read_netatalk_metadata);
    8206         964 :         torture_suite_add_1smb2_test(suite, "stream names with locally created xattr", test_stream_names_local);
    8207         964 :         torture_suite_add_2smb2_test(
    8208             :                 suite, "locking conflict", test_fruit_locking_conflict);
    8209             : 
    8210         964 :         return suite;
    8211             : }
    8212             : 
    8213         964 : struct torture_suite *torture_vfs_fruit_file_id(TALLOC_CTX *ctx)
    8214             : {
    8215         738 :         struct torture_suite *suite =
    8216         226 :             torture_suite_create(ctx, "fruit_file_id");
    8217             : 
    8218         964 :         suite->description =
    8219         964 :             talloc_strdup(suite, "vfs_fruit tests for on-disk file ID that "
    8220             :                                  "require fruit:zero_file_id=yes");
    8221             : 
    8222         964 :         torture_suite_add_1smb2_test(suite, "zero file id if AAPL negotiated",
    8223             :                                      test_zero_file_id);
    8224             : 
    8225         964 :         return suite;
    8226             : }
    8227             : 
    8228           0 : static bool test_timemachine_volsize(struct torture_context *tctx,
    8229             :                                      struct smb2_tree *tree)
    8230             : {
    8231           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    8232           0 :         struct smb2_handle h = {{0}};
    8233             :         union smb_fsinfo fsinfo;
    8234             :         NTSTATUS status;
    8235           0 :         bool ok = true;
    8236           0 :         const char *info_plist =
    8237             :                 "<dict>\n"
    8238             :                 "        <key>band-size</key>\n"
    8239             :                 "        <integer>8192</integer>\n"
    8240             :                 "</dict>\n";
    8241             : 
    8242           0 :         smb2_deltree(tree, "test.sparsebundle");
    8243             : 
    8244           0 :         ok = enable_aapl(tctx, tree);
    8245           0 :         torture_assert_goto(tctx, ok, ok, done, "enable_aapl failed");
    8246             : 
    8247           0 :         status = smb2_util_mkdir(tree, "test.sparsebundle");
    8248           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ok, done,
    8249             :                                         "smb2_util_mkdir\n");
    8250             : 
    8251           0 :         ok = write_stream(tree, __location__, tctx, mem_ctx,
    8252             :                           "test.sparsebundle/Info.plist", NULL,
    8253             :                            0, strlen(info_plist), info_plist);
    8254           0 :         torture_assert_goto(tctx, ok, ok, done, "write_stream failed\n");
    8255             : 
    8256           0 :         status = smb2_util_mkdir(tree, "test.sparsebundle/bands");
    8257           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ok, done,
    8258             :                                         "smb2_util_mkdir\n");
    8259             : 
    8260           0 :         ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/1", false);
    8261           0 :         torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n");
    8262             : 
    8263           0 :         ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/2", false);
    8264           0 :         torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n");
    8265             : 
    8266           0 :         status = smb2_util_roothandle(tree, &h);
    8267           0 :         torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle");
    8268             : 
    8269           0 :         ZERO_STRUCT(fsinfo);
    8270           0 :         fsinfo.generic.level = RAW_QFS_SIZE_INFORMATION;
    8271           0 :         fsinfo.generic.handle = h;
    8272             : 
    8273           0 :         status = smb2_getinfo_fs(tree, tree, &fsinfo);
    8274           0 :         torture_assert_ntstatus_ok(tctx, status, "smb2_getinfo_fs failed");
    8275             : 
    8276           0 :         torture_comment(tctx, "sectors_per_unit: %" PRIu32"\n"
    8277             :                         "bytes_per_sector: %" PRIu32"\n"
    8278             :                         "total_alloc_units: %" PRIu64"\n"
    8279             :                         "avail_alloc_units: %" PRIu64"\n",
    8280             :                         fsinfo.size_info.out.sectors_per_unit,
    8281             :                         fsinfo.size_info.out.bytes_per_sector,
    8282             :                         fsinfo.size_info.out.total_alloc_units,
    8283             :                         fsinfo.size_info.out.avail_alloc_units);
    8284             : 
    8285             :         /*
    8286             :          * Let me explain the numbers:
    8287             :          *
    8288             :          * - the share is set to "fruit:time machine max size = 32K"
    8289             :          * - we've faked a bandsize of 8 K in the Info.plist file
    8290             :          * - we've created two bands files
    8291             :          * - one allocation unit is made of two sectors with 512 B each
    8292             :          * => we've consumed 16 allocation units, there should be 16 free
    8293             :          */
    8294             : 
    8295           0 :         torture_assert_goto(tctx, fsinfo.size_info.out.sectors_per_unit == 2,
    8296             :                             ok, done, "Bad sectors_per_unit");
    8297             : 
    8298           0 :         torture_assert_goto(tctx, fsinfo.size_info.out.bytes_per_sector == 512,
    8299             :                             ok, done, "Bad bytes_per_sector");
    8300             : 
    8301           0 :         torture_assert_goto(tctx, fsinfo.size_info.out.total_alloc_units == 32,
    8302             :                             ok, done, "Bad total_alloc_units");
    8303             : 
    8304           0 :         torture_assert_goto(tctx, fsinfo.size_info.out.avail_alloc_units == 16,
    8305             :                             ok, done, "Bad avail_alloc_units");
    8306             : 
    8307           0 : done:
    8308           0 :         if (!smb2_util_handle_empty(h)) {
    8309           0 :                 smb2_util_close(tree, h);
    8310             :         }
    8311           0 :         smb2_deltree(tree, "test.sparsebundle");
    8312           0 :         talloc_free(mem_ctx);
    8313           0 :         return ok;
    8314             : }
    8315             : 
    8316         964 : struct torture_suite *torture_vfs_fruit_timemachine(TALLOC_CTX *ctx)
    8317             : {
    8318         964 :         struct torture_suite *suite = torture_suite_create(
    8319             :                 ctx, "fruit_timemachine");
    8320             : 
    8321         964 :         suite->description = talloc_strdup(
    8322             :                 suite, "vfs_fruit tests for TimeMachine");
    8323             : 
    8324         964 :         torture_suite_add_1smb2_test(suite, "Timemachine-volsize",
    8325             :                                      test_timemachine_volsize);
    8326             : 
    8327         964 :         return suite;
    8328             : }
    8329             : 
    8330           0 : static bool test_convert_xattr_and_empty_rfork_then_delete(
    8331             :         struct torture_context *tctx,
    8332             :         struct smb2_tree *tree1,
    8333             :         struct smb2_tree *tree2)
    8334             : {
    8335           0 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    8336           0 :         const char *fname = BASEDIR "\\test_adouble_conversion";
    8337           0 :         const char *adname = BASEDIR "/._test_adouble_conversion";
    8338           0 :         const char *rfork = BASEDIR "\\test_adouble_conversion" AFPRESOURCE_STREAM_NAME;
    8339             :         NTSTATUS status;
    8340             :         struct smb2_handle testdirh;
    8341           0 :         bool ret = true;
    8342           0 :         const char *streams[] = {
    8343             :                 "::$DATA",
    8344             :                 AFPINFO_STREAM,
    8345             :                 ":com.apple.metadata" "\xef\x80\xa2" "_kMDItemUserTags:$DATA",
    8346             :                 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
    8347             :         };
    8348             :         struct smb2_create create;
    8349             :         struct smb2_find find;
    8350             :         unsigned int count;
    8351             :         union smb_search_data *d;
    8352             :         bool delete_empty_adfiles;
    8353             :         int expected_num_files;
    8354             : 
    8355           0 :         delete_empty_adfiles = torture_setting_bool(tctx,
    8356             :                                                     "delete_empty_adfiles",
    8357             :                                                     false);
    8358             : 
    8359           0 :         smb2_deltree(tree1, BASEDIR);
    8360             : 
    8361           0 :         status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
    8362           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8363             :                                         "torture_smb2_testdir failed\n");
    8364           0 :         smb2_util_close(tree1, testdirh);
    8365             : 
    8366           0 :         ret = torture_setup_file(tctx, tree1, fname, false);
    8367           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8368             :                             "torture_setup_file failed\n");
    8369             : 
    8370           0 :         ret = torture_setup_file(tctx, tree1, adname, false);
    8371           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8372             :                             "torture_setup_file failed\n");
    8373             : 
    8374           0 :         ret = write_stream(tree1, __location__, tctx, mem_ctx,
    8375             :                            adname, NULL,
    8376             :                            0, sizeof(osx_adouble_w_xattr), osx_adouble_w_xattr);
    8377           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8378             :                             "write_stream failed\n");
    8379             : 
    8380           0 :         ret = enable_aapl(tctx, tree2);
    8381           0 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    8382             : 
    8383             :         /*
    8384             :          * Issue a smb2_find(), this triggers the server-side conversion
    8385             :          */
    8386             : 
    8387           0 :         create = (struct smb2_create) {
    8388             :                 .in.desired_access = SEC_RIGHTS_DIR_READ,
    8389             :                 .in.create_options = NTCREATEX_OPTIONS_DIRECTORY,
    8390             :                 .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY,
    8391             :                 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
    8392             :                 .in.create_disposition = NTCREATEX_DISP_OPEN,
    8393             :                 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
    8394             :                 .in.fname = BASEDIR,
    8395             :         };
    8396             : 
    8397           0 :         status = smb2_create(tree2, tctx, &create);
    8398           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8399             :                                         "smb2_create failed\n");
    8400             : 
    8401           0 :         find = (struct smb2_find) {
    8402             :                 .in.file.handle = create.out.file.handle,
    8403             :                 .in.pattern = "*",
    8404             :                 .in.max_response_size = 0x1000,
    8405             :                 .in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO,
    8406             :         };
    8407             : 
    8408           0 :         status = smb2_find_level(tree2, tree2, &find, &count, &d);
    8409           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8410             :                                         "smb2_find_level failed\n");
    8411             : 
    8412           0 :         status = smb2_util_close(tree2, create.out.file.handle);
    8413           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8414             :                                         "smb2_util_close failed");
    8415             : 
    8416             :         /*
    8417             :          * Check number of streams
    8418             :          */
    8419             : 
    8420           0 :         ret = check_stream_list(tree2, tctx, fname, 4, streams, false);
    8421           0 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    8422             : 
    8423             :         /*
    8424             :          * Check Resource Fork is gone
    8425             :          */
    8426             : 
    8427           0 :         create = (struct smb2_create) {
    8428             :                 .in.desired_access = SEC_RIGHTS_FILE_READ|SEC_RIGHTS_FILE_WRITE,
    8429             :                 .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
    8430             :                 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
    8431             :                 .in.create_disposition = NTCREATEX_DISP_OPEN,
    8432             :                 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
    8433             :                 .in.fname = rfork,
    8434             :         };
    8435             : 
    8436           0 :         status = smb2_create(tree2, mem_ctx, &create);
    8437           0 :         torture_assert_ntstatus_equal_goto(
    8438             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    8439             :                 ret, done, "Bad smb2_create return\n");
    8440             : 
    8441             :         /*
    8442             :          * Check xattr data has been migrated from the AppleDouble file to
    8443             :          * streams.
    8444             :          */
    8445             : 
    8446           0 :         ret = check_stream(tree2, __location__, tctx, mem_ctx,
    8447             :                            fname, AFPINFO_STREAM,
    8448             :                            0, 60, 16, 8, "TESTSLOW");
    8449           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8450             :                             "check AFPINFO_STREAM failed\n");
    8451             : 
    8452           0 :         ret = check_stream(tree2, __location__, tctx, mem_ctx,
    8453             :                            fname, ":foo" "\xef\x80\xa2" "bar", /* foo:bar */
    8454             :                            0, 3, 0, 3, "baz");
    8455           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8456             :                             "check foo stream failed\n");
    8457             : 
    8458             :         /*
    8459             :          * Now check number of files. If delete_empty_adfiles is set, the
    8460             :          * AppleDouble files should have been deleted.
    8461             :          */
    8462             : 
    8463           0 :         create = (struct smb2_create) {
    8464             :                 .in.desired_access = SEC_RIGHTS_DIR_READ,
    8465             :                 .in.create_options = NTCREATEX_OPTIONS_DIRECTORY,
    8466             :                 .in.file_attributes = FILE_ATTRIBUTE_DIRECTORY,
    8467             :                 .in.share_access = NTCREATEX_SHARE_ACCESS_READ,
    8468             :                 .in.create_disposition = NTCREATEX_DISP_OPEN,
    8469             :                 .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
    8470             :                 .in.fname = BASEDIR,
    8471             :         };
    8472             : 
    8473           0 :         status = smb2_create(tree2, tctx, &create);
    8474           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8475             :                                         "smb2_create failed\n");
    8476             : 
    8477           0 :         find = (struct smb2_find) {
    8478             :                 .in.file.handle = create.out.file.handle,
    8479             :                 .in.pattern = "*",
    8480             :                 .in.max_response_size = 0x1000,
    8481             :                 .in.level = SMB2_FIND_ID_BOTH_DIRECTORY_INFO,
    8482             :         };
    8483             : 
    8484           0 :         status = smb2_find_level(tree2, tree2, &find, &count, &d);
    8485           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8486             :                                         "smb2_find_level failed\n");
    8487             : 
    8488           0 :         status = smb2_util_close(tree2, create.out.file.handle);
    8489           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8490             :                                         "smb2_util_close failed");
    8491             : 
    8492           0 :         if (delete_empty_adfiles) {
    8493           0 :                 expected_num_files = 3;
    8494             :         } else {
    8495           0 :                 expected_num_files = 4;
    8496             :         }
    8497           0 :         torture_assert_int_equal_goto(tctx, count, expected_num_files, ret, done,
    8498             :                                       "Wrong number of files\n");
    8499             : 
    8500           0 : done:
    8501           0 :         smb2_deltree(tree1, BASEDIR);
    8502           0 :         talloc_free(mem_ctx);
    8503           0 :         return ret;
    8504             : }
    8505             : 
    8506         964 : struct torture_suite *torture_vfs_fruit_conversion(TALLOC_CTX *ctx)
    8507             : {
    8508         964 :         struct torture_suite *suite = torture_suite_create(
    8509             :                 ctx, "fruit_conversion");
    8510             : 
    8511         964 :         suite->description = talloc_strdup(
    8512             :                 suite, "vfs_fruit conversion tests");
    8513             : 
    8514         964 :         torture_suite_add_2ns_smb2_test(
    8515             :                 suite, "convert_xattr_and_empty_rfork_then_delete",
    8516             :                 test_convert_xattr_and_empty_rfork_then_delete);
    8517             : 
    8518         964 :         return suite;
    8519             : }
    8520             : 
    8521             : /*
    8522             :  * The buf below contains the following AppleDouble encoded data:
    8523             :  *
    8524             :  * -----------------------------------------------------------------------------
    8525             :  * MagicNumber: 00051607                                        : AppleDouble
    8526             :  * Version    : 00020000                                        : Version 2
    8527             :  * Filler     : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
    8528             :  * Num. of ent: 0002                                            : 2
    8529             :  *
    8530             :  * -----------------------------------------------------------------------------
    8531             :  * Entry ID   : 00000002 : Resource Fork
    8532             :  * Offset     : 0000009A : 154
    8533             :  * Length     : 00000004 : 4
    8534             :  *
    8535             :  * -RAW DUMP--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    8536             :  * 00000000   : 62 61 72 00                                     : bar.
    8537             :  *
    8538             :  * -----------------------------------------------------------------------------
    8539             :  * Entry ID   : 00000009 : Finder Info
    8540             :  * Offset     : 00000032 : 50
    8541             :  * Length     : 00000068 : 104
    8542             :  *
    8543             :  * -FInfo-----:
    8544             :  * Type       : 464F4F20 : FOO
    8545             :  * Creator    : 42415220 : BAR
    8546             :  * isAlias    : 0
    8547             :  * Invisible  : 0
    8548             :  * hasBundle  : 0
    8549             :  * nameLocked : 0
    8550             :  * Stationery : 0
    8551             :  * CustomIcon : 0
    8552             :  * Reserved   : 0
    8553             :  * Inited     : 0
    8554             :  * NoINITS    : 0
    8555             :  * Shared     : 0
    8556             :  * SwitchLaunc: 0
    8557             :  * Hidden Ext : 0
    8558             :  * color      : 000      : none
    8559             :  * isOnDesk   : 0
    8560             :  * Location v : 0000     : 0
    8561             :  * Location h : 0000     : 0
    8562             :  * Fldr       : 0000     : ..
    8563             :  *
    8564             :  * -FXInfo----:
    8565             :  * Rsvd|IconID: 0000     : 0
    8566             :  * Rsvd       : 0000     : ..
    8567             :  * Rsvd       : 0000     : ..
    8568             :  * Rsvd       : 0000     : ..
    8569             :  * AreInvalid : 0
    8570             :  * unknown bit: 0
    8571             :  * unknown bit: 0
    8572             :  * unknown bit: 0
    8573             :  * unknown bit: 0
    8574             :  * unknown bit: 0
    8575             :  * unknown bit: 0
    8576             :  * CustomBadge: 0
    8577             :  * ObjctIsBusy: 0
    8578             :  * unknown bit: 0
    8579             :  * unknown bit: 0
    8580             :  * unknown bit: 0
    8581             :  * unknown bit: 0
    8582             :  * RoutingInfo: 0
    8583             :  * unknown bit: 0
    8584             :  * unknown bit: 0
    8585             :  * Rsvd|commnt: 0000     : 0
    8586             :  * PutAway    : 00000000 : 0
    8587             :  *
    8588             :  * -EA--------:
    8589             :  * pad        : 0000     :
    8590             :  * magic      : 41545452 : ATTR
    8591             :  * debug_tag  : 00000000 : 0
    8592             :  * total_size : 0000009A : 154
    8593             :  * data_start : 00000096 : 150
    8594             :  * data_length: 00000004 : 4
    8595             :  * reserved[0]: 00000000 : ....
    8596             :  * reserved[1]: 00000000 : ....
    8597             :  * reserved[2]: 00000000 : ....
    8598             :  * flags      : 0000     : ..
    8599             :  * num_attrs  : 0001     : 1
    8600             :  * -EA ENTRY--:
    8601             :  * offset     : 00000096 : 150
    8602             :  * length     : 00000004 : 4
    8603             :  * flags      : 0000     : ..
    8604             :  * namelen    : 13       : 19
    8605             :  * -EA NAME---:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    8606             :  * 00000000   : 6F 72 67 2E 73 61 6D 62 61 EF 80 A2 77 6F 6F 68 : org.samba...wooh
    8607             :  * 00000010   : 6F 6F 00                                        : oo.
    8608             :  * -EA VALUE--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    8609             :  * 00000000   : 62 61 72 00                                     : bar.
    8610             :  *
    8611             :  * -RAW DUMP--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
    8612             :  * 00000000   : 46 4F 4F 20 42 41 52 20 00 00 00 00 00 00 00 00 : FOO BAR ........
    8613             :  * 00000010   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
    8614             :  * 00000020   : 00 00 41 54 54 52 00 00 00 00 00 00 00 9A 00 00 : baATTR..........
    8615             :  * 00000030   : 00 96 00 00 00 04 00 00 00 00 00 00 00 00 00 00 : ................
    8616             :  * 00000040   : 00 00 00 00 00 01 00 00 00 96 00 00 00 04 00 00 : ................
    8617             :  * 00000050   : 13 6F 72 67 2E 73 61 6D 62 61 EF 80 A2 77 6F 6F : .org.samba...woo
    8618             :  * 00000060   : 68 6F 6F 00 62 61 72 00                         : hoo.bar.
    8619             :  *
    8620             :  * It was created with:
    8621             :  *
    8622             :  * $ hexdump -ve '"\t" 7/1 "0x%02x, " 1/1 " 0x%02x," "\n"'
    8623             :  */
    8624             : static char unconvert_adfile_data[] = {
    8625             :         0x00, 0x05, 0x16, 0x07, 0x00, 0x02, 0x00, 0x00,
    8626             :         0x4d, 0x61, 0x63, 0x20, 0x4f, 0x53, 0x20, 0x58,
    8627             :         0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
    8628             :         0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
    8629             :         0x00, 0x98, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
    8630             :         0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
    8631             :         0x00, 0x66, 0x46, 0x4f, 0x4f, 0x20, 0x42, 0x41,
    8632             :         0x52, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    8633             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    8634             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    8635             :         0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52,
    8636             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98,
    8637             :         0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x04,
    8638             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    8639             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
    8640             :         0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x04,
    8641             :         0x00, 0x00, 0x11, 0x6f, 0x72, 0x67, 0x2e, 0x73,
    8642             :         0x61, 0x6d, 0x62, 0x61, 0x3a, 0x77, 0x6f, 0x6f,
    8643             :         0x68, 0x6f, 0x6f, 0x00, 0x62, 0x61, 0x72, 0x00,
    8644             :         0x62, 0x61, 0x72, 0x00
    8645             : };
    8646             : 
    8647           0 : static bool test_unconvert(struct torture_context *tctx,
    8648             :                            struct smb2_tree *tree1,
    8649             :                            struct smb2_tree *tree2)
    8650             : {
    8651           0 :         const char *fname = BASEDIR "\\unconvert";
    8652           0 :         const char *adname = BASEDIR "\\._unconvert";
    8653           0 :         const char *net = NULL;
    8654           0 :         const char *share = NULL;
    8655           0 :         AfpInfo *afpi = NULL;
    8656           0 :         char *cmd = NULL;
    8657             :         struct smb2_handle h1;
    8658             :         union smb_fileinfo finfo;
    8659             :         size_t adsize;
    8660             :         NTSTATUS status;
    8661             :         int result;
    8662           0 :         bool ret = true;
    8663             : 
    8664           0 :         torture_assert_not_null_goto(tctx, tree2, ret, done,
    8665             :                                      "Need a second share without fruit\n");
    8666             : 
    8667           0 :         net = torture_setting_string(tctx, "net", NULL);
    8668           0 :         torture_assert_not_null_goto(tctx, net, ret, done,
    8669             :                                      "Need path to 'net'");
    8670             : 
    8671           0 :         share = torture_setting_string(tctx, "sharename", NULL);
    8672           0 :         torture_assert_not_null_goto(tctx, share, ret, done,
    8673             :                                      "Need sharename");
    8674             : 
    8675           0 :         torture_comment(tctx, "Testing unconvert\n");
    8676             : 
    8677           0 :         smb2_deltree(tree1, BASEDIR);
    8678             : 
    8679           0 :         status = torture_smb2_testdir(tree1, BASEDIR, &h1);
    8680           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8681             :                                         "torture_smb2_testdir\n");
    8682           0 :         smb2_util_close(tree1, h1);
    8683             : 
    8684           0 :         ret = torture_setup_file(tctx, tree1, fname, false);
    8685           0 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    8686             : 
    8687           0 :         afpi = torture_afpinfo_new(tctx);
    8688           0 :         torture_assert_not_null_goto(tctx, afpi, ret, done,
    8689             :                                      "torture_afpinfo_new failed\n");
    8690             : 
    8691           0 :         memcpy(afpi->afpi_FinderInfo, "FOO BAR ", 8);
    8692             : 
    8693           0 :         ret = torture_write_afpinfo(tree1, tctx, tctx, fname, afpi);
    8694           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8695             :                             "torture_write_afpinfo failed\n");
    8696             : 
    8697           0 :         ret = write_stream(tree1, __location__, tctx, tctx,
    8698             :                            fname,
    8699             :                            /*
    8700             :                             * \xef\x80\xa2 is ':' mapped to Unicoe private range
    8701             :                             */
    8702             :                            ":org.samba" "\xef\x80\xa2" "woohoo",
    8703             :                            0, 4, "bar");
    8704           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8705             :                             "write_stream failed\n");
    8706             : 
    8707           0 :         ret = write_stream(tree1, __location__, tctx, tctx,
    8708             :                            fname, AFPRESOURCE_STREAM_NAME,
    8709             :                            0, 4, "bar");
    8710           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8711             :                             "write_stream failed\n");
    8712             : 
    8713           0 :         cmd = talloc_asprintf(tctx,
    8714             :                               "%s --recursive vfs stream2adouble %s %s/",
    8715             :                               net,
    8716             :                               share,
    8717             :                               BASEDIR);
    8718           0 :         torture_assert_not_null_goto(tctx, cmd, ret, done,
    8719             :                                      "talloc_asprintf failed\n");
    8720             : 
    8721           0 :         torture_comment(tctx, "cmd: %s\n", cmd);
    8722             : 
    8723           0 :         result = system(cmd);
    8724           0 :         torture_assert_int_equal_goto(tctx, result, 0, ret, done,
    8725             :                             "command failed\n");
    8726             : 
    8727           0 :         status = torture_smb2_testfile(tree2, adname, &h1);
    8728           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8729             :                                         "torture_smb2_testfile failed\n");
    8730             : 
    8731           0 :         finfo = (union smb_fileinfo) {
    8732             :                 .generic.level = RAW_FILEINFO_ALL_INFORMATION,
    8733             :                 .generic.in.file.handle = h1,
    8734             :         };
    8735             : 
    8736           0 :         status = smb2_getinfo_file(tree2, tctx, &finfo);
    8737           0 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8738             :                                         "torture_smb2_testdir\n");
    8739           0 :         smb2_util_close(tree2, h1);
    8740             : 
    8741           0 :         adsize = finfo.all_info.out.size;
    8742           0 :         torture_assert_int_equal_goto(tctx, adsize,
    8743             :                                       sizeof(unconvert_adfile_data),
    8744             :                                       ret, done, "wrong size\n");
    8745             : 
    8746           0 :         ret = check_stream(tree2, __location__, tctx, tctx,
    8747             :                            adname, "", 0, adsize, 0, adsize,
    8748             :                            unconvert_adfile_data);
    8749           0 :         torture_assert_goto(tctx, ret == true, ret, done,
    8750             :                             "check_stream failed\n");
    8751             : 
    8752           0 : done:
    8753             : //      smb2_deltree(tree1, BASEDIR);
    8754           0 :         return ret;
    8755             : }
    8756             : 
    8757         964 : struct torture_suite *torture_vfs_fruit_unfruit(TALLOC_CTX *ctx)
    8758             : {
    8759         964 :         struct torture_suite *suite = torture_suite_create(
    8760             :                 ctx, "unfruit");
    8761             : 
    8762         964 :         suite->description = talloc_strdup(
    8763             :                 suite, "test converting back to AppleDouble");
    8764             : 
    8765         964 :         torture_suite_add_2ns_smb2_test(suite,
    8766             :                                         "unconvert",
    8767             :                                         test_unconvert);
    8768             : 
    8769         964 :         return suite;
    8770             : }

Generated by: LCOV version 1.13