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