LCOV - code coverage report
Current view: top level - source4/torture/basic - denytest.c (source / functions) Hit Total Coverage
Test: coverage report for master 6248eab5 Lines: 588 723 81.3 %
Date: 2021-08-25 13:27:56 Functions: 23 31 74.2 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             :    SMB torture tester - deny mode scanning functions
       4             :    Copyright (C) Andrew Tridgell 2001
       5             :    
       6             :    This program is free software; you can redistribute it and/or modify
       7             :    it under the terms of the GNU General Public License as published by
       8             :    the Free Software Foundation; either version 3 of the License, or
       9             :    (at your option) any later version.
      10             :    
      11             :    This program is distributed in the hope that it will be useful,
      12             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :    GNU General Public License for more details.
      15             :    
      16             :    You should have received a copy of the GNU General Public License
      17             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18             : */
      19             : 
      20             : #include "includes.h"
      21             : #include "system/filesys.h"
      22             : #include "libcli/libcli.h"
      23             : #include "libcli/security/security.h"
      24             : #include "torture/util.h"
      25             : #include "cxd_known.h"
      26             : #include "torture/basic/proto.h"
      27             : 
      28             : extern int torture_failures;
      29             : 
      30             : #define CHECK_MAX_FAILURES(label) do { if (++failures >= torture_failures) goto label; } while (0)
      31             : 
      32             : enum deny_result {A_0=0, A_X=1, A_R=2, A_W=3, A_RW=5};
      33             : 
      34           0 : static const char *denystr(int denymode)
      35             : {
      36             :         const struct {
      37             :                 int v;
      38             :                 const char *name; 
      39           0 :         } deny_modes[] = {
      40             :                 {DENY_DOS, "DENY_DOS"},
      41             :                 {DENY_ALL, "DENY_ALL"},
      42             :                 {DENY_WRITE, "DENY_WRITE"},
      43             :                 {DENY_READ, "DENY_READ"},
      44             :                 {DENY_NONE, "DENY_NONE"},
      45             :                 {DENY_FCB, "DENY_FCB"},
      46             :                 {-1, NULL}};
      47             :         int i;
      48           0 :         for (i=0;deny_modes[i].name;i++) {
      49           0 :                 if (deny_modes[i].v == denymode) return deny_modes[i].name;
      50             :         }
      51           0 :         return "DENY_XXX";
      52             : }
      53             : 
      54           0 : static const char *openstr(int mode)
      55             : {
      56             :         const struct {
      57             :                 int v;
      58             :                 const char *name; 
      59           0 :         } open_modes[] = {
      60             :                 {O_RDWR, "O_RDWR"},
      61             :                 {O_RDONLY, "O_RDONLY"},
      62             :                 {O_WRONLY, "O_WRONLY"},
      63             :                 {-1, NULL}};
      64             :         int i;
      65           0 :         for (i=0;open_modes[i].name;i++) {
      66           0 :                 if (open_modes[i].v == mode) return open_modes[i].name;
      67             :         }
      68           0 :         return "O_XXX";
      69             : }
      70             : 
      71           0 : static const char *resultstr(enum deny_result res)
      72             : {
      73             :         const struct {
      74             :                 enum deny_result res;
      75             :                 const char *name; 
      76           0 :         } results[] = {
      77             :                 {A_X, "X"},
      78             :                 {A_0, "-"},
      79             :                 {A_R, "R"},
      80             :                 {A_W, "W"},
      81             :                 {A_RW,"RW"}};
      82             :         int i;
      83           0 :         for (i=0;i<ARRAY_SIZE(results);i++) {
      84           0 :                 if (results[i].res == res) return results[i].name;
      85             :         }
      86           0 :         return "*";
      87             : }
      88             : 
      89             : static const struct {
      90             :         int isexe;
      91             :         int mode1, deny1;
      92             :         int mode2, deny2;
      93             :         enum deny_result result;
      94             : } denytable2[] = {
      95             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
      96             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
      97             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
      98             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
      99             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     100             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     101             : {1,   O_RDWR,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
     102             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
     103             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
     104             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
     105             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
     106             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
     107             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_RW},
     108             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
     109             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_W},
     110             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     111             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     112             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     113             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
     114             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
     115             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
     116             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     117             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     118             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     119             : {1, O_RDONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_RW},
     120             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_R},
     121             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_W},
     122             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
     123             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
     124             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
     125             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_RW},
     126             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
     127             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_W},
     128             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     129             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     130             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     131             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
     132             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
     133             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
     134             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     135             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     136             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     137             : {1, O_WRONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
     138             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
     139             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
     140             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_RW},
     141             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_R},
     142             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_W},
     143             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_RW},
     144             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
     145             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_W},
     146             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     147             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     148             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     149             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     150             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     151             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     152             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     153             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     154             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     155             : {1,   O_RDWR,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     156             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     157             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     158             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     159             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     160             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     161             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     162             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     163             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     164             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     165             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     166             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     167             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     168             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     169             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     170             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     171             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     172             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     173             : {1, O_RDONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     174             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     175             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     176             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     177             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     178             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     179             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     180             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     181             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     182             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     183             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     184             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     185             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     186             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     187             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     188             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     189             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     190             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     191             : {1, O_WRONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     192             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     193             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     194             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     195             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     196             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     197             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     198             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     199             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     200             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     201             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     202             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     203             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     204             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
     205             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     206             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     207             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     208             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     209             : {1,   O_RDWR, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     210             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
     211             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     212             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     213             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
     214             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     215             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     216             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     217             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     218             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     219             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     220             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     221             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     222             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
     223             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     224             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     225             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     226             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     227             : {1, O_RDONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     228             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_R},
     229             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     230             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     231             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
     232             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     233             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     234             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     235             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     236             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     237             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     238             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     239             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     240             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
     241             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     242             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     243             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     244             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     245             : {1, O_WRONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     246             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
     247             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     248             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     249             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_R},
     250             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     251             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     252             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     253             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     254             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     255             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     256             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     257             : {1,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     258             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     259             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_W},
     260             : {1,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     261             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     262             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     263             : {1,   O_RDWR,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     264             : {1,   O_RDWR,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     265             : {1,   O_RDWR,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
     266             : {1,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     267             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     268             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
     269             : {1,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     270             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     271             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     272             : {1,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     273             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     274             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     275             : {1, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     276             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     277             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_W},
     278             : {1, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     279             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     280             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     281             : {1, O_RDONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     282             : {1, O_RDONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     283             : {1, O_RDONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_W},
     284             : {1, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     285             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     286             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
     287             : {1, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     288             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     289             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     290             : {1, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     291             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     292             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     293             : {1, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     294             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     295             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_W},
     296             : {1, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     297             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     298             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     299             : {1, O_WRONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     300             : {1, O_WRONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     301             : {1, O_WRONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
     302             : {1, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     303             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     304             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_W},
     305             : {1, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     306             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     307             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     308             : {1, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     309             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     310             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     311             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_RW},
     312             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
     313             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_W},
     314             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     315             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     316             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     317             : {1,   O_RDWR,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
     318             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
     319             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
     320             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
     321             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
     322             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
     323             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     324             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
     325             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
     326             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
     327             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
     328             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
     329             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_RW},
     330             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
     331             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_W},
     332             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     333             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     334             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     335             : {1, O_RDONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_RW},
     336             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_R},
     337             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_W},
     338             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
     339             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
     340             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
     341             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     342             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
     343             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
     344             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
     345             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
     346             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
     347             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_RW},
     348             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
     349             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_W},
     350             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     351             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     352             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     353             : {1, O_WRONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
     354             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
     355             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
     356             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_RW},
     357             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_R},
     358             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_W},
     359             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     360             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
     361             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
     362             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
     363             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
     364             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
     365             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_0},
     366             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_0},
     367             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_0},
     368             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
     369             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
     370             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
     371             : {1,   O_RDWR,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
     372             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
     373             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
     374             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
     375             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
     376             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
     377             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
     378             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
     379             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
     380             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_0},
     381             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_0},
     382             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_0},
     383             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_0},
     384             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_0},
     385             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_0},
     386             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
     387             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
     388             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
     389             : {1, O_RDONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
     390             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
     391             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
     392             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
     393             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
     394             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
     395             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
     396             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
     397             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
     398             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_0},
     399             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_0},
     400             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_0},
     401             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_0},
     402             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_0},
     403             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_0},
     404             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
     405             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
     406             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
     407             : {1, O_WRONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
     408             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
     409             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
     410             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
     411             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
     412             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
     413             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
     414             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
     415             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
     416             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_0},
     417             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_0},
     418             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_0},
     419             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_0},
     420             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_0},
     421             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_0},
     422             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     423             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     424             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     425             : {0,   O_RDWR,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
     426             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
     427             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
     428             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
     429             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
     430             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
     431             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_0},
     432             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_0},
     433             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_0},
     434             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     435             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     436             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     437             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_0},
     438             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
     439             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_0},
     440             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     441             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     442             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     443             : {0, O_RDONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
     444             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_R},
     445             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
     446             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
     447             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
     448             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
     449             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_0},
     450             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
     451             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_0},
     452             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     453             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     454             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     455             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_0},
     456             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_0},
     457             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_0},
     458             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     459             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     460             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     461             : {0, O_WRONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
     462             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
     463             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
     464             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
     465             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
     466             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
     467             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_0},
     468             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_0},
     469             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_0},
     470             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     471             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     472             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     473             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     474             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     475             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     476             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     477             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     478             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     479             : {0,   O_RDWR,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     480             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     481             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     482             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     483             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     484             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     485             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     486             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     487             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     488             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     489             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     490             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     491             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     492             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     493             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     494             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     495             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     496             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     497             : {0, O_RDONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     498             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     499             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     500             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     501             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     502             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     503             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     504             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     505             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     506             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     507             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     508             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     509             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     510             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     511             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     512             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     513             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     514             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     515             : {0, O_WRONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     516             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     517             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     518             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     519             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     520             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     521             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     522             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     523             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     524             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     525             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     526             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     527             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     528             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_0},
     529             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     530             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     531             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     532             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     533             : {0,   O_RDWR, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     534             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
     535             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     536             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     537             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
     538             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     539             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     540             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     541             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     542             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     543             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     544             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     545             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     546             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
     547             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     548             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     549             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     550             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     551             : {0, O_RDONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     552             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_R},
     553             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     554             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     555             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
     556             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     557             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     558             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     559             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     560             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     561             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     562             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     563             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     564             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_0},
     565             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     566             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     567             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     568             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     569             : {0, O_WRONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     570             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
     571             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     572             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     573             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_R},
     574             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     575             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     576             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     577             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     578             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     579             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     580             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     581             : {0,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     582             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     583             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_0},
     584             : {0,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     585             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     586             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     587             : {0,   O_RDWR,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     588             : {0,   O_RDWR,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     589             : {0,   O_RDWR,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
     590             : {0,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     591             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     592             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
     593             : {0,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     594             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     595             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     596             : {0,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     597             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     598             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     599             : {0, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     600             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     601             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_0},
     602             : {0, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     603             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     604             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     605             : {0, O_RDONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     606             : {0, O_RDONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     607             : {0, O_RDONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_W},
     608             : {0, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     609             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     610             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
     611             : {0, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     612             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     613             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     614             : {0, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     615             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     616             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     617             : {0, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     618             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     619             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_0},
     620             : {0, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     621             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     622             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     623             : {0, O_WRONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     624             : {0, O_WRONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     625             : {0, O_WRONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
     626             : {0, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     627             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     628             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_W},
     629             : {0, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     630             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     631             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     632             : {0, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     633             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     634             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     635             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_0},
     636             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_0},
     637             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_0},
     638             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     639             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     640             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     641             : {0,   O_RDWR,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
     642             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
     643             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
     644             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
     645             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
     646             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
     647             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     648             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
     649             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
     650             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
     651             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
     652             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
     653             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_0},
     654             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
     655             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_0},
     656             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     657             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     658             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     659             : {0, O_RDONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_RW},
     660             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_R},
     661             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_W},
     662             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
     663             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
     664             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
     665             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     666             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
     667             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
     668             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
     669             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
     670             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
     671             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_0},
     672             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_0},
     673             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_0},
     674             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     675             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     676             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     677             : {0, O_WRONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
     678             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
     679             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
     680             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_RW},
     681             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_R},
     682             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_W},
     683             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     684             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
     685             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
     686             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
     687             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
     688             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
     689             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_0},
     690             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_0},
     691             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_0},
     692             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
     693             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
     694             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
     695             : {0,   O_RDWR,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
     696             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
     697             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
     698             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
     699             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
     700             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
     701             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
     702             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
     703             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
     704             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_0},
     705             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_0},
     706             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_0},
     707             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_0},
     708             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_0},
     709             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_0},
     710             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
     711             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
     712             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
     713             : {0, O_RDONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
     714             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
     715             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
     716             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
     717             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
     718             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
     719             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
     720             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
     721             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
     722             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_0},
     723             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_0},
     724             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_0},
     725             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_0},
     726             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_0},
     727             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_0},
     728             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
     729             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
     730             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
     731             : {0, O_WRONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
     732             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
     733             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
     734             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
     735             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
     736             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
     737             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
     738             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
     739             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
     740             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_0},
     741             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_0},
     742             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_0}
     743             : };
     744             : 
     745             : 
     746             : static const struct {
     747             :         int isexe;
     748             :         int mode1, deny1;
     749             :         int mode2, deny2;
     750             :         enum deny_result result;
     751             : } denytable1[] = {
     752             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
     753             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
     754             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
     755             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     756             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     757             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     758             : {1,   O_RDWR,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
     759             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
     760             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
     761             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
     762             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
     763             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
     764             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_RW},
     765             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
     766             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_W},
     767             : {1,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     768             : {1,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     769             : {1,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     770             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
     771             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
     772             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
     773             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     774             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     775             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     776             : {1, O_RDONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_RW},
     777             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_R},
     778             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_W},
     779             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
     780             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
     781             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
     782             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_RW},
     783             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
     784             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_W},
     785             : {1, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     786             : {1, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     787             : {1, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     788             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
     789             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
     790             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
     791             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
     792             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
     793             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
     794             : {1, O_WRONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
     795             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
     796             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
     797             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_RW},
     798             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_R},
     799             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_W},
     800             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_RW},
     801             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
     802             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_W},
     803             : {1, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
     804             : {1, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
     805             : {1, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
     806             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     807             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     808             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     809             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     810             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     811             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     812             : {1,   O_RDWR,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     813             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     814             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     815             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     816             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     817             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     818             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     819             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     820             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     821             : {1,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     822             : {1,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     823             : {1,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     824             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     825             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     826             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     827             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     828             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     829             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     830             : {1, O_RDONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     831             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     832             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     833             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     834             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     835             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     836             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     837             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     838             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     839             : {1, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     840             : {1, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     841             : {1, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     842             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
     843             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
     844             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
     845             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
     846             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
     847             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
     848             : {1, O_WRONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
     849             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
     850             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
     851             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
     852             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
     853             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
     854             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
     855             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
     856             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
     857             : {1, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
     858             : {1, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
     859             : {1, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
     860             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     861             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
     862             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     863             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     864             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     865             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     866             : {1,   O_RDWR, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     867             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
     868             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     869             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     870             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
     871             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     872             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     873             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     874             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     875             : {1,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     876             : {1,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     877             : {1,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     878             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     879             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
     880             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     881             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     882             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     883             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     884             : {1, O_RDONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     885             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_R},
     886             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     887             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     888             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
     889             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     890             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     891             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     892             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     893             : {1, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     894             : {1, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     895             : {1, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     896             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
     897             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
     898             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
     899             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
     900             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
     901             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
     902             : {1, O_WRONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
     903             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
     904             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
     905             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
     906             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_R},
     907             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
     908             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
     909             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
     910             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
     911             : {1, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
     912             : {1, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
     913             : {1, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
     914             : {1,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     915             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     916             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_W},
     917             : {1,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     918             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     919             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     920             : {1,   O_RDWR,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     921             : {1,   O_RDWR,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     922             : {1,   O_RDWR,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
     923             : {1,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     924             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     925             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
     926             : {1,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     927             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     928             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     929             : {1,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     930             : {1,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     931             : {1,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     932             : {1, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     933             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     934             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_W},
     935             : {1, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     936             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     937             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     938             : {1, O_RDONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     939             : {1, O_RDONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     940             : {1, O_RDONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_W},
     941             : {1, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     942             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     943             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
     944             : {1, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     945             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     946             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     947             : {1, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     948             : {1, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     949             : {1, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     950             : {1, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
     951             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
     952             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_W},
     953             : {1, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
     954             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
     955             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
     956             : {1, O_WRONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
     957             : {1, O_WRONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
     958             : {1, O_WRONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
     959             : {1, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
     960             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
     961             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_W},
     962             : {1, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
     963             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
     964             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
     965             : {1, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
     966             : {1, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
     967             : {1, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
     968             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_RW},
     969             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
     970             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_W},
     971             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     972             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     973             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     974             : {1,   O_RDWR,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
     975             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
     976             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
     977             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
     978             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
     979             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
     980             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     981             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
     982             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
     983             : {1,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
     984             : {1,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
     985             : {1,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
     986             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_RW},
     987             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
     988             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_W},
     989             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
     990             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
     991             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
     992             : {1, O_RDONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_RW},
     993             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_R},
     994             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_W},
     995             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
     996             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
     997             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
     998             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
     999             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
    1000             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
    1001             : {1, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
    1002             : {1, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
    1003             : {1, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
    1004             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_RW},
    1005             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
    1006             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_W},
    1007             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
    1008             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
    1009             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
    1010             : {1, O_WRONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
    1011             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
    1012             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
    1013             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_RW},
    1014             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_R},
    1015             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_W},
    1016             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
    1017             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
    1018             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
    1019             : {1, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
    1020             : {1, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
    1021             : {1, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
    1022             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_RW},
    1023             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_R},
    1024             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_W},
    1025             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
    1026             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
    1027             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
    1028             : {1,   O_RDWR,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
    1029             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
    1030             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
    1031             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
    1032             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
    1033             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
    1034             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
    1035             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
    1036             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
    1037             : {1,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_RW},
    1038             : {1,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_RW},
    1039             : {1,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_RW},
    1040             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_RW},
    1041             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_R},
    1042             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_W},
    1043             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
    1044             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
    1045             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
    1046             : {1, O_RDONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
    1047             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
    1048             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
    1049             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
    1050             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
    1051             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
    1052             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
    1053             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
    1054             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
    1055             : {1, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_RW},
    1056             : {1, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_RW},
    1057             : {1, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_RW},
    1058             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_RW},
    1059             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_R},
    1060             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_W},
    1061             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
    1062             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
    1063             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
    1064             : {1, O_WRONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
    1065             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
    1066             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
    1067             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
    1068             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
    1069             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
    1070             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
    1071             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
    1072             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
    1073             : {1, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_RW},
    1074             : {1, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_RW},
    1075             : {1, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_RW},
    1076             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
    1077             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
    1078             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
    1079             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
    1080             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
    1081             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
    1082             : {0,   O_RDWR,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
    1083             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
    1084             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
    1085             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
    1086             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
    1087             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
    1088             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_0},
    1089             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_0},
    1090             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_0},
    1091             : {0,   O_RDWR,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_RW},
    1092             : {0,   O_RDWR,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_RW},
    1093             : {0,   O_RDWR,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_RW},
    1094             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_0},
    1095             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
    1096             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_0},
    1097             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
    1098             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
    1099             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
    1100             : {0, O_RDONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
    1101             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_R},
    1102             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
    1103             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
    1104             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
    1105             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
    1106             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_0},
    1107             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_R},
    1108             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_0},
    1109             : {0, O_RDONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_0},
    1110             : {0, O_RDONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_0},
    1111             : {0, O_RDONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_0},
    1112             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_DOS,     A_RW},
    1113             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_DOS,     A_R},
    1114             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_DOS,     A_W},
    1115             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_ALL,     A_0},
    1116             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_ALL,     A_0},
    1117             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_ALL,     A_0},
    1118             : {0, O_WRONLY,   DENY_DOS,      O_RDWR, DENY_WRITE,     A_0},
    1119             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY, DENY_WRITE,     A_0},
    1120             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY, DENY_WRITE,     A_0},
    1121             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_READ,     A_0},
    1122             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_READ,     A_0},
    1123             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_READ,     A_0},
    1124             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,  DENY_NONE,     A_0},
    1125             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,  DENY_NONE,     A_0},
    1126             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,  DENY_NONE,     A_0},
    1127             : {0, O_WRONLY,   DENY_DOS,      O_RDWR,   DENY_FCB,     A_RW},
    1128             : {0, O_WRONLY,   DENY_DOS,    O_RDONLY,   DENY_FCB,     A_RW},
    1129             : {0, O_WRONLY,   DENY_DOS,    O_WRONLY,   DENY_FCB,     A_RW},
    1130             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
    1131             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
    1132             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
    1133             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
    1134             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
    1135             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
    1136             : {0,   O_RDWR,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
    1137             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
    1138             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
    1139             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
    1140             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
    1141             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
    1142             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
    1143             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
    1144             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
    1145             : {0,   O_RDWR,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
    1146             : {0,   O_RDWR,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
    1147             : {0,   O_RDWR,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
    1148             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
    1149             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
    1150             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
    1151             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
    1152             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
    1153             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
    1154             : {0, O_RDONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
    1155             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
    1156             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
    1157             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
    1158             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
    1159             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
    1160             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
    1161             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
    1162             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
    1163             : {0, O_RDONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
    1164             : {0, O_RDONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
    1165             : {0, O_RDONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
    1166             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_DOS,     A_0},
    1167             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_DOS,     A_0},
    1168             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_DOS,     A_0},
    1169             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_ALL,     A_0},
    1170             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_ALL,     A_0},
    1171             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_ALL,     A_0},
    1172             : {0, O_WRONLY,   DENY_ALL,      O_RDWR, DENY_WRITE,     A_0},
    1173             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY, DENY_WRITE,     A_0},
    1174             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY, DENY_WRITE,     A_0},
    1175             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_READ,     A_0},
    1176             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_READ,     A_0},
    1177             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_READ,     A_0},
    1178             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,  DENY_NONE,     A_0},
    1179             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,  DENY_NONE,     A_0},
    1180             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,  DENY_NONE,     A_0},
    1181             : {0, O_WRONLY,   DENY_ALL,      O_RDWR,   DENY_FCB,     A_0},
    1182             : {0, O_WRONLY,   DENY_ALL,    O_RDONLY,   DENY_FCB,     A_0},
    1183             : {0, O_WRONLY,   DENY_ALL,    O_WRONLY,   DENY_FCB,     A_0},
    1184             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
    1185             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_0},
    1186             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
    1187             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
    1188             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
    1189             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
    1190             : {0,   O_RDWR, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
    1191             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
    1192             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
    1193             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
    1194             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
    1195             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
    1196             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
    1197             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
    1198             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
    1199             : {0,   O_RDWR, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
    1200             : {0,   O_RDWR, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
    1201             : {0,   O_RDWR, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
    1202             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
    1203             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_R},
    1204             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
    1205             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
    1206             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
    1207             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
    1208             : {0, O_RDONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
    1209             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_R},
    1210             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
    1211             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
    1212             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_0},
    1213             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
    1214             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
    1215             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
    1216             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
    1217             : {0, O_RDONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
    1218             : {0, O_RDONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
    1219             : {0, O_RDONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
    1220             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_DOS,     A_0},
    1221             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_DOS,     A_0},
    1222             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_DOS,     A_0},
    1223             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_ALL,     A_0},
    1224             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_ALL,     A_0},
    1225             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_ALL,     A_0},
    1226             : {0, O_WRONLY, DENY_WRITE,      O_RDWR, DENY_WRITE,     A_0},
    1227             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY, DENY_WRITE,     A_0},
    1228             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY, DENY_WRITE,     A_0},
    1229             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_READ,     A_0},
    1230             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_READ,     A_R},
    1231             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_READ,     A_0},
    1232             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,  DENY_NONE,     A_0},
    1233             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,  DENY_NONE,     A_R},
    1234             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,  DENY_NONE,     A_0},
    1235             : {0, O_WRONLY, DENY_WRITE,      O_RDWR,   DENY_FCB,     A_0},
    1236             : {0, O_WRONLY, DENY_WRITE,    O_RDONLY,   DENY_FCB,     A_0},
    1237             : {0, O_WRONLY, DENY_WRITE,    O_WRONLY,   DENY_FCB,     A_0},
    1238             : {0,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
    1239             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
    1240             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_0},
    1241             : {0,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
    1242             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
    1243             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
    1244             : {0,   O_RDWR,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
    1245             : {0,   O_RDWR,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
    1246             : {0,   O_RDWR,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
    1247             : {0,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
    1248             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
    1249             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
    1250             : {0,   O_RDWR,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
    1251             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
    1252             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
    1253             : {0,   O_RDWR,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
    1254             : {0,   O_RDWR,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
    1255             : {0,   O_RDWR,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
    1256             : {0, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
    1257             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
    1258             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_0},
    1259             : {0, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
    1260             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
    1261             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
    1262             : {0, O_RDONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
    1263             : {0, O_RDONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
    1264             : {0, O_RDONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_W},
    1265             : {0, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
    1266             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
    1267             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_0},
    1268             : {0, O_RDONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
    1269             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
    1270             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
    1271             : {0, O_RDONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
    1272             : {0, O_RDONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
    1273             : {0, O_RDONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
    1274             : {0, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_DOS,     A_0},
    1275             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_DOS,     A_0},
    1276             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_DOS,     A_0},
    1277             : {0, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_ALL,     A_0},
    1278             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_ALL,     A_0},
    1279             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_ALL,     A_0},
    1280             : {0, O_WRONLY,  DENY_READ,      O_RDWR, DENY_WRITE,     A_0},
    1281             : {0, O_WRONLY,  DENY_READ,    O_RDONLY, DENY_WRITE,     A_0},
    1282             : {0, O_WRONLY,  DENY_READ,    O_WRONLY, DENY_WRITE,     A_0},
    1283             : {0, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_READ,     A_0},
    1284             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_READ,     A_0},
    1285             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_READ,     A_W},
    1286             : {0, O_WRONLY,  DENY_READ,      O_RDWR,  DENY_NONE,     A_0},
    1287             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,  DENY_NONE,     A_0},
    1288             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,  DENY_NONE,     A_W},
    1289             : {0, O_WRONLY,  DENY_READ,      O_RDWR,   DENY_FCB,     A_0},
    1290             : {0, O_WRONLY,  DENY_READ,    O_RDONLY,   DENY_FCB,     A_0},
    1291             : {0, O_WRONLY,  DENY_READ,    O_WRONLY,   DENY_FCB,     A_0},
    1292             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_0},
    1293             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_0},
    1294             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_0},
    1295             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
    1296             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
    1297             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
    1298             : {0,   O_RDWR,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
    1299             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
    1300             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
    1301             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
    1302             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
    1303             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
    1304             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
    1305             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
    1306             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
    1307             : {0,   O_RDWR,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
    1308             : {0,   O_RDWR,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
    1309             : {0,   O_RDWR,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
    1310             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_0},
    1311             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_R},
    1312             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_0},
    1313             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
    1314             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
    1315             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
    1316             : {0, O_RDONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_RW},
    1317             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_R},
    1318             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_W},
    1319             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_0},
    1320             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_0},
    1321             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_0},
    1322             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
    1323             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
    1324             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
    1325             : {0, O_RDONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
    1326             : {0, O_RDONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
    1327             : {0, O_RDONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
    1328             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_DOS,     A_0},
    1329             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_DOS,     A_0},
    1330             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_DOS,     A_0},
    1331             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_ALL,     A_0},
    1332             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_ALL,     A_0},
    1333             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_ALL,     A_0},
    1334             : {0, O_WRONLY,  DENY_NONE,      O_RDWR, DENY_WRITE,     A_0},
    1335             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY, DENY_WRITE,     A_0},
    1336             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY, DENY_WRITE,     A_0},
    1337             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_READ,     A_RW},
    1338             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_READ,     A_R},
    1339             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_READ,     A_W},
    1340             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,  DENY_NONE,     A_RW},
    1341             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,  DENY_NONE,     A_R},
    1342             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,  DENY_NONE,     A_W},
    1343             : {0, O_WRONLY,  DENY_NONE,      O_RDWR,   DENY_FCB,     A_0},
    1344             : {0, O_WRONLY,  DENY_NONE,    O_RDONLY,   DENY_FCB,     A_0},
    1345             : {0, O_WRONLY,  DENY_NONE,    O_WRONLY,   DENY_FCB,     A_0},
    1346             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_RW},
    1347             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_R},
    1348             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_W},
    1349             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
    1350             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
    1351             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
    1352             : {0,   O_RDWR,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
    1353             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
    1354             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
    1355             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
    1356             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
    1357             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
    1358             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
    1359             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
    1360             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
    1361             : {0,   O_RDWR,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_RW},
    1362             : {0,   O_RDWR,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_RW},
    1363             : {0,   O_RDWR,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_RW},
    1364             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_RW},
    1365             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_R},
    1366             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_W},
    1367             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
    1368             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
    1369             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
    1370             : {0, O_RDONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
    1371             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
    1372             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
    1373             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
    1374             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
    1375             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
    1376             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
    1377             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
    1378             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
    1379             : {0, O_RDONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_RW},
    1380             : {0, O_RDONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_RW},
    1381             : {0, O_RDONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_RW},
    1382             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_DOS,     A_RW},
    1383             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_DOS,     A_R},
    1384             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_DOS,     A_W},
    1385             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_ALL,     A_0},
    1386             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_ALL,     A_0},
    1387             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_ALL,     A_0},
    1388             : {0, O_WRONLY,   DENY_FCB,      O_RDWR, DENY_WRITE,     A_0},
    1389             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY, DENY_WRITE,     A_0},
    1390             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY, DENY_WRITE,     A_0},
    1391             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_READ,     A_0},
    1392             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_READ,     A_0},
    1393             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_READ,     A_0},
    1394             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,  DENY_NONE,     A_0},
    1395             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,  DENY_NONE,     A_0},
    1396             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,  DENY_NONE,     A_0},
    1397             : {0, O_WRONLY,   DENY_FCB,      O_RDWR,   DENY_FCB,     A_RW},
    1398             : {0, O_WRONLY,   DENY_FCB,    O_RDONLY,   DENY_FCB,     A_RW},
    1399             : {0, O_WRONLY,   DENY_FCB,    O_WRONLY,   DENY_FCB,     A_RW}
    1400             : };
    1401             : 
    1402             : 
    1403        5244 : static void progress_bar(struct torture_context *tctx, unsigned int i, unsigned int total)
    1404             : {
    1405        5244 :         if (torture_setting_bool(tctx, "progress", true)) {
    1406           0 :                 torture_comment(tctx, "%5d/%5d\r", i, total);
    1407           0 :                 fflush(stdout);
    1408             :         }
    1409        5244 : }
    1410             : 
    1411             : /*
    1412             :   this produces a matrix of deny mode behaviour for 1 connection
    1413             :  */
    1414           4 : bool torture_denytest1(struct torture_context *tctx, 
    1415             :                        struct smbcli_state *cli1)
    1416             : {
    1417             :         int fnum1, fnum2;
    1418             :         int i;
    1419           4 :         bool correct = true;
    1420             :         struct timespec tv, tv_start;
    1421           4 :         const char *fnames[2] = {"\\denytest1.dat", "\\denytest1.exe"};
    1422           4 :         int failures=0;
    1423             : 
    1424           4 :         torture_comment(tctx, "Testing deny modes with 1 connection\n");
    1425             : 
    1426          12 :         for (i=0;i<2;i++) {
    1427           8 :                 smbcli_unlink(cli1->tree, fnames[i]);
    1428           8 :                 fnum1 = smbcli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
    1429           8 :                 smbcli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
    1430           8 :                 smbcli_close(cli1->tree, fnum1);
    1431             :         }
    1432             : 
    1433           4 :         torture_comment(tctx, "Testing %d entries\n", (int)ARRAY_SIZE(denytable1));
    1434             : 
    1435           4 :         clock_gettime_mono(&tv_start);
    1436             : 
    1437        2596 :         for (i=0; i<ARRAY_SIZE(denytable1); i++) {
    1438             :                 enum deny_result res;
    1439        2592 :                 const char *fname = fnames[denytable1[i].isexe];
    1440             : 
    1441        2592 :                 progress_bar(tctx, i, ARRAY_SIZE(denytable1));
    1442             : 
    1443        2592 :                 if (!torture_setting_bool(tctx, "deny_fcb_support", true) &&
    1444           0 :                     (denytable1[i].deny1 == DENY_FCB ||
    1445           0 :                         denytable1[i].deny2 == DENY_FCB))
    1446           0 :                         continue;
    1447             : 
    1448        2592 :                 if (!torture_setting_bool(tctx, "deny_dos_support", true) &&
    1449           0 :                     (denytable1[i].deny1 == DENY_DOS ||
    1450           0 :                         denytable1[i].deny2 == DENY_DOS))
    1451           0 :                         continue;
    1452             : 
    1453        2592 :                 fnum1 = smbcli_open(cli1->tree, fname, 
    1454             :                                  denytable1[i].mode1,
    1455             :                                  denytable1[i].deny1);
    1456        2592 :                 fnum2 = smbcli_open(cli1->tree, fname, 
    1457             :                                  denytable1[i].mode2,
    1458             :                                  denytable1[i].deny2);
    1459             : 
    1460        2592 :                 if (fnum1 == -1) {
    1461           0 :                         res = A_X;
    1462        2592 :                 } else if (fnum2 == -1) {
    1463        2024 :                         res = A_0;
    1464             :                 } else {
    1465         568 :                         uint8_t x = 1;
    1466         568 :                         res = A_0;
    1467         568 :                         if (smbcli_read(cli1->tree, fnum2, &x, 0, 1) == 1) {
    1468         400 :                                 res += A_R;
    1469             :                         }
    1470         568 :                         if (smbcli_write(cli1->tree, fnum2, 0, &x, 0, 1) == 1) {
    1471         380 :                                 res += A_W;
    1472             :                         }
    1473             :                 }
    1474             : 
    1475        5184 :                 if (torture_setting_bool(tctx, "showall", false) || 
    1476        2592 :                         res != denytable1[i].result) {
    1477             :                         int64_t tdif;
    1478           0 :                         clock_gettime_mono(&tv);
    1479           0 :                         tdif = nsec_time_diff(&tv, &tv_start);
    1480           0 :                         tdif /= 1000000;
    1481           0 :                         torture_comment(tctx, "%lld: %s %8s %10s    %8s %10s    %s (correct=%s)\n",
    1482             :                                (long long)tdif,
    1483             :                                fname,
    1484             :                                denystr(denytable1[i].deny1),
    1485             :                                openstr(denytable1[i].mode1),
    1486             :                                denystr(denytable1[i].deny2),
    1487             :                                openstr(denytable1[i].mode2),
    1488             :                                resultstr(res),
    1489             :                                resultstr(denytable1[i].result));
    1490             :                 }
    1491             : 
    1492        2592 :                 if (res != denytable1[i].result) {
    1493           0 :                         correct = false;
    1494           0 :                         CHECK_MAX_FAILURES(failed);
    1495             :                 }
    1496             : 
    1497        2592 :                 smbcli_close(cli1->tree, fnum1);
    1498        2592 :                 smbcli_close(cli1->tree, fnum2);
    1499             :         }
    1500             : 
    1501           4 : failed:
    1502          12 :         for (i=0;i<2;i++) {
    1503           8 :                 smbcli_unlink(cli1->tree, fnames[i]);
    1504             :         }
    1505             :                 
    1506           4 :         torture_comment(tctx, "finshed denytest1 (%d failures)\n", failures);
    1507           4 :         return correct;
    1508             : }
    1509             : 
    1510             : 
    1511             : /*
    1512             :   this produces a matrix of deny mode behaviour with 2 connections
    1513             :  */
    1514           4 : bool torture_denytest2(struct torture_context *tctx, 
    1515             :                        struct smbcli_state *cli1, 
    1516             :                        struct smbcli_state *cli2)
    1517             : {
    1518             :         int fnum1, fnum2;
    1519             :         int i;
    1520           4 :         bool correct = true;
    1521           4 :         const char *fnames[2] = {"\\denytest2.dat", "\\denytest2.exe"};
    1522             :         struct timespec tv, tv_start;
    1523           4 :         int failures=0;
    1524             : 
    1525          12 :         for (i=0;i<2;i++) {
    1526           8 :                 smbcli_unlink(cli1->tree, fnames[i]);
    1527           8 :                 fnum1 = smbcli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
    1528           8 :                 smbcli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
    1529           8 :                 smbcli_close(cli1->tree, fnum1);
    1530             :         }
    1531             : 
    1532           4 :         clock_gettime_mono(&tv_start);
    1533             : 
    1534        2596 :         for (i=0; i<ARRAY_SIZE(denytable2); i++) {
    1535             :                 enum deny_result res;
    1536        2592 :                 const char *fname = fnames[denytable2[i].isexe];
    1537             : 
    1538        2592 :                 progress_bar(tctx, i, ARRAY_SIZE(denytable1));
    1539             : 
    1540        2592 :                 if (!torture_setting_bool(tctx, "deny_fcb_support", true) &&
    1541           0 :                     (denytable1[i].deny1 == DENY_FCB ||
    1542           0 :                         denytable1[i].deny2 == DENY_FCB))
    1543           0 :                         continue;
    1544             : 
    1545        2592 :                 if (!torture_setting_bool(tctx, "deny_dos_support", true) &&
    1546           0 :                     (denytable1[i].deny1 == DENY_DOS ||
    1547           0 :                         denytable1[i].deny2 == DENY_DOS))
    1548           0 :                         continue;
    1549             : 
    1550        2592 :                 fnum1 = smbcli_open(cli1->tree, fname, 
    1551             :                                  denytable2[i].mode1,
    1552             :                                  denytable2[i].deny1);
    1553        2592 :                 fnum2 = smbcli_open(cli2->tree, fname, 
    1554             :                                  denytable2[i].mode2,
    1555             :                                  denytable2[i].deny2);
    1556             : 
    1557        2592 :                 if (fnum1 == -1) {
    1558           0 :                         res = A_X;
    1559        2592 :                 } else if (fnum2 == -1) {
    1560        2216 :                         res = A_0;
    1561             :                 } else {
    1562         376 :                         uint8_t x = 1;
    1563         376 :                         res = A_0;
    1564         376 :                         if (smbcli_read(cli2->tree, fnum2, &x, 0, 1) == 1) {
    1565         240 :                                 res += A_R;
    1566             :                         }
    1567         376 :                         if (smbcli_write(cli2->tree, fnum2, 0, &x, 0, 1) == 1) {
    1568         220 :                                 res += A_W;
    1569             :                         }
    1570             :                 }
    1571             : 
    1572        5184 :                 if (torture_setting_bool(tctx, "showall", false) || 
    1573        2592 :                         res != denytable2[i].result) {
    1574             :                         int64_t tdif;
    1575           0 :                         clock_gettime_mono(&tv);
    1576           0 :                         tdif = nsec_time_diff(&tv, &tv_start);
    1577           0 :                         tdif /= 1000000;
    1578           0 :                         torture_comment(tctx, "%lld: %s %8s %10s    %8s %10s    %s (correct=%s)\n",
    1579             :                                (long long)tdif,
    1580             :                                fname,
    1581             :                                denystr(denytable2[i].deny1),
    1582             :                                openstr(denytable2[i].mode1),
    1583             :                                denystr(denytable2[i].deny2),
    1584             :                                openstr(denytable2[i].mode2),
    1585             :                                resultstr(res),
    1586             :                                resultstr(denytable2[i].result));
    1587             :                 }
    1588             : 
    1589        2592 :                 if (res != denytable2[i].result) {
    1590           0 :                         correct = false;
    1591           0 :                         CHECK_MAX_FAILURES(failed);
    1592             :                 }
    1593             : 
    1594        2592 :                 smbcli_close(cli1->tree, fnum1);
    1595        2592 :                 smbcli_close(cli2->tree, fnum2);
    1596             :         }
    1597             : 
    1598           4 : failed:         
    1599          12 :         for (i=0;i<2;i++) {
    1600           8 :                 smbcli_unlink(cli1->tree, fnames[i]);
    1601             :         }
    1602             : 
    1603           4 :         torture_comment(tctx, "finshed denytest2 (%d failures)\n", failures);
    1604           4 :         return correct;
    1605             : }
    1606             : 
    1607             : 
    1608             : 
    1609             : /*
    1610             :    simple test harness for playing with deny modes
    1611             :  */
    1612           6 : bool torture_denytest3(struct torture_context *tctx, 
    1613             :                        struct smbcli_state *cli1,
    1614             :                        struct smbcli_state *cli2)
    1615             : {
    1616             :         int fnum1, fnum2;
    1617             :         const char *fname;
    1618             : 
    1619           6 :         fname = "\\deny_dos1.dat";
    1620             : 
    1621           6 :         smbcli_unlink(cli1->tree, fname);
    1622           6 :         fnum1 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
    1623           6 :         fnum2 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
    1624           6 :         if (fnum1 != -1) smbcli_close(cli1->tree, fnum1);
    1625           6 :         if (fnum2 != -1) smbcli_close(cli1->tree, fnum2);
    1626           6 :         smbcli_unlink(cli1->tree, fname);
    1627           6 :         torture_comment(tctx, "fnum1=%d fnum2=%d\n", fnum1, fnum2);
    1628             : 
    1629             : 
    1630           6 :         fname = "\\deny_dos2.dat";
    1631             : 
    1632           6 :         smbcli_unlink(cli1->tree, fname);
    1633           6 :         fnum1 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
    1634           6 :         fnum2 = smbcli_open(cli2->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
    1635           6 :         if (fnum1 != -1) smbcli_close(cli1->tree, fnum1);
    1636           6 :         if (fnum2 != -1) smbcli_close(cli2->tree, fnum2);
    1637           6 :         smbcli_unlink(cli1->tree, fname);
    1638           6 :         torture_comment(tctx, "fnum1=%d fnum2=%d\n", fnum1, fnum2);
    1639             : 
    1640           6 :         return true;
    1641             : }
    1642             : 
    1643             : struct bit_value {
    1644             :         uint32_t value;
    1645             :         const char *name;
    1646             : };
    1647             : 
    1648         240 : static uint32_t map_bits(const struct bit_value *bv, int b, int nbits)
    1649             : {
    1650             :         int i;
    1651         240 :         uint32_t ret = 0;
    1652        1560 :         for (i=0;i<nbits;i++) {
    1653        1320 :                 if (b & (1<<i)) {
    1654         690 :                         ret |= bv[i].value;
    1655             :                 }
    1656             :         }
    1657         240 :         return ret;
    1658             : }
    1659             : 
    1660           0 : static const char *bit_string(TALLOC_CTX *mem_ctx, const struct bit_value *bv, int b, int nbits)
    1661             : {
    1662           0 :         char *ret = NULL;
    1663             :         int i;
    1664           0 :         for (i=0;i<nbits;i++) {
    1665           0 :                 if (b & (1<<i)) {
    1666           0 :                         if (ret == NULL) {
    1667           0 :                                 ret = talloc_asprintf(mem_ctx, "%s", bv[i].name);
    1668             :                         } else {
    1669           0 :                                 ret = talloc_asprintf_append_buffer(ret, " | %s", bv[i].name);
    1670             :                         }
    1671             :                 }
    1672             :         }
    1673           0 :         if (ret == NULL) ret = talloc_strdup(mem_ctx, "(NONE)");
    1674           0 :         return ret;
    1675             : }
    1676             : 
    1677             : 
    1678             : /*
    1679             :   determine if two opens conflict
    1680             : */
    1681          60 : static NTSTATUS predict_share_conflict(uint32_t sa1, uint32_t am1, uint32_t sa2, uint32_t am2,
    1682             :                                        bool read_for_execute, enum deny_result *res)
    1683             : {
    1684             : #define CHECK_MASK(am, sa, right, share) do { \
    1685             :         if (((am) & (right)) && !((sa) & (share))) { \
    1686             :                 *res = A_0; \
    1687             :                 return NT_STATUS_SHARING_VIOLATION; \
    1688             :         }} while (0)
    1689             : 
    1690          60 :         *res = A_0;
    1691          60 :         if (am2 & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)) {
    1692          44 :                 *res += A_W;
    1693             :         }
    1694          60 :         if (am2 & SEC_FILE_READ_DATA) {
    1695          30 :                 *res += A_R;
    1696          30 :         } else if ((am2 & SEC_FILE_EXECUTE) && read_for_execute) {
    1697           8 :                 *res += A_R;
    1698             :         }
    1699             : 
    1700             :         /* if either open involves no read.write or delete access then
    1701             :            it can't conflict */
    1702          60 :         if (!(am1 & (SEC_FILE_WRITE_DATA | 
    1703             :                      SEC_FILE_APPEND_DATA |
    1704             :                      SEC_FILE_READ_DATA | 
    1705             :                      SEC_FILE_EXECUTE | 
    1706             :                      SEC_STD_DELETE))) {
    1707           2 :                 return NT_STATUS_OK;
    1708             :         }
    1709          58 :         if (!(am2 & (SEC_FILE_WRITE_DATA | 
    1710             :                      SEC_FILE_APPEND_DATA |
    1711             :                      SEC_FILE_READ_DATA | 
    1712             :                      SEC_FILE_EXECUTE | 
    1713             :                      SEC_STD_DELETE))) {
    1714           3 :                 return NT_STATUS_OK;
    1715             :         }
    1716             : 
    1717             :         /* check the basic share access */
    1718          55 :         CHECK_MASK(am1, sa2, 
    1719             :                    SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA, 
    1720             :                    NTCREATEX_SHARE_ACCESS_WRITE);
    1721          35 :         CHECK_MASK(am2, sa1, 
    1722             :                    SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA, 
    1723             :                    NTCREATEX_SHARE_ACCESS_WRITE);
    1724             : 
    1725          20 :         CHECK_MASK(am1, sa2, 
    1726             :                    SEC_FILE_READ_DATA | SEC_FILE_EXECUTE, 
    1727             :                    NTCREATEX_SHARE_ACCESS_READ);
    1728          10 :         CHECK_MASK(am2, sa1, 
    1729             :                    SEC_FILE_READ_DATA | SEC_FILE_EXECUTE, 
    1730             :                    NTCREATEX_SHARE_ACCESS_READ);
    1731             : 
    1732           6 :         CHECK_MASK(am1, sa2, 
    1733             :                    SEC_STD_DELETE, 
    1734             :                    NTCREATEX_SHARE_ACCESS_DELETE);
    1735           6 :         CHECK_MASK(am2, sa1, 
    1736             :                    SEC_STD_DELETE, 
    1737             :                    NTCREATEX_SHARE_ACCESS_DELETE);
    1738             : 
    1739           6 :         return NT_STATUS_OK;
    1740             : }
    1741             : 
    1742             : /*
    1743             :   a denytest for ntcreatex
    1744             :  */
    1745           6 : static bool torture_ntdenytest(struct torture_context *tctx, 
    1746             :                                struct smbcli_state *cli1,
    1747             :                                struct smbcli_state *cli2, int client)
    1748             : {
    1749           6 :         const struct bit_value share_access_bits[] = {
    1750             :                 { NTCREATEX_SHARE_ACCESS_READ,   "S_R" },
    1751             :                 { NTCREATEX_SHARE_ACCESS_WRITE,  "S_W" },
    1752             :                 { NTCREATEX_SHARE_ACCESS_DELETE, "S_D" }
    1753             :         };
    1754           6 :         const struct bit_value access_mask_bits[] = {
    1755             :                 { SEC_FILE_READ_DATA,        "R_DATA" },
    1756             :                 { SEC_FILE_WRITE_DATA,       "W_DATA" },
    1757             :                 { SEC_FILE_READ_ATTRIBUTE,   "R_ATTR" },
    1758             :                 { SEC_FILE_WRITE_ATTRIBUTE,  "W_ATTR" },
    1759             :                 { SEC_FILE_READ_EA,          "R_EAS " },
    1760             :                 { SEC_FILE_WRITE_EA,         "W_EAS " },
    1761             :                 { SEC_FILE_APPEND_DATA,      "A_DATA" },
    1762             :                 { SEC_FILE_EXECUTE,          "EXEC  " }
    1763             :         };
    1764             :         int fnum1;
    1765             :         int i;
    1766           6 :         bool correct = true;
    1767             :         struct timespec tv, tv_start;
    1768             :         const char *fname;
    1769           6 :         int nbits1 = ARRAY_SIZE(share_access_bits);
    1770           6 :         int nbits2 = ARRAY_SIZE(access_mask_bits);
    1771             :         union smb_open io1, io2;
    1772             :         extern int torture_numops;
    1773           6 :         int failures = 0;
    1774             :         uint8_t buf[1];
    1775             : 
    1776           6 :         torture_comment(tctx, "format: server correct\n");
    1777             : 
    1778           6 :         ZERO_STRUCT(buf);
    1779             : 
    1780           6 :         fname = talloc_asprintf(cli1, "\\ntdeny_%d.dll", client);
    1781             : 
    1782           6 :         smbcli_unlink(cli1->tree, fname);
    1783           6 :         fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
    1784           6 :         smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf));
    1785           6 :         smbcli_close(cli1->tree, fnum1);
    1786             : 
    1787           6 :         clock_gettime_mono(&tv_start);
    1788             : 
    1789           6 :         io1.ntcreatex.level = RAW_OPEN_NTCREATEX;
    1790           6 :         io1.ntcreatex.in.root_fid.fnum = 0;
    1791           6 :         io1.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
    1792           6 :         io1.ntcreatex.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
    1793           6 :         io1.ntcreatex.in.file_attr = 0;
    1794           6 :         io1.ntcreatex.in.alloc_size = 0;
    1795           6 :         io1.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
    1796           6 :         io1.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;
    1797           6 :         io1.ntcreatex.in.security_flags = 0;
    1798           6 :         io1.ntcreatex.in.fname = fname;
    1799           6 :         io2 = io1;
    1800             : 
    1801           6 :         torture_comment(tctx, "Testing %d entries on %s\n", torture_numops, fname);
    1802             : 
    1803          66 :         for (i=0;i<torture_numops;i++) {
    1804             :                 NTSTATUS status1, status2, status2_p;
    1805             :                 int64_t tdif;
    1806          60 :                 TALLOC_CTX *mem_ctx = talloc_new(NULL);
    1807             :                 enum deny_result res, res2;
    1808          60 :                 int b_sa1 = random() & ((1<<nbits1)-1);
    1809          60 :                 int b_am1 = random() & ((1<<nbits2)-1);
    1810          60 :                 int b_sa2 = random() & ((1<<nbits1)-1);
    1811          60 :                 int b_am2 = random() & ((1<<nbits2)-1);
    1812             :                 bool read_for_execute;
    1813             : 
    1814          60 :                 progress_bar(tctx, i, torture_numops);
    1815             :                 
    1816          60 :                 io1.ntcreatex.in.share_access = map_bits(share_access_bits, b_sa1, nbits1);
    1817          60 :                 io1.ntcreatex.in.access_mask  = map_bits(access_mask_bits,  b_am1, nbits2);
    1818             :                 
    1819          60 :                 io2.ntcreatex.in.share_access = map_bits(share_access_bits, b_sa2, nbits1);
    1820          60 :                 io2.ntcreatex.in.access_mask  = map_bits(access_mask_bits,  b_am2, nbits2);
    1821             : 
    1822          60 :                 status1 = smb_raw_open(cli1->tree, mem_ctx, &io1);
    1823          60 :                 status2 = smb_raw_open(cli2->tree, mem_ctx, &io2);
    1824             : 
    1825          60 :                 if (random() % 2 == 0) {
    1826          29 :                         read_for_execute = true;
    1827             :                 } else {
    1828          31 :                         read_for_execute = false;
    1829             :                 }
    1830             :                 
    1831          60 :                 if (!NT_STATUS_IS_OK(status1)) {
    1832           0 :                         res = A_X;
    1833          60 :                 } else if (!NT_STATUS_IS_OK(status2)) {
    1834          49 :                         res = A_0;
    1835             :                 } else {
    1836             :                         union smb_read r;
    1837             :                         NTSTATUS status;
    1838             : 
    1839             :                         /* we can't use smbcli_read() as we need to
    1840             :                            set read_for_execute */
    1841          11 :                         r.readx.level = RAW_READ_READX;
    1842          11 :                         r.readx.in.file.fnum = io2.ntcreatex.out.file.fnum;
    1843          11 :                         r.readx.in.offset = 0;
    1844          11 :                         r.readx.in.mincnt = sizeof(buf);
    1845          11 :                         r.readx.in.maxcnt = sizeof(buf);
    1846          11 :                         r.readx.in.remaining = 0;
    1847          11 :                         r.readx.in.read_for_execute = read_for_execute;
    1848          11 :                         r.readx.out.data = buf;
    1849             : 
    1850          11 :                         res = A_0;
    1851          11 :                         status = smb_raw_read(cli2->tree, &r);
    1852          11 :                         if (NT_STATUS_IS_OK(status)) {
    1853           5 :                                 res += A_R;
    1854             :                         }
    1855          11 :                         if (smbcli_write(cli2->tree, io2.ntcreatex.out.file.fnum,
    1856             :                                          0, buf, 0, sizeof(buf)) >= 1) {
    1857           7 :                                 res += A_W;
    1858             :                         }
    1859             :                 }
    1860             :                 
    1861          60 :                 if (NT_STATUS_IS_OK(status1)) {
    1862          60 :                         smbcli_close(cli1->tree, io1.ntcreatex.out.file.fnum);
    1863             :                 }
    1864          60 :                 if (NT_STATUS_IS_OK(status2)) {
    1865          11 :                         smbcli_close(cli2->tree, io2.ntcreatex.out.file.fnum);
    1866             :                 }
    1867             :                 
    1868          60 :                 status2_p = predict_share_conflict(io1.ntcreatex.in.share_access,
    1869             :                                                    io1.ntcreatex.in.access_mask,
    1870             :                                                    io2.ntcreatex.in.share_access,
    1871             :                                                    io2.ntcreatex.in.access_mask, 
    1872             :                                                    read_for_execute,
    1873             :                                                    &res2);
    1874             :                 
    1875          60 :                 clock_gettime_mono(&tv);
    1876          60 :                 tdif = nsec_time_diff(&tv, &tv_start);
    1877          60 :                 tdif /= 1000000;
    1878         120 :                 if (torture_setting_bool(tctx, "showall", false) || 
    1879         120 :                     !NT_STATUS_EQUAL(status2, status2_p) ||
    1880          60 :                     res != res2) {
    1881           0 :                         torture_comment(tctx, "\n%-20s %-70s\n%-20s %-70s %4s %4s  %s/%s\n",
    1882             :                                bit_string(mem_ctx, share_access_bits, b_sa1, nbits1),
    1883             :                                bit_string(mem_ctx, access_mask_bits,  b_am1, nbits2),
    1884             :                                bit_string(mem_ctx, share_access_bits, b_sa2, nbits1),
    1885             :                                bit_string(mem_ctx, access_mask_bits,  b_am2, nbits2),
    1886             :                                resultstr(res),
    1887             :                                resultstr(res2),
    1888             :                                nt_errstr(status2),
    1889             :                                nt_errstr(status2_p));
    1890           0 :                         fflush(stdout);
    1891             :                 }
    1892             :                 
    1893         120 :                 if (res != res2 ||
    1894          60 :                     !NT_STATUS_EQUAL(status2, status2_p)) {
    1895           0 :                         CHECK_MAX_FAILURES(failed);
    1896           0 :                         correct = false;
    1897             :                 }
    1898             :                 
    1899          60 :                 talloc_free(mem_ctx);
    1900             :         }
    1901             : 
    1902           6 : failed:
    1903           6 :         smbcli_unlink(cli1->tree, fname);
    1904             :         
    1905           6 :         torture_comment(tctx, "finshed ntdenytest (%d failures)\n", failures);
    1906           6 :         return correct;
    1907             : }
    1908             : 
    1909             : 
    1910             : 
    1911             : /*
    1912             :   a denytest for ntcreatex
    1913             :  */
    1914           0 : bool torture_ntdenytest1(struct torture_context *tctx, 
    1915             :                          struct smbcli_state *cli, int client)
    1916             : {
    1917             :         extern int torture_seed;
    1918             : 
    1919           0 :         srandom(torture_seed + client);
    1920             : 
    1921           0 :         torture_comment(tctx, "starting ntdenytest1 client %d\n", client);
    1922             : 
    1923           0 :         return torture_ntdenytest(tctx, cli, cli, client);
    1924             : }
    1925             : 
    1926             : /*
    1927             :   a denytest for ntcreatex
    1928             :  */
    1929           6 : bool torture_ntdenytest2(struct torture_context *torture, 
    1930             :                          struct smbcli_state *cli1,
    1931             :                          struct smbcli_state *cli2)
    1932             : {
    1933           6 :         return torture_ntdenytest(torture, cli1, cli2, 0);
    1934             : }
    1935             : 
    1936             : #define COMPARE_STATUS(status, correct) do { \
    1937             :         if (!NT_STATUS_EQUAL(status, correct)) { \
    1938             :                 torture_result(tctx, TORTURE_FAIL, \
    1939             :                         "(%s) Incorrect status %s - should be %s\n", \
    1940             :                         __location__, nt_errstr(status), nt_errstr(correct)); \
    1941             :                 ret = false; \
    1942             :                 failed = true; \
    1943             :         }} while (0)
    1944             : 
    1945             : #define CHECK_STATUS(status, correct) do { \
    1946             :         if (!NT_STATUS_EQUAL(status, correct)) { \
    1947             :                 torture_result(tctx, TORTURE_FAIL, \
    1948             :                         "(%s) Incorrect status %s - should be %s\n", \
    1949             :                        __location__, nt_errstr(status), nt_errstr(correct)); \
    1950             :                 ret = false; \
    1951             :                 goto done; \
    1952             :         }} while (0)
    1953             : 
    1954             : #define CHECK_VAL(v, correct) do { \
    1955             :         if ((v) != (correct)) { \
    1956             :                 torture_result(tctx, TORTURE_FAIL, \
    1957             :                       "(%s) wrong value for %s  0x%x - should be 0x%x\n", \
    1958             :                        __location__, #v, (int)(v), (int)correct); \
    1959             :                 ret = false; \
    1960             :         }} while (0)
    1961             : 
    1962             : /*
    1963             :   test sharing of handles with DENY_DOS on a single connection
    1964             : */
    1965           6 : bool torture_denydos_sharing(struct torture_context *tctx, 
    1966             :                              struct smbcli_state *cli)
    1967             : {
    1968             :         union smb_open io;
    1969             :         union smb_fileinfo finfo;
    1970           6 :         const char *fname = "\\torture_denydos.txt";
    1971             :         NTSTATUS status;
    1972           6 :         int fnum1 = -1, fnum2 = -1;
    1973           6 :         bool ret = true;
    1974             :         union smb_setfileinfo sfinfo;
    1975             :         TALLOC_CTX *mem_ctx;
    1976             : 
    1977           6 :         mem_ctx = talloc_new(cli);
    1978             : 
    1979           6 :         torture_comment(tctx, "Checking DENY_DOS shared handle semantics\n");
    1980           6 :         smbcli_unlink(cli->tree, fname);
    1981             : 
    1982           6 :         io.openx.level = RAW_OPEN_OPENX;
    1983           6 :         io.openx.in.fname = fname;
    1984           6 :         io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
    1985           6 :         io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_DOS;
    1986           6 :         io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
    1987           6 :         io.openx.in.search_attrs = 0;
    1988           6 :         io.openx.in.file_attrs = 0;
    1989           6 :         io.openx.in.write_time = 0;
    1990           6 :         io.openx.in.size = 0;
    1991           6 :         io.openx.in.timeout = 0;
    1992             : 
    1993           6 :         torture_comment(tctx, "openx twice with RDWR/DENY_DOS\n");
    1994           6 :         status = smb_raw_open(cli->tree, mem_ctx, &io);
    1995           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    1996           6 :         fnum1 = io.openx.out.file.fnum;
    1997             : 
    1998           6 :         status = smb_raw_open(cli->tree, mem_ctx, &io);
    1999           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2000           6 :         fnum2 = io.openx.out.file.fnum;
    2001             : 
    2002           6 :         torture_comment(tctx, "fnum1=%d fnum2=%d\n", fnum1, fnum2);
    2003             : 
    2004           6 :         sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION;
    2005           6 :         sfinfo.position_information.in.file.fnum = fnum1;
    2006           6 :         sfinfo.position_information.in.position = 1000;
    2007           6 :         status = smb_raw_setfileinfo(cli->tree, &sfinfo);
    2008           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2009             : 
    2010           6 :         torture_comment(tctx, "two handles should be same file handle\n");
    2011           6 :         finfo.position_information.level = RAW_FILEINFO_POSITION_INFORMATION;
    2012           6 :         finfo.position_information.in.file.fnum = fnum1;
    2013           6 :         status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo);
    2014           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2015           6 :         CHECK_VAL(finfo.position_information.out.position, 1000);
    2016             : 
    2017           6 :         finfo.position_information.in.file.fnum = fnum2;
    2018           6 :         status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo);
    2019           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2020           6 :         CHECK_VAL(finfo.position_information.out.position, 1000);
    2021             : 
    2022             : 
    2023           6 :         smbcli_close(cli->tree, fnum1);
    2024           6 :         smbcli_close(cli->tree, fnum2);
    2025             : 
    2026           6 :         torture_comment(tctx, "openx twice with RDWR/DENY_NONE\n");
    2027           6 :         io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_NONE;
    2028           6 :         status = smb_raw_open(cli->tree, mem_ctx, &io);
    2029           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2030           6 :         fnum1 = io.openx.out.file.fnum;
    2031             : 
    2032           6 :         io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
    2033           6 :         status = smb_raw_open(cli->tree, mem_ctx, &io);
    2034           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2035           6 :         fnum2 = io.openx.out.file.fnum;
    2036             : 
    2037           6 :         torture_comment(tctx, "fnum1=%d fnum2=%d\n", fnum1, fnum2);
    2038             : 
    2039           6 :         torture_comment(tctx, "two handles should be separate\n");
    2040           6 :         sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION;
    2041           6 :         sfinfo.position_information.in.file.fnum = fnum1;
    2042           6 :         sfinfo.position_information.in.position = 1000;
    2043           6 :         status = smb_raw_setfileinfo(cli->tree, &sfinfo);
    2044           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2045             : 
    2046           6 :         finfo.position_information.level = RAW_FILEINFO_POSITION_INFORMATION;
    2047           6 :         finfo.position_information.in.file.fnum = fnum1;
    2048           6 :         status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo);
    2049           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2050           6 :         CHECK_VAL(finfo.position_information.out.position, 1000);
    2051             : 
    2052           6 :         finfo.position_information.in.file.fnum = fnum2;
    2053           6 :         status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo);
    2054           6 :         CHECK_STATUS(status, NT_STATUS_OK);
    2055           6 :         CHECK_VAL(finfo.position_information.out.position, 0);
    2056             : 
    2057          12 : done:
    2058           6 :         smbcli_close(cli->tree, fnum1);
    2059           6 :         smbcli_close(cli->tree, fnum2);
    2060           6 :         smbcli_unlink(cli->tree, fname);
    2061             : 
    2062           6 :         return ret;
    2063             : }
    2064             : 
    2065             : #define CXD_MATCHES(_cxd, i)                                            \
    2066             :         ((cxd_known[i].cxd_test == (_cxd)->cxd_test) &&                 \
    2067             :          (cxd_known[i].cxd_flags == (_cxd)->cxd_flags) &&               \
    2068             :          (cxd_known[i].cxd_access1 == (_cxd)->cxd_access1) &&           \
    2069             :          (cxd_known[i].cxd_sharemode1 == (_cxd)->cxd_sharemode1) &&     \
    2070             :          (cxd_known[i].cxd_access2 == (_cxd)->cxd_access2) &&           \
    2071             :          (cxd_known[i].cxd_sharemode2 == (_cxd)->cxd_sharemode2))
    2072             : 
    2073       13952 : static int cxd_find_known(struct createx_data *cxd)
    2074             : {
    2075             :         static int i = -1;
    2076             : 
    2077             :         /* Optimization for tests which we don't have results saved for. */
    2078       27904 :         if ((cxd->cxd_test == CXD_TEST_CREATEX_ACCESS_EXHAUSTIVE) ||
    2079       13952 :             (cxd->cxd_test == CXD_TEST_CREATEX_SHAREMODE_EXTENDED))
    2080           0 :                 return -1;
    2081             : 
    2082             :         /* Optimization: If our cxd_known table is too large, it hurts test
    2083             :          * performance to search through the entire table each time. If the
    2084             :          * caller can pass in the previous result, we can try the next entry.
    2085             :          * This works if results are taken directly from the same code. */
    2086       13952 :         i++;
    2087       27904 :         if ((i >= 0) && (i < sizeof(cxd_known) / sizeof(cxd_known[0])) &&
    2088       27901 :             CXD_MATCHES(cxd, i))
    2089       13949 :                 return i;
    2090             : 
    2091        5347 :         for (i = 0; i < (sizeof(cxd_known) / sizeof(cxd_known[0])); i++) {
    2092        5347 :                 if (CXD_MATCHES(cxd, i))
    2093           3 :                         return i;
    2094             :         }
    2095             : 
    2096           0 :         return -1;
    2097             : }
    2098             : 
    2099             : #define CREATEX_NAME "\\createx_dir"
    2100             : 
    2101         416 : static bool createx_make_dir(struct torture_context *tctx,
    2102             :     struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, const char *fname)
    2103             : {
    2104         416 :         bool ret = true;
    2105             :         NTSTATUS status;
    2106             : 
    2107         416 :         status = smbcli_mkdir(tree, fname);
    2108         416 :         CHECK_STATUS(status, NT_STATUS_OK);
    2109             : 
    2110         832 :  done:
    2111         416 :         return ret;
    2112             : }
    2113             : 
    2114         416 : static bool createx_make_file(struct torture_context *tctx,
    2115             :     struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, const char *fname)
    2116             : {
    2117             :         union smb_open open_parms;
    2118         416 :         bool ret = true;
    2119             :         NTSTATUS status;
    2120             : 
    2121         416 :         ZERO_STRUCT(open_parms);
    2122         416 :         open_parms.generic.level = RAW_OPEN_NTCREATEX;
    2123         416 :         open_parms.ntcreatex.in.flags = 0;
    2124         416 :         open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    2125         416 :         open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
    2126         416 :         open_parms.ntcreatex.in.share_access = 0;
    2127         416 :         open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
    2128         416 :         open_parms.ntcreatex.in.create_options = 0;
    2129         416 :         open_parms.ntcreatex.in.fname = fname;
    2130             : 
    2131         416 :         status = smb_raw_open(tree, mem_ctx, &open_parms);
    2132         416 :         CHECK_STATUS(status, NT_STATUS_OK);
    2133             : 
    2134         416 :         status = smbcli_close(tree, open_parms.ntcreatex.out.file.fnum);
    2135         416 :         CHECK_STATUS(status, NT_STATUS_OK);
    2136             : 
    2137         832 :  done:
    2138         416 :         return ret;
    2139             : }
    2140             : 
    2141        9024 : static void createx_fill_dir(union smb_open *open_parms, int accessmode,
    2142             :     int sharemode, const char *fname)
    2143             : {
    2144        9024 :         ZERO_STRUCTP(open_parms);
    2145        9024 :         open_parms->generic.level = RAW_OPEN_NTCREATEX;
    2146        9024 :         open_parms->ntcreatex.in.flags = 0;
    2147        9024 :         open_parms->ntcreatex.in.access_mask = accessmode;
    2148        9024 :         open_parms->ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY;
    2149        9024 :         open_parms->ntcreatex.in.share_access = sharemode;
    2150        9024 :         open_parms->ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
    2151        9024 :         open_parms->ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
    2152        9024 :         open_parms->ntcreatex.in.fname = fname;
    2153        9024 : }
    2154             : 
    2155       17216 : static void createx_fill_file(union smb_open *open_parms, int accessmode,
    2156             :     int sharemode, const char *fname)
    2157             : {
    2158       17216 :         ZERO_STRUCTP(open_parms);
    2159       17216 :         open_parms->generic.level = RAW_OPEN_NTCREATEX;
    2160       17216 :         open_parms->ntcreatex.in.flags = 0;
    2161       17216 :         open_parms->ntcreatex.in.access_mask = accessmode;
    2162       17216 :         open_parms->ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
    2163       17216 :         open_parms->ntcreatex.in.share_access = sharemode;
    2164       17216 :         open_parms->ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
    2165       17216 :         open_parms->ntcreatex.in.create_options = 0;
    2166       17216 :         open_parms->ntcreatex.in.fname = fname;
    2167       17216 :         open_parms->ntcreatex.in.root_fid.fnum = 0;
    2168       17216 : }
    2169             : 
    2170             : static int data_file_fd = -1;
    2171             : 
    2172             : #define KNOWN   "known"
    2173             : #define CHILD   "child"
    2174        8736 : static bool createx_test_dir(struct torture_context *tctx,
    2175             :     struct smbcli_tree *tree, int fnum, TALLOC_CTX *mem_ctx, NTSTATUS *result)
    2176             : {
    2177        8736 :         bool ret = true;
    2178             :         NTSTATUS status;
    2179             :         union smb_open open_parms;
    2180             : 
    2181             :         /* bypass original handle to guarantee creation */
    2182        8736 :         ZERO_STRUCT(open_parms);
    2183        8736 :         open_parms.generic.level = RAW_OPEN_NTCREATEX;
    2184        8736 :         open_parms.ntcreatex.in.flags = 0;
    2185        8736 :         open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    2186        8736 :         open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
    2187        8736 :         open_parms.ntcreatex.in.share_access = 0;
    2188        8736 :         open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
    2189        8736 :         open_parms.ntcreatex.in.create_options = 0;
    2190        8736 :         open_parms.ntcreatex.in.fname = CREATEX_NAME "\\" KNOWN;
    2191             : 
    2192        8736 :         status = smb_raw_open(tree, mem_ctx, &open_parms);
    2193        8736 :         CHECK_STATUS(status, NT_STATUS_OK);
    2194        8736 :         smbcli_close(tree, open_parms.ntcreatex.out.file.fnum);
    2195             : 
    2196        8736 :         result[CXD_DIR_ENUMERATE] = NT_STATUS_OK;
    2197             : 
    2198             :         /* try to create a child */
    2199        8736 :         ZERO_STRUCT(open_parms);
    2200        8736 :         open_parms.generic.level = RAW_OPEN_NTCREATEX;
    2201        8736 :         open_parms.ntcreatex.in.flags = 0;
    2202        8736 :         open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    2203        8736 :         open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
    2204        8736 :         open_parms.ntcreatex.in.share_access = 0;
    2205        8736 :         open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
    2206        8736 :         open_parms.ntcreatex.in.create_options = 0;
    2207        8736 :         open_parms.ntcreatex.in.fname = CHILD;
    2208        8736 :         open_parms.ntcreatex.in.root_fid.fnum = fnum;
    2209             : 
    2210        8736 :         result[CXD_DIR_CREATE_CHILD] =
    2211             :             smb_raw_open(tree, mem_ctx, &open_parms);
    2212        8736 :         smbcli_close(tree, open_parms.ntcreatex.out.file.fnum);
    2213             : 
    2214             :         /* try to traverse dir to known good file */
    2215        8736 :         ZERO_STRUCT(open_parms);
    2216        8736 :         open_parms.generic.level = RAW_OPEN_NTCREATEX;
    2217        8736 :         open_parms.ntcreatex.in.flags = 0;
    2218        8736 :         open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    2219        8736 :         open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
    2220        8736 :         open_parms.ntcreatex.in.share_access = 0;
    2221        8736 :         open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
    2222        8736 :         open_parms.ntcreatex.in.create_options = 0;
    2223        8736 :         open_parms.ntcreatex.in.fname = KNOWN;
    2224        8736 :         open_parms.ntcreatex.in.root_fid.fnum = fnum;
    2225             : 
    2226        8736 :         result[CXD_DIR_TRAVERSE] =
    2227             :             smb_raw_open(tree, mem_ctx, &open_parms);
    2228             : 
    2229             : 
    2230        8736 :         smbcli_close(tree, open_parms.ntcreatex.out.file.fnum);
    2231        8736 :         smbcli_unlink(tree, CREATEX_NAME "\\" KNOWN);
    2232        8736 :         smbcli_unlink(tree, CREATEX_NAME "\\" CHILD);
    2233             : 
    2234        8736 :  done:
    2235        8736 :         return ret;
    2236             : }
    2237             : 
    2238       16928 : static bool createx_test_file(struct torture_context *tctx,
    2239             :     struct smbcli_tree *tree, int fnum, TALLOC_CTX *mem_ctx, NTSTATUS *result)
    2240             : {
    2241             :         union smb_read rd;
    2242             :         union smb_write wr;
    2243       16928 :         char buf[256] = "";
    2244             : 
    2245       16928 :         memset(&rd, 0, sizeof(rd));
    2246       16928 :         rd.readx.level = RAW_READ_READX;
    2247       16928 :         rd.readx.in.file.fnum = fnum;
    2248       16928 :         rd.readx.in.mincnt = sizeof(buf);
    2249       16928 :         rd.readx.in.maxcnt = sizeof(buf);
    2250       16928 :         rd.readx.out.data = (uint8_t *)buf;
    2251             : 
    2252       16928 :         result[CXD_FILE_READ] = smb_raw_read(tree, &rd);
    2253             : 
    2254       16928 :         memset(&wr, 0, sizeof(wr));
    2255       16928 :         wr.writex.level = RAW_WRITE_WRITEX;
    2256       16928 :         wr.writex.in.file.fnum = fnum;
    2257       16928 :         wr.writex.in.count = sizeof(buf);
    2258       16928 :         wr.writex.in.data = (uint8_t *)buf;
    2259             : 
    2260       16928 :         result[CXD_FILE_WRITE] = smb_raw_write(tree, &wr);
    2261             : 
    2262       16928 :         memset(&rd, 0, sizeof(rd));
    2263       16928 :         rd.readx.level = RAW_READ_READX;
    2264       16928 :         rd.readx.in.file.fnum = fnum;
    2265       16928 :         rd.readx.in.mincnt = sizeof(buf);
    2266       16928 :         rd.readx.in.maxcnt = sizeof(buf);
    2267       16928 :         rd.readx.in.read_for_execute = 1;
    2268       16928 :         rd.readx.out.data = (uint8_t *)buf;
    2269             : 
    2270       16928 :         result[CXD_FILE_EXECUTE] = smb_raw_read(tree, &rd);
    2271             : 
    2272       16928 :         return true;
    2273             : }
    2274             : 
    2275             : /* TODO When redirecting stdout to a file, the progress bar really screws up
    2276             :  * the output. Could use a switch "--noprogress", or direct the progress bar to
    2277             :  * stderr? No other solution? */
    2278       13816 : static void createx_progress_bar(struct torture_context *tctx, unsigned int i,
    2279             :     unsigned int total, unsigned int skipped)
    2280             : {
    2281       13816 :         if (torture_setting_bool(tctx, "progress", true)) {
    2282           0 :                 torture_comment(tctx, "%5d/%5d (%d skipped)\r", i, total,
    2283             :                     skipped);
    2284           0 :                 fflush(stdout);
    2285             :         }
    2286       13816 : }
    2287             : 
    2288       13952 : static bool torture_createx_specific(struct torture_context *tctx, struct
    2289             :     smbcli_state *cli, struct smbcli_state *cli2, TALLOC_CTX *mem_ctx, struct
    2290             :     createx_data *cxd, int estimated_count)
    2291             : {
    2292             :         static int call_count = 1;
    2293             :         static int unskipped_call_count = 1;
    2294       13952 :         const char *fname = CREATEX_NAME;
    2295       13952 :         int fnum = -1, fnum2 = -1, res, i;
    2296             :         union smb_open open_parms1, open_parms2;
    2297       13952 :         bool ret = true;
    2298       13952 :         bool is_dir = cxd->cxd_flags & CXD_FLAGS_DIRECTORY;
    2299       13952 :         NTSTATUS *result = &cxd->cxd_result[0];
    2300       13952 :         NTSTATUS *result2 = &cxd->cxd_result2[0];
    2301       13952 :         bool found = false, failed = false;
    2302             : 
    2303             :         bool (*make_func)(struct torture_context *,
    2304             :             struct smbcli_tree *, TALLOC_CTX *, const char *);
    2305             :         void (*fill_func)(union smb_open *, int, int, const char *);
    2306             :         bool (*test_func)(struct torture_context *,
    2307             :             struct smbcli_tree *, int, TALLOC_CTX *, NTSTATUS *);
    2308             :         NTSTATUS (*destroy_func)(struct smbcli_tree *, const char *);
    2309             : 
    2310       13952 :         if (is_dir) {
    2311        4928 :                 make_func = createx_make_dir;
    2312        4928 :                 fill_func = createx_fill_dir;
    2313        4928 :                 test_func = createx_test_dir;
    2314        4928 :                 destroy_func = smbcli_rmdir;
    2315             :         } else {
    2316        9024 :                 make_func = createx_make_file;
    2317        9024 :                 fill_func = createx_fill_file;
    2318        9024 :                 test_func = createx_test_file;
    2319        9024 :                 destroy_func = smbcli_unlink;
    2320             :         }
    2321             : 
    2322             :         /* Skip all SACL related tests. */
    2323       13952 :         if ((!torture_setting_bool(tctx, "sacl_support", true)) &&
    2324           0 :             ((cxd->cxd_access1 & SEC_FLAG_SYSTEM_SECURITY) ||
    2325           0 :              (cxd->cxd_access2 & SEC_FLAG_SYSTEM_SECURITY)))
    2326             :                 goto done;
    2327             : 
    2328       13952 :         if (cxd->cxd_flags & CXD_FLAGS_MAKE_BEFORE_CREATEX) {
    2329         832 :                 ret = make_func(tctx, cli->tree, mem_ctx, fname);
    2330         832 :                 if (!ret) {
    2331           0 :                         torture_result(tctx, TORTURE_FAIL,
    2332             :                                 "Initial creation failed\n");
    2333           0 :                         goto done;
    2334             :                 }
    2335             :         }
    2336             : 
    2337             :         /* Initialize. */
    2338       13952 :         fill_func(&open_parms1, cxd->cxd_access1, cxd->cxd_sharemode1, fname);
    2339             : 
    2340       13952 :         if (cxd->cxd_test == CXD_TEST_CREATEX_SHAREMODE) {
    2341       12288 :                 fill_func(&open_parms2, cxd->cxd_access2, cxd->cxd_sharemode2,
    2342             :                     fname);
    2343             :         }
    2344             : 
    2345       55808 :         for (i = CXD_CREATEX + 1; i < CXD_MAX; i++) {
    2346       41856 :                 result[i] = NT_STATUS_UNSUCCESSFUL;
    2347       41856 :                 result2[i] = NT_STATUS_UNSUCCESSFUL;
    2348             :         }
    2349             : 
    2350             :         /* Perform open(s). */
    2351       13952 :         result[CXD_CREATEX] = smb_raw_open(cli->tree, mem_ctx, &open_parms1);
    2352       13952 :         if (NT_STATUS_IS_OK(result[CXD_CREATEX])) {
    2353       13376 :                 fnum = open_parms1.ntcreatex.out.file.fnum;
    2354       13376 :                 ret = test_func(tctx, cli->tree, fnum, mem_ctx, result);
    2355       13376 :                 smbcli_close(cli->tree, fnum);
    2356             :         }
    2357             : 
    2358       13952 :         if (cxd->cxd_test == CXD_TEST_CREATEX_SHAREMODE) {
    2359       12288 :                 result2[CXD_CREATEX] = smb_raw_open(cli2->tree, mem_ctx,
    2360             :                     &open_parms2);
    2361       12288 :                 if (NT_STATUS_IS_OK(result2[CXD_CREATEX])) {
    2362       12288 :                         fnum2 = open_parms2.ntcreatex.out.file.fnum;
    2363       12288 :                         ret = test_func(tctx, cli2->tree, fnum2, mem_ctx,
    2364             :                             result2);
    2365       12288 :                         smbcli_close(cli2->tree, fnum2);
    2366             :                 }
    2367             :         }
    2368             : 
    2369       13952 :         if (data_file_fd >= 0) {
    2370           0 :                 size_t cxd_len = sizeof(struct createx_data);
    2371           0 :                 found = true;
    2372           0 :                 res = write(data_file_fd, cxd, cxd_len);
    2373           0 :                 if (res != cxd_len) {
    2374           0 :                         torture_result(tctx, TORTURE_FAIL,
    2375             :                                 "(%s): write failed: %s!",
    2376           0 :                                 __location__, strerror(errno));
    2377           0 :                         ret = false;
    2378             :                 }
    2379       13952 :         } else if ((res = cxd_find_known(cxd)) >= 0) {
    2380       13952 :                 found = true;
    2381       67456 :                 for (i = 0; i < CXD_MAX; i++) {
    2382             :                         /* Note: COMPARE_STATUS will set the "failed" bool. */
    2383       54080 :                         COMPARE_STATUS(result[i], cxd_known[res].cxd_result[i]);
    2384       54080 :                         if (i == 0 && !NT_STATUS_IS_OK(result[i]))
    2385         576 :                                 break;
    2386             : 
    2387       53504 :                         if (cxd->cxd_test == CXD_TEST_CREATEX_SHAREMODE) {
    2388       49152 :                                 COMPARE_STATUS(result2[i],
    2389             :                                     cxd_known[res].cxd_result2[i]);
    2390       49152 :                                 if (i == 0 && !NT_STATUS_IS_OK(result2[i]))
    2391           0 :                                         break;
    2392             :                         }
    2393             :                 }
    2394             :         }
    2395             : 
    2396             :         /* We print if its not in the "cxd_known" list or if we fail. */
    2397       13952 :         if (!found || failed) {
    2398         272 :                 torture_comment(tctx,
    2399             :                     "  { .cxd_test = %d, .cxd_flags = %#3x, "
    2400             :                     ".cxd_access1 = %#10x, .cxd_sharemode1=%1x, "
    2401             :                     ".cxd_access2=%#10x, .cxd_sharemode2=%1x, "
    2402         136 :                     ".cxd_result = { ", cxd->cxd_test, cxd->cxd_flags,
    2403             :                     cxd->cxd_access1, cxd->cxd_sharemode1, cxd->cxd_access2,
    2404             :                     cxd->cxd_sharemode2);
    2405         680 :                 for (i = 0; i < CXD_MAX; i++) {
    2406         544 :                         torture_comment(tctx, "%s, ", nt_errstr(result[i]));
    2407         544 :                         if (i == 0 && !NT_STATUS_IS_OK(result[i]))
    2408           0 :                                 break;
    2409             :                 }
    2410         136 :                 torture_comment(tctx, "}");
    2411         136 :                 if (cxd->cxd_test == CXD_TEST_CREATEX_SHAREMODE) {
    2412           0 :                         torture_comment(tctx, ", .cxd_result2 = { ");
    2413           0 :                         for (i = 0; i < CXD_MAX; i++) {
    2414           0 :                                 torture_comment(tctx, "%s, ",
    2415           0 :                                                 nt_errstr(result2[i]));
    2416           0 :                                 if (i == 0 && !NT_STATUS_IS_OK(result2[i]))
    2417           0 :                                         break;
    2418             :                         }
    2419           0 :                         torture_comment(tctx, "}");
    2420             :                 }
    2421         136 :                 torture_comment(tctx, "}, \n");
    2422             :         } else {
    2423       13816 :                 createx_progress_bar(tctx, call_count, estimated_count,
    2424       13816 :                     call_count - unskipped_call_count);
    2425             :         }
    2426             :         /* Count tests that we didn't skip. */
    2427       13952 :         unskipped_call_count++;
    2428       13952 :  done:
    2429       13952 :         call_count++;
    2430             : 
    2431       13952 :         destroy_func(cli->tree, fname);
    2432       13952 :         return ret;
    2433             : }
    2434             : 
    2435             : uint32_t sec_access_bit_groups[] = {
    2436             :         SEC_RIGHTS_FILE_READ,
    2437             :         SEC_RIGHTS_FILE_WRITE,
    2438             :         SEC_RIGHTS_FILE_EXECUTE
    2439             : };
    2440             : #define NUM_ACCESS_GROUPS     (sizeof(sec_access_bit_groups) / sizeof(uint32_t))
    2441             : #define ACCESS_GROUPS_COUNT   ((1 << NUM_ACCESS_GROUPS))
    2442             : #define BITSINBYTE 8
    2443             : 
    2444             : /* Note: See NTCREATEX_SHARE_ACCESS_{NONE,READ,WRITE,DELETE} for share mode
    2445             :  * declarations. */
    2446             : #define NUM_SHAREMODE_PERMUTATIONS 8
    2447             : 
    2448             : /**
    2449             :  * NTCREATEX and SHARE MODE test.
    2450             :  *
    2451             :  * Open with combinations of (access_mode, share_mode).
    2452             :  *  - Check status
    2453             :  * Open 2nd time with combination of (access_mode2, share_mode2).
    2454             :  *  - Check status
    2455             :  * Perform operations to verify?
    2456             :  *  - Read
    2457             :  *  - Write
    2458             :  *  - Delete
    2459             :  */
    2460           3 : bool torture_createx_sharemodes(struct torture_context *tctx,
    2461             :                                 struct smbcli_state *cli,
    2462             :                                 struct smbcli_state *cli2,
    2463             :                                 bool dir,
    2464             :                                 bool extended)
    2465             : {
    2466             :         TALLOC_CTX *mem_ctx;
    2467           3 :         bool ret = true;
    2468             :         int i, j, est;
    2469             :         int gp1, gp2; /* group permuters */
    2470           3 :         struct createx_data cxd = {0};
    2471           3 :         int num_access_bits1 = sizeof(cxd.cxd_access1) * BITSINBYTE;
    2472           3 :         int num_access_bits2 = sizeof(cxd.cxd_access2) * BITSINBYTE;
    2473             : 
    2474           3 :         mem_ctx = talloc_init("createx_sharemodes");
    2475           3 :         if (!mem_ctx)
    2476           0 :                 return false;
    2477             : 
    2478           3 :         if (!torture_setting_bool(tctx, "sacl_support", true))
    2479           0 :                 torture_warning(tctx, "Skipping SACL related tests!\n");
    2480             : 
    2481           3 :         cxd.cxd_test = extended ? CXD_TEST_CREATEX_SHAREMODE_EXTENDED :
    2482             :             CXD_TEST_CREATEX_SHAREMODE;
    2483           3 :         cxd.cxd_flags = dir ? CXD_FLAGS_DIRECTORY: 0;
    2484             : 
    2485             :         /* HACK for progress bar: figure out estimated count. */
    2486           3 :         est = (NUM_SHAREMODE_PERMUTATIONS * NUM_SHAREMODE_PERMUTATIONS) *
    2487           0 :             ((ACCESS_GROUPS_COUNT * ACCESS_GROUPS_COUNT) +
    2488           0 :              (extended ? num_access_bits1 * num_access_bits2 : 0));
    2489             : 
    2490             :         /* Blank slate. */
    2491           3 :         smbcli_deltree(cli->tree, CREATEX_NAME);
    2492           3 :         smbcli_unlink(cli->tree, CREATEX_NAME);
    2493             : 
    2494             :         /* Choose 2 random share modes. */
    2495          30 :         for (cxd.cxd_sharemode1 = 0;
    2496          27 :              cxd.cxd_sharemode1 < NUM_SHAREMODE_PERMUTATIONS;
    2497          24 :              cxd.cxd_sharemode1++) {
    2498         240 :                 for (cxd.cxd_sharemode2 = 0;
    2499         216 :                      cxd.cxd_sharemode2 < NUM_SHAREMODE_PERMUTATIONS;
    2500         192 :                      cxd.cxd_sharemode2++) {
    2501             : 
    2502             :                         /* Permutate through our access_bit_groups. */
    2503        1728 :                         for (gp1 = 0; gp1 < ACCESS_GROUPS_COUNT; gp1++) {
    2504       13824 :                                 for (gp2 = 0; gp2 < ACCESS_GROUPS_COUNT; gp2++)
    2505             :                                 {
    2506       12288 :                                         cxd.cxd_access1 = cxd.cxd_access2 = 0;
    2507             : 
    2508       49152 :                                         for (i = 0; i < NUM_ACCESS_GROUPS; i++)
    2509             :                                         {
    2510       73728 :                                                 cxd.cxd_access1 |=
    2511       36864 :                                                     (gp1 & (1 << i)) ?
    2512       36864 :                                                     sec_access_bit_groups[i]:0;
    2513       73728 :                                                 cxd.cxd_access2 |=
    2514       36864 :                                                     (gp2 & (1 << i)) ?
    2515       36864 :                                                     sec_access_bit_groups[i]:0;
    2516             :                                         }
    2517             : 
    2518       12288 :                                         torture_createx_specific(tctx, cli,
    2519             :                                            cli2, mem_ctx, &cxd, est);
    2520             :                                 }
    2521             :                         }
    2522             : 
    2523             :                         /* Only do the single access bits on an extended run. */
    2524         192 :                         if (!extended)
    2525         192 :                                 continue;
    2526             : 
    2527           0 :                         for (i = 0; i < num_access_bits1; i++) {
    2528           0 :                                 for (j = 0; j < num_access_bits2; j++) {
    2529           0 :                                         cxd.cxd_access1 = 1ull << i;
    2530           0 :                                         cxd.cxd_access2 = 1ull << j;
    2531             : 
    2532           0 :                                         torture_createx_specific(tctx, cli,
    2533             :                                             cli2, mem_ctx, &cxd, est);
    2534             :                                 }
    2535             :                         }
    2536             :                 }
    2537             :         }
    2538           3 :         torture_comment(tctx, "\n");
    2539             : 
    2540           3 :         talloc_free(mem_ctx);
    2541           3 :         return ret;
    2542             : }
    2543             : 
    2544           2 : bool torture_createx_sharemodes_file(struct torture_context *tctx,
    2545             :     struct smbcli_state *cli, struct smbcli_state *cli2)
    2546             : {
    2547           2 :         return torture_createx_sharemodes(tctx, cli, cli2, false, false);
    2548             : }
    2549             : 
    2550           1 : bool torture_createx_sharemodes_dir(struct torture_context *tctx,
    2551             :     struct smbcli_state *cli, struct smbcli_state *cli2)
    2552             : {
    2553           1 :         return torture_createx_sharemodes(tctx, cli, cli2, true, false);
    2554             : }
    2555             : 
    2556           4 : bool torture_createx_access(struct torture_context *tctx,
    2557             :     struct smbcli_state *cli)
    2558             : {
    2559             :         TALLOC_CTX *mem_ctx;
    2560           4 :         bool ret = true;
    2561             :         uint32_t group_permuter;
    2562             :         uint32_t i;
    2563           4 :         struct createx_data cxd = {0};
    2564             :         int est;
    2565           4 :         int num_access_bits = sizeof(cxd.cxd_access1) * BITSINBYTE;
    2566             : 
    2567           4 :         mem_ctx = talloc_init("createx_dir");
    2568           4 :         if (!mem_ctx)
    2569           0 :                 return false;
    2570             : 
    2571           4 :         if (!torture_setting_bool(tctx, "sacl_support", true))
    2572           0 :                 torture_warning(tctx, "Skipping SACL related tests!\n");
    2573             : 
    2574           4 :         cxd.cxd_test = CXD_TEST_CREATEX_ACCESS;
    2575             : 
    2576             :         /* HACK for progress bar: figure out estimated count. */
    2577           4 :         est = CXD_FLAGS_COUNT * (ACCESS_GROUPS_COUNT + (num_access_bits * 3));
    2578             : 
    2579             :         /* Blank slate. */
    2580           4 :         smbcli_deltree(cli->tree, CREATEX_NAME);
    2581           4 :         smbcli_unlink(cli->tree, CREATEX_NAME);
    2582             : 
    2583          24 :         for (cxd.cxd_flags = 0; cxd.cxd_flags <= CXD_FLAGS_MASK;
    2584          16 :              cxd.cxd_flags++) {
    2585             :                 /**
    2586             :                  * This implements a basic permutation of all elements of
    2587             :                  * 'bit_group'.  group_permuter is a bit field representing
    2588             :                  * which groups to turn on.
    2589             :                 */
    2590         160 :                 for (group_permuter = 0; group_permuter < (1 <<
    2591         128 :                         NUM_ACCESS_GROUPS); group_permuter++) {
    2592         640 :                         for (i = 0, cxd.cxd_access1 = 0;
    2593         384 :                              i < NUM_ACCESS_GROUPS; i++) {
    2594         768 :                                 cxd.cxd_access1 |= (group_permuter & (1 << i))
    2595         384 :                                     ? sec_access_bit_groups[i] : 0;
    2596             :                         }
    2597             : 
    2598         128 :                         torture_createx_specific(tctx, cli, NULL, mem_ctx,
    2599             :                             &cxd, est);
    2600             :                 }
    2601         528 :                 for (i = 0; i < num_access_bits; i++) {
    2602             :                         /* And now run through the single access bits. */
    2603         512 :                         cxd.cxd_access1 = 1 << i;
    2604         512 :                         torture_createx_specific(tctx, cli, NULL, mem_ctx,
    2605             :                             &cxd, est);
    2606             : 
    2607             :                         /* Does SEC_FLAG_MAXIMUM_ALLOWED override? */
    2608         512 :                         cxd.cxd_access1 |= SEC_FLAG_MAXIMUM_ALLOWED;
    2609         512 :                         torture_createx_specific(tctx, cli, NULL, mem_ctx,
    2610             :                             &cxd, est);
    2611             : 
    2612             :                         /* What about SEC_FLAG_SYSTEM_SECURITY? */
    2613         512 :                         cxd.cxd_access1 |= SEC_FLAG_SYSTEM_SECURITY;
    2614         512 :                         torture_createx_specific(tctx, cli, NULL, mem_ctx,
    2615             :                             &cxd, est);
    2616             :                 }
    2617             :         }
    2618             : 
    2619           4 :         talloc_free(mem_ctx);
    2620           4 :         return ret;
    2621             : }
    2622             : 
    2623             : #define ACCESS_KNOWN_MASK 0xF31F01FFull
    2624             : 
    2625           0 : bool torture_createx_access_exhaustive(struct torture_context *tctx,
    2626             :     struct smbcli_state *cli)
    2627             : {
    2628             :         char *data_file;
    2629             :         TALLOC_CTX *mem_ctx;
    2630           0 :         bool ret = true, first;
    2631             :         uint32_t i;
    2632           0 :         struct createx_data cxd = {0};
    2633             : 
    2634           0 :         mem_ctx = talloc_init("createx_dir");
    2635           0 :         if (!mem_ctx)
    2636           0 :                 return false;
    2637             : 
    2638           0 :         if (!torture_setting_bool(tctx, "sacl_support", true))
    2639           0 :                 torture_warning(tctx, "Skipping SACL related tests!\n");
    2640             : 
    2641           0 :         data_file = getenv("CREATEX_DATA");
    2642           0 :         if (data_file) {
    2643           0 :                 data_file_fd = open(data_file, O_WRONLY|O_CREAT|O_TRUNC, 0666);
    2644           0 :                 if (data_file_fd < 0) {
    2645           0 :                         torture_result(tctx, TORTURE_FAIL,
    2646             :                                 "(%s): data file open failedu: %s!",
    2647           0 :                                 __location__, strerror(errno));
    2648           0 :                         ret = false;
    2649           0 :                         goto done;
    2650             :                 }
    2651             :         }
    2652             : 
    2653             :         /* Blank slate. */
    2654           0 :         smbcli_deltree(cli->tree, CREATEX_NAME);
    2655           0 :         smbcli_unlink(cli->tree, CREATEX_NAME);
    2656             : 
    2657           0 :         cxd.cxd_test = CXD_TEST_CREATEX_ACCESS_EXHAUSTIVE;
    2658             : 
    2659           0 :         for (cxd.cxd_flags = 0; cxd.cxd_flags <= CXD_FLAGS_MASK;
    2660           0 :              cxd.cxd_flags++) {
    2661           0 :                 for (i = 0, first = true; (i != 0) || first; first = false,
    2662           0 :                      i = ((i | ~ACCESS_KNOWN_MASK) + 1) & ACCESS_KNOWN_MASK) {
    2663           0 :                         cxd.cxd_access1 = i;
    2664           0 :                         ret = torture_createx_specific(tctx, cli, NULL,
    2665             :                             mem_ctx, &cxd, 0);
    2666           0 :                         if (!ret)
    2667           0 :                                 break;
    2668             :                 }
    2669             :         }
    2670             : 
    2671           0 :         close(data_file_fd);
    2672           0 :         data_file_fd = -1;
    2673             : 
    2674           0 :  done:
    2675           0 :         talloc_free(mem_ctx);
    2676           0 :         return ret;
    2677             : }
    2678             : 
    2679             : #define MAXIMUM_ALLOWED_FILE    "torture_maximum_allowed"
    2680           2 : bool torture_maximum_allowed(struct torture_context *tctx,
    2681             :     struct smbcli_state *cli)
    2682             : {
    2683             :         struct security_descriptor *sd, *sd_orig;
    2684             :         union smb_open io;
    2685             :         static TALLOC_CTX *mem_ctx;
    2686             :         int fnum, i;
    2687           2 :         bool ret = true;
    2688             :         NTSTATUS status;
    2689             :         union smb_fileinfo q;
    2690             :         const char *owner_sid;
    2691             :         bool has_restore_privilege, has_backup_privilege, has_system_security_privilege;
    2692             : 
    2693           2 :         mem_ctx = talloc_init("torture_maximum_allowed");
    2694             : 
    2695           2 :         if (!torture_setting_bool(tctx, "sacl_support", true))
    2696           0 :                 torture_warning(tctx, "Skipping SACL related tests!\n");
    2697             : 
    2698           2 :         sd = security_descriptor_dacl_create(mem_ctx,
    2699             :             0, NULL, NULL,
    2700             :             SID_NT_AUTHENTICATED_USERS,
    2701             :             SEC_ACE_TYPE_ACCESS_ALLOWED,
    2702             :             SEC_RIGHTS_FILE_READ,
    2703             :             0, NULL);
    2704             : 
    2705             :         /* Blank slate */
    2706           2 :         smbcli_unlink(cli->tree, MAXIMUM_ALLOWED_FILE);
    2707             : 
    2708             :         /* create initial file with restrictive SD */
    2709           2 :         memset(&io, 0, sizeof(io));
    2710           2 :         io.generic.level = RAW_OPEN_NTTRANS_CREATE;
    2711           2 :         io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    2712           2 :         io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
    2713           2 :         io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
    2714           2 :         io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
    2715           2 :         io.ntcreatex.in.fname = MAXIMUM_ALLOWED_FILE;
    2716           2 :         io.ntcreatex.in.sec_desc = sd;
    2717             : 
    2718           2 :         status = smb_raw_open(cli->tree, mem_ctx, &io);
    2719           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    2720           2 :         fnum = io.ntcreatex.out.file.fnum;
    2721             : 
    2722             :         /* the correct answers for this test depends on whether the
    2723             :            user has restore privileges. To find that out we first need
    2724             :            to know our SID - get it from the owner_sid of the file we
    2725             :            just created */
    2726           2 :         q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
    2727           2 :         q.query_secdesc.in.file.fnum = fnum;
    2728           2 :         q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
    2729           2 :         status = smb_raw_fileinfo(cli->tree, tctx, &q);
    2730           2 :         CHECK_STATUS(status, NT_STATUS_OK);
    2731           2 :         sd_orig = q.query_secdesc.out.sd;
    2732             : 
    2733           2 :         owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
    2734             : 
    2735           2 :         status = torture_check_privilege(cli, 
    2736             :                                          owner_sid, 
    2737             :                                          sec_privilege_name(SEC_PRIV_RESTORE));
    2738           2 :         has_restore_privilege = NT_STATUS_IS_OK(status);
    2739           2 :         torture_comment(tctx, "Checked SEC_PRIV_RESTORE for %s - %s\n", 
    2740             :                         owner_sid,
    2741             :                         has_restore_privilege?"Yes":"No");
    2742             : 
    2743           2 :         status = torture_check_privilege(cli, 
    2744             :                                          owner_sid, 
    2745             :                                          sec_privilege_name(SEC_PRIV_BACKUP));
    2746           2 :         has_backup_privilege = NT_STATUS_IS_OK(status);
    2747           2 :         torture_comment(tctx, "Checked SEC_PRIV_BACKUP for %s - %s\n", 
    2748             :                         owner_sid,
    2749             :                         has_backup_privilege?"Yes":"No");
    2750             : 
    2751           2 :         status = torture_check_privilege(cli,
    2752             :                                          owner_sid,
    2753             :                                          sec_privilege_name(SEC_PRIV_SECURITY));
    2754           2 :         has_system_security_privilege = NT_STATUS_IS_OK(status);
    2755           2 :         torture_comment(tctx, "Checked SEC_PRIV_SECURITY for %s - %s\n",
    2756             :                         owner_sid,
    2757             :                         has_system_security_privilege?"Yes":"No");
    2758             : 
    2759           2 :         smbcli_close(cli->tree, fnum);
    2760             : 
    2761           4 :         for (i = 0; i < 32; i++) {
    2762           4 :                 uint32_t mask = SEC_FLAG_MAXIMUM_ALLOWED | (1u << i);
    2763             :                 /*
    2764             :                  * SEC_GENERIC_EXECUTE is a complete subset of
    2765             :                  * SEC_GENERIC_READ when mapped to specific bits,
    2766             :                  * so we need to include it in the basic OK mask.
    2767             :                  */
    2768           4 :                 uint32_t ok_mask = SEC_RIGHTS_FILE_READ | SEC_GENERIC_READ | SEC_GENERIC_EXECUTE |
    2769             :                         SEC_STD_DELETE | SEC_STD_WRITE_DAC;
    2770             : 
    2771             :                 /*
    2772             :                  * Now SEC_RIGHTS_PRIV_RESTORE and SEC_RIGHTS_PRIV_BACKUP
    2773             :                  * don't include any generic bits (they're used directly
    2774             :                  * in the fileserver where the generic bits have already
    2775             :                  * been mapped into file specific bits) we need to add the
    2776             :                  * generic bits to the ok_mask when we have these privileges.
    2777             :                  */
    2778           4 :                 if (has_restore_privilege) {
    2779           4 :                         ok_mask |= SEC_RIGHTS_PRIV_RESTORE|SEC_GENERIC_WRITE;
    2780             :                 }
    2781           4 :                 if (has_backup_privilege) {
    2782           4 :                         ok_mask |= SEC_RIGHTS_PRIV_BACKUP|SEC_GENERIC_READ;
    2783             :                 }
    2784           4 :                 if (has_system_security_privilege) {
    2785           4 :                         ok_mask |= SEC_FLAG_SYSTEM_SECURITY;
    2786             :                 }
    2787             : 
    2788             :                 /* Skip all SACL related tests. */
    2789           4 :                 if ((!torture_setting_bool(tctx, "sacl_support", true)) &&
    2790           0 :                     (mask & SEC_FLAG_SYSTEM_SECURITY))
    2791           0 :                         continue;
    2792             : 
    2793           4 :                 memset(&io, 0, sizeof(io));
    2794           4 :                 io.generic.level = RAW_OPEN_NTTRANS_CREATE;
    2795           4 :                 io.ntcreatex.in.access_mask = mask;
    2796           4 :                 io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
    2797           4 :                 io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
    2798           4 :                 io.ntcreatex.in.impersonation =
    2799             :                     NTCREATEX_IMPERSONATION_ANONYMOUS;
    2800           4 :                 io.ntcreatex.in.fname = MAXIMUM_ALLOWED_FILE;
    2801             : 
    2802           4 :                 status = smb_raw_open(cli->tree, mem_ctx, &io);
    2803           4 :                 if (mask & ok_mask ||
    2804             :                     mask == SEC_FLAG_MAXIMUM_ALLOWED) {
    2805           4 :                         CHECK_STATUS(status, NT_STATUS_OK);
    2806             :                 } else {
    2807           0 :                         if (mask & SEC_FLAG_SYSTEM_SECURITY) {
    2808           0 :                                 CHECK_STATUS(status, NT_STATUS_PRIVILEGE_NOT_HELD);
    2809             :                         } else {
    2810           0 :                                 CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
    2811             :                         }
    2812             :                 }
    2813             : 
    2814           2 :                 fnum = io.ntcreatex.out.file.fnum;
    2815             : 
    2816           2 :                 smbcli_close(cli->tree, fnum);
    2817             :         }
    2818             : 
    2819           0 :  done:
    2820           2 :         smbcli_unlink(cli->tree, MAXIMUM_ALLOWED_FILE);
    2821           2 :         return ret;
    2822             : }

Generated by: LCOV version 1.13