LCOV - code coverage report
Current view: top level - source4/ntvfs/posix - pvfs_ioctl.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 19 22 86.4 %
Date: 2024-04-21 15:09:00 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             : 
       4             :    POSIX NTVFS backend - open and close
       5             : 
       6             :    Copyright (C) Andrew Tridgell 2004
       7             : 
       8             :    This program is free software; you can redistribute it and/or modify
       9             :    it under the terms of the GNU General Public License as published by
      10             :    the Free Software Foundation; either version 3 of the License, or
      11             :    (at your option) any later version.
      12             :    
      13             :    This program is distributed in the hope that it will be useful,
      14             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :    GNU General Public License for more details.
      17             :    
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20             : */
      21             : 
      22             : #include "includes.h"
      23             : #include "vfs_posix.h"
      24             : #include "../libcli/smb/smb_constants.h"
      25             : 
      26             : /*
      27             :   old ioctl interface 
      28             : */
      29       65540 : static NTSTATUS pvfs_ioctl_old(struct ntvfs_module_context *ntvfs,
      30             :                         struct ntvfs_request *req, union smb_ioctl *io)
      31             : {
      32       65540 :         return NT_STATUS_DOS(ERRSRV, ERRerror);
      33             : }
      34             : 
      35             : /*
      36             :   nt ioctl interface 
      37             : */
      38           9 : static NTSTATUS pvfs_ntioctl(struct ntvfs_module_context *ntvfs,
      39             :                              struct ntvfs_request *req, union smb_ioctl *io)
      40             : {
      41           9 :         struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
      42             :                                   struct pvfs_state);
      43           0 :         struct pvfs_file *f;
      44             : 
      45           9 :         f = pvfs_find_fd(pvfs, req, io->ntioctl.in.file.ntvfs);
      46           9 :         if (!f) {
      47           0 :                 return NT_STATUS_INVALID_HANDLE;
      48             :         }
      49             : 
      50           9 :         switch (io->ntioctl.in.function) {
      51           5 :         case FSCTL_SET_SPARSE:
      52             :                 /* maybe some posix systems have a way of marking
      53             :                    a file non-sparse? */
      54           5 :                 io->ntioctl.out.blob = data_blob(NULL, 0);
      55           5 :                 return NT_STATUS_OK;
      56             :         }
      57             : 
      58           4 :         return NT_STATUS_NOT_SUPPORTED;
      59             : }
      60             : 
      61             : /*
      62             :   ioctl interface 
      63             : */
      64       66152 : NTSTATUS pvfs_ioctl(struct ntvfs_module_context *ntvfs,
      65             :                     struct ntvfs_request *req,
      66             :                     union smb_ioctl *io)
      67             : {
      68       66152 :         switch (io->generic.level) {
      69       65540 :         case RAW_IOCTL_IOCTL:
      70       65540 :                 return pvfs_ioctl_old(ntvfs, req, io);
      71             : 
      72           9 :         case RAW_IOCTL_NTIOCTL:
      73           9 :                 return pvfs_ntioctl(ntvfs, req, io);
      74             : 
      75         603 :         case RAW_IOCTL_SMB2:
      76             :         case RAW_IOCTL_SMB2_NO_HANDLE:
      77             :                 /* see WSPP SMB2 test 46 */
      78         603 :                 return NT_STATUS_INVALID_DEVICE_REQUEST;
      79             :         }
      80             : 
      81           0 :         return NT_STATUS_INVALID_LEVEL;
      82             : }

Generated by: LCOV version 1.14