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