s3: VFS: Complete the replacement of SMB_VFS_UNLINK() -> SMB_VFS_UNLINKAT().
[samba.git] / source3 / modules / vfs_not_implemented.c
1 /*
2  * VFS module with "not implemented " helper functions for other modules.
3  *
4  * Copyright (C) Tim Potter, 1999-2000
5  * Copyright (C) Alexander Bokovoy, 2002
6  * Copyright (C) Stefan (metze) Metzmacher, 2003,2018
7  * Copyright (C) Jeremy Allison 2009
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #include "includes.h"
24 #include "lib/util/tevent_unix.h"
25 #include "lib/util/tevent_ntstatus.h"
26
27 int vfs_not_implemented_connect(
28                         vfs_handle_struct *handle,
29                         const char *service,
30                         const char *user)
31 {
32         errno = ENOSYS;
33         return -1;
34 }
35
36 void vfs_not_implemented_disconnect(vfs_handle_struct *handle)
37 {
38         ;
39 }
40
41 uint64_t vfs_not_implemented_disk_free(vfs_handle_struct *handle,
42                                 const struct smb_filename *smb_fname,
43                                 uint64_t *bsize,
44                                 uint64_t *dfree,
45                                 uint64_t *dsize)
46 {
47         *bsize = 0;
48         *dfree = 0;
49         *dsize = 0;
50         return 0;
51 }
52
53 int vfs_not_implemented_get_quota(vfs_handle_struct *handle,
54                                 const struct smb_filename *smb_fname,
55                                 enum SMB_QUOTA_TYPE qtype,
56                                 unid_t id,
57                                 SMB_DISK_QUOTA *dq)
58 {
59         errno = ENOSYS;
60         return -1;
61 }
62
63 int vfs_not_implemented_set_quota(vfs_handle_struct *handle,
64                                   enum SMB_QUOTA_TYPE qtype,
65                                   unid_t id, SMB_DISK_QUOTA *dq)
66 {
67         errno = ENOSYS;
68         return -1;
69 }
70
71 int vfs_not_implemented_get_shadow_copy_data(vfs_handle_struct *handle,
72                                 files_struct *fsp,
73                                 struct shadow_copy_data *shadow_copy_data,
74                                 bool labels)
75 {
76         errno = ENOSYS;
77         return -1;
78 }
79
80 int vfs_not_implemented_statvfs(struct vfs_handle_struct *handle,
81                                 const struct smb_filename *smb_fname,
82                                 struct vfs_statvfs_struct *statbuf)
83 {
84         errno = ENOSYS;
85         return -1;
86 }
87
88 uint32_t vfs_not_implemented_fs_capabilities(struct vfs_handle_struct *handle,
89                                 enum timestamp_set_resolution *p_ts_res)
90 {
91         return 0;
92 }
93
94 NTSTATUS vfs_not_implemented_get_dfs_referrals(struct vfs_handle_struct *handle,
95                                                struct dfs_GetDFSReferral *r)
96 {
97         return NT_STATUS_NOT_IMPLEMENTED;
98 }
99
100 DIR *vfs_not_implemented_opendir(vfs_handle_struct *handle,
101                         const struct smb_filename *smb_fname,
102                         const char *mask,
103                         uint32_t attr)
104 {
105         return NULL;
106 }
107
108 NTSTATUS vfs_not_implemented_snap_check_path(struct vfs_handle_struct *handle,
109                                 TALLOC_CTX *mem_ctx,
110                                 const char *service_path,
111                                 char **base_volume)
112 {
113         return NT_STATUS_NOT_SUPPORTED;
114 }
115
116 NTSTATUS vfs_not_implemented_snap_create(struct vfs_handle_struct *handle,
117                                          TALLOC_CTX *mem_ctx,
118                                          const char *base_volume,
119                                          time_t *tstamp,
120                                          bool rw,
121                                          char **base_path,
122                                          char **snap_path)
123 {
124         return NT_STATUS_NOT_SUPPORTED;
125 }
126
127 NTSTATUS vfs_not_implemented_snap_delete(struct vfs_handle_struct *handle,
128                                          TALLOC_CTX *mem_ctx,
129                                          char *base_path,
130                                          char *snap_path)
131 {
132         return NT_STATUS_NOT_SUPPORTED;
133 }
134
135 DIR *vfs_not_implemented_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
136                                    const char *mask, uint32_t attr)
137 {
138         errno = ENOSYS;
139         return NULL;
140 }
141
142 struct dirent *vfs_not_implemented_readdir(vfs_handle_struct *handle,
143                                            DIR *dirp, SMB_STRUCT_STAT *sbuf)
144 {
145         errno = ENOSYS;
146         return NULL;
147 }
148
149 void vfs_not_implemented_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
150 {
151         ;
152 }
153
154 long vfs_not_implemented_telldir(vfs_handle_struct *handle, DIR *dirp)
155 {
156         errno = ENOSYS;
157         return (long)-1;
158 }
159
160 void vfs_not_implemented_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
161 {
162         ;
163 }
164
165 int vfs_not_implemented_mkdirat(vfs_handle_struct *handle,
166                 struct files_struct *dirfsp,
167                 const struct smb_filename *smb_fname,
168                 mode_t mode)
169 {
170         errno = ENOSYS;
171         return -1;
172 }
173
174 int vfs_not_implemented_rmdir(vfs_handle_struct *handle,
175                 const struct smb_filename *smb_fname)
176 {
177         errno = ENOSYS;
178         return -1;
179 }
180
181 int vfs_not_implemented_closedir(vfs_handle_struct *handle, DIR *dir)
182 {
183         errno = ENOSYS;
184         return -1;
185 }
186
187 int vfs_not_implemented_open(vfs_handle_struct *handle,
188                              struct smb_filename *smb_fname,
189                              files_struct *fsp, int flags, mode_t mode)
190 {
191         errno = ENOSYS;
192         return -1;
193 }
194
195 NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
196                                 struct smb_request *req,
197                                 uint16_t root_dir_fid,
198                                 struct smb_filename *smb_fname,
199                                 uint32_t access_mask,
200                                 uint32_t share_access,
201                                 uint32_t create_disposition,
202                                 uint32_t create_options,
203                                 uint32_t file_attributes,
204                                 uint32_t oplock_request,
205                                 const struct smb2_lease *lease,
206                                 uint64_t allocation_size,
207                                 uint32_t private_flags,
208                                 struct security_descriptor *sd,
209                                 struct ea_list *ea_list,
210                                 files_struct **result, int *pinfo,
211                                 const struct smb2_create_blobs *in_context_blobs,
212                                 struct smb2_create_blobs *out_context_blobs)
213 {
214         return NT_STATUS_NOT_IMPLEMENTED;
215 }
216
217 int vfs_not_implemented_close_fn(vfs_handle_struct *handle, files_struct *fsp)
218 {
219         errno = ENOSYS;
220         return -1;
221 }
222
223 ssize_t vfs_not_implemented_pread(vfs_handle_struct *handle, files_struct *fsp,
224                                   void *data, size_t n, off_t offset)
225 {
226         errno = ENOSYS;
227         return -1;
228 }
229
230 struct tevent_req *vfs_not_implemented_pread_send(struct vfs_handle_struct *handle,
231                                                   TALLOC_CTX *mem_ctx,
232                                                   struct tevent_context *ev,
233                                                   struct files_struct *fsp,
234                                                   void *data, size_t n, off_t offset)
235 {
236         return NULL;
237 }
238
239 ssize_t vfs_not_implemented_pread_recv(struct tevent_req *req,
240                                        struct vfs_aio_state *vfs_aio_state)
241 {
242         vfs_aio_state->error = ENOSYS;
243         return -1;
244 }
245
246 ssize_t vfs_not_implemented_pwrite(vfs_handle_struct *handle, files_struct *fsp,
247                                    const void *data, size_t n, off_t offset)
248 {
249         errno = ENOSYS;
250         return -1;
251 }
252
253 struct tevent_req *vfs_not_implemented_pwrite_send(struct vfs_handle_struct *handle,
254                                                    TALLOC_CTX *mem_ctx,
255                                                    struct tevent_context *ev,
256                                                    struct files_struct *fsp,
257                                                    const void *data,
258                                                    size_t n, off_t offset)
259 {
260         return NULL;
261 }
262
263 ssize_t vfs_not_implemented_pwrite_recv(struct tevent_req *req,
264                                 struct vfs_aio_state *vfs_aio_state)
265 {
266         vfs_aio_state->error = ENOSYS;
267         return -1;
268 }
269
270 off_t vfs_not_implemented_lseek(vfs_handle_struct *handle, files_struct *fsp,
271                         off_t offset, int whence)
272 {
273         errno = ENOSYS;
274         return (off_t) - 1;
275 }
276
277 ssize_t vfs_not_implemented_sendfile(vfs_handle_struct *handle, int tofd,
278                                      files_struct *fromfsp, const DATA_BLOB *hdr,
279                                      off_t offset, size_t n)
280 {
281         errno = ENOSYS;
282         return -1;
283 }
284
285 ssize_t vfs_not_implemented_recvfile(vfs_handle_struct *handle, int fromfd,
286                                      files_struct *tofsp, off_t offset, size_t n)
287 {
288         errno = ENOSYS;
289         return -1;
290 }
291
292 int vfs_not_implemented_renameat(vfs_handle_struct *handle,
293                                files_struct *srcfsp,
294                                const struct smb_filename *smb_fname_src,
295                                files_struct *dstfsp,
296                                const struct smb_filename *smb_fname_dst)
297 {
298         errno = ENOSYS;
299         return -1;
300 }
301
302 struct tevent_req *vfs_not_implemented_fsync_send(struct vfs_handle_struct *handle,
303                                                   TALLOC_CTX *mem_ctx,
304                                                   struct tevent_context *ev,
305                                                   struct files_struct *fsp)
306 {
307         return NULL;
308 }
309
310 int vfs_not_implemented_fsync_recv(struct tevent_req *req,
311                                    struct vfs_aio_state *vfs_aio_state)
312 {
313         vfs_aio_state->error = ENOSYS;
314         return -1;
315 }
316
317 int vfs_not_implemented_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
318 {
319         errno = ENOSYS;
320         return -1;
321 }
322
323 int vfs_not_implemented_fstat(vfs_handle_struct *handle, files_struct *fsp,
324                         SMB_STRUCT_STAT *sbuf)
325 {
326         errno = ENOSYS;
327         return -1;
328 }
329
330 int vfs_not_implemented_lstat(vfs_handle_struct *handle,
331                               struct smb_filename *smb_fname)
332 {
333         errno = ENOSYS;
334         return -1;
335 }
336
337 uint64_t vfs_not_implemented_get_alloc_size(struct vfs_handle_struct *handle,
338                                             struct files_struct *fsp,
339                                             const SMB_STRUCT_STAT *sbuf)
340 {
341         errno = ENOSYS;
342         return -1;
343 }
344
345 int vfs_not_implemented_unlinkat(vfs_handle_struct *handle,
346                         struct files_struct *dirfsp,
347                         const struct smb_filename *smb_fname,
348                         int flags)
349 {
350         errno = ENOSYS;
351         return -1;
352 }
353
354 int vfs_not_implemented_chmod(vfs_handle_struct *handle,
355                               const struct smb_filename *smb_fname,
356                               mode_t mode)
357 {
358         errno = ENOSYS;
359         return -1;
360 }
361
362 int vfs_not_implemented_fchmod(vfs_handle_struct *handle, files_struct *fsp,
363                                mode_t mode)
364 {
365         errno = ENOSYS;
366         return -1;
367 }
368
369 int vfs_not_implemented_chown(vfs_handle_struct *handle,
370                               const struct smb_filename *smb_fname,
371                               uid_t uid,
372                               gid_t gid)
373 {
374         errno = ENOSYS;
375         return -1;
376 }
377
378 int vfs_not_implemented_fchown(vfs_handle_struct *handle, files_struct *fsp,
379                                uid_t uid, gid_t gid)
380 {
381         errno = ENOSYS;
382         return -1;
383 }
384
385 int vfs_not_implemented_lchown(vfs_handle_struct *handle,
386                                const struct smb_filename *smb_fname,
387                                uid_t uid,
388                                gid_t gid)
389 {
390         errno = ENOSYS;
391         return -1;
392 }
393
394 int vfs_not_implemented_chdir(vfs_handle_struct *handle,
395                               const struct smb_filename *smb_fname)
396 {
397         errno = ENOSYS;
398         return -1;
399 }
400
401 struct smb_filename *vfs_not_implemented_getwd(vfs_handle_struct *handle,
402                                                TALLOC_CTX *ctx)
403 {
404         errno = ENOSYS;
405         return NULL;
406 }
407
408 int vfs_not_implemented_ntimes(vfs_handle_struct *handle,
409                                const struct smb_filename *smb_fname,
410                                struct smb_file_time *ft)
411 {
412         errno = ENOSYS;
413         return -1;
414 }
415
416 int vfs_not_implemented_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
417                                   off_t offset)
418 {
419         errno = ENOSYS;
420         return -1;
421 }
422
423 int vfs_not_implemented_fallocate(vfs_handle_struct *handle, files_struct *fsp,
424                                   uint32_t mode, off_t offset, off_t len)
425 {
426         errno = ENOSYS;
427         return -1;
428 }
429
430 bool vfs_not_implemented_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
431                               off_t offset, off_t count, int type)
432 {
433         errno = ENOSYS;
434         return false;
435 }
436
437 int vfs_not_implemented_kernel_flock(struct vfs_handle_struct *handle,
438                                      struct files_struct *fsp,
439                                      uint32_t share_mode, uint32_t access_mask)
440 {
441         errno = ENOSYS;
442         return -1;
443 }
444
445 int vfs_not_implemented_linux_setlease(struct vfs_handle_struct *handle,
446                                        struct files_struct *fsp, int leasetype)
447 {
448         errno = ENOSYS;
449         return -1;
450 }
451
452 bool vfs_not_implemented_getlock(vfs_handle_struct *handle, files_struct *fsp,
453                                  off_t *poffset, off_t *pcount, int *ptype,
454                                  pid_t *ppid)
455 {
456         errno = ENOSYS;
457         return false;
458 }
459
460 int vfs_not_implemented_symlinkat(vfs_handle_struct *handle,
461                                 const char *link_contents,
462                                 struct files_struct *dirfsp,
463                                 const struct smb_filename *new_smb_fname)
464 {
465         errno = ENOSYS;
466         return -1;
467 }
468
469 int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle,
470                         files_struct *dirfsp,
471                         const struct smb_filename *smb_fname,
472                         char *buf,
473                         size_t bufsiz)
474 {
475         errno = ENOSYS;
476         return -1;
477 }
478
479 int vfs_not_implemented_linkat(vfs_handle_struct *handle,
480                         files_struct *srcfsp,
481                         const struct smb_filename *old_smb_fname,
482                         files_struct *dstfsp,
483                         const struct smb_filename *new_smb_fname,
484                         int flags)
485 {
486         errno = ENOSYS;
487         return -1;
488 }
489
490 int vfs_not_implemented_mknodat(vfs_handle_struct *handle,
491                         files_struct *dirfsp,
492                         const struct smb_filename *smb_fname,
493                         mode_t mode,
494                         SMB_DEV_T dev)
495 {
496         errno = ENOSYS;
497         return -1;
498 }
499
500 struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
501                                                   TALLOC_CTX *ctx,
502                                                   const struct smb_filename *smb_fname)
503 {
504         errno = ENOSYS;
505         return NULL;
506 }
507
508 int vfs_not_implemented_chflags(vfs_handle_struct *handle,
509                                 const struct smb_filename *smb_fname,
510                                 uint flags)
511 {
512         errno = ENOSYS;
513         return -1;
514 }
515
516 struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
517                                                   const SMB_STRUCT_STAT *sbuf)
518 {
519         struct file_id id;
520         ZERO_STRUCT(id);
521         errno = ENOSYS;
522         return id;
523 }
524
525 uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
526                                         const SMB_STRUCT_STAT *sbuf)
527 {
528         errno = ENOSYS;
529         return 0;
530 }
531
532 struct vfs_not_implemented_offload_read_state {
533         bool dummy;
534 };
535
536 struct tevent_req *vfs_not_implemented_offload_read_send(
537                         TALLOC_CTX *mem_ctx,
538                         struct tevent_context *ev,
539                         struct vfs_handle_struct *handle,
540                         struct files_struct *fsp,
541                         uint32_t fsctl,
542                         uint32_t ttl,
543                         off_t offset,
544                         size_t to_copy)
545 {
546         struct tevent_req *req = NULL;
547         struct vfs_not_implemented_offload_read_state *state = NULL;
548
549         req = tevent_req_create(mem_ctx, &state,
550                                 struct vfs_not_implemented_offload_read_state);
551         if (req == NULL) {
552                 return NULL;
553         }
554
555         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
556         return tevent_req_post(req, ev);
557 }
558
559 NTSTATUS vfs_not_implemented_offload_read_recv(struct tevent_req *req,
560                                        struct vfs_handle_struct *handle,
561                                        TALLOC_CTX *mem_ctx,
562                                        DATA_BLOB *_token_blob)
563 {
564         NTSTATUS status;
565
566         if (tevent_req_is_nterror(req, &status)) {
567                 tevent_req_received(req);
568                 return status;
569         }
570
571         tevent_req_received(req);
572         return NT_STATUS_OK;
573 }
574
575 struct vfs_not_implemented_offload_write_state {
576         uint64_t unused;
577 };
578
579 struct tevent_req *vfs_not_implemented_offload_write_send(
580                         struct vfs_handle_struct *handle,
581                         TALLOC_CTX *mem_ctx,
582                         struct tevent_context *ev,
583                         uint32_t fsctl,
584                         DATA_BLOB *token,
585                         off_t transfer_offset,
586                         struct files_struct *dest_fsp,
587                         off_t dest_off,
588                         off_t num)
589 {
590         struct tevent_req *req;
591         struct vfs_not_implemented_offload_write_state *state;
592
593         req = tevent_req_create(mem_ctx, &state,
594                                 struct vfs_not_implemented_offload_write_state);
595         if (req == NULL) {
596                 return NULL;
597         }
598
599         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
600         return tevent_req_post(req, ev);
601 }
602
603 NTSTATUS vfs_not_implemented_offload_write_recv(struct vfs_handle_struct *handle,
604                                                 struct tevent_req *req,
605                                                 off_t *copied)
606 {
607         NTSTATUS status;
608
609         if (tevent_req_is_nterror(req, &status)) {
610                 tevent_req_received(req);
611                 return status;
612         }
613
614         tevent_req_received(req);
615         return NT_STATUS_OK;
616 }
617
618 NTSTATUS vfs_not_implemented_get_compression(struct vfs_handle_struct *handle,
619                                              TALLOC_CTX *mem_ctx,
620                                              struct files_struct *fsp,
621                                              struct smb_filename *smb_fname,
622                                              uint16_t *_compression_fmt)
623 {
624         return NT_STATUS_INVALID_DEVICE_REQUEST;
625 }
626
627 NTSTATUS vfs_not_implemented_set_compression(struct vfs_handle_struct *handle,
628                                              TALLOC_CTX *mem_ctx,
629                                              struct files_struct *fsp,
630                                              uint16_t compression_fmt)
631 {
632         return NT_STATUS_INVALID_DEVICE_REQUEST;
633 }
634
635 NTSTATUS vfs_not_implemented_streaminfo(struct vfs_handle_struct *handle,
636                                         struct files_struct *fsp,
637                                         const struct smb_filename *smb_fname,
638                                         TALLOC_CTX *mem_ctx,
639                                         unsigned int *num_streams,
640                                         struct stream_struct **streams)
641 {
642         return NT_STATUS_NOT_IMPLEMENTED;
643 }
644
645 int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
646                                           const char *path,
647                                           const char *name,
648                                           TALLOC_CTX *mem_ctx,
649                                           char **found_name)
650 {
651         errno = ENOSYS;
652         return -1;
653 }
654
655 const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
656                                             const struct smb_filename *smb_fname)
657 {
658         errno = ENOSYS;
659         return NULL;
660 }
661
662 NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
663                                               struct byte_range_lock *br_lck,
664                                               struct lock_struct *plock)
665 {
666         return NT_STATUS_NOT_IMPLEMENTED;
667 }
668
669 bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
670                                             struct byte_range_lock *br_lck,
671                                             const struct lock_struct *plock)
672 {
673         errno = ENOSYS;
674         return false;
675 }
676
677 bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,
678                                            struct files_struct *fsp,
679                                            struct lock_struct *plock)
680 {
681         errno = ENOSYS;
682         return false;
683 }
684
685 NTSTATUS vfs_not_implemented_translate_name(struct vfs_handle_struct *handle,
686                                             const char *mapped_name,
687                                             enum vfs_translate_direction direction,
688                                             TALLOC_CTX *mem_ctx, char **pmapped_name)
689 {
690         return NT_STATUS_NOT_IMPLEMENTED;
691 }
692
693 NTSTATUS vfs_not_implemented_fsctl(struct vfs_handle_struct *handle,
694                                    struct files_struct *fsp,
695                                    TALLOC_CTX *ctx,
696                                    uint32_t function,
697                                    uint16_t req_flags,  /* Needed for UNICODE ... */
698                                    const uint8_t *_in_data,
699                                    uint32_t in_len,
700                                    uint8_t **_out_data,
701                                    uint32_t max_out_len, uint32_t *out_len)
702 {
703         return NT_STATUS_NOT_IMPLEMENTED;
704 }
705
706 NTSTATUS vfs_not_implemented_readdir_attr(struct vfs_handle_struct *handle,
707                                           const struct smb_filename *fname,
708                                           TALLOC_CTX *mem_ctx,
709                                           struct readdir_attr_data **pattr_data)
710 {
711         return NT_STATUS_NOT_IMPLEMENTED;
712 }
713
714 NTSTATUS vfs_not_implemented_get_dos_attributes(struct vfs_handle_struct *handle,
715                                                 struct smb_filename *smb_fname,
716                                                 uint32_t *dosmode)
717 {
718         return NT_STATUS_NOT_IMPLEMENTED;
719 }
720
721 struct vfs_not_implemented_get_dos_attributes_state {
722         struct vfs_aio_state aio_state;
723         uint32_t dosmode;
724 };
725
726 struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
727                         TALLOC_CTX *mem_ctx,
728                         struct tevent_context *ev,
729                         struct vfs_handle_struct *handle,
730                         files_struct *dir_fsp,
731                         struct smb_filename *smb_fname)
732 {
733         struct tevent_req *req = NULL;
734         struct vfs_not_implemented_get_dos_attributes_state *state = NULL;
735
736         req = tevent_req_create(mem_ctx, &state,
737                         struct vfs_not_implemented_get_dos_attributes_state);
738         if (req == NULL) {
739                 return NULL;
740         }
741
742         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
743         return tevent_req_post(req, ev);
744 }
745
746 NTSTATUS vfs_not_implemented_get_dos_attributes_recv(
747                         struct tevent_req *req,
748                         struct vfs_aio_state *aio_state,
749                         uint32_t *dosmode)
750 {
751         struct vfs_not_implemented_get_dos_attributes_state *state =
752                 tevent_req_data(req,
753                 struct vfs_not_implemented_get_dos_attributes_state);
754         NTSTATUS status;
755
756         if (tevent_req_is_nterror(req, &status)) {
757                 tevent_req_received(req);
758                 return status;
759         }
760
761         *aio_state = state->aio_state;
762         *dosmode = state->dosmode;
763         tevent_req_received(req);
764         return NT_STATUS_OK;
765 }
766
767 NTSTATUS vfs_not_implemented_fget_dos_attributes(struct vfs_handle_struct *handle,
768                                                  struct files_struct *fsp,
769                                                  uint32_t *dosmode)
770 {
771         return NT_STATUS_NOT_IMPLEMENTED;
772 }
773
774 NTSTATUS vfs_not_implemented_set_dos_attributes(struct vfs_handle_struct *handle,
775                                                 const struct smb_filename *smb_fname,
776                                                 uint32_t dosmode)
777 {
778         return NT_STATUS_NOT_IMPLEMENTED;
779 }
780
781 NTSTATUS vfs_not_implemented_fset_dos_attributes(struct vfs_handle_struct *handle,
782                                                  struct files_struct *fsp,
783                                                  uint32_t dosmode)
784 {
785         return NT_STATUS_NOT_IMPLEMENTED;
786 }
787
788 NTSTATUS vfs_not_implemented_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
789                                          uint32_t security_info,
790                                          TALLOC_CTX *mem_ctx,
791                                          struct security_descriptor **ppdesc)
792 {
793         return NT_STATUS_NOT_IMPLEMENTED;
794 }
795
796 NTSTATUS vfs_not_implemented_get_nt_acl(vfs_handle_struct *handle,
797                                         const struct smb_filename *smb_fname,
798                                         uint32_t security_info,
799                                         TALLOC_CTX *mem_ctx,
800                                         struct security_descriptor **ppdesc)
801 {
802         return NT_STATUS_NOT_IMPLEMENTED;
803 }
804
805 NTSTATUS vfs_not_implemented_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
806                                          uint32_t security_info_sent,
807                                          const struct security_descriptor *psd)
808 {
809         return NT_STATUS_NOT_IMPLEMENTED;
810 }
811
812 SMB_ACL_T vfs_not_implemented_sys_acl_get_file(vfs_handle_struct *handle,
813                                                const struct smb_filename *smb_fname,
814                                                SMB_ACL_TYPE_T type,
815                                                TALLOC_CTX *mem_ctx)
816 {
817         errno = ENOSYS;
818         return (SMB_ACL_T) NULL;
819 }
820
821 SMB_ACL_T vfs_not_implemented_sys_acl_get_fd(vfs_handle_struct *handle,
822                                              files_struct *fsp, TALLOC_CTX *mem_ctx)
823 {
824         errno = ENOSYS;
825         return (SMB_ACL_T) NULL;
826 }
827
828 int vfs_not_implemented_sys_acl_blob_get_file(vfs_handle_struct *handle,
829                                 const struct smb_filename *smb_fname,
830                                 TALLOC_CTX *mem_ctx,
831                                 char **blob_description,
832                                 DATA_BLOB *blob)
833 {
834         errno = ENOSYS;
835         return -1;
836 }
837
838 int vfs_not_implemented_sys_acl_blob_get_fd(vfs_handle_struct *handle,
839                                 files_struct *fsp, TALLOC_CTX *mem_ctx,
840                                 char **blob_description, DATA_BLOB *blob)
841 {
842         errno = ENOSYS;
843         return -1;
844 }
845
846 int vfs_not_implemented_sys_acl_set_file(vfs_handle_struct *handle,
847                                 const struct smb_filename *smb_fname,
848                                 SMB_ACL_TYPE_T acltype,
849                                 SMB_ACL_T theacl)
850 {
851         errno = ENOSYS;
852         return -1;
853 }
854
855 int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
856                                        SMB_ACL_T theacl)
857 {
858         errno = ENOSYS;
859         return -1;
860 }
861
862 int vfs_not_implemented_sys_acl_delete_def_file(vfs_handle_struct *handle,
863                                         const struct smb_filename *smb_fname)
864 {
865         errno = ENOSYS;
866         return -1;
867 }
868
869 ssize_t vfs_not_implemented_getxattr(vfs_handle_struct *handle,
870                                 const struct smb_filename *smb_fname,
871                                 const char *name,
872                                 void *value,
873                                 size_t size)
874 {
875         errno = ENOSYS;
876         return -1;
877 }
878
879 struct vfs_not_implemented_getxattrat_state {
880         struct vfs_aio_state aio_state;
881         ssize_t xattr_size;
882         uint8_t *xattr_value;
883 };
884
885 struct tevent_req *vfs_not_implemented_getxattrat_send(
886                         TALLOC_CTX *mem_ctx,
887                         struct tevent_context *ev,
888                         struct vfs_handle_struct *handle,
889                         files_struct *dir_fsp,
890                         const struct smb_filename *smb_fname,
891                         const char *xattr_name,
892                         size_t alloc_hint)
893 {
894         struct tevent_req *req = NULL;
895         struct vfs_not_implemented_getxattrat_state *state = NULL;
896
897         req = tevent_req_create(mem_ctx, &state,
898                                 struct vfs_not_implemented_getxattrat_state);
899         if (req == NULL) {
900                 return NULL;
901         }
902
903         tevent_req_error(req, ENOSYS);
904         return tevent_req_post(req, ev);
905 }
906
907 ssize_t vfs_not_implemented_getxattrat_recv(struct tevent_req *req,
908                                     struct vfs_aio_state *aio_state,
909                                     TALLOC_CTX *mem_ctx,
910                                     uint8_t **xattr_value)
911 {
912         struct vfs_not_implemented_getxattrat_state *state = tevent_req_data(
913                 req, struct vfs_not_implemented_getxattrat_state);
914         ssize_t xattr_size;
915
916         if (tevent_req_is_unix_error(req, &aio_state->error)) {
917                 tevent_req_received(req);
918                 return -1;
919         }
920
921         *aio_state = state->aio_state;
922         xattr_size = state->xattr_size;
923         if (xattr_value != NULL) {
924                 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
925         }
926
927         tevent_req_received(req);
928         return xattr_size;
929 }
930
931 ssize_t vfs_not_implemented_fgetxattr(vfs_handle_struct *handle,
932                               struct files_struct *fsp, const char *name,
933                               void *value, size_t size)
934 {
935         errno = ENOSYS;
936         return -1;
937 }
938
939 ssize_t vfs_not_implemented_listxattr(vfs_handle_struct *handle,
940                                       const struct smb_filename *smb_fname,
941                                       char *list,
942                                       size_t size)
943 {
944         errno = ENOSYS;
945         return -1;
946 }
947
948 ssize_t vfs_not_implemented_flistxattr(vfs_handle_struct *handle,
949                                        struct files_struct *fsp, char *list,
950                                        size_t size)
951 {
952         errno = ENOSYS;
953         return -1;
954 }
955
956 int vfs_not_implemented_removexattr(vfs_handle_struct *handle,
957                                     const struct smb_filename *smb_fname,
958                                     const char *name)
959 {
960         errno = ENOSYS;
961         return -1;
962 }
963
964 int vfs_not_implemented_fremovexattr(vfs_handle_struct *handle,
965                                      struct files_struct *fsp, const char *name)
966 {
967         errno = ENOSYS;
968         return -1;
969 }
970
971 int vfs_not_implemented_setxattr(vfs_handle_struct *handle,
972                                  const struct smb_filename *smb_fname,
973                                  const char *name,
974                                  const void *value,
975                                  size_t size,
976                                  int flags)
977 {
978         errno = ENOSYS;
979         return -1;
980 }
981
982 int vfs_not_implemented_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
983                                   const char *name, const void *value, size_t size,
984                                   int flags)
985 {
986         errno = ENOSYS;
987         return -1;
988 }
989
990 bool vfs_not_implemented_aio_force(struct vfs_handle_struct *handle,
991                                    struct files_struct *fsp)
992 {
993         errno = ENOSYS;
994         return false;
995 }
996
997 NTSTATUS vfs_not_implemented_audit_file(struct vfs_handle_struct *handle,
998                                         struct smb_filename *file,
999                                         struct security_acl *sacl,
1000                                         uint32_t access_requested,
1001                                         uint32_t access_denied)
1002 {
1003         return NT_STATUS_NOT_IMPLEMENTED;
1004 }
1005
1006 NTSTATUS vfs_not_implemented_durable_cookie(struct vfs_handle_struct *handle,
1007                                             struct files_struct *fsp,
1008                                             TALLOC_CTX *mem_ctx,
1009                                             DATA_BLOB *cookie)
1010 {
1011         return NT_STATUS_NOT_IMPLEMENTED;
1012 }
1013
1014 NTSTATUS vfs_not_implemented_durable_disconnect(struct vfs_handle_struct *handle,
1015                                                 struct files_struct *fsp,
1016                                                 const DATA_BLOB old_cookie,
1017                                                 TALLOC_CTX *mem_ctx,
1018                                                 DATA_BLOB *new_cookie)
1019 {
1020         return NT_STATUS_NOT_IMPLEMENTED;
1021 }
1022
1023 NTSTATUS vfs_not_implemented_durable_reconnect(struct vfs_handle_struct *handle,
1024                                                struct smb_request *smb1req,
1025                                                struct smbXsrv_open *op,
1026                                                const DATA_BLOB old_cookie,
1027                                                TALLOC_CTX *mem_ctx,
1028                                                struct files_struct **fsp,
1029                                                DATA_BLOB *new_cookie)
1030 {
1031         return NT_STATUS_NOT_IMPLEMENTED;
1032 }
1033
1034 /* VFS operations structure */
1035
1036 static struct vfs_fn_pointers vfs_not_implemented_fns = {
1037         /* Disk operations */
1038
1039         .connect_fn = vfs_not_implemented_connect,
1040         .disconnect_fn = vfs_not_implemented_disconnect,
1041         .disk_free_fn = vfs_not_implemented_disk_free,
1042         .get_quota_fn = vfs_not_implemented_get_quota,
1043         .set_quota_fn = vfs_not_implemented_set_quota,
1044         .get_shadow_copy_data_fn = vfs_not_implemented_get_shadow_copy_data,
1045         .statvfs_fn = vfs_not_implemented_statvfs,
1046         .fs_capabilities_fn = vfs_not_implemented_fs_capabilities,
1047         .get_dfs_referrals_fn = vfs_not_implemented_get_dfs_referrals,
1048         .snap_check_path_fn = vfs_not_implemented_snap_check_path,
1049         .snap_create_fn = vfs_not_implemented_snap_create,
1050         .snap_delete_fn = vfs_not_implemented_snap_delete,
1051
1052         /* Directory operations */
1053
1054         .opendir_fn = vfs_not_implemented_opendir,
1055         .fdopendir_fn = vfs_not_implemented_fdopendir,
1056         .readdir_fn = vfs_not_implemented_readdir,
1057         .seekdir_fn = vfs_not_implemented_seekdir,
1058         .telldir_fn = vfs_not_implemented_telldir,
1059         .rewind_dir_fn = vfs_not_implemented_rewind_dir,
1060         .mkdirat_fn = vfs_not_implemented_mkdirat,
1061         .rmdir_fn = vfs_not_implemented_rmdir,
1062         .closedir_fn = vfs_not_implemented_closedir,
1063
1064         /* File operations */
1065
1066         .open_fn = vfs_not_implemented_open,
1067         .create_file_fn = vfs_not_implemented_create_file,
1068         .close_fn = vfs_not_implemented_close_fn,
1069         .pread_fn = vfs_not_implemented_pread,
1070         .pread_send_fn = vfs_not_implemented_pread_send,
1071         .pread_recv_fn = vfs_not_implemented_pread_recv,
1072         .pwrite_fn = vfs_not_implemented_pwrite,
1073         .pwrite_send_fn = vfs_not_implemented_pwrite_send,
1074         .pwrite_recv_fn = vfs_not_implemented_pwrite_recv,
1075         .lseek_fn = vfs_not_implemented_lseek,
1076         .sendfile_fn = vfs_not_implemented_sendfile,
1077         .recvfile_fn = vfs_not_implemented_recvfile,
1078         .renameat_fn = vfs_not_implemented_renameat,
1079         .fsync_send_fn = vfs_not_implemented_fsync_send,
1080         .fsync_recv_fn = vfs_not_implemented_fsync_recv,
1081         .stat_fn = vfs_not_implemented_stat,
1082         .fstat_fn = vfs_not_implemented_fstat,
1083         .lstat_fn = vfs_not_implemented_lstat,
1084         .get_alloc_size_fn = vfs_not_implemented_get_alloc_size,
1085         .unlinkat_fn = vfs_not_implemented_unlinkat,
1086         .chmod_fn = vfs_not_implemented_chmod,
1087         .fchmod_fn = vfs_not_implemented_fchmod,
1088         .chown_fn = vfs_not_implemented_chown,
1089         .fchown_fn = vfs_not_implemented_fchown,
1090         .lchown_fn = vfs_not_implemented_lchown,
1091         .chdir_fn = vfs_not_implemented_chdir,
1092         .getwd_fn = vfs_not_implemented_getwd,
1093         .ntimes_fn = vfs_not_implemented_ntimes,
1094         .ftruncate_fn = vfs_not_implemented_ftruncate,
1095         .fallocate_fn = vfs_not_implemented_fallocate,
1096         .lock_fn = vfs_not_implemented_lock,
1097         .kernel_flock_fn = vfs_not_implemented_kernel_flock,
1098         .linux_setlease_fn = vfs_not_implemented_linux_setlease,
1099         .getlock_fn = vfs_not_implemented_getlock,
1100         .symlinkat_fn = vfs_not_implemented_symlinkat,
1101         .readlinkat_fn = vfs_not_implemented_vfs_readlinkat,
1102         .linkat_fn = vfs_not_implemented_linkat,
1103         .mknodat_fn = vfs_not_implemented_mknodat,
1104         .realpath_fn = vfs_not_implemented_realpath,
1105         .chflags_fn = vfs_not_implemented_chflags,
1106         .file_id_create_fn = vfs_not_implemented_file_id_create,
1107         .fs_file_id_fn = vfs_not_implemented_fs_file_id,
1108         .offload_read_send_fn = vfs_not_implemented_offload_read_send,
1109         .offload_read_recv_fn = vfs_not_implemented_offload_read_recv,
1110         .offload_write_send_fn = vfs_not_implemented_offload_write_send,
1111         .offload_write_recv_fn = vfs_not_implemented_offload_write_recv,
1112         .get_compression_fn = vfs_not_implemented_get_compression,
1113         .set_compression_fn = vfs_not_implemented_set_compression,
1114
1115         .streaminfo_fn = vfs_not_implemented_streaminfo,
1116         .get_real_filename_fn = vfs_not_implemented_get_real_filename,
1117         .connectpath_fn = vfs_not_implemented_connectpath,
1118         .brl_lock_windows_fn = vfs_not_implemented_brl_lock_windows,
1119         .brl_unlock_windows_fn = vfs_not_implemented_brl_unlock_windows,
1120         .strict_lock_check_fn = vfs_not_implemented_strict_lock_check,
1121         .translate_name_fn = vfs_not_implemented_translate_name,
1122         .fsctl_fn = vfs_not_implemented_fsctl,
1123         .readdir_attr_fn = vfs_not_implemented_readdir_attr,
1124         .audit_file_fn = vfs_not_implemented_audit_file,
1125
1126         /* DOS attributes. */
1127         .get_dos_attributes_fn = vfs_not_implemented_get_dos_attributes,
1128         .get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
1129         .get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
1130         .fget_dos_attributes_fn = vfs_not_implemented_fget_dos_attributes,
1131         .set_dos_attributes_fn = vfs_not_implemented_set_dos_attributes,
1132         .fset_dos_attributes_fn = vfs_not_implemented_fset_dos_attributes,
1133
1134         /* NT ACL operations. */
1135
1136         .fget_nt_acl_fn = vfs_not_implemented_fget_nt_acl,
1137         .get_nt_acl_fn = vfs_not_implemented_get_nt_acl,
1138         .fset_nt_acl_fn = vfs_not_implemented_fset_nt_acl,
1139
1140         /* POSIX ACL operations. */
1141
1142         .sys_acl_get_file_fn = vfs_not_implemented_sys_acl_get_file,
1143         .sys_acl_get_fd_fn = vfs_not_implemented_sys_acl_get_fd,
1144         .sys_acl_blob_get_file_fn = vfs_not_implemented_sys_acl_blob_get_file,
1145         .sys_acl_blob_get_fd_fn = vfs_not_implemented_sys_acl_blob_get_fd,
1146         .sys_acl_set_file_fn = vfs_not_implemented_sys_acl_set_file,
1147         .sys_acl_set_fd_fn = vfs_not_implemented_sys_acl_set_fd,
1148         .sys_acl_delete_def_file_fn = vfs_not_implemented_sys_acl_delete_def_file,
1149
1150         /* EA operations. */
1151         .getxattr_fn = vfs_not_implemented_getxattr,
1152         .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
1153         .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
1154         .fgetxattr_fn = vfs_not_implemented_fgetxattr,
1155         .listxattr_fn = vfs_not_implemented_listxattr,
1156         .flistxattr_fn = vfs_not_implemented_flistxattr,
1157         .removexattr_fn = vfs_not_implemented_removexattr,
1158         .fremovexattr_fn = vfs_not_implemented_fremovexattr,
1159         .setxattr_fn = vfs_not_implemented_setxattr,
1160         .fsetxattr_fn = vfs_not_implemented_fsetxattr,
1161
1162         /* aio operations */
1163         .aio_force_fn = vfs_not_implemented_aio_force,
1164
1165         /* durable handle operations */
1166         .durable_cookie_fn = vfs_not_implemented_durable_cookie,
1167         .durable_disconnect_fn = vfs_not_implemented_durable_disconnect,
1168         .durable_reconnect_fn = vfs_not_implemented_durable_reconnect,
1169 };
1170
1171 static_decl_vfs;
1172 NTSTATUS vfs_not_implemented_init(TALLOC_CTX *ctx)
1173 {
1174         /*
1175          * smb_vfs_assert_all_fns() makes sure every
1176          * call is implemented.
1177          */
1178         smb_vfs_assert_all_fns(&vfs_not_implemented_fns, "vfs_not_implemented");
1179         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "vfs_not_implemented",
1180                                 &vfs_not_implemented_fns);
1181 }