LCOV - code coverage report
Current view: top level - source4/ntvfs - ntvfs_interface.c (source / functions) Hit Total Coverage
Test: coverage report for master 2b515b7d Lines: 226 305 74.1 %
Date: 2024-02-28 12:06:22 Functions: 64 68 94.1 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             :    NTVFS interface functions
       4             : 
       5             :    Copyright (C) Stefan (metze) Metzmacher 2004
       6             : 
       7             :    This program is free software; you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation; either version 3 of the License, or
      10             :    (at your option) any later version.
      11             :    
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             :    
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include "includes.h"
      22             : #include "ntvfs/ntvfs.h"
      23             : #include "lib/tsocket/tsocket.h"
      24             : 
      25             : /* connect/disconnect */
      26        2558 : NTSTATUS ntvfs_connect(struct ntvfs_request *req, union smb_tcon *tcon)
      27             : {
      28        2558 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
      29        2558 :         if (!ntvfs->ops->connect_fn) {
      30           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
      31             :         }
      32        2558 :         return ntvfs->ops->connect_fn(ntvfs, req, tcon);
      33             : }
      34             : 
      35        2558 : NTSTATUS ntvfs_disconnect(struct ntvfs_context *ntvfs_ctx)
      36             : {
      37           0 :         struct ntvfs_module_context *ntvfs;
      38        2558 :         if (ntvfs_ctx == NULL) {
      39           0 :                 return NT_STATUS_INVALID_CONNECTION;
      40             :         }
      41        2558 :         ntvfs = ntvfs_ctx->modules;
      42        2558 :         if (!ntvfs->ops->disconnect_fn) {
      43           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
      44             :         }
      45        2558 :         return ntvfs->ops->disconnect_fn(ntvfs);
      46             : }
      47             : 
      48             : /* async setup - called by a backend that wants to setup any state for
      49             :    a async request */
      50        3439 : NTSTATUS ntvfs_async_setup(struct ntvfs_request *req, void *private_data)
      51             : {
      52        3439 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
      53        3439 :         if (!ntvfs->ops->async_setup_fn) {
      54           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
      55             :         }
      56        3439 :         return ntvfs->ops->async_setup_fn(ntvfs, req, private_data);
      57             : }
      58             : 
      59             : /* filesystem operations */
      60        6196 : NTSTATUS ntvfs_fsinfo(struct ntvfs_request *req, union smb_fsinfo *fs)
      61             : {
      62        6196 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
      63        6196 :         if (!ntvfs->ops->fsinfo_fn) {
      64           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
      65             :         }
      66        6196 :         return ntvfs->ops->fsinfo_fn(ntvfs, req, fs);
      67             : }
      68             : 
      69             : /* path operations */
      70       41362 : NTSTATUS ntvfs_unlink(struct ntvfs_request *req, union smb_unlink *unl)
      71             : {
      72       41362 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
      73       41362 :         if (!ntvfs->ops->unlink_fn) {
      74           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
      75             :         }
      76       41362 :         return ntvfs->ops->unlink_fn(ntvfs, req, unl);
      77             : }
      78             : 
      79         757 : NTSTATUS ntvfs_chkpath(struct ntvfs_request *req, union smb_chkpath *cp)
      80             : {
      81         757 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
      82         757 :         if (!ntvfs->ops->chkpath_fn) {
      83           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
      84             :         }
      85         757 :         return ntvfs->ops->chkpath_fn(ntvfs, req, cp);
      86             : }
      87             : 
      88        7694 : NTSTATUS ntvfs_qpathinfo(struct ntvfs_request *req, union smb_fileinfo *st)
      89             : {
      90        7694 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
      91        7694 :         if (!ntvfs->ops->qpathinfo_fn) {
      92           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
      93             :         }
      94        7694 :         return ntvfs->ops->qpathinfo_fn(ntvfs, req, st);
      95             : }
      96             : 
      97         586 : NTSTATUS ntvfs_setpathinfo(struct ntvfs_request *req, union smb_setfileinfo *st)
      98             : {
      99         586 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     100         586 :         if (!ntvfs->ops->setpathinfo_fn) {
     101           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     102             :         }
     103         586 :         return ntvfs->ops->setpathinfo_fn(ntvfs, req, st);
     104             : }
     105             : 
     106      288010 : NTSTATUS ntvfs_open(struct ntvfs_request *req, union smb_open *oi)
     107             : {
     108      288010 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     109      288010 :         if (!ntvfs->ops->open_fn) {
     110           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     111             :         }
     112      288010 :         return ntvfs->ops->open_fn(ntvfs, req, oi);
     113             : }
     114             : 
     115        3718 : NTSTATUS ntvfs_mkdir(struct ntvfs_request *req, union smb_mkdir *md)
     116             : {
     117        3718 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     118        3718 :         if (!ntvfs->ops->mkdir_fn) {
     119           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     120             :         }
     121        3718 :         return ntvfs->ops->mkdir_fn(ntvfs, req, md);
     122             : }
     123             : 
     124        8209 : NTSTATUS ntvfs_rmdir(struct ntvfs_request *req, struct smb_rmdir *rd)
     125             : {
     126        8209 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     127        8209 :         if (!ntvfs->ops->rmdir_fn) {
     128           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     129             :         }
     130        8209 :         return ntvfs->ops->rmdir_fn(ntvfs, req, rd);
     131             : }
     132             : 
     133        4236 : NTSTATUS ntvfs_rename(struct ntvfs_request *req, union smb_rename *ren)
     134             : {
     135        4236 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     136        4236 :         if (!ntvfs->ops->rename_fn) {
     137           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     138             :         }
     139        4236 :         return ntvfs->ops->rename_fn(ntvfs, req, ren);
     140             : }
     141             : 
     142           0 : NTSTATUS ntvfs_copy(struct ntvfs_request *req, struct smb_copy *cp)
     143             : {
     144           0 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     145           0 :         if (!ntvfs->ops->copy_fn) {
     146           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     147             :         }
     148           0 :         return ntvfs->ops->copy_fn(ntvfs, req, cp);
     149             : }
     150             : 
     151             : /* directory search */
     152       10239 : NTSTATUS ntvfs_search_first(struct ntvfs_request *req, union smb_search_first *io, void *private_data,
     153             :                                      bool ntvfs_callback(void *private_data, const union smb_search_data *file))
     154             : {
     155       10239 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     156       10239 :         if (!ntvfs->ops->search_first_fn) {
     157           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     158             :         }
     159       10239 :         return ntvfs->ops->search_first_fn(ntvfs, req, io, private_data, ntvfs_callback);
     160             : }
     161             : 
     162        1324 : NTSTATUS ntvfs_search_next(struct ntvfs_request *req, union smb_search_next *io, void *private_data,
     163             :                                     bool ntvfs_callback(void *private_data, const union smb_search_data *file))
     164             : {
     165        1324 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     166        1324 :         if (!ntvfs->ops->search_next_fn) {
     167           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     168             :         }
     169        1324 :         return ntvfs->ops->search_next_fn(ntvfs, req, io, private_data, ntvfs_callback);
     170             : }
     171             : 
     172           1 : NTSTATUS ntvfs_search_close(struct ntvfs_request *req, union smb_search_close *io)
     173             : {
     174           1 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     175           1 :         if (!ntvfs->ops->search_close_fn) {
     176           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     177             :         }
     178           1 :         return ntvfs->ops->search_close_fn(ntvfs, req, io);
     179             : }
     180             : 
     181             : /* operations on open files */
     182      114631 : NTSTATUS ntvfs_ioctl(struct ntvfs_request *req, union smb_ioctl *io)
     183             : {
     184      114631 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     185      114631 :         if (!ntvfs->ops->ioctl_fn) {
     186           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     187             :         }
     188      114631 :         return ntvfs->ops->ioctl_fn(ntvfs, req, io);
     189             : }
     190             : 
     191       53694 : NTSTATUS ntvfs_read(struct ntvfs_request *req, union smb_read *io)
     192             : {
     193       53694 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     194       53694 :         if (!ntvfs->ops->read_fn) {
     195           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     196             :         }
     197       53694 :         return ntvfs->ops->read_fn(ntvfs, req, io);
     198             : }
     199             : 
     200       47504 : NTSTATUS ntvfs_write(struct ntvfs_request *req, union smb_write *io)
     201             : {
     202       47504 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     203       47504 :         if (!ntvfs->ops->write_fn) {
     204           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     205             :         }
     206       47504 :         return ntvfs->ops->write_fn(ntvfs, req, io);
     207             : }
     208             : 
     209          11 : NTSTATUS ntvfs_seek(struct ntvfs_request *req, union smb_seek *io)
     210             : {
     211          11 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     212          11 :         if (!ntvfs->ops->seek_fn) {
     213           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     214             :         }
     215          11 :         return ntvfs->ops->seek_fn(ntvfs, req, io);
     216             : }
     217             : 
     218           5 : NTSTATUS ntvfs_flush(struct ntvfs_request *req,
     219             :                               union smb_flush *flush)
     220             : {
     221           5 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     222           5 :         if (!ntvfs->ops->flush_fn) {
     223           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     224             :         }
     225           5 :         return ntvfs->ops->flush_fn(ntvfs, req, flush);
     226             : }
     227             : 
     228        2639 : NTSTATUS ntvfs_lock(struct ntvfs_request *req, union smb_lock *lck)
     229             : {
     230        2639 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     231        2639 :         if (!ntvfs->ops->lock_fn) {
     232           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     233             :         }
     234        2639 :         return ntvfs->ops->lock_fn(ntvfs, req, lck);
     235             : }
     236             : 
     237        8429 : NTSTATUS ntvfs_qfileinfo(struct ntvfs_request *req, union smb_fileinfo *info)
     238             : {
     239        8429 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     240        8429 :         if (!ntvfs->ops->qfileinfo_fn) {
     241           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     242             :         }
     243        8429 :         return ntvfs->ops->qfileinfo_fn(ntvfs, req, info);
     244             : }
     245             : 
     246        2442 : NTSTATUS ntvfs_setfileinfo(struct ntvfs_request *req, union smb_setfileinfo *info)
     247             : {
     248        2442 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     249        2442 :         if (!ntvfs->ops->setfileinfo_fn) {
     250           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     251             :         }
     252        2442 :         return ntvfs->ops->setfileinfo_fn(ntvfs, req, info);
     253             : }
     254             : 
     255      215671 : NTSTATUS ntvfs_close(struct ntvfs_request *req, union smb_close *io)
     256             : {
     257      215671 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     258      215671 :         if (!ntvfs->ops->close_fn) {
     259           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     260             :         }
     261      215671 :         return ntvfs->ops->close_fn(ntvfs, req, io);
     262             : }
     263             : 
     264             : /* trans interface - used by IPC backend for pipes and RAP calls */
     265          44 : NTSTATUS ntvfs_trans(struct ntvfs_request *req, struct smb_trans2 *trans)
     266             : {
     267          44 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     268          44 :         if (!ntvfs->ops->trans_fn) {
     269           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     270             :         }
     271          44 :         return ntvfs->ops->trans_fn(ntvfs, req, trans);
     272             : }
     273             : 
     274             : /* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
     275       36453 : NTSTATUS ntvfs_trans2(struct ntvfs_request *req, struct smb_trans2 *trans2)
     276             : {
     277       36453 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     278       36453 :         if (!ntvfs->ops->trans2_fn) {
     279       24829 :                 return NT_STATUS_NOT_IMPLEMENTED;
     280             :         }
     281       11624 :         return ntvfs->ops->trans2_fn(ntvfs, req, trans2);
     282             : }
     283             : 
     284             : /* printing specific operations */
     285           0 : NTSTATUS ntvfs_lpq(struct ntvfs_request *req, union smb_lpq *lpq)
     286             : {
     287           0 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     288           0 :         if (!ntvfs->ops->lpq_fn) {
     289           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     290             :         }
     291           0 :         return ntvfs->ops->lpq_fn(ntvfs, req, lpq);
     292             : }
     293             : 
     294             : /* logoff - called when a vuid is closed */
     295          21 : NTSTATUS ntvfs_logoff(struct ntvfs_request *req)
     296             : {
     297          21 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     298          21 :         if (!ntvfs->ops->logoff_fn) {
     299           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     300             :         }
     301          21 :         return ntvfs->ops->logoff_fn(ntvfs, req);
     302             : }
     303             : 
     304         614 : NTSTATUS ntvfs_exit(struct ntvfs_request *req)
     305             : {
     306         614 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     307         614 :         if (!ntvfs->ops->exit_fn) {
     308           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     309             :         }
     310         614 :         return ntvfs->ops->exit_fn(ntvfs, req);
     311             : }
     312             : 
     313             : /*
     314             :   change notify request
     315             : */
     316         563 : NTSTATUS ntvfs_notify(struct ntvfs_request *req, union smb_notify *info)
     317             : {
     318         563 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     319         563 :         if (!ntvfs->ops->notify_fn) {
     320           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     321             :         }
     322         563 :         return ntvfs->ops->notify_fn(ntvfs, req, info);
     323             : }
     324             : 
     325             : /*
     326             :   cancel an outstanding async request
     327             : */
     328         497 : NTSTATUS ntvfs_cancel(struct ntvfs_request *req)
     329             : {
     330         497 :         struct ntvfs_module_context *ntvfs = req->ctx->modules;
     331         497 :         if (!ntvfs->ops->cancel_fn) {
     332           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     333             :         }
     334         497 :         return ntvfs->ops->cancel_fn(ntvfs, req);
     335             : }
     336             : 
     337             : /* initial setup */
     338        1328 : NTSTATUS ntvfs_next_connect(struct ntvfs_module_context *ntvfs, 
     339             :                                      struct ntvfs_request *req,
     340             :                                      union smb_tcon *tcon)
     341             : {
     342        1328 :         if (!ntvfs->next || !ntvfs->next->ops->connect_fn) {
     343           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     344             :         }
     345        1328 :         return ntvfs->next->ops->connect_fn(ntvfs->next, req, tcon);
     346             : }
     347             : 
     348        1328 : NTSTATUS ntvfs_next_disconnect(struct ntvfs_module_context *ntvfs)
     349             : {
     350        1328 :         if (!ntvfs->next || !ntvfs->next->ops->disconnect_fn) {
     351           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     352             :         }
     353        1328 :         return ntvfs->next->ops->disconnect_fn(ntvfs->next);
     354             : }
     355             : 
     356             : /* async_setup - called when setting up for a async request */
     357        3439 : NTSTATUS ntvfs_next_async_setup(struct ntvfs_module_context *ntvfs, 
     358             :                                          struct ntvfs_request *req, 
     359             :                                          void *private_data)
     360             : {
     361        3439 :         if (!ntvfs->next || !ntvfs->next->ops->async_setup_fn) {
     362           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     363             :         }
     364        3439 :         return ntvfs->next->ops->async_setup_fn(ntvfs->next, req, private_data);
     365             : }
     366             : 
     367             : /* filesystem operations */
     368        4195 : NTSTATUS ntvfs_next_fsinfo(struct ntvfs_module_context *ntvfs, 
     369             :                                     struct ntvfs_request *req,
     370             :                                     union smb_fsinfo *fs)
     371             : {
     372        4195 :         if (!ntvfs->next || !ntvfs->next->ops->fsinfo_fn) {
     373           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     374             :         }
     375        4195 :         return ntvfs->next->ops->fsinfo_fn(ntvfs->next, req, fs);
     376             : }
     377             : 
     378             : /* path operations */
     379       34435 : NTSTATUS ntvfs_next_unlink(struct ntvfs_module_context *ntvfs, 
     380             :                                     struct ntvfs_request *req,
     381             :                                     union smb_unlink *unl)
     382             : {
     383       34435 :         if (!ntvfs->next || !ntvfs->next->ops->unlink_fn) {
     384           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     385             :         }
     386       34435 :         return ntvfs->next->ops->unlink_fn(ntvfs->next, req, unl);
     387             : }
     388             : 
     389         732 : NTSTATUS ntvfs_next_chkpath(struct ntvfs_module_context *ntvfs, 
     390             :                                      struct ntvfs_request *req,
     391             :                                      union smb_chkpath *cp)
     392             : {
     393         732 :         if (!ntvfs->next || !ntvfs->next->ops->chkpath_fn) {
     394           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     395             :         }
     396         732 :         return ntvfs->next->ops->chkpath_fn(ntvfs->next, req, cp);
     397             : }
     398             : 
     399        5291 : NTSTATUS ntvfs_next_qpathinfo(struct ntvfs_module_context *ntvfs, 
     400             :                                        struct ntvfs_request *req,
     401             :                                        union smb_fileinfo *st)
     402             : {
     403        5291 :         if (!ntvfs->next || !ntvfs->next->ops->qpathinfo_fn) {
     404           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     405             :         }
     406        5291 :         return ntvfs->next->ops->qpathinfo_fn(ntvfs->next, req, st);
     407             : }
     408             : 
     409         440 : NTSTATUS ntvfs_next_setpathinfo(struct ntvfs_module_context *ntvfs, 
     410             :                                          struct ntvfs_request *req,
     411             :                                          union smb_setfileinfo *st)
     412             : {
     413         440 :         if (!ntvfs->next || !ntvfs->next->ops->setpathinfo_fn) {
     414           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     415             :         }
     416         440 :         return ntvfs->next->ops->setpathinfo_fn(ntvfs->next, req, st);
     417             : }
     418             : 
     419        2593 : NTSTATUS ntvfs_next_mkdir(struct ntvfs_module_context *ntvfs, 
     420             :                                    struct ntvfs_request *req,
     421             :                                    union smb_mkdir *md)
     422             : {
     423        2593 :         if (!ntvfs->next || !ntvfs->next->ops->mkdir_fn) {
     424           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     425             :         }
     426        2593 :         return ntvfs->next->ops->mkdir_fn(ntvfs->next, req, md);
     427             : }
     428             : 
     429        6979 : NTSTATUS ntvfs_next_rmdir(struct ntvfs_module_context *ntvfs, 
     430             :                                    struct ntvfs_request *req,
     431             :                                    struct smb_rmdir *rd)
     432             : {
     433        6979 :         if (!ntvfs->next || !ntvfs->next->ops->rmdir_fn) {
     434           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     435             :         }
     436        6979 :         return ntvfs->next->ops->rmdir_fn(ntvfs->next, req, rd);
     437             : }
     438             : 
     439        4232 : NTSTATUS ntvfs_next_rename(struct ntvfs_module_context *ntvfs, 
     440             :                                     struct ntvfs_request *req,
     441             :                                     union smb_rename *ren)
     442             : {
     443        4232 :         if (!ntvfs->next || !ntvfs->next->ops->rename_fn) {
     444           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     445             :         }
     446        4232 :         return ntvfs->next->ops->rename_fn(ntvfs->next, req, ren);
     447             : }
     448             : 
     449           0 : NTSTATUS ntvfs_next_copy(struct ntvfs_module_context *ntvfs, 
     450             :                                   struct ntvfs_request *req,
     451             :                                   struct smb_copy *cp)
     452             : {
     453           0 :         if (!ntvfs->next || !ntvfs->next->ops->copy_fn) {
     454           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     455             :         }
     456           0 :         return ntvfs->next->ops->copy_fn(ntvfs->next, req, cp);
     457             : }
     458             : 
     459      273273 : NTSTATUS ntvfs_next_open(struct ntvfs_module_context *ntvfs, 
     460             :                                   struct ntvfs_request *req,
     461             :                                   union smb_open *oi)
     462             : {
     463      273273 :         if (!ntvfs->next || !ntvfs->next->ops->open_fn) {
     464           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     465             :         }
     466      273273 :         return ntvfs->next->ops->open_fn(ntvfs->next, req, oi);
     467             : }
     468             : 
     469             : 
     470             : /* directory search */
     471        7112 : NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs, 
     472             :                                           struct ntvfs_request *req,
     473             :                                           union smb_search_first *io, void *private_data,
     474             :                                           bool (*callback)(void *private_data, const union smb_search_data *file))
     475             : {
     476        7112 :         if (!ntvfs->next || !ntvfs->next->ops->search_first_fn) {
     477           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     478             :         }
     479        7112 :         return ntvfs->next->ops->search_first_fn(ntvfs->next, req, io, private_data, callback);
     480             : }
     481             : 
     482        1312 : NTSTATUS ntvfs_next_search_next(struct ntvfs_module_context *ntvfs, 
     483             :                                          struct ntvfs_request *req,
     484             :                                          union smb_search_next *io, void *private_data,
     485             :                                          bool (*callback)(void *private_data, const union smb_search_data *file))
     486             : {
     487        1312 :         if (!ntvfs->next || !ntvfs->next->ops->search_next_fn) {
     488           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     489             :         }
     490        1312 :         return ntvfs->next->ops->search_next_fn(ntvfs->next, req, io, private_data, callback);
     491             : }
     492             : 
     493           1 : NTSTATUS ntvfs_next_search_close(struct ntvfs_module_context *ntvfs, 
     494             :                                           struct ntvfs_request *req,
     495             :                                           union smb_search_close *io)
     496             : {
     497           1 :         if (!ntvfs->next || !ntvfs->next->ops->search_close_fn) {
     498           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     499             :         }
     500           1 :         return ntvfs->next->ops->search_close_fn(ntvfs->next, req, io);
     501             : }
     502             : 
     503             : /* operations on open files */
     504       66152 : NTSTATUS ntvfs_next_ioctl(struct ntvfs_module_context *ntvfs, 
     505             :                                    struct ntvfs_request *req,
     506             :                                    union smb_ioctl *io)
     507             : {
     508       66152 :         if (!ntvfs->next || !ntvfs->next->ops->ioctl_fn) {
     509           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     510             :         }
     511       66152 :         return ntvfs->next->ops->ioctl_fn(ntvfs->next, req, io);
     512             : }
     513             : 
     514       35376 : NTSTATUS ntvfs_next_read(struct ntvfs_module_context *ntvfs, 
     515             :                                   struct ntvfs_request *req,
     516             :                                   union smb_read *io)
     517             : {
     518       35376 :         if (!ntvfs->next || !ntvfs->next->ops->read_fn) {
     519           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     520             :         }
     521       35376 :         return ntvfs->next->ops->read_fn(ntvfs->next, req, io);
     522             : }
     523             : 
     524       37405 : NTSTATUS ntvfs_next_write(struct ntvfs_module_context *ntvfs, 
     525             :                                    struct ntvfs_request *req,
     526             :                                    union smb_write *io)
     527             : {
     528       37405 :         if (!ntvfs->next || !ntvfs->next->ops->write_fn) {
     529           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     530             :         }
     531       37405 :         return ntvfs->next->ops->write_fn(ntvfs->next, req, io);
     532             : }
     533             : 
     534          11 : NTSTATUS ntvfs_next_seek(struct ntvfs_module_context *ntvfs, 
     535             :                                   struct ntvfs_request *req,
     536             :                                   union smb_seek *io)
     537             : {
     538          11 :         if (!ntvfs->next || !ntvfs->next->ops->seek_fn) {
     539           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     540             :         }
     541          11 :         return ntvfs->next->ops->seek_fn(ntvfs->next, req, io);
     542             : }
     543             : 
     544           5 : NTSTATUS ntvfs_next_flush(struct ntvfs_module_context *ntvfs, 
     545             :                                    struct ntvfs_request *req,
     546             :                                    union smb_flush *flush)
     547             : {
     548           5 :         if (!ntvfs->next || !ntvfs->next->ops->flush_fn) {
     549           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     550             :         }
     551           5 :         return ntvfs->next->ops->flush_fn(ntvfs->next, req, flush);
     552             : }
     553             : 
     554        2449 : NTSTATUS ntvfs_next_lock(struct ntvfs_module_context *ntvfs, 
     555             :                                   struct ntvfs_request *req,
     556             :                                   union smb_lock *lck)
     557             : {
     558        2449 :         if (!ntvfs->next || !ntvfs->next->ops->lock_fn) {
     559           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     560             :         }
     561        2449 :         return ntvfs->next->ops->lock_fn(ntvfs->next, req, lck);
     562             : }
     563             : 
     564        6243 : NTSTATUS ntvfs_next_qfileinfo(struct ntvfs_module_context *ntvfs, 
     565             :                                        struct ntvfs_request *req,
     566             :                                        union smb_fileinfo *info)
     567             : {
     568        6243 :         if (!ntvfs->next || !ntvfs->next->ops->qfileinfo_fn) {
     569           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     570             :         }
     571        6243 :         return ntvfs->next->ops->qfileinfo_fn(ntvfs->next, req, info);
     572             : }
     573             : 
     574        2404 : NTSTATUS ntvfs_next_setfileinfo(struct ntvfs_module_context *ntvfs, 
     575             :                                          struct ntvfs_request *req,
     576             :                                          union smb_setfileinfo *info)
     577             : {
     578        2404 :         if (!ntvfs->next || !ntvfs->next->ops->setfileinfo_fn) {
     579           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     580             :         }
     581        2404 :         return ntvfs->next->ops->setfileinfo_fn(ntvfs->next, req, info);
     582             : }
     583             : 
     584      202723 : NTSTATUS ntvfs_next_close(struct ntvfs_module_context *ntvfs, 
     585             :                                    struct ntvfs_request *req,
     586             :                                    union smb_close *io)
     587             : {
     588      202723 :         if (!ntvfs->next || !ntvfs->next->ops->close_fn) {
     589           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     590             :         }
     591      202723 :         return ntvfs->next->ops->close_fn(ntvfs->next, req, io);
     592             : }
     593             : 
     594             : /* trans interface - used by IPC backend for pipes and RAP calls */
     595           2 : NTSTATUS ntvfs_next_trans(struct ntvfs_module_context *ntvfs, 
     596             :                                    struct ntvfs_request *req,
     597             :                                    struct smb_trans2 *trans)
     598             : {
     599           2 :         if (!ntvfs->next || !ntvfs->next->ops->trans_fn) {
     600           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     601             :         }
     602           2 :         return ntvfs->next->ops->trans_fn(ntvfs->next, req, trans);
     603             : }
     604             : 
     605             : /*
     606             :   change notify request
     607             : */
     608         563 : NTSTATUS ntvfs_next_notify(struct ntvfs_module_context *ntvfs,
     609             :                                     struct ntvfs_request *req,
     610             :                                     union smb_notify *info)
     611             : {
     612         563 :         if (!ntvfs->next || !ntvfs->next->ops->notify_fn) {
     613           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     614             :         }
     615         563 :         return ntvfs->next->ops->notify_fn(ntvfs->next, req, info);
     616             : }
     617             : 
     618             : /* cancel - called to cancel an outstanding async request */
     619         497 : NTSTATUS ntvfs_next_cancel(struct ntvfs_module_context *ntvfs, 
     620             :                                     struct ntvfs_request *req)
     621             : {
     622         497 :         if (!ntvfs->next || !ntvfs->next->ops->cancel_fn) {
     623           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     624             :         }
     625         497 :         return ntvfs->next->ops->cancel_fn(ntvfs->next, req);
     626             : }
     627             : 
     628             : /* printing specific operations */
     629           0 : NTSTATUS ntvfs_next_lpq(struct ntvfs_module_context *ntvfs, 
     630             :                                  struct ntvfs_request *req,
     631             :                                  union smb_lpq *lpq)
     632             : {
     633           0 :         if (!ntvfs->next || !ntvfs->next->ops->lpq_fn) {
     634           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     635             :         }
     636           0 :         return ntvfs->next->ops->lpq_fn(ntvfs->next, req, lpq);
     637             : }
     638             : 
     639             : 
     640             : /* logoff - called when a vuid is closed */
     641          21 : NTSTATUS ntvfs_next_logoff(struct ntvfs_module_context *ntvfs, 
     642             :                                     struct ntvfs_request *req)
     643             : {
     644          21 :         if (!ntvfs->next || !ntvfs->next->ops->logoff_fn) {
     645           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     646             :         }
     647          21 :         return ntvfs->next->ops->logoff_fn(ntvfs->next, req);
     648             : }
     649             : 
     650         523 : NTSTATUS ntvfs_next_exit(struct ntvfs_module_context *ntvfs, 
     651             :                                   struct ntvfs_request *req)
     652             : {
     653         523 :         if (!ntvfs->next || !ntvfs->next->ops->exit_fn) {
     654           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     655             :         }
     656         523 :         return ntvfs->next->ops->exit_fn(ntvfs->next, req);
     657             : }
     658             : 
     659             : /* client connection callback */
     660        2558 : NTSTATUS ntvfs_set_addresses(struct ntvfs_context *ntvfs,
     661             :                              const struct tsocket_address *local_address,
     662             :                              const struct tsocket_address *remote_address)
     663             : {
     664        2558 :         ntvfs->client.local_address = tsocket_address_copy(local_address, ntvfs);
     665        2558 :         NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.local_address);
     666             : 
     667        2558 :         ntvfs->client.remote_address = tsocket_address_copy(remote_address, ntvfs);
     668        2558 :         NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.remote_address);
     669             : 
     670        2558 :         return NT_STATUS_OK;
     671             : }
     672             : 
     673        1333 : const struct tsocket_address *ntvfs_get_local_address(struct ntvfs_module_context *ntvfs)
     674             : {
     675        1333 :         return ntvfs->ctx->client.local_address;
     676             : }
     677             : 
     678        1333 : const struct tsocket_address *ntvfs_get_remote_address(struct ntvfs_module_context *ntvfs)
     679             : {
     680        1333 :         return ntvfs->ctx->client.remote_address;
     681             : }
     682             : 
     683             : /* oplock helpers */
     684        2558 : NTSTATUS ntvfs_set_oplock_handler(struct ntvfs_context *ntvfs,
     685             :                                            NTSTATUS (*handler)(void *private_data, struct ntvfs_handle *handle, uint8_t level),
     686             :                                            void *private_data)
     687             : {
     688        2558 :         ntvfs->oplock.handler                = handler;
     689        2558 :         ntvfs->oplock.private_data   = private_data;
     690        2558 :         return NT_STATUS_OK;
     691             : }
     692             : 
     693         104 : NTSTATUS ntvfs_send_oplock_break(struct ntvfs_module_context *ntvfs,
     694             :                                           struct ntvfs_handle *handle, uint8_t level)
     695             : {
     696         104 :         if (!ntvfs->ctx->oplock.handler) {
     697           0 :                 return NT_STATUS_OK;
     698             :         }
     699             : 
     700         104 :         return ntvfs->ctx->oplock.handler(ntvfs->ctx->oplock.private_data, handle, level);
     701             : }
     702             : 

Generated by: LCOV version 1.14