LCOV - code coverage report
Current view: top level - source4/torture/vfs - fruit.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 2696 3115 86.5 %
Date: 2024-04-21 15:09:00 Functions: 72 72 100.0 %

          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        1170 : static int qsort_string(char * const *s1, char * const *s2)
      74             : {
      75        1170 :         return strcmp(*s1, *s2);
      76             : }
      77             : 
      78        1184 : static int qsort_stream(const struct stream_struct * s1, const struct stream_struct *s2)
      79             : {
      80        1184 :         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         106 : static AfpInfo *torture_afpinfo_new(TALLOC_CTX *mem_ctx)
    1694             : {
    1695           0 :         AfpInfo *info;
    1696             : 
    1697         106 :         info = talloc_zero(mem_ctx, AfpInfo);
    1698         106 :         if (info == NULL) {
    1699           0 :                 return NULL;
    1700             :         }
    1701             : 
    1702         106 :         info->afpi_Signature = AFP_Signature;
    1703         106 :         info->afpi_Version = AFP_Version;
    1704         106 :         info->afpi_BackupTime = AFP_BackupTime;
    1705             : 
    1706         106 :         return info;
    1707             : }
    1708             : 
    1709             : /**
    1710             :  * Pack AfpInfo into a talloced buffer
    1711             :  **/
    1712         122 : static char *torture_afpinfo_pack(TALLOC_CTX *mem_ctx,
    1713             :                                   AfpInfo *info)
    1714             : {
    1715           0 :         char *buf;
    1716             : 
    1717         122 :         buf = talloc_zero_array(mem_ctx, char, AFP_INFO_SIZE);
    1718         122 :         if (buf == NULL) {
    1719           0 :                 return NULL;
    1720             :         }
    1721             : 
    1722         122 :         RSIVAL(buf, 0, info->afpi_Signature);
    1723         122 :         RSIVAL(buf, 4, info->afpi_Version);
    1724         122 :         RSIVAL(buf, 12, info->afpi_BackupTime);
    1725         122 :         memcpy(buf + 16, info->afpi_FinderInfo, sizeof(info->afpi_FinderInfo));
    1726             : 
    1727         122 :         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          90 : 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           0 :         struct smb2_handle handle;
    1751           0 :         struct smb2_create io;
    1752           0 :         NTSTATUS status;
    1753           0 :         const char *full_name;
    1754           0 :         char *infobuf;
    1755          90 :         bool ret = true;
    1756             : 
    1757          90 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, AFPINFO_STREAM_NAME);
    1758          90 :         if (full_name == NULL) {
    1759           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1760           0 :             return false;
    1761             :         }
    1762          90 :         ZERO_STRUCT(io);
    1763          90 :         io.in.desired_access = SEC_FILE_WRITE_DATA;
    1764          90 :         io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1765          90 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    1766          90 :         io.in.create_options = 0;
    1767          90 :         io.in.fname = full_name;
    1768             : 
    1769          90 :         status = smb2_create(tree, mem_ctx, &io);
    1770          90 :         CHECK_STATUS(status, NT_STATUS_OK);
    1771             : 
    1772          90 :         handle = io.out.file.handle;
    1773             : 
    1774          90 :         infobuf = torture_afpinfo_pack(mem_ctx, info);
    1775          90 :         if (infobuf == NULL) {
    1776           0 :                 return false;
    1777             :         }
    1778             : 
    1779          90 :         status = smb2_util_write(tree, handle, infobuf, 0, AFP_INFO_SIZE);
    1780          90 :         CHECK_STATUS(status, NT_STATUS_OK);
    1781             : 
    1782          90 :         smb2_util_close(tree, handle);
    1783             : 
    1784          90 : done:
    1785          90 :         return ret;
    1786             : }
    1787             : 
    1788             : /**
    1789             :  * Read 'count' bytes at 'offset' from stream 'fname:sname' and
    1790             :  * compare against buffer 'value'
    1791             :  **/
    1792         544 : 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           0 :         struct smb2_handle handle;
    1805           0 :         struct smb2_create create;
    1806           0 :         struct smb2_read r;
    1807           0 :         NTSTATUS status;
    1808           0 :         char *full_name;
    1809         544 :         bool ret = true;
    1810             : 
    1811         544 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
    1812         544 :         if (full_name == NULL) {
    1813           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1814           0 :             return false;
    1815             :         }
    1816         544 :         ZERO_STRUCT(create);
    1817         544 :         create.in.desired_access = SEC_FILE_READ_DATA;
    1818         544 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1819         544 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    1820         544 :         create.in.fname = full_name;
    1821             : 
    1822         544 :         torture_comment(tctx, "Open stream %s\n", full_name);
    1823             : 
    1824         544 :         status = smb2_create(tree, mem_ctx, &create);
    1825         544 :         if (!NT_STATUS_IS_OK(status)) {
    1826           2 :                 if (value == NULL) {
    1827           0 :                         TALLOC_FREE(full_name);
    1828           0 :                         return true;
    1829             :                 }
    1830           2 :                 torture_comment(tctx, "Unable to open stream %s: %s\n",
    1831             :                         full_name, nt_errstr(status));
    1832           2 :                 TALLOC_FREE(full_name);
    1833           2 :                 return false;
    1834             :         }
    1835             : 
    1836         542 :         handle = create.out.file.handle;
    1837         542 :         if (value == NULL) {
    1838           0 :                 TALLOC_FREE(full_name);
    1839           0 :                 smb2_util_close(tree, handle);
    1840           0 :                 return true;
    1841             :         }
    1842             : 
    1843         542 :         ZERO_STRUCT(r);
    1844         542 :         r.in.file.handle = handle;
    1845         542 :         r.in.length      = read_count;
    1846         542 :         r.in.offset      = read_offset;
    1847             : 
    1848         542 :         status = smb2_read(tree, tree, &r);
    1849             : 
    1850         542 :         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         542 :         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         542 :         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         542 : done:
    1865         542 :         TALLOC_FREE(full_name);
    1866         542 :         smb2_util_close(tree, handle);
    1867         542 :         return ret;
    1868             : }
    1869             : 
    1870             : /**
    1871             :  * Read 'count' bytes at 'offset' from stream 'fname:sname' and
    1872             :  * compare against buffer 'value'
    1873             :  **/
    1874          40 : 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           0 :         struct smb2_handle handle;
    1884           0 :         struct smb2_create create;
    1885           0 :         struct smb2_read r;
    1886           0 :         NTSTATUS status;
    1887           0 :         const char *full_name;
    1888          40 :         bool ret = true;
    1889             : 
    1890          40 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
    1891          40 :         if (full_name == NULL) {
    1892           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1893           0 :             return -1;
    1894             :         }
    1895          40 :         ZERO_STRUCT(create);
    1896          40 :         create.in.desired_access = SEC_FILE_READ_DATA;
    1897          40 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1898          40 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    1899          40 :         create.in.fname = full_name;
    1900             : 
    1901          40 :         torture_comment(tctx, "Open stream %s\n", full_name);
    1902             : 
    1903          40 :         status = smb2_create(tree, mem_ctx, &create);
    1904          40 :         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          40 :         handle = create.out.file.handle;
    1911             : 
    1912          40 :         ZERO_STRUCT(r);
    1913          40 :         r.in.file.handle = handle;
    1914          40 :         r.in.length      = read_count;
    1915          40 :         r.in.offset      = read_offset;
    1916             : 
    1917          40 :         status = smb2_read(tree, tree, &r);
    1918          40 :         if (!NT_STATUS_IS_OK(status)) {
    1919          10 :                 CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
    1920             :         }
    1921             : 
    1922          40 :         smb2_util_close(tree, handle);
    1923             : 
    1924          40 : done:
    1925          40 :         if (ret == false) {
    1926           0 :                 return -1;
    1927             :         }
    1928          40 :         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         162 : 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           0 :         struct smb2_handle handle;
    1946           0 :         struct smb2_create create;
    1947           0 :         NTSTATUS status;
    1948           0 :         const char *full_name;
    1949             : 
    1950         162 :         full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname ? sname : "");
    1951         162 :         if (full_name == NULL) {
    1952           0 :             torture_comment(tctx, "talloc_asprintf error\n");
    1953           0 :             return false;
    1954             :         }
    1955         162 :         ZERO_STRUCT(create);
    1956         162 :         create.in.desired_access = SEC_FILE_WRITE_DATA;
    1957         162 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    1958         162 :         create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    1959         162 :         create.in.fname = full_name;
    1960             : 
    1961         162 :         status = smb2_create(tree, mem_ctx, &create);
    1962         162 :         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         162 :         handle = create.out.file.handle;
    1973         162 :         if (value == NULL) {
    1974           0 :                 return true;
    1975             :         }
    1976             : 
    1977         162 :         status = smb2_util_write(tree, handle, value, offset, size);
    1978             : 
    1979         162 :         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         162 :         smb2_util_close(tree, handle);
    1986         162 :         return true;
    1987             : }
    1988             : 
    1989           4 : 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           4 :         int ret = true;
    1997           0 :         int result;
    1998           0 :         const char *spath;
    1999           0 :         char *path;
    2000             : 
    2001           4 :         spath = torture_setting_string(tctx, path_option, NULL);
    2002           4 :         if (spath == NULL) {
    2003           0 :                 printf("No sharepath for option %s\n", path_option);
    2004           0 :                 return false;
    2005             :         }
    2006             : 
    2007           4 :         path = talloc_asprintf(tctx, "%s/%s", spath, name);
    2008             : 
    2009           4 :         result = setxattr(path, xattr, metadata, size, 0);
    2010           4 :         if (result != 0) {
    2011           0 :                 ret = false;
    2012             :         }
    2013             : 
    2014           4 :         TALLOC_FREE(path);
    2015             : 
    2016           4 :         return ret;
    2017             : }
    2018             : 
    2019             : /**
    2020             :  * Create a file or directory
    2021             :  **/
    2022         322 : static bool torture_setup_file(TALLOC_CTX *mem_ctx, struct smb2_tree *tree,
    2023             :                                const char *name, bool dir)
    2024             : {
    2025           0 :         struct smb2_create io;
    2026           0 :         NTSTATUS status;
    2027             : 
    2028         322 :         smb2_util_unlink(tree, name);
    2029         322 :         ZERO_STRUCT(io);
    2030         322 :         io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
    2031         322 :         io.in.file_attributes   = FILE_ATTRIBUTE_NORMAL;
    2032         322 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    2033         322 :         io.in.share_access =
    2034             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    2035             :                 NTCREATEX_SHARE_ACCESS_READ|
    2036             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2037         322 :         io.in.create_options = 0;
    2038         322 :         io.in.fname = name;
    2039         322 :         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         322 :         status = smb2_create(tree, mem_ctx, &io);
    2047         322 :         if (!NT_STATUS_IS_OK(status)) {
    2048           0 :                 return false;
    2049             :         }
    2050             : 
    2051         322 :         status = smb2_util_close(tree, io.out.file.handle);
    2052         322 :         if (!NT_STATUS_IS_OK(status)) {
    2053           0 :                 return false;
    2054             :         }
    2055             : 
    2056         322 :         return true;
    2057             : }
    2058             : 
    2059         112 : static bool enable_aapl(struct torture_context *tctx,
    2060             :                         struct smb2_tree *tree)
    2061             : {
    2062         112 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2063           0 :         NTSTATUS status;
    2064         112 :         bool ret = true;
    2065           0 :         struct smb2_create io;
    2066           0 :         DATA_BLOB data;
    2067         112 :         struct smb2_create_blob *aapl = NULL;
    2068           0 :         uint32_t aapl_server_caps;
    2069         112 :         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         112 :         bool is_osx_server = torture_setting_bool(tctx, "osx", false);
    2074             : 
    2075         112 :         ZERO_STRUCT(io);
    2076         112 :         io.in.desired_access     = SEC_FLAG_MAXIMUM_ALLOWED;
    2077         112 :         io.in.file_attributes    = FILE_ATTRIBUTE_DIRECTORY;
    2078         112 :         io.in.create_disposition = NTCREATEX_DISP_OPEN;
    2079         112 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
    2080             :                               NTCREATEX_SHARE_ACCESS_READ |
    2081             :                               NTCREATEX_SHARE_ACCESS_WRITE);
    2082         112 :         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         112 :         data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
    2091         112 :         SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
    2092         112 :         SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS |
    2093             :                              SMB2_CRTCTX_AAPL_VOLUME_CAPS |
    2094             :                              SMB2_CRTCTX_AAPL_MODEL_INFO));
    2095         112 :         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         112 :         status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
    2100         112 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create_blob_add");
    2101             : 
    2102         112 :         status = smb2_create(tree, tctx, &io);
    2103         112 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2104             : 
    2105         112 :         status = smb2_util_close(tree, io.out.file.handle);
    2106         112 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_close");
    2107             : 
    2108             :         /*
    2109             :          * Now check returned AAPL context
    2110             :          */
    2111         112 :         torture_comment(tctx, "Comparing returned AAPL capabilities\n");
    2112             : 
    2113         112 :         aapl = smb2_create_blob_find(&io.out.blobs,
    2114             :                                      SMB2_CREATE_TAG_AAPL);
    2115         112 :         torture_assert_goto(tctx, aapl != NULL, ret, done, "missing AAPL context");
    2116             : 
    2117         112 :         if (!is_osx_server) {
    2118           0 :                 size_t expected_aapl_ctx_size;
    2119             : 
    2120         112 :                 expected_aapl_ctx_size = strlen("MacSamba") * 2 + 40;
    2121             : 
    2122         112 :                 torture_assert_goto(
    2123             :                         tctx, aapl->data.length == expected_aapl_ctx_size,
    2124             :                         ret, done, "bad AAPL size");
    2125             :         }
    2126             : 
    2127         112 :         aapl_server_caps = BVAL(aapl->data.data, 16);
    2128         112 :         torture_assert_goto(tctx, aapl_server_caps == expected_scaps,
    2129             :                             ret, done, "bad AAPL caps");
    2130             : 
    2131         112 : done:
    2132         112 :         talloc_free(mem_ctx);
    2133         112 :         return ret;
    2134             : }
    2135             : 
    2136           2 : static bool test_read_netatalk_metadata(struct torture_context *tctx,
    2137             :                                         struct smb2_tree *tree)
    2138             : {
    2139           2 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2140           2 :         const char *fname = BASEDIR "\\torture_read_metadata";
    2141           0 :         NTSTATUS status;
    2142           0 :         struct smb2_handle testdirh;
    2143           2 :         bool ret = true;
    2144           0 :         ssize_t len;
    2145           2 :         const char *localdir = NULL;
    2146             : 
    2147           2 :         torture_comment(tctx, "Checking metadata access\n");
    2148             : 
    2149           2 :         localdir = torture_setting_string(tctx, "localdir", NULL);
    2150           2 :         if (localdir == NULL) {
    2151           0 :                 torture_skip(tctx, "Need localdir for test");
    2152             :         }
    2153             : 
    2154           2 :         smb2_util_unlink(tree, fname);
    2155             : 
    2156           2 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2157           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    2158           2 :         smb2_util_close(tree, testdirh);
    2159             : 
    2160           2 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2161           2 :         if (ret == false) {
    2162           0 :                 goto done;
    2163             :         }
    2164             : 
    2165           2 :         ret = torture_setup_local_xattr(tctx, "localdir",
    2166             :                                         BASEDIR "/torture_read_metadata",
    2167             :                                         AFPINFO_EA_NETATALK,
    2168             :                                         metadata_xattr, sizeof(metadata_xattr));
    2169           2 :         if (ret == false) {
    2170           0 :                 goto done;
    2171             :         }
    2172             : 
    2173           2 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2174             :                            0, 60, 0, 4, "AFP");
    2175           2 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2176             : 
    2177           2 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2178             :                            0, 60, 16, 8, "BARRFOOO");
    2179           2 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2180             : 
    2181           2 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2182             :                            16, 8, 0, 3, "AFP");
    2183           2 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2184             : 
    2185             :         /* Check reading offset and read size > sizeof(AFPINFO_STREAM) */
    2186             : 
    2187           2 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2188             :                           AFPINFO_STREAM, 0, 61);
    2189           2 :         CHECK_VALUE(len, 60);
    2190             : 
    2191           2 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2192             :                           AFPINFO_STREAM, 59, 2);
    2193           2 :         CHECK_VALUE(len, 2);
    2194             : 
    2195           2 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2196             :                           AFPINFO_STREAM, 60, 1);
    2197           2 :         CHECK_VALUE(len, 1);
    2198             : 
    2199           2 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2200             :                           AFPINFO_STREAM, 61, 1);
    2201           2 :         CHECK_VALUE(len, 0);
    2202             : 
    2203           2 : done:
    2204           2 :         smb2_deltree(tree, BASEDIR);
    2205           2 :         talloc_free(mem_ctx);
    2206           2 :         return ret;
    2207             : }
    2208             : 
    2209           8 : static bool test_read_afpinfo(struct torture_context *tctx,
    2210             :                               struct smb2_tree *tree)
    2211             : {
    2212           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2213           8 :         const char *fname = BASEDIR "\\torture_read_metadata";
    2214           0 :         NTSTATUS status;
    2215           0 :         struct smb2_handle testdirh;
    2216           8 :         bool ret = true;
    2217           0 :         ssize_t len;
    2218           0 :         AfpInfo *info;
    2219           8 :         const char *type_creator = "SMB,OLE!";
    2220             : 
    2221           8 :         torture_comment(tctx, "Checking metadata access\n");
    2222             : 
    2223           8 :         smb2_util_unlink(tree, fname);
    2224             : 
    2225           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2226           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir failed");
    2227           8 :         smb2_util_close(tree, testdirh);
    2228             : 
    2229           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2230           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
    2231             : 
    2232           8 :         info = torture_afpinfo_new(mem_ctx);
    2233           8 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    2234             : 
    2235           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    2236           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    2237           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    2238             : 
    2239           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2240             :                            0, 60, 0, 4, "AFP");
    2241           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2242             : 
    2243           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2244             :                            0, 60, 16, 8, type_creator);
    2245           8 :         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           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2253             :                            16, 8, 0, 8, "AFP\0\0\0\001\0");
    2254           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2255             : 
    2256           8 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2257             :                           AFPINFO_STREAM, 0, 61);
    2258           8 :         torture_assert_goto(tctx, len == 60, ret, done, "read_stream failed");
    2259             : 
    2260           8 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2261             :                           AFPINFO_STREAM, 59, 2);
    2262           8 :         torture_assert_goto(tctx, len == 2, ret, done, "read_stream failed");
    2263             : 
    2264           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2265             :                            59, 2, 0, 2, "AF");
    2266           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2267             : 
    2268           8 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2269             :                           AFPINFO_STREAM, 60, 1);
    2270           8 :         torture_assert_goto(tctx, len == 1, ret, done, "read_stream failed");
    2271             : 
    2272           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2273             :                            60, 1, 0, 1, "A");
    2274           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    2275             : 
    2276           8 :         len = read_stream(tree, __location__, tctx, mem_ctx, fname,
    2277             :                           AFPINFO_STREAM, 61, 1);
    2278           8 :         torture_assert_goto(tctx, len == 0, ret, done, "read_stream failed");
    2279             : 
    2280           8 : done:
    2281           8 :         smb2_util_unlink(tree, fname);
    2282           8 :         smb2_deltree(tree, BASEDIR);
    2283           8 :         talloc_free(mem_ctx);
    2284           8 :         return ret;
    2285             : }
    2286             : 
    2287           8 : static bool test_write_atalk_metadata(struct torture_context *tctx,
    2288             :                                       struct smb2_tree *tree)
    2289             : {
    2290           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2291           8 :         const char *fname = BASEDIR "\\torture_write_metadata";
    2292           8 :         const char *type_creator = "SMB,OLE!";
    2293           0 :         NTSTATUS status;
    2294           0 :         struct smb2_handle testdirh;
    2295           8 :         bool ret = true;
    2296           0 :         AfpInfo *info;
    2297             : 
    2298           8 :         smb2_deltree(tree, BASEDIR);
    2299           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2300           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2301           8 :         smb2_util_close(tree, testdirh);
    2302             : 
    2303           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2304           8 :         if (ret == false) {
    2305           0 :                 goto done;
    2306             :         }
    2307             : 
    2308           8 :         info = torture_afpinfo_new(mem_ctx);
    2309           8 :         if (info == NULL) {
    2310           0 :                 goto done;
    2311             :         }
    2312             : 
    2313           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    2314           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    2315           8 :         ret &= check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    2316             :                             0, 60, 16, 8, type_creator);
    2317             : 
    2318           8 : done:
    2319           8 :         smb2_util_unlink(tree, fname);
    2320           8 :         smb2_deltree(tree, BASEDIR);
    2321           8 :         talloc_free(mem_ctx);
    2322           8 :         return ret;
    2323             : }
    2324             : 
    2325           8 : static bool test_write_atalk_rfork_io(struct torture_context *tctx,
    2326             :                                       struct smb2_tree *tree)
    2327             : {
    2328           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2329           8 :         const char *fname = BASEDIR "\\torture_write_rfork_io";
    2330           8 :         const char *rfork = BASEDIR "\\torture_write_rfork_io" AFPRESOURCE_STREAM_NAME;
    2331           8 :         const char *rfork_content = "1234567890";
    2332           0 :         NTSTATUS status;
    2333           0 :         struct smb2_handle testdirh;
    2334           8 :         bool ret = true;
    2335             : 
    2336           0 :         union smb_open io;
    2337           0 :         struct smb2_handle filehandle;
    2338           0 :         union smb_fileinfo finfo;
    2339           0 :         union smb_setfileinfo sinfo;
    2340             : 
    2341           8 :         smb2_util_unlink(tree, fname);
    2342             : 
    2343           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2344           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2345           8 :         smb2_util_close(tree, testdirh);
    2346             : 
    2347           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2348           8 :         if (ret == false) {
    2349           0 :                 goto done;
    2350             :         }
    2351             : 
    2352           8 :         torture_comment(tctx, "(%s) writing to resource fork\n",
    2353             :             __location__);
    2354             : 
    2355           8 :         ret &= write_stream(tree, __location__, tctx, mem_ctx,
    2356             :                             fname, AFPRESOURCE_STREAM_NAME,
    2357             :                             10, 10, rfork_content);
    2358             : 
    2359           8 :         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           8 :         ZERO_STRUCT(io);
    2366           8 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2367           8 :         io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
    2368             :                 SEC_FILE_WRITE_ATTRIBUTE;
    2369           8 :         io.smb2.in.fname = rfork;
    2370           8 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2371           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2372           8 :         filehandle = io.smb2.out.file.handle;
    2373             : 
    2374           8 :         torture_comment(tctx, "(%s) check resource fork size after write\n",
    2375             :             __location__);
    2376             : 
    2377           8 :         ZERO_STRUCT(finfo);
    2378           8 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2379           8 :         finfo.generic.in.file.handle = filehandle;
    2380           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2381           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2382           8 :         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           8 :         smb2_util_close(tree, filehandle);
    2391             : 
    2392             :         /* Write at large offset */
    2393             : 
    2394           8 :         torture_comment(tctx, "(%s) writing to resource fork at large offset\n",
    2395             :                         __location__);
    2396             : 
    2397           8 :         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           8 :         ZERO_STRUCT(io);
    2404           8 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2405           8 :         io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
    2406             :                 SEC_FILE_WRITE_ATTRIBUTE;
    2407           8 :         io.smb2.in.fname = rfork;
    2408           8 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2409           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2410           8 :         filehandle = io.smb2.out.file.handle;
    2411             : 
    2412           8 :         torture_comment(tctx, "(%s) check resource fork size after write\n",
    2413             :             __location__);
    2414             : 
    2415           8 :         ZERO_STRUCT(finfo);
    2416           8 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2417           8 :         finfo.generic.in.file.handle = filehandle;
    2418           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2419           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2420           8 :         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           8 :         smb2_util_close(tree, filehandle);
    2429             : 
    2430           8 :         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           8 :         torture_comment(tctx, "(%s) truncate resource fork and check size\n",
    2437             :                         __location__);
    2438             : 
    2439           8 :         ZERO_STRUCT(io);
    2440           8 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2441           8 :         io.smb2.in.desired_access = SEC_FILE_ALL;
    2442           8 :         io.smb2.in.fname = rfork;
    2443           8 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2444           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2445           8 :         filehandle = io.smb2.out.file.handle;
    2446             : 
    2447           8 :         ZERO_STRUCT(sinfo);
    2448           8 :         sinfo.end_of_file_info.level =
    2449             :                 RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    2450           8 :         sinfo.end_of_file_info.in.file.handle = filehandle;
    2451           8 :         sinfo.end_of_file_info.in.size = 1;
    2452           8 :         status = smb2_setinfo_file(tree, &sinfo);
    2453           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2454             : 
    2455           8 :         smb2_util_close(tree, filehandle);
    2456             : 
    2457             :         /* Now check size */
    2458           8 :         ZERO_STRUCT(io);
    2459           8 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    2460           8 :         io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
    2461             :                 SEC_FILE_WRITE_ATTRIBUTE;
    2462           8 :         io.smb2.in.fname = rfork;
    2463           8 :         status = smb2_create(tree, mem_ctx, &(io.smb2));
    2464           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2465           8 :         filehandle = io.smb2.out.file.handle;
    2466             : 
    2467           8 :         ZERO_STRUCT(finfo);
    2468           8 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2469           8 :         finfo.generic.in.file.handle = filehandle;
    2470           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2471           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2472           8 :         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           8 :         smb2_util_close(tree, filehandle);
    2481             : 
    2482           8 : done:
    2483           8 :         smb2_util_unlink(tree, fname);
    2484           8 :         smb2_deltree(tree, BASEDIR);
    2485           8 :         talloc_free(mem_ctx);
    2486           8 :         return ret;
    2487             : }
    2488             : 
    2489           8 : static bool test_rfork_truncate(struct torture_context *tctx,
    2490             :                                 struct smb2_tree *tree)
    2491             : {
    2492           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2493           8 :         const char *fname = BASEDIR "\\torture_rfork_truncate";
    2494           8 :         const char *rfork = BASEDIR "\\torture_rfork_truncate" AFPRESOURCE_STREAM;
    2495           8 :         const char *rfork_content = "1234567890";
    2496           0 :         NTSTATUS status;
    2497           0 :         struct smb2_handle testdirh;
    2498           8 :         bool ret = true;
    2499           0 :         struct smb2_create create;
    2500           0 :         struct smb2_handle fh1, fh2, fh3;
    2501           0 :         union smb_setfileinfo sinfo;
    2502             : 
    2503           8 :         ret = enable_aapl(tctx, tree);
    2504           8 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    2505             : 
    2506           8 :         smb2_util_unlink(tree, fname);
    2507             : 
    2508           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2509           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    2510           8 :         smb2_util_close(tree, testdirh);
    2511             : 
    2512           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2513           8 :         if (ret == false) {
    2514           0 :                 goto done;
    2515             :         }
    2516             : 
    2517           8 :         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           8 :         torture_comment(tctx, "(%s) truncate resource fork to size 0\n",
    2524             :                         __location__);
    2525             : 
    2526           8 :         ZERO_STRUCT(create);
    2527           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2528           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2529           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2530           8 :         create.in.fname               = fname;
    2531           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2532             :                 NTCREATEX_SHARE_ACCESS_READ |
    2533             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2534           8 :         status = smb2_create(tree, mem_ctx, &create);
    2535           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2536           8 :         fh1 = create.out.file.handle;
    2537             : 
    2538           8 :         ZERO_STRUCT(create);
    2539           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2540           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2541           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2542           8 :         create.in.fname               = rfork;
    2543           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2544             :                 NTCREATEX_SHARE_ACCESS_READ |
    2545             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2546           8 :         status = smb2_create(tree, mem_ctx, &create);
    2547           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2548           8 :         fh2 = create.out.file.handle;
    2549             : 
    2550           8 :         ZERO_STRUCT(sinfo);
    2551           8 :         sinfo.end_of_file_info.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    2552           8 :         sinfo.end_of_file_info.in.file.handle = fh2;
    2553           8 :         sinfo.end_of_file_info.in.size = 0;
    2554           8 :         status = smb2_setinfo_file(tree, &sinfo);
    2555           8 :         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           8 :         ZERO_STRUCT(create);
    2561           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2562           8 :         create.in.desired_access      = SEC_FILE_ALL;
    2563           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2564           8 :         create.in.fname               = rfork;
    2565           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2566             :                 NTCREATEX_SHARE_ACCESS_READ |
    2567             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2568           8 :         status = smb2_create(tree, mem_ctx, &create);
    2569           8 :         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           8 :         ZERO_STRUCT(create);
    2579           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2580           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2581           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2582           8 :         create.in.fname               = rfork;
    2583           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2584             :                 NTCREATEX_SHARE_ACCESS_READ |
    2585             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2586           8 :         status = smb2_create(tree, mem_ctx, &create);
    2587           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2588           8 :         fh3 = create.out.file.handle;
    2589             : 
    2590           8 :         status = smb2_util_write(tree, fh3, "foo", 0, 3);
    2591           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_write");
    2592             : 
    2593           8 :         smb2_util_close(tree, fh3);
    2594           8 :         smb2_util_close(tree, fh2);
    2595           8 :         smb2_util_close(tree, fh1);
    2596             : 
    2597           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM,
    2598             :                            0, 3, 0, 3, "foo");
    2599           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream");
    2600             : 
    2601           8 : done:
    2602           8 :         smb2_util_unlink(tree, fname);
    2603           8 :         smb2_deltree(tree, BASEDIR);
    2604           8 :         talloc_free(mem_ctx);
    2605           8 :         return ret;
    2606             : }
    2607             : 
    2608           8 : static bool test_rfork_create(struct torture_context *tctx,
    2609             :                               struct smb2_tree *tree)
    2610             : {
    2611           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2612           8 :         const char *fname = BASEDIR "\\torture_rfork_create";
    2613           8 :         const char *rfork = BASEDIR "\\torture_rfork_create" AFPRESOURCE_STREAM;
    2614           0 :         NTSTATUS status;
    2615           0 :         struct smb2_handle testdirh;
    2616           8 :         bool ret = true;
    2617           0 :         struct smb2_create create;
    2618           0 :         struct smb2_handle fh1;
    2619           8 :         const char *streams[] = {
    2620             :                 "::$DATA"
    2621             :         };
    2622           0 :         union smb_fileinfo finfo;
    2623             : 
    2624           8 :         ret = enable_aapl(tctx, tree);
    2625           8 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    2626             : 
    2627           8 :         smb2_util_unlink(tree, fname);
    2628             : 
    2629           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2630           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    2631           8 :         smb2_util_close(tree, testdirh);
    2632             : 
    2633           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2634           8 :         if (ret == false) {
    2635           0 :                 goto done;
    2636             :         }
    2637             : 
    2638           8 :         torture_comment(tctx, "(%s) open rfork, should return ENOENT\n",
    2639             :                         __location__);
    2640             : 
    2641           8 :         ZERO_STRUCT(create);
    2642           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2643           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2644           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2645           8 :         create.in.fname               = rfork;
    2646           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2647             :                 NTCREATEX_SHARE_ACCESS_READ |
    2648             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2649           8 :         status = smb2_create(tree, mem_ctx, &create);
    2650           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
    2651             : 
    2652           8 :         torture_comment(tctx, "(%s) create resource fork\n", __location__);
    2653             : 
    2654           8 :         ZERO_STRUCT(create);
    2655           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2656           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2657           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2658           8 :         create.in.fname               = rfork;
    2659           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2660             :                 NTCREATEX_SHARE_ACCESS_READ |
    2661             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2662           8 :         status = smb2_create(tree, mem_ctx, &create);
    2663           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2664           8 :         fh1 = create.out.file.handle;
    2665             : 
    2666           8 :         torture_comment(tctx, "(%s) getinfo on create handle\n",
    2667             :                         __location__);
    2668             : 
    2669           8 :         ZERO_STRUCT(finfo);
    2670           8 :         finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
    2671           8 :         finfo.generic.in.file.handle = fh1;
    2672           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    2673           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_getinfo_file");
    2674           8 :         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           8 :         torture_comment(tctx, "(%s) open rfork, should still return ENOENT\n",
    2684             :                         __location__);
    2685             : 
    2686           8 :         ZERO_STRUCT(create);
    2687           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2688           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2689           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2690           8 :         create.in.fname               = rfork;
    2691           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2692             :                 NTCREATEX_SHARE_ACCESS_READ |
    2693             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2694           8 :         status = smb2_create(tree, mem_ctx, &create);
    2695           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
    2696             : 
    2697           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams, false);
    2698           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    2699             : 
    2700           8 :         torture_comment(tctx, "(%s) close empty created rfork, open should return ENOENT\n",
    2701             :                         __location__);
    2702             : 
    2703           8 :         ZERO_STRUCT(create);
    2704           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN;
    2705           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2706           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2707           8 :         create.in.fname               = rfork;
    2708           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2709             :                 NTCREATEX_SHARE_ACCESS_READ |
    2710             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2711           8 :         status = smb2_create(tree, mem_ctx, &create);
    2712           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done, "smb2_create");
    2713             : 
    2714           8 : done:
    2715           8 :         smb2_util_unlink(tree, fname);
    2716           8 :         smb2_deltree(tree, BASEDIR);
    2717           8 :         talloc_free(mem_ctx);
    2718           8 :         return ret;
    2719             : }
    2720             : 
    2721             : /*
    2722             :  * BUG: https://bugzilla.samba.org/show_bug.cgi?id=15182
    2723             :  */
    2724             : 
    2725           8 : static bool test_rfork_fsync(struct torture_context *tctx,
    2726             :                               struct smb2_tree *tree)
    2727             : {
    2728           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2729           8 :         const char *fname = BASEDIR "\\torture_rfork_fsync";
    2730           8 :         const char *rfork = BASEDIR "\\torture_rfork_fsync" AFPRESOURCE_STREAM;
    2731           0 :         NTSTATUS status;
    2732           0 :         struct smb2_handle testdirh;
    2733           8 :         bool ret = true;
    2734           0 :         struct smb2_create create;
    2735           0 :         struct smb2_handle fh1;
    2736           0 :         struct smb2_flush f;
    2737             : 
    2738           8 :         ZERO_STRUCT(fh1);
    2739             : 
    2740           8 :         ret = enable_aapl(tctx, tree);
    2741           8 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    2742             : 
    2743           8 :         smb2_util_unlink(tree, fname);
    2744             : 
    2745           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2746           8 :         torture_assert_ntstatus_ok_goto(tctx,
    2747             :                                         status,
    2748             :                                         ret,
    2749             :                                         done,
    2750             :                                         "torture_smb2_testdir");
    2751           8 :         smb2_util_close(tree, testdirh);
    2752             : 
    2753           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2754           8 :         if (ret == false) {
    2755           0 :                 goto done;
    2756             :         }
    2757             : 
    2758           8 :         torture_comment(tctx, "(%s) create resource fork %s\n",
    2759             :                 __location__,
    2760             :                 rfork);
    2761             : 
    2762           8 :         ZERO_STRUCT(create);
    2763           8 :         create.in.create_disposition  = NTCREATEX_DISP_OPEN_IF;
    2764           8 :         create.in.desired_access      = SEC_STD_READ_CONTROL | SEC_FILE_ALL;
    2765           8 :         create.in.file_attributes     = FILE_ATTRIBUTE_NORMAL;
    2766           8 :         create.in.fname               = rfork;
    2767           8 :         create.in.share_access        = NTCREATEX_SHARE_ACCESS_DELETE |
    2768             :                 NTCREATEX_SHARE_ACCESS_READ |
    2769             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    2770           8 :         status = smb2_create(tree, mem_ctx, &create);
    2771           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    2772           8 :         fh1 = create.out.file.handle;
    2773             : 
    2774           8 :         torture_comment(tctx, "(%s) Write 10 bytes to resource fork %s\n",
    2775             :                 __location__,
    2776             :                 rfork);
    2777             : 
    2778           8 :         status = smb2_util_write(tree, fh1, "1234567890", 0, 10);
    2779           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2780             :                                         "smb2_util_write failed\n");
    2781             : 
    2782           8 :         torture_comment(tctx, "(%s) fsync on resource fork %s\n",
    2783             :                 __location__,
    2784             :                 rfork);
    2785             : 
    2786           8 :         f.in.file.handle = fh1;
    2787           8 :         status = smb2_flush(tree, &f);
    2788           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2789             :                                         "smb2_flush failed\n");
    2790             : 
    2791           8 : done:
    2792             : 
    2793           8 :         smb2_util_close(tree, fh1);
    2794           8 :         smb2_util_unlink(tree, fname);
    2795           8 :         smb2_deltree(tree, BASEDIR);
    2796           8 :         talloc_free(mem_ctx);
    2797           8 :         return ret;
    2798             : }
    2799             : 
    2800           8 : static bool test_rfork_create_ro(struct torture_context *tctx,
    2801             :                                  struct smb2_tree *tree)
    2802             : {
    2803           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2804           8 :         const char *fname = BASEDIR "\\torture_rfork_create";
    2805           8 :         const char *rfork = BASEDIR "\\torture_rfork_create" AFPRESOURCE_STREAM;
    2806           0 :         NTSTATUS status;
    2807           0 :         struct smb2_handle testdirh;
    2808           8 :         bool ret = true;
    2809           0 :         struct smb2_create create;
    2810             : 
    2811           8 :         smb2_util_unlink(tree, fname);
    2812           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2813           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2814             :                 "torture_smb2_testdir\n");
    2815           8 :         smb2_util_close(tree, testdirh);
    2816             : 
    2817           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    2818           8 :         if (ret == false) {
    2819           0 :                 goto done;
    2820             :         }
    2821             : 
    2822           8 :         torture_comment(tctx, "(%s) Try opening read-only with "
    2823             :                         "open_if create disposition, should work\n",
    2824             :                         __location__);
    2825             : 
    2826           8 :         ZERO_STRUCT(create);
    2827           8 :         create.in.fname = rfork;
    2828           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    2829           8 :         create.in.desired_access = SEC_FILE_READ_DATA | SEC_STD_READ_CONTROL;
    2830           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    2831           8 :         create.in.share_access = FILE_SHARE_READ | FILE_SHARE_DELETE;
    2832           8 :         status = smb2_create(tree, mem_ctx, &(create));
    2833           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2834             :                 "smb2_create failed\n");
    2835             : 
    2836           8 :         smb2_util_close(tree, create.out.file.handle);
    2837             : 
    2838           8 : done:
    2839           8 :         smb2_util_unlink(tree, fname);
    2840           8 :         smb2_deltree(tree, BASEDIR);
    2841           8 :         talloc_free(mem_ctx);
    2842           8 :         return ret;
    2843             : }
    2844             : 
    2845           8 : static bool test_adouble_conversion(struct torture_context *tctx,
    2846             :                                     struct smb2_tree *tree)
    2847             : {
    2848           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2849           8 :         const char *fname = BASEDIR "\\test_adouble_conversion";
    2850           8 :         const char *adname = BASEDIR "/._test_adouble_conversion";
    2851           0 :         NTSTATUS status;
    2852           0 :         struct smb2_handle testdirh;
    2853           8 :         bool ret = true;
    2854           8 :         const char data[] = {
    2855             :                 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
    2856             :                 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
    2857             :         };
    2858           8 :         size_t datalen = sizeof(data);
    2859           8 :         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           8 :         bool is_osx = torture_setting_bool(tctx, "osx", false);
    2867             : 
    2868           8 :         if (is_osx) {
    2869           0 :                 torture_skip(tctx, "Test only works with Samba\n");
    2870             :         }
    2871             : 
    2872           8 :         smb2_deltree(tree, BASEDIR);
    2873             : 
    2874           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2875           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    2876           8 :         smb2_util_close(tree, testdirh);
    2877             : 
    2878           8 :         ret = torture_setup_file(tctx, tree, fname, false);
    2879           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    2880             :                             "torture_setup_file failed\n");
    2881             : 
    2882           8 :         ret = torture_setup_file(tctx, tree, adname, false);
    2883           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    2884             :                             "torture_setup_file failed\n");
    2885             : 
    2886           8 :         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           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    2892             :                             "write_stream failed\n");
    2893             : 
    2894           8 :         torture_comment(tctx, "(%s) test OS X AppleDouble conversion\n",
    2895             :             __location__);
    2896             : 
    2897           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    2898             :                            fname, AFPRESOURCE_STREAM,
    2899             :                            16, datalen, 0, datalen, data);
    2900           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    2901             :                             "check AFPRESOURCE_STREAM failed\n");
    2902             : 
    2903           6 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    2904             :                            fname, AFPINFO_STREAM,
    2905             :                            0, 60, 16, 8, "TESTSLOW");
    2906           6 :         torture_assert_goto(tctx, ret == true, ret, done,
    2907             :                             "check AFPINFO_STREAM failed\n");
    2908             : 
    2909           6 :         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           6 :         torture_assert_goto(tctx, ret == true, ret, done,
    2913             :                             "check foo:bar stream failed\n");
    2914             : 
    2915           6 :         ret = check_stream_list(tree, tctx, fname, 5, streams, false);
    2916           6 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    2917             : 
    2918           6 : done:
    2919           8 :         smb2_deltree(tree, BASEDIR);
    2920           8 :         talloc_free(mem_ctx);
    2921           8 :         return ret;
    2922             : }
    2923             : 
    2924             : /*
    2925             :  * Test conversion of AppleDouble file without embedded xattr data
    2926             :  */
    2927           8 : static bool test_adouble_conversion_wo_xattr(struct torture_context *tctx,
    2928             :                                              struct smb2_tree *tree)
    2929             : {
    2930           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    2931           8 :         const char *fname = BASEDIR "\\test_adouble_conversion";
    2932           8 :         const char *adname = BASEDIR "/._test_adouble_conversion";
    2933           0 :         NTSTATUS status;
    2934           0 :         struct smb2_handle testdirh;
    2935           8 :         bool ret = true;
    2936           8 :         const char *streams[] = {
    2937             :                 "::$DATA",
    2938             :                 AFPINFO_STREAM,
    2939             :                 AFPRESOURCE_STREAM
    2940             :         };
    2941           0 :         struct smb2_create create;
    2942           0 :         struct smb2_find find;
    2943           0 :         unsigned int count;
    2944           0 :         union smb_search_data *d;
    2945           8 :         const char data[] = {
    2946             :                 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
    2947             :                 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
    2948             :         };
    2949           8 :         size_t datalen = sizeof(data);
    2950           8 :         bool is_osx = torture_setting_bool(tctx, "osx", false);
    2951             : 
    2952           8 :         if (is_osx) {
    2953           0 :                 torture_skip(tctx, "Test only works with Samba\n");
    2954             :         }
    2955             : 
    2956           8 :         smb2_deltree(tree, BASEDIR);
    2957             : 
    2958           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    2959           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2960             :                                         "torture_smb2_testdir failed\n");
    2961           8 :         smb2_util_close(tree, testdirh);
    2962             : 
    2963           8 :         ret = torture_setup_file(tctx, tree, fname, false);
    2964           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    2965             :                             "torture_setup_file failed\n");
    2966             : 
    2967           8 :         ret = torture_setup_file(tctx, tree, adname, false);
    2968           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    2969             :                             "torture_setup_file failed\n");
    2970             : 
    2971           8 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    2972             :                            adname, NULL, 0,
    2973             :                            sizeof(osx_adouble_without_xattr),
    2974             :                            osx_adouble_without_xattr);
    2975           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    2976             :                             "write_stream failed\n");
    2977             : 
    2978           8 :         ret = enable_aapl(tctx, tree);
    2979           8 :         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           8 :         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           8 :         status = smb2_create(tree, tctx, &create);
    2996           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    2997             :                                         "smb2_create failed\n");
    2998             : 
    2999           8 :         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           8 :         status = smb2_find_level(tree, tree, &find, &count, &d);
    3007           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3008             :                                         "smb2_find_level failed\n");
    3009             : 
    3010           8 :         status = smb2_util_close(tree, create.out.file.handle);
    3011           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3012             :                                         "smb2_util_close failed");
    3013             : 
    3014             :         /*
    3015             :          * Check number of streams
    3016             :          */
    3017             : 
    3018           8 :         ret = check_stream_list(tree, tctx, fname, 3, streams, false);
    3019           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    3020             : 
    3021             : 
    3022             :         /*
    3023             :          * Check Resourcefork data can be read.
    3024             :          */
    3025             : 
    3026           6 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    3027             :                            fname, AFPRESOURCE_STREAM,
    3028             :                            16, datalen, 0, datalen, data);
    3029           6 :         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           6 :         ret = check_stream(tree, __location__, tctx, mem_ctx,
    3037             :                            fname, AFPINFO_STREAM,
    3038             :                            0, 60, 16, 8, "WAVEPTul");
    3039           6 :         torture_assert_goto(tctx, ret == true, ret, done,
    3040             :                             "check AFPINFO_STREAM failed\n");
    3041             : 
    3042           6 : done:
    3043           8 :         smb2_deltree(tree, BASEDIR);
    3044           8 :         talloc_free(mem_ctx);
    3045           8 :         return ret;
    3046             : }
    3047             : 
    3048           8 : static bool test_aapl(struct torture_context *tctx,
    3049             :                       struct smb2_tree *tree)
    3050             : {
    3051           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    3052           8 :         const char *fname = BASEDIR "\\test_aapl";
    3053           0 :         NTSTATUS status;
    3054           0 :         struct smb2_handle testdirh;
    3055           8 :         bool ret = true;
    3056           0 :         struct smb2_create io;
    3057           0 :         DATA_BLOB data;
    3058           8 :         struct smb2_create_blob *aapl = NULL;
    3059           0 :         AfpInfo *info;
    3060           8 :         const char *type_creator = "SMB,OLE!";
    3061           0 :         char type_creator_buf[9];
    3062           0 :         uint32_t aapl_cmd;
    3063           0 :         uint32_t aapl_reply_bitmap;
    3064           0 :         uint32_t aapl_server_caps;
    3065           0 :         uint32_t aapl_vol_caps;
    3066           8 :         uint32_t expected_vol_caps = 0;
    3067           0 :         char *model;
    3068           0 :         struct smb2_find f;
    3069           0 :         unsigned int count;
    3070           0 :         union smb_search_data *d;
    3071           0 :         uint64_t rfork_len;
    3072           8 :         bool is_osx_server = torture_setting_bool(tctx, "osx", false);
    3073             : 
    3074           8 :         smb2_deltree(tree, BASEDIR);
    3075             : 
    3076           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    3077           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3078           8 :         smb2_util_close(tree, testdirh);
    3079             : 
    3080           8 :         ZERO_STRUCT(io);
    3081           8 :         io.in.desired_access     = SEC_FLAG_MAXIMUM_ALLOWED;
    3082           8 :         io.in.file_attributes    = FILE_ATTRIBUTE_NORMAL;
    3083           8 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    3084           8 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
    3085             :                               NTCREATEX_SHARE_ACCESS_READ |
    3086             :                               NTCREATEX_SHARE_ACCESS_WRITE);
    3087           8 :         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           8 :         data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
    3096           8 :         SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
    3097           8 :         SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS |
    3098             :                              SMB2_CRTCTX_AAPL_VOLUME_CAPS |
    3099             :                              SMB2_CRTCTX_AAPL_MODEL_INFO));
    3100           8 :         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           8 :         torture_comment(tctx, "Testing SMB2 create context AAPL\n");
    3105           8 :         status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
    3106           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3107             : 
    3108           8 :         status = smb2_create(tree, tctx, &io);
    3109           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3110           8 :         status = smb2_util_close(tree, io.out.file.handle);
    3111           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3112             : 
    3113             :         /*
    3114             :          * Now check returned AAPL context
    3115             :          */
    3116           8 :         torture_comment(tctx, "Comparing returned AAPL capabilities\n");
    3117             : 
    3118           8 :         aapl = smb2_create_blob_find(&io.out.blobs,
    3119             :                                      SMB2_CREATE_TAG_AAPL);
    3120             : 
    3121           8 :         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           8 :         if (!is_osx_server) {
    3130           0 :                 size_t expected_aapl_ctx_size;
    3131           0 :                 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           8 :                 expected_aapl_ctx_size = strlen("MacSamba") * 2 + 40;
    3148             : 
    3149           8 :                 size_ok = aapl->data.length == expected_aapl_ctx_size;
    3150           8 :                 torture_assert_goto(tctx, size_ok, ret, done, "bad AAPL size");
    3151             :         }
    3152             : 
    3153           8 :         aapl_cmd = IVAL(aapl->data.data, 0);
    3154           8 :         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           8 :         aapl_reply_bitmap = BVAL(aapl->data.data, 8);
    3163           8 :         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           8 :         aapl_server_caps = BVAL(aapl->data.data, 16);
    3174           8 :         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           8 :         if (is_osx_server) {
    3186           0 :                 expected_vol_caps = 5;
    3187             :         }
    3188           8 :         aapl_vol_caps = BVAL(aapl->data.data, 24);
    3189           8 :         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           8 :         ret = convert_string_talloc(mem_ctx,
    3197             :                                     CH_UTF16LE, CH_UNIX,
    3198           8 :                                     aapl->data.data + 40, 10,
    3199             :                                     &model, NULL);
    3200           8 :         if (ret == false) {
    3201           0 :                 torture_result(tctx, TORTURE_FAIL,
    3202             :                                "(%s) convert_string_talloc() failed",
    3203             :                                __location__);
    3204           0 :                 goto done;
    3205             :         }
    3206           8 :         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           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    3213           8 :         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           8 :         info = torture_afpinfo_new(mem_ctx);
    3221           8 :         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           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    3230           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    3231           8 :         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           8 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    3239             :                            fname, AFPRESOURCE_STREAM_NAME,
    3240             :                            0, 3, "foo");
    3241           8 :         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           8 :         ZERO_STRUCT(io);
    3253           8 :         io.in.desired_access = SEC_RIGHTS_DIR_READ;
    3254           8 :         io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    3255           8 :         io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    3256           8 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_READ |
    3257             :                               NTCREATEX_SHARE_ACCESS_WRITE |
    3258             :                               NTCREATEX_SHARE_ACCESS_DELETE);
    3259           8 :         io.in.create_disposition = NTCREATEX_DISP_OPEN;
    3260           8 :         io.in.fname = BASEDIR;
    3261           8 :         status = smb2_create(tree, tctx, &io);
    3262           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3263             : 
    3264           8 :         ZERO_STRUCT(f);
    3265           8 :         f.in.file.handle        = io.out.file.handle;
    3266           8 :         f.in.pattern            = "test_aapl";
    3267           8 :         f.in.continue_flags     = SMB2_CONTINUE_FLAG_SINGLE;
    3268           8 :         f.in.max_response_size  = 0x1000;
    3269           8 :         f.in.level              = SMB2_FIND_ID_BOTH_DIRECTORY_INFO;
    3270             : 
    3271           8 :         status = smb2_find_level(tree, tree, &f, &count, &d);
    3272           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3273             : 
    3274           8 :         status = smb2_util_close(tree, io.out.file.handle);
    3275           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3276             : 
    3277           8 :         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           8 :         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           8 :         torture_comment(tctx, "short_name buffer:\n");
    3294           8 :         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           8 :         torture_comment(tctx, "mac_access: %" PRIx32 "\n",
    3303           8 :                         d[0].id_both_directory_info.ea_size);
    3304             : 
    3305           8 :         rfork_len = BVAL(d[0].id_both_directory_info.short_name_buf, 0);
    3306           8 :         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           8 :         memcpy(type_creator_buf, d[0].id_both_directory_info.short_name_buf + 8, 8);
    3315           8 :         type_creator_buf[8] = 0;
    3316           8 :         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           8 : done:
    3325           8 :         smb2_util_unlink(tree, fname);
    3326           8 :         smb2_deltree(tree, BASEDIR);
    3327           8 :         talloc_free(mem_ctx);
    3328           8 :         return ret;
    3329             : }
    3330             : 
    3331       74240 : static uint64_t patt_hash(uint64_t off)
    3332             : {
    3333       74240 :         return off;
    3334             : }
    3335             : 
    3336          32 : 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           0 :         NTSTATUS status;
    3342           0 :         uint64_t i;
    3343           0 :         uint8_t *buf;
    3344          32 :         uint64_t io_sz = MIN(1024 * 64, len);
    3345             : 
    3346          32 :         if (len == 0) {
    3347           0 :                 return true;
    3348             :         }
    3349             : 
    3350          32 :         torture_assert(torture, (len % 8) == 0, "invalid write len");
    3351             : 
    3352          32 :         buf = talloc_zero_size(mem_ctx, io_sz);
    3353          32 :         torture_assert(torture, (buf != NULL), "no memory for file data buf");
    3354             : 
    3355          64 :         while (len > 0) {
    3356        8736 :                 for (i = 0; i <= io_sz - 8; i += 8) {
    3357        8704 :                         SBVAL(buf, i, patt_hash(patt_off));
    3358        8704 :                         patt_off += 8;
    3359             :                 }
    3360             : 
    3361          32 :                 status = smb2_util_write(tree, h,
    3362             :                                          buf, off, io_sz);
    3363          32 :                 torture_assert_ntstatus_ok(torture, status, "file write");
    3364             : 
    3365          32 :                 len -= io_sz;
    3366          32 :                 off += io_sz;
    3367             :         }
    3368             : 
    3369          32 :         talloc_free(buf);
    3370             : 
    3371          32 :         return true;
    3372             : }
    3373             : 
    3374          24 : 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          24 :         if (len == 0) {
    3380           0 :                 return true;
    3381             :         }
    3382             : 
    3383          24 :         torture_assert(torture, (len % 8) == 0, "invalid read len");
    3384             : 
    3385          48 :         while (len > 0) {
    3386           0 :                 uint64_t i;
    3387           0 :                 struct smb2_read r;
    3388           0 :                 NTSTATUS status;
    3389          24 :                 uint64_t io_sz = MIN(1024 * 64, len);
    3390             : 
    3391          24 :                 ZERO_STRUCT(r);
    3392          24 :                 r.in.file.handle = h;
    3393          24 :                 r.in.length      = io_sz;
    3394          24 :                 r.in.offset      = off;
    3395          24 :                 status = smb2_read(tree, mem_ctx, &r);
    3396          24 :                 torture_assert_ntstatus_ok(torture, status, "read");
    3397             : 
    3398          24 :                 torture_assert_u64_equal(torture, r.out.data.length, io_sz,
    3399             :                                          "read data len mismatch");
    3400             : 
    3401        4632 :                 for (i = 0; i <= io_sz - 8; i += 8, patt_off += 8) {
    3402        4608 :                         uint64_t data = BVAL(r.out.data.data, i);
    3403        4608 :                         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          24 :                 talloc_free(r.out.data.data);
    3409          24 :                 len -= io_sz;
    3410          24 :                 off += io_sz;
    3411             :         }
    3412             : 
    3413          24 :         return true;
    3414             : }
    3415             : 
    3416          88 : 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           0 :         struct smb2_create io;
    3424           0 :         NTSTATUS status;
    3425             : 
    3426          88 :         ZERO_STRUCT(io);
    3427          88 :         io.in.desired_access = desired_access;
    3428          88 :         io.in.file_attributes = file_attributes;
    3429          88 :         io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    3430          88 :         io.in.share_access =
    3431             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    3432             :                 NTCREATEX_SHARE_ACCESS_READ|
    3433             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    3434          88 :         if (file_attributes & FILE_ATTRIBUTE_DIRECTORY) {
    3435           0 :                 io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    3436             :         }
    3437          88 :         io.in.fname = fname;
    3438             : 
    3439          88 :         status = smb2_create(tree, mem_ctx, &io);
    3440          88 :         torture_assert_ntstatus_ok(torture, status, "file create");
    3441             : 
    3442          88 :         *fh = io.out.file.handle;
    3443             : 
    3444          88 :         return true;
    3445             : }
    3446             : 
    3447          80 : 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           0 :         bool ok;
    3456             : 
    3457          80 :         ok = test_setup_open(torture, tree, mem_ctx,
    3458             :                              fname,
    3459             :                              fh,
    3460             :                              desired_access,
    3461             :                              file_attributes);
    3462          80 :         torture_assert(torture, ok, "file open");
    3463             : 
    3464          80 :         if (size > 0) {
    3465          32 :                 ok = write_pattern(torture, tree, mem_ctx, *fh, 0, size, 0);
    3466          32 :                 torture_assert(torture, ok, "write pattern");
    3467             :         }
    3468          80 :         return true;
    3469             : }
    3470             : 
    3471          40 : 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           0 :         struct req_resume_key_rsp res_key;
    3486           0 :         bool ok;
    3487           0 :         NTSTATUS status;
    3488           0 :         enum ndr_err_code ndr_ret;
    3489             : 
    3490          40 :         ok = test_setup_create_fill(torture, tree, mem_ctx, src_name,
    3491             :                                     src_h, src_size, src_desired_access,
    3492             :                                     FILE_ATTRIBUTE_NORMAL);
    3493          40 :         torture_assert(torture, ok, "src file create fill");
    3494             : 
    3495          40 :         ok = test_setup_create_fill(torture, tree, mem_ctx, dst_name,
    3496             :                                     dest_h, dest_size, dest_desired_access,
    3497             :                                     FILE_ATTRIBUTE_NORMAL);
    3498          40 :         torture_assert(torture, ok, "dest file create fill");
    3499             : 
    3500          40 :         ZERO_STRUCTPN(io);
    3501          40 :         io->smb2.level = RAW_IOCTL_SMB2;
    3502          40 :         io->smb2.in.file.handle = *src_h;
    3503          40 :         io->smb2.in.function = FSCTL_SRV_REQUEST_RESUME_KEY;
    3504             :         /* Allow for Key + ContextLength + Context */
    3505          40 :         io->smb2.in.max_output_response = 32;
    3506          40 :         io->smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
    3507             : 
    3508          40 :         status = smb2_ioctl(tree, mem_ctx, &io->smb2);
    3509          40 :         torture_assert_ntstatus_ok(torture, status,
    3510             :                                    "FSCTL_SRV_REQUEST_RESUME_KEY");
    3511             : 
    3512          40 :         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          40 :         torture_assert_ndr_success(torture, ndr_ret,
    3516             :                                    "ndr_pull_req_resume_key_rsp");
    3517             : 
    3518          40 :         ZERO_STRUCTPN(io);
    3519          40 :         io->smb2.level = RAW_IOCTL_SMB2;
    3520          40 :         io->smb2.in.file.handle = *dest_h;
    3521          40 :         io->smb2.in.function = FSCTL_SRV_COPYCHUNK;
    3522          40 :         io->smb2.in.max_output_response = sizeof(struct srv_copychunk_rsp);
    3523          40 :         io->smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
    3524             : 
    3525          40 :         ZERO_STRUCTPN(cc_copy);
    3526          40 :         memcpy(cc_copy->source_key, res_key.resume_key, ARRAY_SIZE(cc_copy->source_key));
    3527          40 :         cc_copy->chunk_count = nchunks;
    3528          40 :         cc_copy->chunks = talloc_zero_array(mem_ctx, struct srv_copychunk, nchunks);
    3529          40 :         torture_assert(torture, (cc_copy->chunks != NULL), "no memory for chunks");
    3530             : 
    3531          40 :         return true;
    3532             : }
    3533             : 
    3534             : 
    3535          40 : 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          40 :         torture_assert_int_equal(torture, cc_rsp->chunks_written,
    3542             :                                  ex_chunks_written, "num chunks");
    3543          40 :         torture_assert_int_equal(torture, cc_rsp->chunk_bytes_written,
    3544             :                                  ex_chunk_bytes_written, "chunk bytes written");
    3545          40 :         torture_assert_int_equal(torture, cc_rsp->total_bytes_written,
    3546             :                                  ex_total_bytes_written, "chunk total bytes");
    3547          40 :         return true;
    3548             : }
    3549             : 
    3550           8 : static bool neg_aapl_copyfile(struct torture_context *tctx,
    3551             :                               struct smb2_tree *tree,
    3552             :                               uint64_t flags)
    3553             : {
    3554           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    3555           8 :         const char *fname = "aapl";
    3556           0 :         NTSTATUS status;
    3557           0 :         struct smb2_create io;
    3558           0 :         DATA_BLOB data;
    3559           8 :         struct smb2_create_blob *aapl = NULL;
    3560           0 :         uint32_t aapl_cmd;
    3561           0 :         uint32_t aapl_reply_bitmap;
    3562           0 :         uint32_t aapl_server_caps;
    3563           8 :         bool ret = true;
    3564             : 
    3565           8 :         ZERO_STRUCT(io);
    3566           8 :         io.in.desired_access     = SEC_FLAG_MAXIMUM_ALLOWED;
    3567           8 :         io.in.file_attributes    = FILE_ATTRIBUTE_NORMAL;
    3568           8 :         io.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    3569           8 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_DELETE |
    3570             :                               NTCREATEX_SHARE_ACCESS_READ |
    3571             :                               NTCREATEX_SHARE_ACCESS_WRITE);
    3572           8 :         io.in.fname = fname;
    3573             : 
    3574           8 :         data = data_blob_talloc(mem_ctx, NULL, 3 * sizeof(uint64_t));
    3575           8 :         SBVAL(data.data, 0, SMB2_CRTCTX_AAPL_SERVER_QUERY);
    3576           8 :         SBVAL(data.data, 8, (SMB2_CRTCTX_AAPL_SERVER_CAPS));
    3577           8 :         SBVAL(data.data, 16, flags);
    3578             : 
    3579           8 :         status = smb2_create_blob_add(tctx, &io.in.blobs, "AAPL", data);
    3580           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3581             : 
    3582           8 :         status = smb2_create(tree, tctx, &io);
    3583           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3584             : 
    3585           8 :         aapl = smb2_create_blob_find(&io.out.blobs,
    3586             :                                      SMB2_CREATE_TAG_AAPL);
    3587           8 :         if (aapl == NULL) {
    3588           0 :                 ret = false;
    3589           0 :                 goto done;
    3590             : 
    3591             :         }
    3592           8 :         if (aapl->data.length < 24) {
    3593           0 :                 ret = false;
    3594           0 :                 goto done;
    3595             :         }
    3596             : 
    3597           8 :         aapl_cmd = IVAL(aapl->data.data, 0);
    3598           8 :         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           8 :         aapl_reply_bitmap = BVAL(aapl->data.data, 8);
    3607           8 :         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           8 :         aapl_server_caps = BVAL(aapl->data.data, 16);
    3616           8 :         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           8 : done:
    3625           8 :         status = smb2_util_close(tree, io.out.file.handle);
    3626           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3627             : 
    3628           8 :         smb2_util_unlink(tree, "aapl");
    3629           8 :         talloc_free(mem_ctx);
    3630           8 :         return ret;
    3631             : }
    3632             : 
    3633           8 : static bool test_copyfile(struct torture_context *torture,
    3634             :                           struct smb2_tree *tree)
    3635             : {
    3636           0 :         struct smb2_handle src_h;
    3637           0 :         struct smb2_handle dest_h;
    3638           0 :         NTSTATUS status;
    3639           0 :         union smb_ioctl io;
    3640           8 :         TALLOC_CTX *tmp_ctx = talloc_new(tree);
    3641           0 :         struct srv_copychunk_copy cc_copy;
    3642           0 :         struct srv_copychunk_rsp cc_rsp;
    3643           0 :         enum ndr_err_code ndr_ret;
    3644           0 :         bool ok;
    3645           8 :         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           8 :         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           8 :         if (!ok) {
    3665           0 :                 torture_fail_goto(torture, done, "setup copy chunk error");
    3666             :         }
    3667             : 
    3668           8 :         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           8 :         torture_assert_ndr_success(torture, ndr_ret,
    3672             :                                    "ndr_push_srv_copychunk_copy");
    3673             : 
    3674           8 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    3675           8 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done, "FSCTL_SRV_COPYCHUNK");
    3676             : 
    3677           8 :         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           8 :         torture_assert_ndr_success(torture, ndr_ret,
    3681             :                                    "ndr_pull_srv_copychunk_rsp");
    3682             : 
    3683           8 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    3684             :                                   0,    /* chunks written */
    3685             :                                   0,    /* chunk bytes unsuccessfully written */
    3686             :                                   0); /* total bytes written */
    3687           8 :         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           8 :         ok = neg_aapl_copyfile(torture, tree,
    3696             :                                SMB2_CRTCTX_AAPL_SUPPORTS_OSX_COPYFILE);
    3697           8 :         if (!ok) {
    3698           0 :                 torture_skip_goto(torture, done, "missing AAPL copyfile");
    3699             :                 goto done;
    3700             :         }
    3701             : 
    3702           8 :         smb2_util_close(tree, src_h);
    3703           8 :         smb2_util_close(tree, dest_h);
    3704           8 :         smb2_util_unlink(tree, FNAME_CC_SRC);
    3705           8 :         smb2_util_unlink(tree, FNAME_CC_DST);
    3706             : 
    3707           8 :         ok = torture_setup_file(tmp_ctx, tree, FNAME_CC_SRC, false);
    3708           8 :         if (!ok) {
    3709           0 :                 torture_fail(torture, "setup file error");
    3710             :         }
    3711           8 :         ok = write_stream(tree, __location__, torture, tmp_ctx,
    3712             :                             FNAME_CC_SRC, AFPRESOURCE_STREAM,
    3713             :                             10, 10, "1234567890");
    3714           8 :         if (!ok) {
    3715           0 :                 torture_fail(torture, "setup stream error");
    3716             :         }
    3717             : 
    3718           8 :         ok = write_stream(tree, __location__, torture, tmp_ctx,
    3719             :                             FNAME_CC_SRC, sname,
    3720             :                             10, 10, "abcdefghij");
    3721           8 :         torture_assert_goto(torture, ok == true, ok, done, "write_stream failed\n");
    3722             : 
    3723           8 :         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           8 :         if (!ok) {
    3734           0 :                 torture_fail_goto(torture, done, "setup copy chunk error");
    3735             :         }
    3736             : 
    3737           8 :         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           8 :         torture_assert_ndr_success(torture, ndr_ret,
    3741             :                                    "ndr_push_srv_copychunk_copy");
    3742             : 
    3743           8 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    3744           8 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done, "FSCTL_SRV_COPYCHUNK");
    3745             : 
    3746           8 :         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           8 :         torture_assert_ndr_success(torture, ndr_ret,
    3750             :                                    "ndr_pull_srv_copychunk_rsp");
    3751             : 
    3752           8 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    3753             :                                   0,    /* chunks written */
    3754             :                                   0,    /* chunk bytes unsuccessfully written */
    3755             :                                   4096); /* total bytes written */
    3756           8 :         if (!ok) {
    3757           0 :                 torture_fail_goto(torture, done, "bad copy chunk response data");
    3758             :         }
    3759             : 
    3760           8 :         ok = test_setup_open(torture, tree, tmp_ctx, FNAME_CC_DST, &dest_h,
    3761             :                              SEC_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL);
    3762           8 :         if (!ok) {
    3763           0 :                 torture_fail_goto(torture, done,"open failed");
    3764             :         }
    3765           8 :         ok = check_pattern(torture, tree, tmp_ctx, dest_h, 0, 4096, 0);
    3766           8 :         if (!ok) {
    3767           0 :                 torture_fail_goto(torture, done, "inconsistent file data");
    3768             :         }
    3769             : 
    3770           8 :         ok = check_stream(tree, __location__, torture, tmp_ctx,
    3771             :                             FNAME_CC_DST, AFPRESOURCE_STREAM,
    3772             :                             0, 20, 10, 10, "1234567890");
    3773           8 :         if (!ok) {
    3774           0 :                 torture_fail_goto(torture, done, "inconsistent stream data");
    3775             :         }
    3776             : 
    3777           8 :         ok = check_stream(tree, __location__, torture, tmp_ctx,
    3778             :                             FNAME_CC_DST, sname,
    3779             :                             0, 20, 10, 10, "abcdefghij");
    3780           8 :         torture_assert_goto(torture, ok == true, ok, done, "check_stream failed\n");
    3781             : 
    3782           8 : done:
    3783           8 :         smb2_util_close(tree, src_h);
    3784           8 :         smb2_util_close(tree, dest_h);
    3785           8 :         smb2_util_unlink(tree, FNAME_CC_SRC);
    3786           8 :         smb2_util_unlink(tree, FNAME_CC_DST);
    3787           8 :         talloc_free(tmp_ctx);
    3788           8 :         return true;
    3789             : }
    3790             : 
    3791        1492 : 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        1492 :         bool ret = true;
    3799           0 :         union smb_fileinfo finfo;
    3800           0 :         NTSTATUS status;
    3801           0 :         int i;
    3802        1492 :         TALLOC_CTX *tmp_ctx = talloc_new(tctx);
    3803           0 :         char **exp_sort;
    3804           0 :         struct stream_struct *stream_sort;
    3805           0 :         struct smb2_create create;
    3806           0 :         struct smb2_handle h;
    3807             : 
    3808        1492 :         ZERO_STRUCT(h);
    3809        1492 :         torture_assert_goto(tctx, tmp_ctx != NULL, ret, done, "talloc_new failed");
    3810             : 
    3811        1492 :         ZERO_STRUCT(create);
    3812        1492 :         create.in.fname = fname;
    3813        1492 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    3814        1492 :         create.in.desired_access = SEC_FILE_ALL;
    3815        1492 :         create.in.create_options = is_dir ? NTCREATEX_OPTIONS_DIRECTORY : 0;
    3816        1492 :         create.in.file_attributes = is_dir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
    3817        1492 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    3818        1492 :         status = smb2_create(tree, tmp_ctx, &create);
    3819        1492 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create");
    3820        1492 :         h = create.out.file.handle;
    3821             : 
    3822        1492 :         finfo.generic.level = RAW_FILEINFO_STREAM_INFORMATION;
    3823        1492 :         finfo.generic.in.file.handle = h;
    3824             : 
    3825        1492 :         status = smb2_getinfo_file(tree, tctx, &finfo);
    3826        1492 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "get stream info");
    3827             : 
    3828        1492 :         smb2_util_close(tree, h);
    3829             : 
    3830        1492 :         torture_assert_int_equal_goto(tctx, finfo.stream_info.out.num_streams, num_exp,
    3831             :                                       ret, done, "stream count");
    3832             : 
    3833        1490 :         if (num_exp == 0) {
    3834           0 :                 TALLOC_FREE(tmp_ctx);
    3835           0 :                 goto done;
    3836             :         }
    3837             : 
    3838        1490 :         exp_sort = talloc_memdup(tmp_ctx, exp, num_exp * sizeof(*exp));
    3839        1490 :         torture_assert_goto(tctx, exp_sort != NULL, ret, done, __location__);
    3840             : 
    3841        1490 :         TYPESAFE_QSORT(exp_sort, num_exp, qsort_string);
    3842             : 
    3843        1490 :         stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams,
    3844             :                                     finfo.stream_info.out.num_streams *
    3845             :                                     sizeof(*stream_sort));
    3846        1490 :         torture_assert_goto(tctx, stream_sort != NULL, ret, done, __location__);
    3847             : 
    3848        1490 :         TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream);
    3849             : 
    3850        3480 :         for (i=0; i<num_exp; i++) {
    3851        1990 :                 torture_comment(tctx, "i[%d] exp[%s] got[%s]\n",
    3852        1990 :                                 i, exp_sort[i], stream_sort[i].stream_name.s);
    3853        1990 :                 torture_assert_str_equal_goto(tctx, stream_sort[i].stream_name.s, exp_sort[i],
    3854             :                                               ret, done, "stream name");
    3855             :         }
    3856             : 
    3857        1490 : done:
    3858        1492 :         TALLOC_FREE(tmp_ctx);
    3859        1492 :         return ret;
    3860             : }
    3861             : 
    3862         288 : 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         288 :         bool ret = true;
    3870           0 :         union smb_fileinfo finfo;
    3871           0 :         NTSTATUS status;
    3872           0 :         int i;
    3873         288 :         TALLOC_CTX *tmp_ctx = talloc_new(tctx);
    3874           0 :         char **exp_sort;
    3875           0 :         struct stream_struct *stream_sort;
    3876             : 
    3877         288 :         torture_assert_goto(tctx, tmp_ctx != NULL, ret, done,
    3878             :                             "talloc_new failed\n");
    3879             : 
    3880         288 :         finfo = (union smb_fileinfo) {
    3881             :                 .stream_info.level = RAW_FILEINFO_STREAM_INFORMATION,
    3882             :                 .stream_info.in.file.handle = h,
    3883             :         };
    3884             : 
    3885         288 :         status = smb2_getinfo_file(tree, tctx, &finfo);
    3886         288 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3887             :                                         "get stream info\n");
    3888             : 
    3889         288 :         torture_assert_int_equal_goto(tctx, finfo.stream_info.out.num_streams,
    3890             :                                       num_exp, ret, done, "stream count\n");
    3891             : 
    3892         288 :         if (num_exp == 0) {
    3893           0 :                 TALLOC_FREE(tmp_ctx);
    3894           0 :                 goto done;
    3895             :         }
    3896             : 
    3897         288 :         exp_sort = talloc_memdup(tmp_ctx, exp, num_exp * sizeof(*exp));
    3898         288 :         torture_assert_goto(tctx, exp_sort != NULL, ret, done, __location__);
    3899             : 
    3900         288 :         TYPESAFE_QSORT(exp_sort, num_exp, qsort_string);
    3901             : 
    3902         288 :         stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams,
    3903             :                                     finfo.stream_info.out.num_streams *
    3904             :                                     sizeof(*stream_sort));
    3905         288 :         torture_assert_goto(tctx, stream_sort != NULL, ret, done, __location__);
    3906             : 
    3907         288 :         TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream);
    3908             : 
    3909         672 :         for (i=0; i<num_exp; i++) {
    3910         384 :                 torture_comment(tctx, "i[%d] exp[%s] got[%s]\n",
    3911         384 :                                 i, exp_sort[i], stream_sort[i].stream_name.s);
    3912         384 :                 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         288 : done:
    3918         288 :         TALLOC_FREE(tmp_ctx);
    3919         288 :         return ret;
    3920             : }
    3921             : 
    3922             : /*
    3923             :   test stream names
    3924             : */
    3925           8 : static bool test_stream_names(struct torture_context *tctx,
    3926             :                               struct smb2_tree *tree)
    3927             : {
    3928           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    3929           0 :         NTSTATUS status;
    3930           0 :         struct smb2_create create;
    3931           0 :         struct smb2_handle h;
    3932           8 :         const char *fname = BASEDIR "\\stream_names.txt";
    3933           0 :         const char *sname1;
    3934           0 :         bool ret;
    3935             :         /* UTF8 private use are starts at 0xef 0x80 0x80 (0xf000) */
    3936           8 :         const char *streams[] = {
    3937             :                 ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
    3938             :                 "::$DATA"
    3939             :         };
    3940             : 
    3941           8 :         sname1 = talloc_asprintf(mem_ctx, "%s%s", fname, streams[0]);
    3942             : 
    3943             :         /* clean slate ...*/
    3944           8 :         smb2_util_unlink(tree, fname);
    3945           8 :         smb2_deltree(tree, fname);
    3946           8 :         smb2_deltree(tree, BASEDIR);
    3947             : 
    3948           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    3949           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3950           8 :         smb2_util_close(tree, h);
    3951             : 
    3952           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    3953           8 :         torture_assert_goto(tctx, ret, ret, done, "torture_setup_file");
    3954             : 
    3955           8 :         torture_comment(tctx, "(%s) testing stream names\n", __location__);
    3956           8 :         ZERO_STRUCT(create);
    3957           8 :         create.in.desired_access = SEC_FILE_WRITE_DATA;
    3958           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    3959           8 :         create.in.share_access =
    3960             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    3961             :                 NTCREATEX_SHARE_ACCESS_READ|
    3962             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    3963           8 :         create.in.create_disposition = NTCREATEX_DISP_CREATE;
    3964           8 :         create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    3965           8 :         create.in.fname = sname1;
    3966             : 
    3967           8 :         status = smb2_create(tree, mem_ctx, &create);
    3968           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    3969             : 
    3970           8 :         status = smb2_util_write(tree, create.out.file.handle, "foo", 0, 3);
    3971           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    3972             :                                         "smb2_util_write failed\n");
    3973             : 
    3974           8 :         smb2_util_close(tree, create.out.file.handle);
    3975             : 
    3976           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams, false);
    3977           8 :         CHECK_VALUE(ret, true);
    3978             : 
    3979           8 : done:
    3980           8 :         status = smb2_util_unlink(tree, fname);
    3981           8 :         smb2_deltree(tree, BASEDIR);
    3982           8 :         talloc_free(mem_ctx);
    3983             : 
    3984           8 :         return ret;
    3985             : }
    3986             : 
    3987             : /* Renaming a directory with open file, should work for OS X AAPL clients */
    3988           8 : static bool test_rename_dir_openfile(struct torture_context *torture,
    3989             :                                      struct smb2_tree *tree)
    3990             : {
    3991           8 :         bool ret = true;
    3992           0 :         NTSTATUS status;
    3993           0 :         union smb_open io;
    3994           0 :         union smb_close cl;
    3995           0 :         union smb_setfileinfo sinfo;
    3996           0 :         struct smb2_handle d1, h1;
    3997           8 :         const char *renamedir = BASEDIR "-new";
    3998           8 :         bool server_is_osx = torture_setting_bool(torture, "osx", false);
    3999             : 
    4000           8 :         smb2_deltree(tree, BASEDIR);
    4001           8 :         smb2_util_rmdir(tree, BASEDIR);
    4002           8 :         smb2_deltree(tree, renamedir);
    4003             : 
    4004           8 :         ZERO_STRUCT(io.smb2);
    4005           8 :         io.generic.level = RAW_OPEN_SMB2;
    4006           8 :         io.smb2.in.create_flags = 0;
    4007           8 :         io.smb2.in.desired_access = 0x0017019f;
    4008           8 :         io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    4009           8 :         io.smb2.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    4010           8 :         io.smb2.in.share_access = 0;
    4011           8 :         io.smb2.in.alloc_size = 0;
    4012           8 :         io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
    4013           8 :         io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    4014           8 :         io.smb2.in.security_flags = 0;
    4015           8 :         io.smb2.in.fname = BASEDIR;
    4016             : 
    4017           8 :         status = smb2_create(tree, torture, &(io.smb2));
    4018           8 :         torture_assert_ntstatus_ok(torture, status, "smb2_create dir");
    4019           8 :         d1 = io.smb2.out.file.handle;
    4020             : 
    4021           8 :         ZERO_STRUCT(io.smb2);
    4022           8 :         io.generic.level = RAW_OPEN_SMB2;
    4023           8 :         io.smb2.in.create_flags = 0;
    4024           8 :         io.smb2.in.desired_access = 0x0017019f;
    4025           8 :         io.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
    4026           8 :         io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4027           8 :         io.smb2.in.share_access = 0;
    4028           8 :         io.smb2.in.alloc_size = 0;
    4029           8 :         io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
    4030           8 :         io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    4031           8 :         io.smb2.in.security_flags = 0;
    4032           8 :         io.smb2.in.fname = BASEDIR "\\file.txt";
    4033             : 
    4034           8 :         status = smb2_create(tree, torture, &(io.smb2));
    4035           8 :         torture_assert_ntstatus_ok(torture, status, "smb2_create file");
    4036           8 :         h1 = io.smb2.out.file.handle;
    4037             : 
    4038           8 :         if (!server_is_osx) {
    4039           8 :                 torture_comment(torture, "Renaming directory without AAPL, must fail\n");
    4040             : 
    4041           8 :                 ZERO_STRUCT(sinfo);
    4042           8 :                 sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
    4043           8 :                 sinfo.rename_information.in.file.handle = d1;
    4044           8 :                 sinfo.rename_information.in.overwrite = 0;
    4045           8 :                 sinfo.rename_information.in.root_fid = 0;
    4046           8 :                 sinfo.rename_information.in.new_name = renamedir;
    4047           8 :                 status = smb2_setinfo_file(tree, &sinfo);
    4048             : 
    4049           8 :                 torture_assert_ntstatus_equal(torture, status,
    4050             :                                               NT_STATUS_ACCESS_DENIED,
    4051             :                                               "smb2_setinfo_file");
    4052             :         }
    4053             : 
    4054           8 :         status = smb2_util_close(tree, d1);
    4055           8 :         torture_assert_ntstatus_ok(torture, status, "smb2_util_close\n");
    4056           8 :         ZERO_STRUCT(d1);
    4057             : 
    4058           8 :         torture_comment(torture, "Enabling AAPL\n");
    4059             : 
    4060           8 :         ret = enable_aapl(torture, tree);
    4061           8 :         torture_assert(torture, ret == true, "enable_aapl failed");
    4062             : 
    4063           8 :         torture_comment(torture, "Renaming directory with AAPL\n");
    4064             : 
    4065           8 :         ZERO_STRUCT(io.smb2);
    4066           8 :         io.generic.level = RAW_OPEN_SMB2;
    4067           8 :         io.smb2.in.desired_access = 0x0017019f;
    4068           8 :         io.smb2.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    4069           8 :         io.smb2.in.share_access = 0;
    4070           8 :         io.smb2.in.alloc_size = 0;
    4071           8 :         io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
    4072           8 :         io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    4073           8 :         io.smb2.in.security_flags = 0;
    4074           8 :         io.smb2.in.fname = BASEDIR;
    4075             : 
    4076           8 :         status = smb2_create(tree, torture, &(io.smb2));
    4077           8 :         torture_assert_ntstatus_ok(torture, status, "smb2_create dir");
    4078           8 :         d1 = io.smb2.out.file.handle;
    4079             : 
    4080           8 :         ZERO_STRUCT(sinfo);
    4081           8 :         sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
    4082           8 :         sinfo.rename_information.in.file.handle = d1;
    4083           8 :         sinfo.rename_information.in.overwrite = 0;
    4084           8 :         sinfo.rename_information.in.root_fid = 0;
    4085           8 :         sinfo.rename_information.in.new_name = renamedir;
    4086             : 
    4087           8 :         status = smb2_setinfo_file(tree, &sinfo);
    4088           8 :         torture_assert_ntstatus_ok(torture, status, "smb2_setinfo_file");
    4089             : 
    4090           8 :         ZERO_STRUCT(cl.smb2);
    4091           8 :         cl.smb2.level = RAW_CLOSE_SMB2;
    4092           8 :         cl.smb2.in.file.handle = d1;
    4093           8 :         status = smb2_close(tree, &(cl.smb2));
    4094           8 :         torture_assert_ntstatus_ok(torture, status, "smb2_close");
    4095           8 :         ZERO_STRUCT(d1);
    4096             : 
    4097           8 :         cl.smb2.in.file.handle = h1;
    4098           8 :         status = smb2_close(tree, &(cl.smb2));
    4099           8 :         torture_assert_ntstatus_ok(torture, status, "smb2_close");
    4100           8 :         ZERO_STRUCT(h1);
    4101             : 
    4102           8 :         torture_comment(torture, "Cleaning up\n");
    4103             : 
    4104           8 :         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           8 :         smb2_util_unlink(tree, BASEDIR "\\file.txt");
    4112           8 :         smb2_util_unlink(tree, BASEDIR "-new\\file.txt");
    4113           8 :         smb2_deltree(tree, renamedir);
    4114           8 :         smb2_deltree(tree, BASEDIR);
    4115           8 :         return ret;
    4116             : }
    4117             : 
    4118           8 : static bool test_afpinfo_enoent(struct torture_context *tctx,
    4119             :                                 struct smb2_tree *tree)
    4120             : {
    4121           8 :         bool ret = true;
    4122           0 :         NTSTATUS status;
    4123           0 :         struct smb2_create create;
    4124           0 :         struct smb2_handle h1;
    4125           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4126           8 :         const char *fname = BASEDIR "\\file";
    4127           8 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4128             : 
    4129           8 :         torture_comment(tctx, "Opening file without AFP_AfpInfo\n");
    4130             : 
    4131           8 :         smb2_deltree(tree, BASEDIR);
    4132           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4133           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4134           8 :         smb2_util_close(tree, h1);
    4135           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4136           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4137             : 
    4138           8 :         torture_comment(tctx, "Opening not existing AFP_AfpInfo\n");
    4139             : 
    4140           8 :         ZERO_STRUCT(create);
    4141           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4142           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
    4143           8 :         create.in.fname = sname;
    4144             : 
    4145           8 :         status = smb2_create(tree, mem_ctx, &create);
    4146           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4147             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4148             : 
    4149           8 : done:
    4150           8 :         smb2_util_unlink(tree, fname);
    4151           8 :         smb2_util_rmdir(tree, BASEDIR);
    4152           8 :         return ret;
    4153             : }
    4154             : 
    4155           8 : static bool test_create_delete_on_close(struct torture_context *tctx,
    4156             :                                         struct smb2_tree *tree)
    4157             : {
    4158           8 :         bool ret = true;
    4159           0 :         NTSTATUS status;
    4160           0 :         struct smb2_create create;
    4161           0 :         struct smb2_handle h1;
    4162           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4163           8 :         const char *fname = BASEDIR "\\file";
    4164           8 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4165           8 :         const char *type_creator = "SMB,OLE!";
    4166           8 :         AfpInfo *info = NULL;
    4167           8 :         const char *streams_basic[] = {
    4168             :                 "::$DATA"
    4169             :         };
    4170           8 :         const char *streams_afpinfo[] = {
    4171             :                 "::$DATA",
    4172             :                 AFPINFO_STREAM
    4173             :         };
    4174             : 
    4175           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4176             : 
    4177           8 :         torture_comment(tctx, "Checking whether create with delete-on-close work with AFP_AfpInfo\n");
    4178             : 
    4179           8 :         smb2_deltree(tree, BASEDIR);
    4180           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4181           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4182           8 :         smb2_util_close(tree, h1);
    4183           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4184           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4185             : 
    4186           8 :         torture_comment(tctx, "Opening not existing AFP_AfpInfo\n");
    4187             : 
    4188           8 :         ZERO_STRUCT(create);
    4189           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4190           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
    4191           8 :         create.in.fname = sname;
    4192             : 
    4193           8 :         status = smb2_create(tree, mem_ctx, &create);
    4194           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4195             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4196             : 
    4197           8 :         ZERO_STRUCT(create);
    4198           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4199           8 :         create.in.desired_access = SEC_FILE_ALL;
    4200           8 :         create.in.fname = sname;
    4201             : 
    4202           8 :         status = smb2_create(tree, mem_ctx, &create);
    4203           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4204             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4205             : 
    4206           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4207           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4208             : 
    4209           8 :         torture_comment(tctx, "Deleting AFP_AfpInfo via create with delete-on-close\n");
    4210             : 
    4211           8 :         info = torture_afpinfo_new(mem_ctx);
    4212           8 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4213             : 
    4214           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4215           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4216           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4217             : 
    4218           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4219             :                            0, 60, 16, 8, type_creator);
    4220           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad type/creator in AFP_AfpInfo");
    4221             : 
    4222           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4223           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4224             : 
    4225           8 :         ZERO_STRUCT(create);
    4226           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4227           8 :         create.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
    4228           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4229           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4230           8 :         create.in.fname = sname;
    4231           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4232             : 
    4233           8 :         status = smb2_create(tree, mem_ctx, &create);
    4234           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4235             : 
    4236           8 :         h1 = create.out.file.handle;
    4237           8 :         smb2_util_close(tree, h1);
    4238             : 
    4239           8 :         ZERO_STRUCT(create);
    4240           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4241           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    4242           8 :         create.in.fname = sname;
    4243           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4244           8 :         status = smb2_create(tree, mem_ctx, &create);
    4245           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4246             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4247             : 
    4248           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4249           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4250             : 
    4251           8 : done:
    4252           8 :         smb2_util_unlink(tree, fname);
    4253           8 :         smb2_util_rmdir(tree, BASEDIR);
    4254           8 :         return ret;
    4255             : }
    4256             : 
    4257           8 : static bool test_setinfo_delete_on_close(struct torture_context *tctx,
    4258             :                                          struct smb2_tree *tree)
    4259             : {
    4260           8 :         bool ret = true;
    4261           0 :         NTSTATUS status;
    4262           0 :         struct smb2_create create;
    4263           0 :         union smb_setfileinfo sfinfo;
    4264           0 :         struct smb2_handle h1;
    4265           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4266           8 :         const char *fname = BASEDIR "\\file";
    4267           8 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4268           8 :         const char *type_creator = "SMB,OLE!";
    4269           8 :         AfpInfo *info = NULL;
    4270           8 :         const char *streams[] = {
    4271             :                 AFPINFO_STREAM,
    4272             :                 "::$DATA"
    4273             :         };
    4274           8 :         const char *streams_basic[] = {
    4275             :                 "::$DATA"
    4276             :         };
    4277             : 
    4278           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4279             : 
    4280           8 :         torture_comment(tctx, "Deleting AFP_AfpInfo via setinfo with delete-on-close\n");
    4281             : 
    4282           8 :         smb2_deltree(tree, BASEDIR);
    4283           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4284           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4285           8 :         smb2_util_close(tree, h1);
    4286           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4287           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4288             : 
    4289           8 :         info = torture_afpinfo_new(mem_ctx);
    4290           8 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4291           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4292           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4293           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4294             : 
    4295           8 :         ZERO_STRUCT(create);
    4296           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4297           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4298           8 :         create.in.fname = sname;
    4299           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4300           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4301             : 
    4302           8 :         status = smb2_create(tree, mem_ctx, &create);
    4303           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4304             : 
    4305           8 :         h1 = create.out.file.handle;
    4306             : 
    4307             :         /* Delete stream via setinfo delete-on-close */
    4308           8 :         ZERO_STRUCT(sfinfo);
    4309           8 :         sfinfo.disposition_info.in.delete_on_close = 1;
    4310           8 :         sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
    4311           8 :         sfinfo.generic.in.file.handle = h1;
    4312           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    4313           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set delete-on-close failed");
    4314             : 
    4315           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams, false);
    4316           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4317             : 
    4318           8 :         ZERO_STRUCT(create);
    4319           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4320           8 :         create.in.desired_access = SEC_FILE_ALL;
    4321           8 :         create.in.fname = sname;
    4322           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4323           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4324           8 :         status = smb2_create(tree, mem_ctx, &create);
    4325           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_DELETE_PENDING,
    4326             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4327             : 
    4328           8 :         smb2_util_close(tree, h1);
    4329             : 
    4330           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4331           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4332             : 
    4333           8 :         ZERO_STRUCT(create);
    4334           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4335           8 :         create.in.desired_access = SEC_FILE_ALL;
    4336           8 :         create.in.fname = sname;
    4337           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4338           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4339           8 :         status = smb2_create(tree, mem_ctx, &create);
    4340           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4341             :                                            ret, done, "Got unexpected AFP_AfpInfo stream");
    4342             : 
    4343           8 : done:
    4344           8 :         smb2_util_unlink(tree, fname);
    4345           8 :         smb2_util_rmdir(tree, BASEDIR);
    4346           8 :         return ret;
    4347             : }
    4348             : 
    4349           8 : static bool test_setinfo_eof(struct torture_context *tctx,
    4350             :                              struct smb2_tree *tree)
    4351             : {
    4352           8 :         bool ret = true;
    4353           0 :         NTSTATUS status;
    4354           0 :         struct smb2_create create;
    4355           0 :         union smb_setfileinfo sfinfo;
    4356           0 :         struct smb2_handle h1;
    4357           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4358           8 :         const char *fname = BASEDIR "\\file";
    4359           8 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
    4360           8 :         const char *type_creator = "SMB,OLE!";
    4361           8 :         AfpInfo *info = NULL;
    4362           8 :         const char *streams_afpinfo[] = {
    4363             :                 "::$DATA",
    4364             :                 AFPINFO_STREAM
    4365             :         };
    4366             : 
    4367           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4368             : 
    4369           8 :         torture_comment(tctx, "Set AFP_AfpInfo EOF to 61, 1 and 0\n");
    4370             : 
    4371           8 :         smb2_deltree(tree, BASEDIR);
    4372           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4373           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4374           8 :         smb2_util_close(tree, h1);
    4375           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4376           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4377             : 
    4378           8 :         info = torture_afpinfo_new(mem_ctx);
    4379           8 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4380           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4381           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4382           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4383             : 
    4384           8 :         ZERO_STRUCT(create);
    4385           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4386           8 :         create.in.desired_access = SEC_FILE_ALL;
    4387           8 :         create.in.fname = sname;
    4388           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4389           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4390             : 
    4391           8 :         status = smb2_create(tree, mem_ctx, &create);
    4392           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4393             : 
    4394           8 :         h1 = create.out.file.handle;
    4395             : 
    4396           8 :         torture_comment(tctx, "Set AFP_AfpInfo EOF to 61\n");
    4397             : 
    4398             :         /* Test setinfo end-of-file info */
    4399           8 :         ZERO_STRUCT(sfinfo);
    4400           8 :         sfinfo.generic.in.file.handle = h1;
    4401           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4402           8 :         sfinfo.position_information.in.position = 61;
    4403           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    4404           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_ALLOTTED_SPACE_EXCEEDED,
    4405             :                                            ret, done, "set eof 61 failed");
    4406             : 
    4407           8 :         torture_comment(tctx, "Set AFP_AfpInfo EOF to 1\n");
    4408             : 
    4409             :         /* Truncation returns success, but has no effect */
    4410           8 :         ZERO_STRUCT(sfinfo);
    4411           8 :         sfinfo.generic.in.file.handle = h1;
    4412           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4413           8 :         sfinfo.position_information.in.position = 1;
    4414           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    4415           8 :         torture_assert_ntstatus_ok_goto(tctx, status,
    4416             :                                         ret, done, "set eof 1 failed");
    4417           8 :         smb2_util_close(tree, h1);
    4418             : 
    4419           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4420           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4421             : 
    4422           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4423             :                            0, 60, 16, 8, type_creator);
    4424           8 :         torture_assert_goto(tctx, ret == true, ret, done, "FinderInfo changed");
    4425             : 
    4426           8 :         ZERO_STRUCT(create);
    4427           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4428           8 :         create.in.desired_access = SEC_FILE_ALL;
    4429           8 :         create.in.fname = sname;
    4430           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4431           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4432             : 
    4433           8 :         status = smb2_create(tree, mem_ctx, &create);
    4434           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4435             : 
    4436           8 :         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           8 :         ZERO_STRUCT(sfinfo);
    4443           8 :         sfinfo.generic.in.file.handle = h1;
    4444           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4445           8 :         sfinfo.position_information.in.position = 0;
    4446           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    4447           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set eof 0 failed");
    4448             : 
    4449           8 :         smb2_util_close(tree, h1);
    4450             : 
    4451           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4452           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4453             : 
    4454           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4455             :                            0, 60, 16, 8, type_creator);
    4456           8 :         torture_assert_goto(tctx, ret == true, ret, done, "FinderInfo changed");
    4457             : 
    4458           8 : done:
    4459           8 :         smb2_util_unlink(tree, fname);
    4460           8 :         smb2_util_rmdir(tree, BASEDIR);
    4461           8 :         return ret;
    4462             : }
    4463             : 
    4464           8 : static bool test_afpinfo_all0(struct torture_context *tctx,
    4465             :                               struct smb2_tree *tree)
    4466             : {
    4467           8 :         bool ret = true;
    4468           0 :         NTSTATUS status;
    4469           0 :         struct smb2_create create;
    4470           8 :         struct smb2_handle h1 = {{0}};
    4471           8 :         struct smb2_handle baseh = {{0}};
    4472           0 :         union smb_setfileinfo setfinfo;
    4473           0 :         union smb_fileinfo getfinfo;
    4474           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4475           8 :         const char *fname = BASEDIR "\\file";
    4476           8 :         const char *sname = BASEDIR "\\file" AFPINFO_STREAM;
    4477           8 :         const char *type_creator = "SMB,OLE!";
    4478           8 :         AfpInfo *info = NULL;
    4479           8 :         char *infobuf = NULL;
    4480           8 :         const char *streams_basic[] = {
    4481             :                 "::$DATA"
    4482             :         };
    4483           8 :         const char *streams_afpinfo[] = {
    4484             :                 "::$DATA",
    4485             :                 AFPINFO_STREAM
    4486             :         };
    4487             : 
    4488           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4489             : 
    4490           8 :         torture_comment(tctx, "Write all 0 to AFP_AfpInfo and see what happens\n");
    4491             : 
    4492           8 :         smb2_deltree(tree, BASEDIR);
    4493           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4494           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4495           8 :         smb2_util_close(tree, h1);
    4496           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4497           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4498             : 
    4499           8 :         info = torture_afpinfo_new(mem_ctx);
    4500           8 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    4501           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    4502           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    4503           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    4504             : 
    4505           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpinfo, false);
    4506           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4507             : 
    4508             :         /* Write all 0 to AFP_AfpInfo */
    4509           8 :         memset(info->afpi_FinderInfo, 0, AFP_FinderSize);
    4510           8 :         infobuf = torture_afpinfo_pack(mem_ctx, info);
    4511           8 :         torture_assert_not_null_goto(tctx, infobuf, ret, done,
    4512             :                                      "torture_afpinfo_pack failed\n");
    4513             : 
    4514           8 :         ZERO_STRUCT(create);
    4515           8 :         create.in.desired_access = SEC_FILE_ALL;
    4516           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4517           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4518           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    4519           8 :         create.in.fname = fname;
    4520             : 
    4521           8 :         status = smb2_create(tree, mem_ctx, &create);
    4522           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4523             :                                         "smb2_create failed\n");
    4524           8 :         baseh = create.out.file.handle;
    4525             : 
    4526           8 :         ZERO_STRUCT(create);
    4527           8 :         create.in.desired_access = SEC_FILE_ALL;
    4528           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4529           8 :         create.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
    4530           8 :         create.in.fname = sname;
    4531             : 
    4532           8 :         status = smb2_create(tree, mem_ctx, &create);
    4533           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4534             :                                         "smb2_create failed\n");
    4535           8 :         h1 = create.out.file.handle;
    4536             : 
    4537           8 :         status = smb2_util_write(tree, h1, infobuf, 0, AFP_INFO_SIZE);
    4538           8 :         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           8 :         ZERO_STRUCT(getfinfo);
    4547           8 :         getfinfo.generic.level = RAW_FILEINFO_STREAM_INFORMATION;
    4548           8 :         getfinfo.generic.in.file.handle = baseh;
    4549             : 
    4550           8 :         status = smb2_getinfo_file(tree, tctx, &getfinfo);
    4551           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4552             :                                         "get stream info\n");
    4553             : 
    4554           8 :         torture_assert_int_equal_goto(tctx, getfinfo.stream_info.out.num_streams,
    4555             :                                       1, ret, done, "stream count");
    4556             : 
    4557           8 :         smb2_util_close(tree, baseh);
    4558           8 :         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           8 :         ZERO_STRUCT(setfinfo);
    4567           8 :         unix_to_nt_time(&setfinfo.basic_info.in.write_time, time(NULL));
    4568           8 :         setfinfo.basic_info.in.attrib = 0x20;
    4569           8 :         setfinfo.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
    4570           8 :         setfinfo.generic.in.file.handle = h1;
    4571             : 
    4572           8 :         status = smb2_setinfo_file(tree, &setfinfo);
    4573           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4574             :                                         "smb2_getinfo_file failed\n");
    4575             : 
    4576           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4577           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    4578             : 
    4579           8 :         smb2_util_close(tree, h1);
    4580           8 :         ZERO_STRUCT(h1);
    4581             : 
    4582           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4583           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4584             : 
    4585           8 : done:
    4586           8 :         if (!smb2_util_handle_empty(h1)) {
    4587           0 :                 smb2_util_close(tree, h1);
    4588             :         }
    4589           8 :         if (!smb2_util_handle_empty(baseh)) {
    4590           0 :                 smb2_util_close(tree, baseh);
    4591             :         }
    4592           8 :         smb2_util_unlink(tree, fname);
    4593           8 :         smb2_util_rmdir(tree, BASEDIR);
    4594           8 :         return ret;
    4595             : }
    4596             : 
    4597           8 : static bool test_create_delete_on_close_resource(struct torture_context *tctx,
    4598             :                                                  struct smb2_tree *tree)
    4599             : {
    4600           8 :         bool ret = true;
    4601           0 :         NTSTATUS status;
    4602           0 :         struct smb2_create create;
    4603           0 :         struct smb2_handle h1;
    4604           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4605           8 :         const char *fname = BASEDIR "\\file";
    4606           8 :         const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
    4607           8 :         const char *streams_basic[] = {
    4608             :                 "::$DATA"
    4609             :         };
    4610           8 :         const char *streams_afpresource[] = {
    4611             :                 "::$DATA",
    4612             :                 AFPRESOURCE_STREAM
    4613             :         };
    4614             : 
    4615           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4616             : 
    4617           8 :         torture_comment(tctx, "Checking whether create with delete-on-close is ignored for AFP_AfpResource\n");
    4618             : 
    4619           8 :         smb2_deltree(tree, BASEDIR);
    4620           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4621           8 :         torture_assert_ntstatus_ok(tctx, status, "torture_smb2_testdir");
    4622           8 :         smb2_util_close(tree, h1);
    4623           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4624           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4625             : 
    4626           8 :         torture_comment(tctx, "Opening not existing AFP_AfpResource\n");
    4627             : 
    4628           8 :         ZERO_STRUCT(create);
    4629           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4630           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */
    4631           8 :         create.in.fname = sname;
    4632             : 
    4633           8 :         status = smb2_create(tree, mem_ctx, &create);
    4634           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4635             :                                            ret, done, "Got unexpected AFP_AfpResource stream");
    4636             : 
    4637           8 :         ZERO_STRUCT(create);
    4638           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4639           8 :         create.in.desired_access = SEC_FILE_ALL;
    4640           8 :         create.in.fname = sname;
    4641             : 
    4642           8 :         status = smb2_create(tree, mem_ctx, &create);
    4643           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4644             :                                            ret, done, "Got unexpected AFP_AfpResource stream");
    4645             : 
    4646           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4647           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4648             : 
    4649           8 :         torture_comment(tctx, "Trying to delete AFP_AfpResource via create with delete-on-close\n");
    4650             : 
    4651           8 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    4652             :                            fname, AFPRESOURCE_STREAM_NAME,
    4653             :                            0, 10, "1234567890");
    4654           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
    4655             : 
    4656           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM_NAME,
    4657             :                            0, 10, 0, 10, "1234567890");
    4658           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad content from AFP_AfpResource");
    4659             : 
    4660           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
    4661           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4662             : 
    4663           8 :         ZERO_STRUCT(create);
    4664           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4665           8 :         create.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
    4666           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4667           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4668           8 :         create.in.fname = sname;
    4669           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4670             : 
    4671           8 :         status = smb2_create(tree, mem_ctx, &create);
    4672           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4673             : 
    4674           8 :         h1 = create.out.file.handle;
    4675           8 :         smb2_util_close(tree, h1);
    4676             : 
    4677           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
    4678           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4679             : 
    4680           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPRESOURCE_STREAM_NAME,
    4681             :                            0, 10, 0, 10, "1234567890");
    4682           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad content from AFP_AfpResource");
    4683             : 
    4684           8 : done:
    4685           8 :         smb2_util_unlink(tree, fname);
    4686           8 :         smb2_util_rmdir(tree, BASEDIR);
    4687           8 :         return ret;
    4688             : }
    4689             : 
    4690           8 : static bool test_setinfo_delete_on_close_resource(struct torture_context *tctx,
    4691             :                                                   struct smb2_tree *tree)
    4692             : {
    4693           8 :         bool ret = true;
    4694           0 :         NTSTATUS status;
    4695           0 :         struct smb2_create create;
    4696           0 :         union smb_setfileinfo sfinfo;
    4697           0 :         struct smb2_handle h1;
    4698           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4699           8 :         const char *fname = BASEDIR "\\file";
    4700           8 :         const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
    4701           8 :         const char *streams_afpresource[] = {
    4702             :                 "::$DATA",
    4703             :                 AFPRESOURCE_STREAM
    4704             :         };
    4705             : 
    4706           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4707             : 
    4708           8 :         torture_comment(tctx, "Trying to delete AFP_AfpResource via setinfo with delete-on-close\n");
    4709             : 
    4710           8 :         smb2_deltree(tree, BASEDIR);
    4711           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4712           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4713           8 :         smb2_util_close(tree, h1);
    4714           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4715           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4716             : 
    4717           8 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    4718             :                            fname, AFPRESOURCE_STREAM_NAME,
    4719             :                            10, 10, "1234567890");
    4720           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
    4721             : 
    4722           8 :         ZERO_STRUCT(create);
    4723           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4724           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE | SEC_STD_SYNCHRONIZE | SEC_STD_DELETE;
    4725           8 :         create.in.fname = sname;
    4726           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4727           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4728             : 
    4729           8 :         status = smb2_create(tree, mem_ctx, &create);
    4730           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4731             : 
    4732           8 :         h1 = create.out.file.handle;
    4733             : 
    4734             :         /* Try to delete stream via setinfo delete-on-close */
    4735           8 :         ZERO_STRUCT(sfinfo);
    4736           8 :         sfinfo.disposition_info.in.delete_on_close = 1;
    4737           8 :         sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
    4738           8 :         sfinfo.generic.in.file.handle = h1;
    4739           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    4740           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set delete-on-close failed");
    4741             : 
    4742           8 :         smb2_util_close(tree, h1);
    4743             : 
    4744           8 :         ret = check_stream_list(tree, tctx, fname, 2, streams_afpresource, false);
    4745           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4746             : 
    4747           8 :         ZERO_STRUCT(create);
    4748           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4749           8 :         create.in.desired_access = SEC_FILE_ALL;
    4750           8 :         create.in.fname = sname;
    4751           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4752           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4753           8 :         status = smb2_create(tree, mem_ctx, &create);
    4754           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4755             :                                         "Got unexpected AFP_AfpResource stream");
    4756             : 
    4757           8 : done:
    4758           8 :         smb2_util_unlink(tree, fname);
    4759           8 :         smb2_util_rmdir(tree, BASEDIR);
    4760           8 :         return ret;
    4761             : }
    4762             : 
    4763           8 : static bool test_setinfo_eof_resource(struct torture_context *tctx,
    4764             :                                       struct smb2_tree *tree)
    4765             : {
    4766           8 :         bool ret = true;
    4767           0 :         NTSTATUS status;
    4768           0 :         struct smb2_create create;
    4769           0 :         union smb_setfileinfo sfinfo;
    4770           0 :         union smb_fileinfo finfo;
    4771           0 :         struct smb2_handle h1;
    4772           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4773           8 :         const char *fname = BASEDIR "\\file";
    4774           8 :         const char *sname = BASEDIR "\\file" AFPRESOURCE_STREAM_NAME;
    4775           8 :         const char *streams_basic[] = {
    4776             :                 "::$DATA"
    4777             :         };
    4778             : 
    4779           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new");
    4780             : 
    4781           8 :         ret = enable_aapl(tctx, tree);
    4782           8 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    4783             : 
    4784           8 :         torture_comment(tctx, "Set AFP_AfpResource EOF to 1 and 0\n");
    4785             : 
    4786           8 :         smb2_deltree(tree, BASEDIR);
    4787           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    4788           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir");
    4789           8 :         smb2_util_close(tree, h1);
    4790           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4791           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    4792             : 
    4793           8 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    4794             :                            fname, AFPRESOURCE_STREAM_NAME,
    4795             :                            10, 10, "1234567890");
    4796           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Writing to AFP_AfpResource failed");
    4797             : 
    4798           8 :         ZERO_STRUCT(create);
    4799           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4800           8 :         create.in.desired_access = SEC_FILE_ALL;
    4801           8 :         create.in.fname = sname;
    4802           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4803           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4804             : 
    4805           8 :         status = smb2_create(tree, mem_ctx, &create);
    4806           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4807             : 
    4808           8 :         h1 = create.out.file.handle;
    4809             : 
    4810           8 :         torture_comment(tctx, "Set AFP_AfpResource EOF to 1\n");
    4811             : 
    4812             :         /* Test setinfo end-of-file info */
    4813           8 :         ZERO_STRUCT(sfinfo);
    4814           8 :         sfinfo.generic.in.file.handle = h1;
    4815           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4816           8 :         sfinfo.position_information.in.position = 1;
    4817           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    4818           8 :         torture_assert_ntstatus_ok_goto(tctx, status,
    4819             :                                         ret, done, "set eof 1 failed");
    4820             : 
    4821           8 :         smb2_util_close(tree, h1);
    4822             : 
    4823             :         /* Check size == 1 */
    4824           8 :         ZERO_STRUCT(create);
    4825           8 :         create.in.fname = sname;
    4826           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4827           8 :         create.in.desired_access = SEC_FILE_ALL;
    4828           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4829           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4830           8 :         status = smb2_create(tree, mem_ctx, &create);
    4831           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4832             : 
    4833           8 :         h1 = create.out.file.handle;
    4834             : 
    4835           8 :         ZERO_STRUCT(finfo);
    4836           8 :         finfo.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
    4837           8 :         finfo.generic.in.file.handle = h1;
    4838           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    4839           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_getinfo_file failed");
    4840             : 
    4841           8 :         smb2_util_close(tree, h1);
    4842             : 
    4843           8 :         torture_assert_goto(tctx, finfo.all_info.out.size == 1, ret, done, "size != 1");
    4844             : 
    4845           8 :         ZERO_STRUCT(create);
    4846           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4847           8 :         create.in.desired_access = SEC_FILE_ALL;
    4848           8 :         create.in.fname = sname;
    4849           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4850           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4851             : 
    4852           8 :         status = smb2_create(tree, mem_ctx, &create);
    4853           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    4854             : 
    4855           8 :         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           8 :         ZERO_STRUCT(sfinfo);
    4862           8 :         sfinfo.generic.in.file.handle = h1;
    4863           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    4864           8 :         sfinfo.position_information.in.position = 0;
    4865           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    4866           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set eof 0 failed");
    4867             : 
    4868           8 :         smb2_util_close(tree, h1);
    4869             : 
    4870           8 :         ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);
    4871           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    4872             : 
    4873           8 :         ZERO_STRUCT(create);
    4874           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    4875           8 :         create.in.desired_access = SEC_FILE_ALL;
    4876           8 :         create.in.fname = sname;
    4877           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4878           8 :         create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
    4879             : 
    4880           8 :         status = smb2_create(tree, mem_ctx, &create);
    4881           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    4882             :                                            ret, done, "smb2_create failed");
    4883             : 
    4884           8 : done:
    4885           8 :         smb2_util_unlink(tree, fname);
    4886           8 :         smb2_util_rmdir(tree, BASEDIR);
    4887           8 :         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           8 : static bool test_null_afpinfo(struct torture_context *tctx,
    4900             :                               struct smb2_tree *tree)
    4901             : {
    4902           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    4903           8 :         const char *fname = "test_null_afpinfo";
    4904           8 :         const char *sname = "test_null_afpinfo" AFPINFO_STREAM_NAME;
    4905           0 :         NTSTATUS status;
    4906           8 :         bool ret = true;
    4907           0 :         struct smb2_request *req[3];
    4908           0 :         struct smb2_handle handle;
    4909           0 :         struct smb2_create create;
    4910           0 :         struct smb2_read read;
    4911           8 :         AfpInfo *afpinfo = NULL;
    4912           8 :         char *afpinfo_buf = NULL;
    4913           8 :         const char *type_creator = "SMB,OLE!";
    4914           0 :         struct smb2_handle handle2;
    4915           0 :         struct smb2_read r;
    4916             : 
    4917           8 :         torture_comment(tctx, "Checking create of AfpInfo stream\n");
    4918             : 
    4919           8 :         smb2_util_unlink(tree, fname);
    4920             : 
    4921           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    4922           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
    4923             : 
    4924           8 :         ZERO_STRUCT(create);
    4925           8 :         create.in.desired_access = SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA;
    4926           8 :         create.in.share_access = FILE_SHARE_READ | FILE_SHARE_DELETE;
    4927           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    4928           8 :         create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    4929           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
    4930           8 :         create.in.fname = sname;
    4931             : 
    4932           8 :         smb2_transport_compound_start(tree->session->transport, 2);
    4933             : 
    4934           8 :         req[0] = smb2_create_send(tree, &create);
    4935             : 
    4936           8 :         handle.data[0] = UINT64_MAX;
    4937           8 :         handle.data[1] = UINT64_MAX;
    4938             : 
    4939           8 :         smb2_transport_compound_set_related(tree->session->transport, true);
    4940             : 
    4941           8 :         ZERO_STRUCT(read);
    4942           8 :         read.in.file.handle = handle;
    4943           8 :         read.in.length = AFP_INFO_SIZE;
    4944           8 :         req[1] = smb2_read_send(tree, &read);
    4945             : 
    4946           8 :         status = smb2_create_recv(req[0], tree, &create);
    4947           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create_recv failed");
    4948             : 
    4949           8 :         handle = create.out.file.handle;
    4950             : 
    4951           8 :         status = smb2_read_recv(req[1], tree, &read);
    4952           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_read_recv failed");
    4953             : 
    4954           8 :         status = torture_smb2_testfile_access(tree, sname, &handle2,
    4955             :                                               SEC_FILE_READ_DATA);
    4956           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4957             :                                         "torture_smb2_testfile failed\n");
    4958           8 :         r = (struct smb2_read) {
    4959             :                 .in.file.handle = handle2,
    4960             :                 .in.length      = AFP_INFO_SIZE,
    4961             :         };
    4962             : 
    4963           8 :         status = smb2_read(tree, tree, &r);
    4964           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    4965             :                                         "torture_smb2_testfile failed\n");
    4966           8 :         smb2_util_close(tree, handle2);
    4967             : 
    4968           8 :         afpinfo = torture_afpinfo_new(mem_ctx);
    4969           8 :         torture_assert_goto(tctx, afpinfo != NULL, ret, done, "torture_afpinfo_new failed");
    4970             : 
    4971           8 :         memcpy(afpinfo->afpi_FinderInfo, type_creator, 8);
    4972             : 
    4973           8 :         afpinfo_buf = torture_afpinfo_pack(tctx, afpinfo);
    4974           8 :         torture_assert_goto(tctx, afpinfo_buf != NULL, ret, done, "torture_afpinfo_new failed");
    4975             : 
    4976           8 :         status = smb2_util_write(tree, handle, afpinfo_buf, 0, AFP_INFO_SIZE);
    4977           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_write failed");
    4978             : 
    4979           8 :         smb2_util_close(tree, handle);
    4980             : 
    4981           8 :         ret = check_stream(tree, __location__, tctx, mem_ctx, fname, AFPINFO_STREAM,
    4982             :                            0, 60, 16, 8, type_creator);
    4983           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    4984             : 
    4985           8 : done:
    4986           8 :         smb2_util_unlink(tree, fname);
    4987           8 :         talloc_free(mem_ctx);
    4988           8 :         return ret;
    4989             : }
    4990             : 
    4991           8 : static bool test_delete_file_with_rfork(struct torture_context *tctx,
    4992             :                                         struct smb2_tree *tree)
    4993             : {
    4994           8 :         const char *fname = "torture_write_rfork_io";
    4995           8 :         const char *rfork_content = "1234567890";
    4996           0 :         NTSTATUS status;
    4997           8 :         bool ret = true;
    4998             : 
    4999           8 :         smb2_util_unlink(tree, fname);
    5000             : 
    5001           8 :         torture_comment(tctx, "Test deleting file with resource fork\n");
    5002             : 
    5003           8 :         ret = torture_setup_file(tctx, tree, fname, false);
    5004           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed\n");
    5005             : 
    5006           8 :         ret = write_stream(tree, __location__, tctx, tctx,
    5007             :                            fname, AFPRESOURCE_STREAM_NAME,
    5008             :                            10, 10, rfork_content);
    5009           8 :         torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed\n");
    5010             : 
    5011           8 :         ret = check_stream(tree, __location__, tctx, tctx,
    5012             :                            fname, AFPRESOURCE_STREAM_NAME,
    5013             :                            0, 20, 10, 10, rfork_content);
    5014           8 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed\n");
    5015             : 
    5016           8 :         status = smb2_util_unlink(tree, fname);
    5017           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "check_stream failed\n");
    5018             : 
    5019           8 : done:
    5020           8 :         return ret;
    5021             : }
    5022             : 
    5023           8 : static bool test_rename_and_read_rsrc(struct torture_context *tctx,
    5024             :                                       struct smb2_tree *tree)
    5025             : {
    5026           8 :         bool ret = true;
    5027           0 :         NTSTATUS status;
    5028           0 :         struct smb2_create create, create2;
    5029           0 :         struct smb2_handle h1, h2;
    5030           8 :         const char *fname = "test_rename_openfile";
    5031           8 :         const char *sname = "test_rename_openfile" AFPRESOURCE_STREAM_NAME;
    5032           8 :         const char *fname_renamed = "test_rename_openfile_renamed";
    5033           8 :         const char *data = "1234567890";
    5034           0 :         union smb_setfileinfo sinfo;
    5035           8 :         bool server_is_macos = torture_setting_bool(tctx, "osx", false);
    5036           0 :         NTSTATUS expected_status;
    5037             : 
    5038           8 :         ret = enable_aapl(tctx, tree);
    5039           8 :         torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
    5040             : 
    5041           8 :         torture_comment(tctx, "Create file with resource fork\n");
    5042             : 
    5043           8 :         ret = torture_setup_file(tctx, tree, fname, false);
    5044           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    5045             : 
    5046           8 :         ret = write_stream(tree, __location__, tctx, tctx,
    5047             :                            fname, AFPRESOURCE_STREAM_NAME, 0, 10, data);
    5048           8 :         torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
    5049             : 
    5050           8 :         torture_comment(tctx, "Open resource fork\n");
    5051             : 
    5052           8 :         ZERO_STRUCT(create);
    5053           8 :         create.in.desired_access = SEC_FILE_ALL;
    5054           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5055           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5056           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5057           8 :         create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    5058           8 :         create.in.fname = sname;
    5059             : 
    5060           8 :         status = smb2_create(tree, tctx, &create);
    5061           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    5062             : 
    5063           8 :         h1 = create.out.file.handle;
    5064             : 
    5065           8 :         torture_comment(tctx, "Rename base file\n");
    5066             : 
    5067           8 :         ZERO_STRUCT(create2);
    5068           8 :         create2.in.desired_access = SEC_FILE_ALL;
    5069           8 :         create2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5070           8 :         create2.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5071           8 :         create2.in.create_disposition = NTCREATEX_DISP_OPEN;
    5072           8 :         create2.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    5073           8 :         create2.in.fname = fname;
    5074             : 
    5075           8 :         status = smb2_create(tree, tctx, &create2);
    5076           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    5077             : 
    5078           8 :         h2 = create2.out.file.handle;
    5079             : 
    5080           8 :         ZERO_STRUCT(sinfo);
    5081           8 :         sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
    5082           8 :         sinfo.rename_information.in.file.handle = h2;
    5083           8 :         sinfo.rename_information.in.overwrite = 0;
    5084           8 :         sinfo.rename_information.in.root_fid = 0;
    5085           8 :         sinfo.rename_information.in.new_name = fname_renamed;
    5086             : 
    5087           8 :         if (server_is_macos) {
    5088           0 :                 expected_status = NT_STATUS_SHARING_VIOLATION;
    5089             :         } else {
    5090           8 :                 expected_status = NT_STATUS_ACCESS_DENIED;
    5091             :         }
    5092             : 
    5093           8 :         status = smb2_setinfo_file(tree, &sinfo);
    5094           8 :         torture_assert_ntstatus_equal_goto(
    5095             :                 tctx, status, expected_status, ret, done,
    5096             :                 "smb2_setinfo_file failed");
    5097             : 
    5098           8 :         smb2_util_close(tree, h2);
    5099             : 
    5100           8 :         status = smb2_util_write(tree, h1, "foo", 0, 3);
    5101           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    5102             :                                         "write failed\n");
    5103             : 
    5104           8 :         smb2_util_close(tree, h1);
    5105             : 
    5106           8 : done:
    5107           8 :         smb2_util_unlink(tree, fname);
    5108           8 :         smb2_util_unlink(tree, fname_renamed);
    5109             : 
    5110           8 :         return ret;
    5111             : }
    5112             : 
    5113           8 : static bool test_readdir_attr_illegal_ntfs(struct torture_context *tctx,
    5114             :                                            struct smb2_tree *tree)
    5115             : {
    5116           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    5117           8 :         const char *name = "test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */
    5118           8 :         const char *fname = BASEDIR "\\test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */
    5119           0 :         NTSTATUS status;
    5120           0 :         struct smb2_handle testdirh;
    5121           8 :         bool ret = true;
    5122           0 :         struct smb2_create io;
    5123           0 :         AfpInfo *info;
    5124           8 :         const char *type_creator = "SMB,OLE!";
    5125           0 :         struct smb2_find f;
    5126           0 :         unsigned int count;
    5127           0 :         union smb_search_data *d;
    5128           0 :         uint64_t rfork_len;
    5129           0 :         unsigned int i;
    5130             : 
    5131           8 :         smb2_deltree(tree, BASEDIR);
    5132             : 
    5133           8 :         status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
    5134           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir failed");
    5135           8 :         smb2_util_close(tree, testdirh);
    5136             : 
    5137           8 :         torture_comment(tctx, "Enabling AAPL\n");
    5138             : 
    5139           8 :         ret = enable_aapl(tctx, tree);
    5140           8 :         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           8 :         torture_comment(tctx, "Preparing file\n");
    5148             : 
    5149           8 :         ret = torture_setup_file(mem_ctx, tree, fname, false);
    5150           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
    5151             : 
    5152           8 :         info = torture_afpinfo_new(mem_ctx);
    5153           8 :         torture_assert_not_null_goto(tctx, info, ret, done, "torture_afpinfo_new failed");
    5154             : 
    5155           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    5156           8 :         ret = torture_write_afpinfo(tree, tctx, mem_ctx, fname, info);
    5157           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    5158             : 
    5159           8 :         ret = write_stream(tree, __location__, tctx, mem_ctx,
    5160             :                            fname, AFPRESOURCE_STREAM_NAME,
    5161             :                            0, 3, "foo");
    5162           8 :         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           8 :         torture_comment(tctx, "Issue find\n");
    5169             : 
    5170           8 :         ZERO_STRUCT(io);
    5171           8 :         io.in.desired_access = SEC_RIGHTS_DIR_READ;
    5172           8 :         io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    5173           8 :         io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
    5174           8 :         io.in.share_access = (NTCREATEX_SHARE_ACCESS_READ |
    5175             :                               NTCREATEX_SHARE_ACCESS_WRITE |
    5176             :                               NTCREATEX_SHARE_ACCESS_DELETE);
    5177           8 :         io.in.create_disposition = NTCREATEX_DISP_OPEN;
    5178           8 :         io.in.fname = BASEDIR;
    5179           8 :         status = smb2_create(tree, tctx, &io);
    5180           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_create failed");
    5181             : 
    5182           8 :         ZERO_STRUCT(f);
    5183           8 :         f.in.file.handle        = io.out.file.handle;
    5184           8 :         f.in.pattern            = "*";
    5185           8 :         f.in.max_response_size  = 0x1000;
    5186           8 :         f.in.level              = SMB2_FIND_ID_BOTH_DIRECTORY_INFO;
    5187             : 
    5188           8 :         status = smb2_find_level(tree, tree, &f, &count, &d);
    5189           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_find_level failed");
    5190             : 
    5191           8 :         status = smb2_util_close(tree, io.out.file.handle);
    5192           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_util_close failed");
    5193             : 
    5194           8 :         torture_comment(tctx, "Checking find response with enriched macOS metadata\n");
    5195             : 
    5196          28 :         for (i = 0; i < count; i++) {
    5197          28 :                 const char *found = d[i].id_both_directory_info.name.s;
    5198             : 
    5199          28 :                 if (!strcmp(found, ".") || !strcmp(found, ".."))
    5200          16 :                         continue;
    5201          12 :                 if (strncmp(found, "._", 2) == 0) {
    5202           4 :                         continue;
    5203             :                 }
    5204           8 :                 break;
    5205             :         }
    5206             : 
    5207           8 :         torture_assert_str_equal_goto(tctx,
    5208             :                                       d[i].id_both_directory_info.name.s, name,
    5209             :                                       ret, done, "bad name");
    5210             : 
    5211           8 :         rfork_len = BVAL(d[i].id_both_directory_info.short_name_buf, 0);
    5212           8 :         torture_assert_int_equal_goto(tctx, rfork_len, 3, ret, done, "bad resource fork length");
    5213             : 
    5214           8 :         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           8 : done:
    5218           8 :         smb2_util_unlink(tree, fname);
    5219           8 :         smb2_deltree(tree, BASEDIR);
    5220           8 :         talloc_free(mem_ctx);
    5221           8 :         return ret;
    5222             : }
    5223             : 
    5224           8 : static bool test_invalid_afpinfo(struct torture_context *tctx,
    5225             :                                  struct smb2_tree *tree1,
    5226             :                                  struct smb2_tree *tree2)
    5227             : {
    5228           8 :         const char *fname = "filtest_invalid_afpinfo";
    5229           8 :         const char *sname = "filtest_invalid_afpinfo" AFPINFO_STREAM_NAME;
    5230           0 :         struct smb2_create create;
    5231           8 :         const char *streams_basic[] = {
    5232             :                 "::$DATA"
    5233             :         };
    5234           8 :         const char *streams_afpinfo[] = {
    5235             :                 "::$DATA",
    5236             :                 AFPINFO_STREAM
    5237             :         };
    5238           0 :         NTSTATUS status;
    5239           8 :         bool ret = true;
    5240             : 
    5241           8 :         if (tree2 == NULL) {
    5242           0 :                 torture_skip_goto(tctx, done, "need second share without fruit\n");
    5243             :         }
    5244             : 
    5245           8 :         torture_comment(tctx, "Testing invalid AFP_AfpInfo stream\n");
    5246             : 
    5247           8 :         ret = torture_setup_file(tctx, tree2, fname, false);
    5248           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    5249             : 
    5250           8 :         ret = write_stream(tree2, __location__, tctx, tctx,
    5251             :                            fname, AFPINFO_STREAM_NAME,
    5252             :                            0, 3, "foo");
    5253           8 :         torture_assert_goto(tctx, ret == true, ret, done, "write_stream failed");
    5254             : 
    5255           8 :         ret = check_stream_list(tree2, tctx, fname, 2, streams_afpinfo, false);
    5256           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    5257             : 
    5258           8 :         torture_comment(tctx, "Listing streams, bad AFPINFO stream must not be present\n");
    5259             : 
    5260           8 :         ret = check_stream_list(tree1, tctx, fname, 1, streams_basic, false);
    5261           8 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    5262             : 
    5263           8 :         torture_comment(tctx, "Try to open AFPINFO stream, must fail\n");
    5264             : 
    5265           8 :         ZERO_STRUCT(create);
    5266           8 :         create.in.desired_access = SEC_FILE_ALL;
    5267           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5268           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5269           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5270           8 :         create.in.impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
    5271           8 :         create.in.fname = sname;
    5272             : 
    5273           8 :         status = smb2_create(tree1, tctx, &create);
    5274           8 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND,
    5275             :                                            ret, done, "Stream still around?");
    5276             : 
    5277           8 : done:
    5278           8 :         smb2_util_unlink(tree1, fname);
    5279           8 :         return ret;
    5280             : }
    5281             : 
    5282           8 : static bool test_writing_afpinfo(struct torture_context *tctx,
    5283             :                                  struct smb2_tree *tree)
    5284             : {
    5285           8 :         const char *fname = "filtest_invalid_afpinfo";
    5286           8 :         const char *sname = "filtest_invalid_afpinfo" AFPINFO_STREAM;
    5287           8 :         const char *streams_afpinfo[] = {
    5288             :                 "::$DATA",
    5289             :                 AFPINFO_STREAM
    5290             :         };
    5291           8 :         bool ret = true;
    5292           0 :         static AfpInfo *afpi = NULL;
    5293           8 :         char *buf = NULL;
    5294           8 :         char *afpi_buf = NULL;
    5295           8 :         char *zero_buf = NULL;
    5296           8 :         bool broken_osx = torture_setting_bool(tctx, "broken_osx_45759458", false);
    5297           8 :         off_t min_offset_for_2streams = 16;
    5298           0 :         int i;
    5299           0 :         NTSTATUS status;
    5300           0 :         struct test_sizes {
    5301             :                 off_t offset;
    5302             :                 size_t size;
    5303             :                 bool expected_result;
    5304           8 :         } 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           8 :         afpi = torture_afpinfo_new(tctx);
    5478           8 :         torture_assert_not_null_goto(tctx, afpi, ret, done,
    5479             :                                      "torture_afpinfo_new failed\n");
    5480             : 
    5481           8 :         memcpy(afpi->afpi_FinderInfo, "FOO BAR ", 8);
    5482             : 
    5483           8 :         buf = torture_afpinfo_pack(afpi, afpi);
    5484           8 :         torture_assert_not_null_goto(tctx, buf, ret, done,
    5485             :                                      "torture_afpinfo_pack failed\n");
    5486             : 
    5487           8 :         afpi_buf = talloc_zero_array(tctx, char, 10064);
    5488           8 :         torture_assert_not_null_goto(tctx, afpi_buf, ret, done,
    5489             :                                      "talloc_zero_array failed\n");
    5490           8 :         memcpy(afpi_buf, buf, 60);
    5491             : 
    5492           8 :         zero_buf = talloc_zero_array(tctx, char, 10064);
    5493           8 :         torture_assert_not_null_goto(tctx, zero_buf, ret, done,
    5494             :                                      "talloc_zero_array failed\n");
    5495             : 
    5496           8 :         ret = torture_setup_file(tctx, tree, fname, false);
    5497           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    5498             :                             "torture_setup_file\n");
    5499             : 
    5500        1296 :         for (i = 0; test_sizes[i].offset != -1; i++) {
    5501           0 :                 struct smb2_handle h;
    5502           0 :                 struct smb2_create c;
    5503           0 :                 int expected_num_streams;
    5504           0 :                 size_t fi_check_size;
    5505             : 
    5506        1288 :                 torture_comment(tctx,
    5507             :                                 "Test %d: offset=%jd size=%zu result=%s\n",
    5508             :                                 i,
    5509        1288 :                                 (intmax_t)test_sizes[i].offset,
    5510             :                                 test_sizes[i].size,
    5511        1288 :                                 test_sizes[i].expected_result ? "true":"false");
    5512             : 
    5513             : 
    5514        1288 :                 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        1288 :                 status = smb2_create(tree, tree, &c);
    5522        1288 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    5523             :                                                 "smb2_create\n");
    5524        1288 :                 h = c.out.file.handle;
    5525             : 
    5526        1288 :                 status = smb2_util_write(tree,
    5527             :                                          h,
    5528             :                                          zero_buf,
    5529             :                                          test_sizes[i].offset,
    5530             :                                          test_sizes[i].size);
    5531        1288 :                 torture_assert_ntstatus_equal_goto(
    5532             :                         tctx, status, NT_STATUS_INVALID_PARAMETER,
    5533             :                         ret, done, "smb2_util_write\n");
    5534             : 
    5535        1288 :                 status = smb2_util_write(tree,
    5536             :                                          h,
    5537             :                                          afpi_buf,
    5538             :                                          test_sizes[i].offset,
    5539             :                                          test_sizes[i].size);
    5540        1288 :                 smb2_util_close(tree, h);
    5541        1288 :                 if (test_sizes[i].expected_result == true) {
    5542         376 :                         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    5543             :                                                         "smb2_util_write\n");
    5544             :                 } else {
    5545         912 :                         torture_assert_ntstatus_equal_goto(
    5546             :                                 tctx, status, NT_STATUS_INVALID_PARAMETER,
    5547             :                                 ret, done, "smb2_util_write\n");
    5548             :                 }
    5549             : 
    5550        1288 :                 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        1288 :                 if ((test_sizes[i].expected_result == true) &&
    5563         376 :                     (test_sizes[i].size > min_offset_for_2streams))
    5564             :                 {
    5565         336 :                         expected_num_streams = 2;
    5566             :                 } else {
    5567         952 :                         expected_num_streams = 1;
    5568             :                 }
    5569             : 
    5570        1288 :                 ret = check_stream_list(tree, tctx, fname,
    5571             :                                         expected_num_streams,
    5572             :                                         streams_afpinfo, false);
    5573        1288 :                 torture_assert_goto(tctx, ret == true, ret, done,
    5574             :                                     "Bad streams\n");
    5575             : 
    5576        1288 :                 if (test_sizes[i].expected_result == false) {
    5577         912 :                         continue;
    5578             :                 }
    5579             : 
    5580         376 :                 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          40 :                         goto next;
    5587             :                 }
    5588             : 
    5589         336 :                 fi_check_size = test_sizes[i].size - 16;
    5590         336 :                 fi_check_size = MIN(fi_check_size, 8);
    5591             : 
    5592         336 :                 ret = check_stream(tree, __location__,
    5593             :                                    tctx, tctx,
    5594             :                                    fname, AFPINFO_STREAM,
    5595             :                                    0, 60, 16, fi_check_size, "FOO BAR ");
    5596         336 :                 torture_assert_goto(tctx, ret == true, ret, done,
    5597             :                                     "Bad streams\n");
    5598             : 
    5599         336 : next:
    5600         376 :                 status = smb2_util_unlink(tree, sname);
    5601         376 :                 if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
    5602           0 :                         bool missing_ok;
    5603             : 
    5604          40 :                         missing_ok = test_sizes[i].expected_result == false;
    5605          40 :                         missing_ok |= test_sizes[i].size <= 16;
    5606             : 
    5607          40 :                         torture_assert_goto(tctx, missing_ok,
    5608             :                                             ret, done, "smb2_util_unlink\n");
    5609             :                 }
    5610             :         }
    5611             : 
    5612           8 : done:
    5613           8 :         smb2_util_unlink(tree, fname);
    5614           8 :         return ret;
    5615             : }
    5616             : 
    5617           2 : static bool test_zero_file_id(struct torture_context *tctx,
    5618             :                               struct smb2_tree *tree)
    5619             : {
    5620           2 :         const char *fname = "filtest_file_id";
    5621           2 :         struct smb2_create create = {0};
    5622           0 :         NTSTATUS status;
    5623           2 :         bool ret = true;
    5624           2 :         uint8_t zero_file_id[8] = {0};
    5625             : 
    5626           2 :         torture_comment(tctx, "Testing zero file id\n");
    5627             : 
    5628           2 :         ret = torture_setup_file(tctx, tree, fname, false);
    5629           2 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    5630             : 
    5631           2 :         ZERO_STRUCT(create);
    5632           2 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    5633           2 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5634           2 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5635           2 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5636           2 :         create.in.fname = fname;
    5637           2 :         create.in.query_on_disk_id = true;
    5638             : 
    5639           2 :         status = smb2_create(tree, tctx, &create);
    5640           2 :         torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, ret,
    5641             :                                            done,
    5642             :                                            "test file could not be opened");
    5643           2 :         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           2 :         smb2_util_close(tree, create.out.file.handle);
    5648             : 
    5649           2 :         ret = enable_aapl(tctx, tree);
    5650           2 :         torture_assert(tctx, ret == true, "enable_aapl failed");
    5651             : 
    5652           2 :         ZERO_STRUCT(create);
    5653           2 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    5654           2 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    5655           2 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    5656           2 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    5657           2 :         create.in.fname = fname;
    5658           2 :         create.in.query_on_disk_id = true;
    5659             : 
    5660           2 :         status = smb2_create(tree, tctx, &create);
    5661           2 :         torture_assert_ntstatus_equal_goto(
    5662             :             tctx, status, NT_STATUS_OK, ret, done,
    5663             :             "test file could not be opened with AAPL");
    5664           2 :         torture_assert_mem_equal_goto(tctx, create.out.on_disk_id, zero_file_id,
    5665             :                                       8, ret, done, "non-zero file id");
    5666             : 
    5667           2 :         smb2_util_close(tree, create.out.file.handle);
    5668             : 
    5669           2 : done:
    5670           2 :         smb2_util_unlink(tree, fname);
    5671           2 :         return ret;
    5672             : }
    5673             : 
    5674          16 : 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          16 :         struct smb2_handle src_h = {{0}};
    5681          16 :         struct smb2_handle dest_h = {{0}};
    5682           0 :         NTSTATUS status;
    5683           0 :         union smb_ioctl io;
    5684           0 :         struct srv_copychunk_copy cc_copy;
    5685           0 :         struct srv_copychunk_rsp cc_rsp;
    5686           0 :         enum ndr_err_code ndr_ret;
    5687          16 :         bool ok = false;
    5688             : 
    5689          16 :         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          16 :         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          16 :         cc_copy.chunks[0].source_off = 0;
    5704          16 :         cc_copy.chunks[0].target_off = 0;
    5705          16 :         cc_copy.chunks[0].length = 256;
    5706             : 
    5707          16 :         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          16 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5712             :                                    "ndr_push_srv_copychunk_copy\n");
    5713             : 
    5714          16 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    5715          16 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done,
    5716             :                                         "FSCTL_SRV_COPYCHUNK\n");
    5717             : 
    5718          16 :         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          16 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5723             :                                    "ndr_pull_srv_copychunk_rsp\n");
    5724             : 
    5725          16 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    5726             :                                   1,    /* chunks written */
    5727             :                                   0,    /* chunk bytes unsuccessfully written */
    5728             :                                   256); /* total bytes written */
    5729          16 :         torture_assert_goto(torture, ok == true, ok, done,
    5730             :                             "bad copy chunk response data\n");
    5731             : 
    5732          16 :         ok = check_pattern(torture, tree, tmp_ctx, dest_h, 0, 256, 0);
    5733          16 :         if (!ok) {
    5734           0 :                 torture_fail(torture, "inconsistent file data\n");
    5735             :         }
    5736             : 
    5737          16 : done:
    5738          16 :         if (!smb2_util_handle_empty(src_h)) {
    5739          16 :                 smb2_util_close(tree, src_h);
    5740             :         }
    5741          16 :         if (!smb2_util_handle_empty(dest_h)) {
    5742          16 :                 smb2_util_close(tree, dest_h);
    5743             :         }
    5744             : 
    5745          16 :         return ok;
    5746             : }
    5747             : 
    5748           8 : 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           8 :         struct smb2_handle src_h = {{0}};
    5755           8 :         struct smb2_handle dest_h = {{0}};
    5756           0 :         NTSTATUS status;
    5757           0 :         union smb_ioctl io;
    5758           0 :         struct srv_copychunk_copy cc_copy;
    5759           0 :         struct srv_copychunk_rsp cc_rsp;
    5760           0 :         enum ndr_err_code ndr_ret;
    5761           8 :         const char *type_creator = "SMB,OLE!";
    5762           8 :         AfpInfo *info = NULL;
    5763           8 :         const char *src_name_afpinfo = NULL;
    5764           8 :         const char *dst_name_afpinfo = NULL;
    5765           8 :         bool ok = false;
    5766             : 
    5767           8 :         src_name_afpinfo = talloc_asprintf(tmp_ctx, "%s%s", src_name,
    5768             :                                            AFPINFO_STREAM);
    5769           8 :         torture_assert_not_null_goto(torture, src_name_afpinfo, ok, done,
    5770             :                                      "talloc_asprintf failed\n");
    5771             : 
    5772           8 :         dst_name_afpinfo = talloc_asprintf(tmp_ctx, "%s%s", dst_name,
    5773             :                                            AFPINFO_STREAM);
    5774           8 :         torture_assert_not_null_goto(torture, dst_name_afpinfo, ok, done,
    5775             :                                      "talloc_asprintf failed\n");
    5776             : 
    5777           8 :         info = torture_afpinfo_new(tmp_ctx);
    5778           8 :         torture_assert_not_null_goto(torture, info, ok, done,
    5779             :                                      "torture_afpinfo_new failed\n");
    5780             : 
    5781           8 :         memcpy(info->afpi_FinderInfo, type_creator, 8);
    5782           8 :         ok = torture_write_afpinfo(tree, torture, tmp_ctx, src_name, info);
    5783           8 :         torture_assert_goto(torture, ok == true, ok, done,
    5784             :                             "torture_write_afpinfo failed\n");
    5785             : 
    5786           8 :         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           8 :         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           8 :         cc_copy.chunks[0].source_off = 0;
    5801           8 :         cc_copy.chunks[0].target_off = 0;
    5802           8 :         cc_copy.chunks[0].length = 60;
    5803             : 
    5804           8 :         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           8 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5809             :                                    "ndr_push_srv_copychunk_copy\n");
    5810             : 
    5811           8 :         status = smb2_ioctl(tree, tmp_ctx, &io.smb2);
    5812           8 :         torture_assert_ntstatus_ok_goto(torture, status, ok, done,
    5813             :                                         "FSCTL_SRV_COPYCHUNK\n");
    5814             : 
    5815           8 :         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           8 :         torture_assert_ndr_success_goto(torture, ndr_ret, ok, done,
    5820             :                                    "ndr_pull_srv_copychunk_rsp\n");
    5821             : 
    5822           8 :         smb2_util_close(tree, src_h);
    5823           8 :         ZERO_STRUCT(src_h);
    5824           8 :         smb2_util_close(tree, dest_h);
    5825           8 :         ZERO_STRUCT(dest_h);
    5826             : 
    5827           8 :         ok = check_copy_chunk_rsp(torture, &cc_rsp,
    5828             :                                   1,    /* chunks written */
    5829             :                                   0,    /* chunk bytes unsuccessfully written */
    5830             :                                   60); /* total bytes written */
    5831           8 :         torture_assert_goto(torture, ok == true, ok, done,
    5832             :                             "bad copy chunk response data\n");
    5833             : 
    5834           8 :         ok = check_stream(tree, __location__, torture, tmp_ctx,
    5835             :                           dst_name, AFPINFO_STREAM,
    5836             :                           0, 60, 16, 8, type_creator);
    5837           8 :         torture_assert_goto(torture, ok == true, ok, done, "check_stream failed\n");
    5838             : 
    5839           8 : done:
    5840           8 :         if (!smb2_util_handle_empty(src_h)) {
    5841           0 :                 smb2_util_close(tree, src_h);
    5842             :         }
    5843           8 :         if (!smb2_util_handle_empty(dest_h)) {
    5844           0 :                 smb2_util_close(tree, dest_h);
    5845             :         }
    5846             : 
    5847           8 :         return ok;
    5848             : }
    5849             : 
    5850           8 : static bool test_copy_chunk_streams(struct torture_context *torture,
    5851             :                                     struct smb2_tree *tree)
    5852             : {
    5853           8 :         const char *src_name = "src";
    5854           8 :         const char *dst_name = "dst";
    5855           0 :         struct names {
    5856             :                 const char *src_sname;
    5857             :                 const char *dst_sname;
    5858           8 :         } names[] = {
    5859             :                 { "src:foo", "dst:foo" },
    5860             :                 { "src" AFPRESOURCE_STREAM, "dst" AFPRESOURCE_STREAM }
    5861             :         };
    5862           0 :         size_t i;
    5863           8 :         TALLOC_CTX *tmp_ctx = NULL;
    5864           8 :         bool ok = false;
    5865             : 
    5866           8 :         tmp_ctx = talloc_new(tree);
    5867           8 :         torture_assert_not_null_goto(torture, tmp_ctx, ok, done,
    5868             :                                      "torture_setup_file\n");
    5869             : 
    5870           8 :         smb2_util_unlink(tree, src_name);
    5871           8 :         smb2_util_unlink(tree, dst_name);
    5872             : 
    5873           8 :         ok = torture_setup_file(torture, tree, src_name, false);
    5874           8 :         torture_assert_goto(torture, ok == true, ok, done, "torture_setup_file\n");
    5875           8 :         ok = torture_setup_file(torture, tree, dst_name, false);
    5876           8 :         torture_assert_goto(torture, ok == true, ok, done, "torture_setup_file\n");
    5877             : 
    5878          24 :         for (i = 0; i < ARRAY_SIZE(names); i++) {
    5879          16 :                 ok = copy_one_stream(torture, tree, tmp_ctx,
    5880             :                                      names[i].src_sname,
    5881             :                                      names[i].dst_sname);
    5882          16 :                 torture_assert_goto(torture, ok == true, ok, done,
    5883             :                                     "copy_one_stream failed\n");
    5884             :         }
    5885             : 
    5886           8 :         ok = copy_finderinfo_stream(torture, tree, tmp_ctx,
    5887             :                                     src_name, dst_name);
    5888           8 :         torture_assert_goto(torture, ok == true, ok, done,
    5889             :                             "copy_finderinfo_stream failed\n");
    5890             : 
    5891           8 : done:
    5892           8 :         smb2_util_unlink(tree, src_name);
    5893           8 :         smb2_util_unlink(tree, dst_name);
    5894           8 :         talloc_free(tmp_ctx);
    5895           8 :         return ok;
    5896             : }
    5897             : 
    5898             : /*
    5899             :  * Ensure this security descriptor has exactly one mode, uid
    5900             :  * and gid.
    5901             :  */
    5902             : 
    5903          16 : static NTSTATUS check_nfs_sd(const struct security_descriptor *psd)
    5904             : {
    5905           0 :         uint32_t i;
    5906          16 :         bool got_one_mode = false;
    5907          16 :         bool got_one_uid = false;
    5908          16 :         bool got_one_gid = false;
    5909             : 
    5910          16 :         if (psd->dacl == NULL) {
    5911           0 :                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5912             :         }
    5913             : 
    5914         112 :         for (i = 0; i < psd->dacl->num_aces; i++) {
    5915          96 :                 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Mode,
    5916          96 :                                            &psd->dacl->aces[i].trustee) == 0) {
    5917          16 :                         if (got_one_mode == true) {
    5918             :                                 /* Can't have more than one. */
    5919           0 :                                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5920             :                         }
    5921          16 :                         got_one_mode = true;
    5922             :                 }
    5923             :         }
    5924         112 :         for (i = 0; i < psd->dacl->num_aces; i++) {
    5925          96 :                 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Users,
    5926          96 :                                            &psd->dacl->aces[i].trustee) == 0) {
    5927          16 :                         if (got_one_uid == true) {
    5928             :                                 /* Can't have more than one. */
    5929           0 :                                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5930             :                         }
    5931          16 :                         got_one_uid = true;
    5932             :                 }
    5933             :         }
    5934         112 :         for (i = 0; i < psd->dacl->num_aces; i++) {
    5935          96 :                 if (dom_sid_compare_domain(&global_sid_Unix_NFS_Groups,
    5936          96 :                                            &psd->dacl->aces[i].trustee) == 0) {
    5937          16 :                         if (got_one_gid == true) {
    5938             :                                 /* Can't have more than one. */
    5939           0 :                                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5940             :                         }
    5941          16 :                         got_one_gid = true;
    5942             :                 }
    5943             :         }
    5944             :         /* Must have at least one of each. */
    5945          16 :         if (got_one_mode == false ||
    5946          16 :                         got_one_uid == false ||
    5947          16 :                         got_one_gid == false) {
    5948           0 :                 return NT_STATUS_INVALID_SECURITY_DESCR;
    5949             :         }
    5950          16 :         return NT_STATUS_OK;
    5951             : }
    5952             : 
    5953           8 : static bool test_nfs_aces(struct torture_context *tctx,
    5954             :                           struct smb2_tree *tree)
    5955             : {
    5956           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    5957           0 :         struct security_ace ace;
    5958           0 :         struct dom_sid sid;
    5959           8 :         const char *fname = BASEDIR "\\nfs_aces.txt";
    5960           8 :         struct smb2_handle h = {{0}};
    5961           0 :         union smb_fileinfo finfo2;
    5962           0 :         union smb_setfileinfo set;
    5963           8 :         struct security_descriptor *psd = NULL;
    5964           0 :         NTSTATUS status;
    5965           8 :         bool ret = true;
    5966           8 :         bool is_osx = torture_setting_bool(tctx, "osx", false);
    5967             : 
    5968           8 :         if (is_osx) {
    5969           0 :                 torture_skip(tctx, "Test only works with Samba\n");
    5970             :         }
    5971             : 
    5972           8 :         ret = enable_aapl(tctx, tree);
    5973           8 :         torture_assert(tctx, ret == true, "enable_aapl failed");
    5974             : 
    5975             :         /* clean slate ...*/
    5976           8 :         smb2_util_unlink(tree, fname);
    5977           8 :         smb2_deltree(tree, fname);
    5978           8 :         smb2_deltree(tree, BASEDIR);
    5979             : 
    5980           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    5981           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    5982           8 :         smb2_util_close(tree, h);
    5983             : 
    5984             :         /* Create a test file. */
    5985           8 :         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           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    5992             : 
    5993             :         /* Get the ACL. */
    5994           8 :         finfo2.query_secdesc.in.secinfo_flags =
    5995             :                 SECINFO_OWNER |
    5996             :                 SECINFO_GROUP |
    5997             :                 SECINFO_DACL;
    5998           8 :         finfo2.generic.level = RAW_FILEINFO_SEC_DESC;
    5999           8 :         finfo2.generic.in.file.handle = h;
    6000           8 :         status = smb2_getinfo_file(tree, tctx, &finfo2);
    6001           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6002             : 
    6003           8 :         psd = finfo2.query_secdesc.out.sd;
    6004             : 
    6005             :         /* Ensure we have only single mode/uid/gid NFS entries. */
    6006           8 :         status = check_nfs_sd(psd);
    6007           8 :         if (!NT_STATUS_IS_OK(status)) {
    6008           0 :                 NDR_PRINT_DEBUG(
    6009             :                         security_descriptor,
    6010             :                         discard_const_p(struct security_descriptor, psd));
    6011             :         }
    6012           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6013             : 
    6014             :         /* Add a couple of extra NFS uids and gids. */
    6015           8 :         sid_compose(&sid, &global_sid_Unix_NFS_Users, 27);
    6016           8 :         init_sec_ace(&ace, &sid, SEC_ACE_TYPE_ACCESS_DENIED, 0, 0);
    6017           8 :         status = security_descriptor_dacl_add(psd, &ace);
    6018           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6019           8 :         status = security_descriptor_dacl_add(psd, &ace);
    6020           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6021             : 
    6022           8 :         sid_compose(&sid, &global_sid_Unix_NFS_Groups, 300);
    6023           8 :         init_sec_ace(&ace, &sid, SEC_ACE_TYPE_ACCESS_DENIED, 0, 0);
    6024           8 :         status = security_descriptor_dacl_add(psd, &ace);
    6025           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6026           8 :         status = security_descriptor_dacl_add(psd, &ace);
    6027           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6028             : 
    6029             :         /* Now set on the file handle. */
    6030           8 :         set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
    6031           8 :         set.set_secdesc.in.file.handle = h;
    6032           8 :         set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
    6033           8 :         set.set_secdesc.in.sd = psd;
    6034           8 :         status = smb2_setinfo_file(tree, &set);
    6035           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6036             : 
    6037             :         /* Get the ACL again. */
    6038           8 :         finfo2.query_secdesc.in.secinfo_flags =
    6039             :                 SECINFO_OWNER |
    6040             :                 SECINFO_GROUP |
    6041             :                 SECINFO_DACL;
    6042           8 :         finfo2.generic.level = RAW_FILEINFO_SEC_DESC;
    6043           8 :         finfo2.generic.in.file.handle = h;
    6044           8 :         status = smb2_getinfo_file(tree, tctx, &finfo2);
    6045           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6046             : 
    6047           8 :         psd = finfo2.query_secdesc.out.sd;
    6048             : 
    6049             :         /* Ensure we have only single mode/uid/gid NFS entries. */
    6050           8 :         status = check_nfs_sd(psd);
    6051           8 :         if (!NT_STATUS_IS_OK(status)) {
    6052           0 :                 NDR_PRINT_DEBUG(
    6053             :                         security_descriptor,
    6054             :                         discard_const_p(struct security_descriptor, psd));
    6055             :         }
    6056           8 :         CHECK_STATUS(status, NT_STATUS_OK);
    6057             : 
    6058           8 : done:
    6059           8 :         if (!smb2_util_handle_empty(h)) {
    6060           8 :                 smb2_util_close(tree, h);
    6061             :         }
    6062           8 :         smb2_util_unlink(tree, fname);
    6063           8 :         smb2_deltree(tree, fname);
    6064           8 :         smb2_deltree(tree, BASEDIR);
    6065           8 :         talloc_free(mem_ctx);
    6066           8 :         return ret;
    6067             : }
    6068             : 
    6069           8 : static bool test_setinfo_stream_eof(struct torture_context *tctx,
    6070             :                                     struct smb2_tree *tree)
    6071             : {
    6072           8 :         bool ret = true;
    6073           0 :         NTSTATUS status;
    6074           0 :         struct smb2_create create;
    6075           0 :         union smb_setfileinfo sfinfo;
    6076           0 :         union smb_fileinfo finfo;
    6077           0 :         struct smb2_handle h1;
    6078           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    6079           8 :         const char *fname = BASEDIR "\\file";
    6080           8 :         const char *sname = BASEDIR "\\file:foo";
    6081             : 
    6082           8 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done,
    6083             :                             "talloc_new failed\n");
    6084             : 
    6085           8 :         ret = enable_aapl(tctx, tree);
    6086           8 :         torture_assert(tctx, ret == true, "enable_aapl failed");
    6087             : 
    6088           8 :         torture_comment(tctx, "Test setting EOF on a stream\n");
    6089             : 
    6090           8 :         smb2_deltree(tree, BASEDIR);
    6091           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    6092           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6093             :                                         "torture_smb2_testdir\n");
    6094           8 :         smb2_util_close(tree, h1);
    6095             : 
    6096           8 :         status = torture_smb2_testfile(tree, fname, &h1);
    6097           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6098             :                                         "torture_smb2_testfile failed\n");
    6099           8 :         smb2_util_close(tree, h1);
    6100             : 
    6101           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6102             :                                               SEC_FILE_WRITE_DATA);
    6103           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6104             :                                         "torture_smb2_testfile failed\n");
    6105             : 
    6106           8 :         status = smb2_util_write(tree, h1, "1234567890", 0, 10);
    6107           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6108             :                                         "smb2_util_write failed\n");
    6109           8 :         smb2_util_close(tree, h1);
    6110             : 
    6111             :         /*
    6112             :          * Test setting EOF to 21
    6113             :          */
    6114             : 
    6115           8 :         torture_comment(tctx, "Setting stream EOF to 21\n");
    6116             : 
    6117           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6118             :                                               SEC_FILE_WRITE_DATA);
    6119           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6120             :                                         "torture_smb2_testfile failed\n");
    6121             : 
    6122           8 :         ZERO_STRUCT(sfinfo);
    6123           8 :         sfinfo.generic.in.file.handle = h1;
    6124           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6125           8 :         sfinfo.position_information.in.position = 21;
    6126           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    6127           8 :         torture_assert_ntstatus_ok_goto(tctx, status,
    6128             :                                         ret, done, "set EOF 21 failed\n");
    6129             : 
    6130           8 :         smb2_util_close(tree, h1);
    6131             : 
    6132           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6133             :                                               SEC_FILE_WRITE_DATA);
    6134           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6135             :                                         "torture_smb2_testfile failed\n");
    6136             : 
    6137           8 :         ZERO_STRUCT(finfo);
    6138           8 :         finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
    6139           8 :         finfo.generic.in.file.handle = h1;
    6140           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6141           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6142             :                                         "smb2_getinfo_file failed");
    6143             : 
    6144           8 :         smb2_util_close(tree, h1);
    6145             : 
    6146           8 :         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           8 :         torture_comment(tctx, "Setting stream EOF to 0\n");
    6154             : 
    6155           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6156             :                                               SEC_FILE_WRITE_DATA);
    6157           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6158             :                                         "torture_smb2_testfile failed\n");
    6159             : 
    6160           8 :         ZERO_STRUCT(sfinfo);
    6161           8 :         sfinfo.generic.in.file.handle = h1;
    6162           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6163           8 :         sfinfo.position_information.in.position = 0;
    6164           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    6165           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6166             :                                         "set eof 0 failed\n");
    6167             : 
    6168           8 :         ZERO_STRUCT(create);
    6169           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6170           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6171           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6172           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6173           8 :         create.in.fname = sname;
    6174             : 
    6175           8 :         status = smb2_create(tree, tctx, &create);
    6176           8 :         torture_assert_ntstatus_equal_goto(
    6177             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6178             :                 "Unexpected status\n");
    6179             : 
    6180           8 :         smb2_util_close(tree, h1);
    6181             : 
    6182           8 :         ZERO_STRUCT(create);
    6183           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6184           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6185           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6186           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6187           8 :         create.in.fname = sname;
    6188             : 
    6189           8 :         status = smb2_create(tree, tctx, &create);
    6190           8 :         torture_assert_ntstatus_equal_goto(
    6191             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6192             :                 "Unexpected status\n");
    6193             : 
    6194           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6195             :                                               SEC_FILE_WRITE_DATA);
    6196           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6197             :                                         "torture_smb2_testfile failed\n");
    6198             : 
    6199           8 :         ZERO_STRUCT(finfo);
    6200           8 :         finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
    6201           8 :         finfo.generic.in.file.handle = h1;
    6202           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6203           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6204             :                                         "smb2_getinfo_file failed\n");
    6205             : 
    6206           8 :         smb2_util_close(tree, h1);
    6207             : 
    6208           8 :         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           8 :         torture_comment(tctx, "Setting stream EOF to 1\n");
    6216             : 
    6217           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6218             :                                               SEC_FILE_WRITE_DATA);
    6219           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6220             :                                         "torture_smb2_testfile failed\n");
    6221             : 
    6222           8 :         ZERO_STRUCT(sfinfo);
    6223           8 :         sfinfo.generic.in.file.handle = h1;
    6224           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6225           8 :         sfinfo.position_information.in.position = 1;
    6226           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    6227           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6228             :                                         "set EOF 1 failed\n");
    6229             : 
    6230           8 :         smb2_util_close(tree, h1);
    6231             : 
    6232           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6233             :                                               SEC_FILE_WRITE_DATA);
    6234           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6235             :                                         "torture_smb2_testfile failed\n");
    6236             : 
    6237           8 :         ZERO_STRUCT(finfo);
    6238           8 :         finfo.generic.level = RAW_FILEINFO_STANDARD_INFORMATION;
    6239           8 :         finfo.generic.in.file.handle = h1;
    6240           8 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6241           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6242             :                                         "smb2_getinfo_file failed\n");
    6243             : 
    6244           8 :         smb2_util_close(tree, h1);
    6245             : 
    6246           8 :         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           8 :         torture_comment(tctx, "Enabling AAPL extensions\n");
    6254             : 
    6255           8 :         ret = enable_aapl(tctx, tree);
    6256           8 :         torture_assert(tctx, ret == true, "enable_aapl failed\n");
    6257             : 
    6258           8 :         torture_comment(tctx, "Setting stream EOF to 0\n");
    6259           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6260             :                                               SEC_FILE_WRITE_DATA);
    6261           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6262             :                                         "torture_smb2_testfile failed\n");
    6263             : 
    6264           8 :         ZERO_STRUCT(sfinfo);
    6265           8 :         sfinfo.generic.in.file.handle = h1;
    6266           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6267           8 :         sfinfo.position_information.in.position = 0;
    6268           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    6269           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6270             :                                         "set eof 0 failed\n");
    6271             : 
    6272           8 :         ZERO_STRUCT(create);
    6273           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6274           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6275           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6276           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6277           8 :         create.in.fname = sname;
    6278             : 
    6279           8 :         status = smb2_create(tree, tctx, &create);
    6280           8 :         torture_assert_ntstatus_equal_goto(
    6281             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6282             :                 "Unexpected status\n");
    6283             : 
    6284           8 :         smb2_util_close(tree, h1);
    6285             : 
    6286           8 :         ZERO_STRUCT(create);
    6287           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6288           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6289           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6290           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6291           8 :         create.in.fname = sname;
    6292             : 
    6293           8 :         status = smb2_create(tree, tctx, &create);
    6294           8 :         torture_assert_ntstatus_equal_goto(
    6295             :                 tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
    6296             :                 "Unexpected status\n");
    6297             : 
    6298           8 :         torture_comment(
    6299             :                 tctx, "Setting main file EOF to 1 to force 0-truncate\n");
    6300             : 
    6301           8 :         status = torture_smb2_testfile_access(
    6302             :                 tree,
    6303             :                 fname,
    6304             :                 &h1,
    6305             :                 SEC_FILE_WRITE_DATA);
    6306           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6307             :                                         "torture_smb2_testfile failed\n");
    6308             : 
    6309           8 :         ZERO_STRUCT(sfinfo);
    6310           8 :         sfinfo.generic.in.file.handle = h1;
    6311           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6312           8 :         sfinfo.position_information.in.position = 1;
    6313           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    6314           8 :         torture_assert_ntstatus_ok_goto(
    6315             :                 tctx,
    6316             :                 status,
    6317             :                 ret,
    6318             :                 done,
    6319             :                 "set eof 1 failed\n");
    6320             : 
    6321           8 :         sfinfo.position_information.in.position = 0;
    6322           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    6323           8 :         torture_assert_ntstatus_ok_goto(
    6324             :                 tctx,
    6325             :                 status,
    6326             :                 ret,
    6327             :                 done,
    6328             :                 "set eof 0 failed\n");
    6329             : 
    6330           8 :         smb2_util_close(tree, h1);
    6331             : 
    6332           8 :         ZERO_STRUCT(create);
    6333           8 :         create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
    6334           8 :         create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
    6335           8 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    6336           8 :         create.in.create_disposition = NTCREATEX_DISP_OPEN;
    6337           8 :         create.in.fname = fname;
    6338             : 
    6339           8 :         status = smb2_create(tree, tctx, &create);
    6340           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6341             :                                         "torture_smb2_testfile failed\n");
    6342           8 :         smb2_util_close(tree, h1);
    6343             : 
    6344           8 :         torture_comment(tctx, "Writing to stream after setting EOF to 0\n");
    6345           8 :         status = torture_smb2_testfile_access(tree, sname, &h1,
    6346             :                                               SEC_FILE_WRITE_DATA);
    6347           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6348             :                                         "torture_smb2_testfile failed\n");
    6349             : 
    6350           8 :         status = smb2_util_write(tree, h1, "1234567890", 0, 10);
    6351           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6352             :                                         "smb2_util_write failed\n");
    6353             : 
    6354           8 :         ZERO_STRUCT(sfinfo);
    6355           8 :         sfinfo.generic.in.file.handle = h1;
    6356           8 :         sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
    6357           8 :         sfinfo.position_information.in.position = 0;
    6358           8 :         status = smb2_setinfo_file(tree, &sfinfo);
    6359           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6360             :                                         "set eof 0 failed\n");
    6361             : 
    6362           8 :         status = smb2_util_write(tree, h1, "1234567890", 0, 10);
    6363           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6364             :                                         "smb2_util_write failed\n");
    6365             : 
    6366           8 :         smb2_util_close(tree, h1);
    6367             : 
    6368           8 : done:
    6369           8 :         smb2_util_unlink(tree, fname);
    6370           8 :         smb2_util_rmdir(tree, BASEDIR);
    6371           8 :         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         144 : 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         144 :         bool ret = false;
    6405           0 :         NTSTATUS status;
    6406           0 :         struct smb2_handle h1;
    6407           0 :         union smb_fileinfo finfo;
    6408         144 :         struct tcase_results *tcase_results = NULL;
    6409             : 
    6410         144 :         switch (subcase) {
    6411          48 :         case T_CREATE:
    6412          48 :                 tcase_results = &tcase->create;
    6413          48 :                 break;
    6414          24 :         case T_OVERWRITE:
    6415          24 :                 tcase_results = &tcase->overwrite;
    6416          24 :                 break;
    6417          24 :         case T_WRITE:
    6418          24 :                 tcase_results = &tcase->write;
    6419          24 :                 break;
    6420          24 :         case T_EOF:
    6421          24 :                 tcase_results = &tcase->eof;
    6422          24 :                 break;
    6423          24 :         case T_DOC:
    6424          24 :                 tcase_results = &tcase->doc;
    6425          24 :                 break;
    6426             :         }
    6427             : 
    6428         144 :         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         144 :         status = smb2_getinfo_file(tree, mem_ctx, &finfo);
    6438         144 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6439             :                                         "torture_smb2_testfile failed\n");
    6440             : 
    6441         144 :         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         144 :         status = torture_smb2_open(tree, tcase->name,
    6450             :                                    SEC_FILE_READ_ATTRIBUTE, &h1);
    6451         144 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6452             :                                            tcase_results->initial_status,
    6453             :                                            ret, done,
    6454             :                                            "smb2_create failed\n");
    6455         144 :         if (NT_STATUS_IS_OK(status)) {
    6456          32 :                 status = smb2_util_close(tree, h1);
    6457          32 :                 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         144 :         ret = check_stream_list_handle(tree, tctx, baseh,
    6466             :                                        tcase_results->num_streams_open_handle,
    6467         144 :                                        tcase_results->streams_open_handle,
    6468             :                                        false);
    6469         144 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    6470             : 
    6471             :         /*
    6472             :          * Test: open, different client
    6473             :          */
    6474             : 
    6475         144 :         status = torture_smb2_open(tree2, tcase->name,
    6476             :                                    SEC_FILE_READ_ATTRIBUTE, &h1);
    6477         144 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6478             :                                            tcase_results->initial_status,
    6479             :                                            ret, done,
    6480             :                                            "smb2_create failed\n");
    6481         144 :         if (NT_STATUS_IS_OK(status)) {
    6482          32 :                 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          32 :                 status = smb2_getinfo_file(tree2, mem_ctx, &finfo);
    6492          32 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6493             :                                                 "smb2_getinfo_file failed\n");
    6494             : 
    6495          32 :                 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          32 :                 ret = check_stream_list(tree2, tctx, BASEDIR "\\file",
    6504             :                                         tcase_results->num_streams_open_handle,
    6505          32 :                                         tcase_results->streams_open_handle,
    6506             :                                         false);
    6507          32 :                 torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    6508             : 
    6509          32 :                 status = smb2_util_close(tree2, h1);
    6510          32 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6511             :                                                 "smb2_util_close failed\n");
    6512             :         }
    6513             : 
    6514         144 :         status = smb2_util_close(tree, streamh);
    6515         144 :         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         144 :         status = torture_smb2_open(tree, tcase->name,
    6523             :                                    SEC_FILE_READ_DATA, &h1);
    6524         144 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6525             :                                            tcase_results->final_status,
    6526             :                                            ret, done,
    6527             :                                            "smb2_create failed\n");
    6528         144 :         if (NT_STATUS_IS_OK(status)) {
    6529          40 :                 status = smb2_util_close(tree, h1);
    6530          40 :                 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         144 :         status = torture_smb2_open(tree2, tcase->name,
    6539             :                                    SEC_FILE_READ_DATA, &h1);
    6540         144 :         torture_assert_ntstatus_equal_goto(tctx, status,
    6541             :                                            tcase_results->final_status,
    6542             :                                            ret, done,
    6543             :                                            "smb2_create failed\n");
    6544         144 :         if (NT_STATUS_IS_OK(status)) {
    6545          40 :                 status = smb2_util_close(tree2, h1);
    6546          40 :                 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         144 :         ret = check_stream_list_handle(tree, tctx, baseh,
    6555             :                                        tcase_results->num_streams_closed_handle,
    6556         144 :                                        tcase_results->streams_closed_handle,
    6557             :                                        false);
    6558         144 :         torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
    6559             : 
    6560         144 :         ret = true;
    6561             : 
    6562         144 : done:
    6563         144 :         smb2_util_close(tree, streamh);
    6564         144 :         smb2_util_close(tree, baseh);
    6565         144 :         return ret;
    6566             : }
    6567             : 
    6568          48 : 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          48 :         bool ret = false;
    6575           0 :         NTSTATUS status;
    6576          48 :         struct smb2_handle baseh = {{0}};
    6577           0 :         struct smb2_handle streamh;
    6578           0 :         struct smb2_create create;
    6579           0 :         union smb_setfileinfo sfinfo;
    6580          48 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    6581             : 
    6582          48 :         torture_comment(tctx, "Testing stream [%s]\n", tcase->name);
    6583             : 
    6584          48 :         torture_assert_goto(tctx, mem_ctx != NULL, ret, done, "talloc_new\n");
    6585             : 
    6586             :         /*
    6587             :          * Subtest: create
    6588             :          */
    6589          48 :         torture_comment(tctx, "Subtest: T_CREATE\n");
    6590             : 
    6591          48 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6592          48 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6593             :                                         "smb2_util_unlink failed\n");
    6594             : 
    6595          48 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6596             :                                               &baseh, SEC_FILE_ALL);
    6597          48 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6598             :                                         "torture_smb2_testfile_access failed\n");
    6599             : 
    6600          48 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6601             :                                               tcase->access);
    6602          48 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6603             :                                         "torture_smb2_testfile_access failed\n");
    6604             : 
    6605          48 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6606             :                                           mem_ctx, baseh, streamh, T_CREATE);
    6607          48 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6608             : 
    6609          48 :         if (!(tcase->access & SEC_FILE_WRITE_DATA)) {
    6610             :                 /*
    6611             :                  * All subsequent tests require write access
    6612             :                  */
    6613          24 :                 ret = true;
    6614          24 :                 goto done;
    6615             :         }
    6616             : 
    6617             :         /*
    6618             :          * Subtest: create and write
    6619             :          */
    6620          24 :         torture_comment(tctx, "Subtest: T_WRITE\n");
    6621             : 
    6622          24 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6623          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6624             :                                         "smb2_util_unlink failed\n");
    6625             : 
    6626          24 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6627             :                                               &baseh, SEC_FILE_ALL);
    6628          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6629             :                                         "torture_smb2_testfile_access failed\n");
    6630             : 
    6631          24 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6632             :                                               tcase->access);
    6633          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6634             :                                         "torture_smb2_testfile_access failed\n");
    6635             : 
    6636          24 :         status = smb2_util_write(tree, streamh, tcase->write_data, 0,
    6637             :                                  tcase->write_size);
    6638          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6639             :                                         "torture_smb2_open failed\n");
    6640             : 
    6641          24 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6642             :                                           mem_ctx, baseh, streamh, T_WRITE);
    6643          24 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6644             : 
    6645             :         /*
    6646             :          * Subtest: overwrite
    6647             :          */
    6648          24 :         torture_comment(tctx, "Subtest: T_OVERWRITE\n");
    6649             : 
    6650          24 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6651          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6652             :                                         "smb2_util_unlink failed\n");
    6653             : 
    6654          24 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6655             :                                               &baseh, SEC_FILE_ALL);
    6656          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6657             :                                         "torture_smb2_testfile_access failed\n");
    6658             : 
    6659          24 :         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          24 :                 .in.fname = tcase->name,
    6665             :         };
    6666             : 
    6667          24 :         status = smb2_create(tree, tctx, &create);
    6668          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6669             :                                         "torture_smb2_testfile failed\n");
    6670          24 :         streamh = create.out.file.handle;
    6671             : 
    6672          24 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6673             :                                           mem_ctx, baseh, streamh, T_OVERWRITE);
    6674          24 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6675             : 
    6676             :         /*
    6677             :          * Subtest: setinfo EOF 0
    6678             :          */
    6679          24 :         torture_comment(tctx, "Subtest: T_EOF\n");
    6680             : 
    6681          24 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6682          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6683             :                                         "smb2_util_unlink failed\n");
    6684             : 
    6685          24 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6686             :                                               &baseh, SEC_FILE_ALL);
    6687          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6688             :                                         "torture_smb2_testfile_access failed\n");
    6689             : 
    6690          24 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6691             :                                               tcase->access);
    6692          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6693             :                                         "torture_smb2_testfile_access failed\n");
    6694             : 
    6695          24 :         status = smb2_util_write(tree, streamh, tcase->write_data, 0,
    6696             :                                  tcase->write_size);
    6697          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6698             :                                         "torture_smb2_open failed\n");
    6699             : 
    6700          24 :         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          24 :         status = smb2_setinfo_file(tree, &sfinfo);
    6706          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6707             :                                         "set eof 0 failed\n");
    6708             : 
    6709          24 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6710             :                                           mem_ctx, baseh, streamh, T_EOF);
    6711          24 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6712             : 
    6713             :         /*
    6714             :          * Subtest: delete-on-close
    6715             :          */
    6716          24 :         torture_comment(tctx, "Subtest: T_DOC\n");
    6717             : 
    6718          24 :         status = smb2_util_unlink(tree, BASEDIR "\\file");
    6719          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6720             :                                         "smb2_util_unlink failed\n");
    6721             : 
    6722          24 :         status = torture_smb2_testfile_access(tree, BASEDIR "\\file",
    6723             :                                               &baseh, SEC_FILE_ALL);
    6724          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6725             :                                         "torture_smb2_testfile_access failed\n");
    6726             : 
    6727          24 :         status = torture_smb2_testfile_access(tree, tcase->name, &streamh,
    6728             :                                               tcase->access);
    6729          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6730             :                                         "torture_smb2_testfile_access failed\n");
    6731             : 
    6732          24 :         status = smb2_util_write(tree, streamh, tcase->write_data, 0,
    6733             :                                  tcase->write_size);
    6734          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6735             :                                         "torture_smb2_open failed\n");
    6736             : 
    6737          24 :         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          24 :         status = smb2_setinfo_file(tree, &sfinfo);
    6743          24 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6744             :                                         "set eof 0 failed\n");
    6745             : 
    6746          24 :         ret = test_empty_stream_do_checks(tctx, tree, tree2, tcase,
    6747             :                                           mem_ctx, baseh, streamh,
    6748             :                                           T_DOC);
    6749          24 :         torture_assert_goto(tctx, ret, ret, done, "test failed\n");
    6750             : 
    6751          24 :         ret = true;
    6752             : 
    6753          48 : done:
    6754          48 :         smb2_util_close(tree, baseh);
    6755          48 :         TALLOC_FREE(mem_ctx);
    6756          48 :         return ret;
    6757             : }
    6758             : 
    6759           8 : static bool test_empty_stream(struct torture_context *tctx,
    6760             :                               struct smb2_tree *tree)
    6761             : {
    6762           8 :         struct smb2_tree *tree2 = NULL;
    6763           8 :         struct tcase *tcase = NULL;
    6764           8 :         const char *fname = BASEDIR "\\file";
    6765           0 :         struct smb2_handle h1;
    6766           8 :         bool ret = true;
    6767           0 :         NTSTATUS status;
    6768           8 :         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           8 :         char *ai_blob = torture_afpinfo_pack(tctx, &ai);
    6775           8 :         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           8 :         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           8 :         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           8 :         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           8 :         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           8 :         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           8 :         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           8 :         ret = torture_smb2_connection(tctx, &tree2);
    6984           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    6985             :                             "torture_smb2_connection failed\n");
    6986             : 
    6987           8 :         ret = enable_aapl(tctx, tree);
    6988           8 :         torture_assert(tctx, ret == true, "enable_aapl failed\n");
    6989             : 
    6990           8 :         ret = enable_aapl(tctx, tree2);
    6991           8 :         torture_assert(tctx, ret == true, "enable_aapl failed\n");
    6992             : 
    6993           8 :         smb2_deltree(tree, BASEDIR);
    6994             : 
    6995           8 :         status = torture_smb2_testdir(tree, BASEDIR, &h1);
    6996           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    6997             :                                         "torture_smb2_testdir\n");
    6998           8 :         smb2_util_close(tree, h1);
    6999             : 
    7000          56 :         for (tcase = &tcases[0]; tcase->name != NULL; tcase++) {
    7001          48 :                 ret = torture_setup_file(tctx, tree, fname, false);
    7002          48 :                 torture_assert_goto(tctx, ret == true, ret, done,
    7003             :                                     "torture_setup_file failed\n");
    7004             : 
    7005          48 :                 ret = test_empty_stream_do_one(tctx, tree, tree2, tcase);
    7006          48 :                 torture_assert_goto(tctx, ret == true, ret, done,
    7007             :                                     "subtest failed\n");
    7008             : 
    7009          48 :                 status = smb2_util_unlink(tree, fname);
    7010          48 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7011             :                                                 "smb2_util_unlink failed\n");
    7012             :         }
    7013             : 
    7014           8 : done:
    7015           8 :         smb2_deltree(tree, BASEDIR);
    7016           8 :         TALLOC_FREE(tree2);
    7017           8 :         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           8 : static bool test_delete_trigger_convert_sharing_violation(
    7883             :         struct torture_context *tctx,
    7884             :         struct smb2_tree *tree1)
    7885             : {
    7886           8 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    7887           8 :         const char *dirname = BASEDIR "\\dir";
    7888           8 :         const char *adname = BASEDIR "\\._dir";
    7889           0 :         struct smb2_handle testdirh;
    7890           0 :         struct smb2_create create;
    7891           8 :         AfpInfo *info = NULL;
    7892           8 :         bool ret = true;
    7893           0 :         NTSTATUS status;
    7894             : 
    7895           8 :         smb2_deltree(tree1, BASEDIR);
    7896             : 
    7897           8 :         status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
    7898           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7899             :                                         "torture_smb2_testdir failed\n");
    7900           8 :         smb2_util_close(tree1, testdirh);
    7901             : 
    7902           8 :         status = torture_smb2_testdir(tree1, dirname, &testdirh);
    7903           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7904             :                                         "torture_smb2_testdir failed\n");
    7905           8 :         smb2_util_close(tree1, testdirh);
    7906             : 
    7907           8 :         ret = torture_setup_file(tctx, tree1, adname, false);
    7908           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    7909             :                             "torture_setup_file failed\n");
    7910             : 
    7911           8 :         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           8 :         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           8 :         info = torture_afpinfo_new(mem_ctx);
    7923           8 :         torture_assert_goto(tctx, info != NULL, ret, done, "torture_afpinfo_new failed");
    7924             : 
    7925             :         /* Set "Inited" flag (any other would do too) */
    7926           8 :         info->afpi_FinderInfo[8] = 0x01;
    7927             : 
    7928           8 :         ret = torture_write_afpinfo(tree1, tctx, mem_ctx, dirname, info);
    7929           8 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_write_afpinfo failed");
    7930             : 
    7931           8 :         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           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    7936             :                             "write_stream failed\n");
    7937             : 
    7938             :         /*
    7939             :          * 2) Create a second stream
    7940             :          */
    7941             : 
    7942           8 :         ret = write_stream(tree1, __location__, tctx, mem_ctx,
    7943             :                            dirname, ":org.samba.boom", 0,
    7944             :                            strlen("boom"),
    7945             :                            "boom");
    7946           8 :         torture_assert_goto(tctx, ret == true, ret, done,
    7947             :                             "write_stream failed\n");
    7948             : 
    7949           8 :         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           8 :         status = smb2_create(tree1, tctx, &create);
    7960           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7961             :                                         "smb2_create failed\n");
    7962             : 
    7963           8 :         status = smb2_util_close(tree1, create.out.file.handle);
    7964           8 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    7965             :                                         "smb2_util_close failed");
    7966             : 
    7967           8 : done:
    7968           8 :         smb2_deltree(tree1, BASEDIR);
    7969           8 :         talloc_free(mem_ctx);
    7970           8 :         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        2354 : struct torture_suite *torture_vfs_fruit(TALLOC_CTX *ctx)
    7982             : {
    7983        2354 :         struct torture_suite *suite = torture_suite_create(
    7984             :                 ctx, "fruit");
    7985             : 
    7986        2354 :         suite->description = talloc_strdup(suite, "vfs_fruit tests");
    7987             : 
    7988        2354 :         torture_suite_add_1smb2_test(suite, "copyfile", test_copyfile);
    7989        2354 :         torture_suite_add_1smb2_test(suite, "read metadata", test_read_afpinfo);
    7990        2354 :         torture_suite_add_1smb2_test(suite, "write metadata", test_write_atalk_metadata);
    7991        2354 :         torture_suite_add_1smb2_test(suite, "resource fork IO", test_write_atalk_rfork_io);
    7992        2354 :         torture_suite_add_1smb2_test(suite, "SMB2/CREATE context AAPL", test_aapl);
    7993        2354 :         torture_suite_add_1smb2_test(suite, "stream names", test_stream_names);
    7994        2354 :         torture_suite_add_1smb2_test(suite, "truncate resource fork to 0 bytes", test_rfork_truncate);
    7995        2354 :         torture_suite_add_1smb2_test(suite, "opening and creating resource fork", test_rfork_create);
    7996        2354 :         torture_suite_add_1smb2_test(suite, "fsync_resource_fork", test_rfork_fsync);
    7997        2354 :         torture_suite_add_1smb2_test(suite, "rename_dir_openfile", test_rename_dir_openfile);
    7998        2354 :         torture_suite_add_1smb2_test(suite, "File without AFP_AfpInfo", test_afpinfo_enoent);
    7999        2354 :         torture_suite_add_1smb2_test(suite, "create delete-on-close AFP_AfpInfo", test_create_delete_on_close);
    8000        2354 :         torture_suite_add_1smb2_test(suite, "setinfo delete-on-close AFP_AfpInfo", test_setinfo_delete_on_close);
    8001        2354 :         torture_suite_add_1smb2_test(suite, "setinfo eof AFP_AfpInfo", test_setinfo_eof);
    8002        2354 :         torture_suite_add_1smb2_test(suite, "delete AFP_AfpInfo by writing all 0", test_afpinfo_all0);
    8003        2354 :         torture_suite_add_1smb2_test(suite, "create delete-on-close AFP_AfpResource", test_create_delete_on_close_resource);
    8004        2354 :         torture_suite_add_1smb2_test(suite, "setinfo delete-on-close AFP_AfpResource", test_setinfo_delete_on_close_resource);
    8005        2354 :         torture_suite_add_1smb2_test(suite, "setinfo eof AFP_AfpResource", test_setinfo_eof_resource);
    8006        2354 :         torture_suite_add_1smb2_test(suite, "setinfo eof stream", test_setinfo_stream_eof);
    8007        2354 :         torture_suite_add_1smb2_test(suite, "null afpinfo", test_null_afpinfo);
    8008        2354 :         torture_suite_add_1smb2_test(suite, "delete", test_delete_file_with_rfork);
    8009        2354 :         torture_suite_add_1smb2_test(suite, "read open rsrc after rename", test_rename_and_read_rsrc);
    8010        2354 :         torture_suite_add_1smb2_test(suite, "readdir_attr with names with illegal ntfs characters", test_readdir_attr_illegal_ntfs);
    8011        2354 :         torture_suite_add_2ns_smb2_test(suite, "invalid AFP_AfpInfo", test_invalid_afpinfo);
    8012        2354 :         torture_suite_add_1smb2_test(suite, "creating rsrc with read-only access", test_rfork_create_ro);
    8013        2354 :         torture_suite_add_1smb2_test(suite, "copy-chunk streams", test_copy_chunk_streams);
    8014        2354 :         torture_suite_add_1smb2_test(suite, "OS X AppleDouble file conversion", test_adouble_conversion);
    8015        2354 :         torture_suite_add_1smb2_test(suite, "NFS ACE entries", test_nfs_aces);
    8016        2354 :         torture_suite_add_1smb2_test(suite, "OS X AppleDouble file conversion without embedded xattr", test_adouble_conversion_wo_xattr);
    8017        2354 :         torture_suite_add_1smb2_test(suite, "empty_stream", test_empty_stream);
    8018        2354 :         torture_suite_add_1smb2_test(suite, "writing_afpinfo", test_writing_afpinfo);
    8019        2354 :         torture_suite_add_1smb2_test(suite, "delete_trigger_convert_sharing_violation", test_delete_trigger_convert_sharing_violation);
    8020             : 
    8021        2354 :         return suite;
    8022             : }
    8023             : 
    8024           2 : static bool test_stream_names_local(struct torture_context *tctx,
    8025             :                                     struct smb2_tree *tree)
    8026             : {
    8027           2 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    8028           0 :         NTSTATUS status;
    8029           0 :         struct smb2_create create;
    8030           0 :         struct smb2_handle h;
    8031           2 :         const char *fname = BASEDIR "\\stream_names.txt";
    8032           0 :         const char *sname1;
    8033           0 :         bool ret;
    8034             :         /* UTF8 private use are starts at 0xef 0x80 0x80 (0xf000) */
    8035           2 :         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           2 :         const char *localdir = NULL;
    8041             : 
    8042           2 :         localdir = torture_setting_string(tctx, "localdir", NULL);
    8043           2 :         if (localdir == NULL) {
    8044           0 :                 torture_skip(tctx, "Need localdir for test");
    8045             :         }
    8046             : 
    8047           2 :         sname1 = talloc_asprintf(mem_ctx, "%s%s", fname, streams[0]);
    8048             : 
    8049             :         /* clean slate ...*/
    8050           2 :         smb2_util_unlink(tree, fname);
    8051           2 :         smb2_deltree(tree, fname);
    8052           2 :         smb2_deltree(tree, BASEDIR);
    8053             : 
    8054           2 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    8055           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    8056           2 :         smb2_util_close(tree, h);
    8057             : 
    8058           2 :         torture_comment(tctx, "(%s) testing stream names\n", __location__);
    8059           2 :         ZERO_STRUCT(create);
    8060           2 :         create.in.desired_access = SEC_FILE_WRITE_DATA;
    8061           2 :         create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
    8062           2 :         create.in.share_access =
    8063             :                 NTCREATEX_SHARE_ACCESS_DELETE|
    8064             :                 NTCREATEX_SHARE_ACCESS_READ|
    8065             :                 NTCREATEX_SHARE_ACCESS_WRITE;
    8066           2 :         create.in.create_disposition = NTCREATEX_DISP_CREATE;
    8067           2 :         create.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
    8068           2 :         create.in.fname = sname1;
    8069             : 
    8070           2 :         status = smb2_create(tree, mem_ctx, &create);
    8071           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    8072             : 
    8073           2 :         status = smb2_util_write(tree, create.out.file.handle, "foo", 0, 3);
    8074           2 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8075             :                                         "smb2_util_write failed\n");
    8076             : 
    8077           2 :         smb2_util_close(tree, create.out.file.handle);
    8078             : 
    8079           2 :         ret = torture_setup_local_xattr(tctx, "localdir", BASEDIR "/stream_names.txt",
    8080             :                                         "user.DosStream.bar:baz:$DATA",
    8081             :                                         "data", strlen("data"));
    8082           2 :         CHECK_VALUE(ret, true);
    8083             : 
    8084           2 :         ret = check_stream_list(tree, tctx, fname, 3, streams, false);
    8085           2 :         CHECK_VALUE(ret, true);
    8086             : 
    8087           2 : done:
    8088           2 :         status = smb2_util_unlink(tree, fname);
    8089           2 :         smb2_deltree(tree, BASEDIR);
    8090           2 :         talloc_free(mem_ctx);
    8091             : 
    8092           2 :         return ret;
    8093             : }
    8094             : 
    8095           2 : static bool test_fruit_locking_conflict(struct torture_context *tctx,
    8096             :                                         struct smb2_tree *tree,
    8097             :                                         struct smb2_tree *tree2)
    8098             : {
    8099           0 :         TALLOC_CTX *mem_ctx;
    8100           0 :         struct smb2_create create;
    8101           0 :         struct smb2_handle h;
    8102           0 :         struct smb2_lock lck;
    8103           0 :         struct smb2_lock_element el;
    8104           2 :         const char *fname = BASEDIR "\\locking_conflict.txt";
    8105           0 :         NTSTATUS status;
    8106           2 :         bool ret = false;
    8107             : 
    8108           2 :         mem_ctx = talloc_new(tctx);
    8109           2 :         torture_assert_not_null(tctx, mem_ctx, "talloc_new failed");
    8110             : 
    8111             :         /* clean slate ...*/
    8112           2 :         smb2_util_unlink(tree, fname);
    8113           2 :         smb2_deltree(tree, fname);
    8114           2 :         smb2_deltree(tree, BASEDIR);
    8115             : 
    8116           2 :         status = torture_smb2_testdir(tree, BASEDIR, &h);
    8117           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    8118           2 :         smb2_util_close(tree, h);
    8119             : 
    8120           2 :         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           2 :         status = smb2_create(tree, mem_ctx, &create);
    8132           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    8133           2 :         h = create.out.file.handle;
    8134             : 
    8135             :         /* Add AD_FILELOCK_RSRC_DENY_WR lock. */
    8136           2 :         el = (struct smb2_lock_element) {
    8137             :                 .offset = 0xfffffffffffffffc,
    8138             :                 .length = 1,
    8139             :                 .flags = SMB2_LOCK_FLAG_EXCLUSIVE,
    8140             :         };
    8141           2 :         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           2 :         status = smb2_lock(tree, &lck);
    8157           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    8158             : 
    8159           2 :         el = (struct smb2_lock_element) {
    8160             :                 .offset = 0,
    8161             :                 .length = 0x7ffffffffffffff7,
    8162             :                 .flags = SMB2_LOCK_FLAG_EXCLUSIVE,
    8163             :         };
    8164           2 :         status = smb2_lock(tree, &lck);
    8165           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    8166             : 
    8167           2 :         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           2 :         status = smb2_create(tree2, mem_ctx, &create);
    8183           2 :         CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
    8184             : 
    8185             :         {
    8186           2 :                 struct smb2_close cl = {
    8187             :                         .level = RAW_CLOSE_SMB2,
    8188             :                         .in.file.handle = h,
    8189             :                 };
    8190           2 :                 smb2_close(tree, &cl);
    8191             :         }
    8192             : 
    8193           2 :         ret = true;
    8194           2 : done:
    8195           2 :         return ret;
    8196             : }
    8197             : 
    8198        2354 : struct torture_suite *torture_vfs_fruit_netatalk(TALLOC_CTX *ctx)
    8199             : {
    8200        2354 :         struct torture_suite *suite = torture_suite_create(
    8201             :                 ctx, "fruit_netatalk");
    8202             : 
    8203        2354 :         suite->description = talloc_strdup(suite, "vfs_fruit tests for Netatalk interop that require fruit:metadata=netatalk");
    8204             : 
    8205        2354 :         torture_suite_add_1smb2_test(suite, "read netatalk metadata", test_read_netatalk_metadata);
    8206        2354 :         torture_suite_add_1smb2_test(suite, "stream names with locally created xattr", test_stream_names_local);
    8207        2354 :         torture_suite_add_2smb2_test(
    8208             :                 suite, "locking conflict", test_fruit_locking_conflict);
    8209             : 
    8210        2354 :         return suite;
    8211             : }
    8212             : 
    8213        2354 : struct torture_suite *torture_vfs_fruit_file_id(TALLOC_CTX *ctx)
    8214             : {
    8215         125 :         struct torture_suite *suite =
    8216        2354 :             torture_suite_create(ctx, "fruit_file_id");
    8217             : 
    8218        2479 :         suite->description =
    8219        2354 :             talloc_strdup(suite, "vfs_fruit tests for on-disk file ID that "
    8220             :                                  "require fruit:zero_file_id=yes");
    8221             : 
    8222        2354 :         torture_suite_add_1smb2_test(suite, "zero file id if AAPL negotiated",
    8223             :                                      test_zero_file_id);
    8224             : 
    8225        2354 :         return suite;
    8226             : }
    8227             : 
    8228           2 : static bool test_timemachine_volsize(struct torture_context *tctx,
    8229             :                                      struct smb2_tree *tree)
    8230             : {
    8231           2 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    8232           2 :         struct smb2_handle h = {{0}};
    8233           0 :         union smb_fsinfo fsinfo;
    8234           0 :         NTSTATUS status;
    8235           2 :         bool ok = true;
    8236           2 :         const char *info_plist =
    8237             :                 "<dict>\n"
    8238             :                 "        <key>band-size</key>\n"
    8239             :                 "        <integer>8192</integer>\n"
    8240             :                 "</dict>\n";
    8241             : 
    8242           2 :         smb2_deltree(tree, "test.sparsebundle");
    8243             : 
    8244           2 :         ok = enable_aapl(tctx, tree);
    8245           2 :         torture_assert_goto(tctx, ok, ok, done, "enable_aapl failed");
    8246             : 
    8247           2 :         status = smb2_util_mkdir(tree, "test.sparsebundle");
    8248           2 :         torture_assert_ntstatus_ok_goto(tctx, status, ok, done,
    8249             :                                         "smb2_util_mkdir\n");
    8250             : 
    8251           2 :         ok = write_stream(tree, __location__, tctx, mem_ctx,
    8252             :                           "test.sparsebundle/Info.plist", NULL,
    8253             :                            0, strlen(info_plist), info_plist);
    8254           2 :         torture_assert_goto(tctx, ok, ok, done, "write_stream failed\n");
    8255             : 
    8256           2 :         status = smb2_util_mkdir(tree, "test.sparsebundle/bands");
    8257           2 :         torture_assert_ntstatus_ok_goto(tctx, status, ok, done,
    8258             :                                         "smb2_util_mkdir\n");
    8259             : 
    8260           2 :         ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/1", false);
    8261           2 :         torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n");
    8262             : 
    8263           2 :         ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/2", false);
    8264           2 :         torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n");
    8265             : 
    8266           2 :         status = smb2_util_roothandle(tree, &h);
    8267           2 :         torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle");
    8268             : 
    8269           2 :         ZERO_STRUCT(fsinfo);
    8270           2 :         fsinfo.generic.level = RAW_QFS_SIZE_INFORMATION;
    8271           2 :         fsinfo.generic.handle = h;
    8272             : 
    8273           2 :         status = smb2_getinfo_fs(tree, tree, &fsinfo);
    8274           2 :         torture_assert_ntstatus_ok(tctx, status, "smb2_getinfo_fs failed");
    8275             : 
    8276           2 :         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           2 :         torture_assert_goto(tctx, fsinfo.size_info.out.sectors_per_unit == 2,
    8296             :                             ok, done, "Bad sectors_per_unit");
    8297             : 
    8298           2 :         torture_assert_goto(tctx, fsinfo.size_info.out.bytes_per_sector == 512,
    8299             :                             ok, done, "Bad bytes_per_sector");
    8300             : 
    8301           2 :         torture_assert_goto(tctx, fsinfo.size_info.out.total_alloc_units == 32,
    8302             :                             ok, done, "Bad total_alloc_units");
    8303             : 
    8304           2 :         torture_assert_goto(tctx, fsinfo.size_info.out.avail_alloc_units == 16,
    8305             :                             ok, done, "Bad avail_alloc_units");
    8306             : 
    8307           2 : done:
    8308           2 :         if (!smb2_util_handle_empty(h)) {
    8309           2 :                 smb2_util_close(tree, h);
    8310             :         }
    8311           2 :         smb2_deltree(tree, "test.sparsebundle");
    8312           2 :         talloc_free(mem_ctx);
    8313           2 :         return ok;
    8314             : }
    8315             : 
    8316        2354 : struct torture_suite *torture_vfs_fruit_timemachine(TALLOC_CTX *ctx)
    8317             : {
    8318        2354 :         struct torture_suite *suite = torture_suite_create(
    8319             :                 ctx, "fruit_timemachine");
    8320             : 
    8321        2354 :         suite->description = talloc_strdup(
    8322             :                 suite, "vfs_fruit tests for TimeMachine");
    8323             : 
    8324        2354 :         torture_suite_add_1smb2_test(suite, "Timemachine-volsize",
    8325             :                                      test_timemachine_volsize);
    8326             : 
    8327        2354 :         return suite;
    8328             : }
    8329             : 
    8330           4 : 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           4 :         TALLOC_CTX *mem_ctx = talloc_new(tctx);
    8336           4 :         const char *fname = BASEDIR "\\test_adouble_conversion";
    8337           4 :         const char *adname = BASEDIR "/._test_adouble_conversion";
    8338           4 :         const char *rfork = BASEDIR "\\test_adouble_conversion" AFPRESOURCE_STREAM_NAME;
    8339           0 :         NTSTATUS status;
    8340           0 :         struct smb2_handle testdirh;
    8341           4 :         bool ret = true;
    8342           4 :         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           0 :         struct smb2_create create;
    8349           0 :         struct smb2_find find;
    8350           0 :         unsigned int count;
    8351           0 :         union smb_search_data *d;
    8352           0 :         bool delete_empty_adfiles;
    8353           0 :         int expected_num_files;
    8354             : 
    8355           4 :         delete_empty_adfiles = torture_setting_bool(tctx,
    8356             :                                                     "delete_empty_adfiles",
    8357             :                                                     false);
    8358             : 
    8359           4 :         smb2_deltree(tree1, BASEDIR);
    8360             : 
    8361           4 :         status = torture_smb2_testdir(tree1, BASEDIR, &testdirh);
    8362           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8363             :                                         "torture_smb2_testdir failed\n");
    8364           4 :         smb2_util_close(tree1, testdirh);
    8365             : 
    8366           4 :         ret = torture_setup_file(tctx, tree1, fname, false);
    8367           4 :         torture_assert_goto(tctx, ret == true, ret, done,
    8368             :                             "torture_setup_file failed\n");
    8369             : 
    8370           4 :         ret = torture_setup_file(tctx, tree1, adname, false);
    8371           4 :         torture_assert_goto(tctx, ret == true, ret, done,
    8372             :                             "torture_setup_file failed\n");
    8373             : 
    8374           4 :         ret = write_stream(tree1, __location__, tctx, mem_ctx,
    8375             :                            adname, NULL,
    8376             :                            0, sizeof(osx_adouble_w_xattr), osx_adouble_w_xattr);
    8377           4 :         torture_assert_goto(tctx, ret == true, ret, done,
    8378             :                             "write_stream failed\n");
    8379             : 
    8380           4 :         ret = enable_aapl(tctx, tree2);
    8381           4 :         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           4 :         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           4 :         status = smb2_create(tree2, tctx, &create);
    8398           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8399             :                                         "smb2_create failed\n");
    8400             : 
    8401           4 :         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           4 :         status = smb2_find_level(tree2, tree2, &find, &count, &d);
    8409           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8410             :                                         "smb2_find_level failed\n");
    8411             : 
    8412           4 :         status = smb2_util_close(tree2, create.out.file.handle);
    8413           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8414             :                                         "smb2_util_close failed");
    8415             : 
    8416             :         /*
    8417             :          * Check number of streams
    8418             :          */
    8419             : 
    8420           4 :         ret = check_stream_list(tree2, tctx, fname, 4, streams, false);
    8421           4 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
    8422             : 
    8423             :         /*
    8424             :          * Check Resource Fork is gone
    8425             :          */
    8426             : 
    8427           4 :         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           4 :         status = smb2_create(tree2, mem_ctx, &create);
    8437           4 :         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           4 :         ret = check_stream(tree2, __location__, tctx, mem_ctx,
    8447             :                            fname, AFPINFO_STREAM,
    8448             :                            0, 60, 16, 8, "TESTSLOW");
    8449           4 :         torture_assert_goto(tctx, ret == true, ret, done,
    8450             :                             "check AFPINFO_STREAM failed\n");
    8451             : 
    8452           4 :         ret = check_stream(tree2, __location__, tctx, mem_ctx,
    8453             :                            fname, ":foo" "\xef\x80\xa2" "bar", /* foo:bar */
    8454             :                            0, 3, 0, 3, "baz");
    8455           4 :         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           4 :         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           4 :         status = smb2_create(tree2, tctx, &create);
    8474           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8475             :                                         "smb2_create failed\n");
    8476             : 
    8477           4 :         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           4 :         status = smb2_find_level(tree2, tree2, &find, &count, &d);
    8485           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8486             :                                         "smb2_find_level failed\n");
    8487             : 
    8488           4 :         status = smb2_util_close(tree2, create.out.file.handle);
    8489           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8490             :                                         "smb2_util_close failed");
    8491             : 
    8492           4 :         if (delete_empty_adfiles) {
    8493           2 :                 expected_num_files = 3;
    8494             :         } else {
    8495           2 :                 expected_num_files = 4;
    8496             :         }
    8497           4 :         torture_assert_int_equal_goto(tctx, count, expected_num_files, ret, done,
    8498             :                                       "Wrong number of files\n");
    8499             : 
    8500           4 : done:
    8501           4 :         smb2_deltree(tree1, BASEDIR);
    8502           4 :         talloc_free(mem_ctx);
    8503           4 :         return ret;
    8504             : }
    8505             : 
    8506        2354 : struct torture_suite *torture_vfs_fruit_conversion(TALLOC_CTX *ctx)
    8507             : {
    8508        2354 :         struct torture_suite *suite = torture_suite_create(
    8509             :                 ctx, "fruit_conversion");
    8510             : 
    8511        2354 :         suite->description = talloc_strdup(
    8512             :                 suite, "vfs_fruit conversion tests");
    8513             : 
    8514        2354 :         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        2354 :         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           6 : static bool test_unconvert(struct torture_context *tctx,
    8648             :                            struct smb2_tree *tree1,
    8649             :                            struct smb2_tree *tree2)
    8650             : {
    8651           6 :         const char *fname = BASEDIR "\\unconvert";
    8652           6 :         const char *adname = BASEDIR "\\._unconvert";
    8653           6 :         const char *net = NULL;
    8654           6 :         const char *share = NULL;
    8655           6 :         AfpInfo *afpi = NULL;
    8656           6 :         char *cmd = NULL;
    8657           0 :         struct smb2_handle h1;
    8658           0 :         union smb_fileinfo finfo;
    8659           0 :         size_t adsize;
    8660           0 :         NTSTATUS status;
    8661           0 :         int result;
    8662           6 :         bool ret = true;
    8663             : 
    8664           6 :         torture_assert_not_null_goto(tctx, tree2, ret, done,
    8665             :                                      "Need a second share without fruit\n");
    8666             : 
    8667           6 :         net = torture_setting_string(tctx, "net", NULL);
    8668           6 :         torture_assert_not_null_goto(tctx, net, ret, done,
    8669             :                                      "Need path to 'net'");
    8670             : 
    8671           6 :         share = torture_setting_string(tctx, "sharename", NULL);
    8672           6 :         torture_assert_not_null_goto(tctx, share, ret, done,
    8673             :                                      "Need sharename");
    8674             : 
    8675           6 :         torture_comment(tctx, "Testing unconvert\n");
    8676             : 
    8677           6 :         smb2_deltree(tree1, BASEDIR);
    8678             : 
    8679           6 :         status = torture_smb2_testdir(tree1, BASEDIR, &h1);
    8680           6 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8681             :                                         "torture_smb2_testdir\n");
    8682           6 :         smb2_util_close(tree1, h1);
    8683             : 
    8684           6 :         ret = torture_setup_file(tctx, tree1, fname, false);
    8685           6 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
    8686             : 
    8687           6 :         afpi = torture_afpinfo_new(tctx);
    8688           6 :         torture_assert_not_null_goto(tctx, afpi, ret, done,
    8689             :                                      "torture_afpinfo_new failed\n");
    8690             : 
    8691           6 :         memcpy(afpi->afpi_FinderInfo, "FOO BAR ", 8);
    8692             : 
    8693           6 :         ret = torture_write_afpinfo(tree1, tctx, tctx, fname, afpi);
    8694           6 :         torture_assert_goto(tctx, ret == true, ret, done,
    8695             :                             "torture_write_afpinfo failed\n");
    8696             : 
    8697           6 :         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           6 :         torture_assert_goto(tctx, ret == true, ret, done,
    8705             :                             "write_stream failed\n");
    8706             : 
    8707           6 :         ret = write_stream(tree1, __location__, tctx, tctx,
    8708             :                            fname, AFPRESOURCE_STREAM_NAME,
    8709             :                            0, 4, "bar");
    8710           6 :         torture_assert_goto(tctx, ret == true, ret, done,
    8711             :                             "write_stream failed\n");
    8712             : 
    8713           6 :         cmd = talloc_asprintf(tctx,
    8714             :                               "%s --recursive vfs stream2adouble %s %s/",
    8715             :                               net,
    8716             :                               share,
    8717             :                               BASEDIR);
    8718           6 :         torture_assert_not_null_goto(tctx, cmd, ret, done,
    8719             :                                      "talloc_asprintf failed\n");
    8720             : 
    8721           6 :         torture_comment(tctx, "cmd: %s\n", cmd);
    8722             : 
    8723           6 :         result = system(cmd);
    8724           6 :         torture_assert_int_equal_goto(tctx, result, 0, ret, done,
    8725             :                             "command failed\n");
    8726             : 
    8727           6 :         status = torture_smb2_testfile(tree2, adname, &h1);
    8728           6 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8729             :                                         "torture_smb2_testfile failed\n");
    8730             : 
    8731           6 :         finfo = (union smb_fileinfo) {
    8732             :                 .generic.level = RAW_FILEINFO_ALL_INFORMATION,
    8733             :                 .generic.in.file.handle = h1,
    8734             :         };
    8735             : 
    8736           6 :         status = smb2_getinfo_file(tree2, tctx, &finfo);
    8737           6 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8738             :                                         "torture_smb2_testdir\n");
    8739           6 :         smb2_util_close(tree2, h1);
    8740             : 
    8741           6 :         adsize = finfo.all_info.out.size;
    8742           6 :         torture_assert_int_equal_goto(tctx, adsize,
    8743             :                                       sizeof(unconvert_adfile_data),
    8744             :                                       ret, done, "wrong size\n");
    8745             : 
    8746           6 :         ret = check_stream(tree2, __location__, tctx, tctx,
    8747             :                            adname, "", 0, adsize, 0, adsize,
    8748             :                            unconvert_adfile_data);
    8749           6 :         torture_assert_goto(tctx, ret == true, ret, done,
    8750             :                             "check_stream failed\n");
    8751             : 
    8752           6 : done:
    8753             : //      smb2_deltree(tree1, BASEDIR);
    8754           6 :         return ret;
    8755             : }
    8756             : 
    8757        2354 : struct torture_suite *torture_vfs_fruit_unfruit(TALLOC_CTX *ctx)
    8758             : {
    8759        2354 :         struct torture_suite *suite = torture_suite_create(
    8760             :                 ctx, "unfruit");
    8761             : 
    8762        2354 :         suite->description = talloc_strdup(
    8763             :                 suite, "test converting back to AppleDouble");
    8764             : 
    8765        2354 :         torture_suite_add_2ns_smb2_test(suite,
    8766             :                                         "unconvert",
    8767             :                                         test_unconvert);
    8768             : 
    8769        2354 :         return suite;
    8770             : }
    8771             : 
    8772             : /*
    8773             :  * Write an invalid AFP_AfpInfo stream header
    8774             :  */
    8775           4 : bool test_fruit_validate_afpinfo(struct torture_context *tctx,
    8776             :                                  struct smb2_tree *tree)
    8777             : {
    8778           4 :         bool expect_invalid_param = torture_setting_bool(tctx, "validate_afpinfo", true);
    8779           4 :         const char *fname = "test_fruit_validate_afpinfo";
    8780           4 :         const char *sname = "test_fruit_validate_afpinfo" AFPINFO_STREAM_NAME;
    8781           0 :         struct smb2_handle handle;
    8782           4 :         AfpInfo *afpinfo = NULL;
    8783           4 :         char *afpinfo_buf = NULL;
    8784           0 :         uint8_t valbuf[8];
    8785           0 :         NTSTATUS status;
    8786           4 :         bool ret = true;
    8787             : 
    8788           4 :         torture_comment(tctx, "Checking create of AfpInfo stream\n");
    8789             : 
    8790           4 :         smb2_util_unlink(tree, fname);
    8791             : 
    8792           4 :         ret = torture_setup_file(tctx, tree, fname, false);
    8793           4 :         torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file failed");
    8794             : 
    8795           4 :         afpinfo = torture_afpinfo_new(tctx);
    8796           4 :         torture_assert_not_null_goto(tctx, afpinfo, ret, done,
    8797             :                                      "torture_afpinfo_new failed\n");
    8798             : 
    8799           4 :         memcpy(afpinfo->afpi_FinderInfo, "FOO BAR ", 8);
    8800             : 
    8801           4 :         ret = torture_write_afpinfo(tree, tctx, tctx, fname, afpinfo);
    8802           4 :         torture_assert_goto(tctx, ret == true, ret, done,
    8803             :                             "torture_write_afpinfo failed\n");
    8804             : 
    8805           4 :         afpinfo_buf = talloc_zero_size(tctx, 60);
    8806           4 :         torture_assert_goto(tctx, afpinfo_buf != NULL, ret, done,
    8807             :                             "torture_afpinfo_new failed");
    8808           4 :         memcpy(afpinfo_buf + 16, "FOO ", 4);
    8809             : 
    8810           4 :         status = torture_smb2_testfile_access(
    8811             :                 tree, sname, &handle, SEC_FILE_ALL);
    8812           4 :         torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8813             :                                         "smb2_create failed\n");
    8814             : 
    8815           4 :         status = smb2_util_write(tree, handle, afpinfo_buf, 0, AFP_INFO_SIZE);
    8816           4 :         if (expect_invalid_param) {
    8817           2 :                 torture_assert_ntstatus_equal_goto(
    8818             :                         tctx, status, NT_STATUS_INVALID_PARAMETER, ret, done,
    8819             :                         "write didn't fail as expected\n");
    8820             :         } else {
    8821           2 :                 torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
    8822             :                                                 "smb2_util_write failed");
    8823             :         }
    8824             : 
    8825           4 :         smb2_util_close(tree, handle);
    8826             : 
    8827             :         /*
    8828             :          * Verify the server fixed the header
    8829             :          */
    8830           4 :         PUSH_BE_U32(valbuf, 0, AFP_Signature);
    8831           4 :         PUSH_BE_U32(valbuf + 4, 0, AFP_Version);
    8832           4 :         ret = check_stream(tree, __location__, tctx, tctx, fname,
    8833             :                            AFPINFO_STREAM, 0, 60, 0, 8, (char *)valbuf);
    8834           4 :         torture_assert_goto(tctx, ret == true, ret, done, "check_stream failed");
    8835             : 
    8836           4 : done:
    8837           4 :         smb2_util_unlink(tree, fname);
    8838           4 :         return ret;
    8839             : }

Generated by: LCOV version 1.14