VFS: Add SMB_VFS_FREADDIR_ATTR()
[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_fchmod(vfs_handle_struct *handle, files_struct *fsp,
363                                mode_t mode)
364 {
365         errno = ENOSYS;
366         return -1;
367 }
368
369 int vfs_not_implemented_fchown(vfs_handle_struct *handle, files_struct *fsp,
370                                uid_t uid, gid_t gid)
371 {
372         errno = ENOSYS;
373         return -1;
374 }
375
376 int vfs_not_implemented_lchown(vfs_handle_struct *handle,
377                                const struct smb_filename *smb_fname,
378                                uid_t uid,
379                                gid_t gid)
380 {
381         errno = ENOSYS;
382         return -1;
383 }
384
385 int vfs_not_implemented_chdir(vfs_handle_struct *handle,
386                               const struct smb_filename *smb_fname)
387 {
388         errno = ENOSYS;
389         return -1;
390 }
391
392 struct smb_filename *vfs_not_implemented_getwd(vfs_handle_struct *handle,
393                                                TALLOC_CTX *ctx)
394 {
395         errno = ENOSYS;
396         return NULL;
397 }
398
399 int vfs_not_implemented_fntimes(vfs_handle_struct *handle,
400                                 files_struct *fsp,
401                                 struct smb_file_time *ft)
402 {
403         errno = ENOSYS;
404         return -1;
405 }
406
407 int vfs_not_implemented_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
408                                   off_t offset)
409 {
410         errno = ENOSYS;
411         return -1;
412 }
413
414 int vfs_not_implemented_fallocate(vfs_handle_struct *handle, files_struct *fsp,
415                                   uint32_t mode, off_t offset, off_t len)
416 {
417         errno = ENOSYS;
418         return -1;
419 }
420
421 bool vfs_not_implemented_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
422                               off_t offset, off_t count, int type)
423 {
424         errno = ENOSYS;
425         return false;
426 }
427
428 int vfs_not_implemented_kernel_flock(struct vfs_handle_struct *handle,
429                                      struct files_struct *fsp,
430                                      uint32_t share_access, uint32_t access_mask)
431 {
432         errno = ENOSYS;
433         return -1;
434 }
435
436 int vfs_not_implemented_fcntl(struct vfs_handle_struct *handle,
437                               struct files_struct *fsp, int cmd,
438                               va_list cmd_arg)
439 {
440         errno = ENOSYS;
441         return -1;
442 }
443
444 int vfs_not_implemented_linux_setlease(struct vfs_handle_struct *handle,
445                                        struct files_struct *fsp, int leasetype)
446 {
447         errno = ENOSYS;
448         return -1;
449 }
450
451 bool vfs_not_implemented_getlock(vfs_handle_struct *handle, files_struct *fsp,
452                                  off_t *poffset, off_t *pcount, int *ptype,
453                                  pid_t *ppid)
454 {
455         errno = ENOSYS;
456         return false;
457 }
458
459 int vfs_not_implemented_symlinkat(vfs_handle_struct *handle,
460                                 const struct smb_filename *link_contents,
461                                 struct files_struct *dirfsp,
462                                 const struct smb_filename *new_smb_fname)
463 {
464         errno = ENOSYS;
465         return -1;
466 }
467
468 int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle,
469                         const struct files_struct *dirfsp,
470                         const struct smb_filename *smb_fname,
471                         char *buf,
472                         size_t bufsiz)
473 {
474         errno = ENOSYS;
475         return -1;
476 }
477
478 int vfs_not_implemented_linkat(vfs_handle_struct *handle,
479                         files_struct *srcfsp,
480                         const struct smb_filename *old_smb_fname,
481                         files_struct *dstfsp,
482                         const struct smb_filename *new_smb_fname,
483                         int flags)
484 {
485         errno = ENOSYS;
486         return -1;
487 }
488
489 int vfs_not_implemented_mknodat(vfs_handle_struct *handle,
490                         files_struct *dirfsp,
491                         const struct smb_filename *smb_fname,
492                         mode_t mode,
493                         SMB_DEV_T dev)
494 {
495         errno = ENOSYS;
496         return -1;
497 }
498
499 struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
500                                                   TALLOC_CTX *ctx,
501                                                   const struct smb_filename *smb_fname)
502 {
503         errno = ENOSYS;
504         return NULL;
505 }
506
507 int vfs_not_implemented_chflags(vfs_handle_struct *handle,
508                                 const struct smb_filename *smb_fname,
509                                 uint flags)
510 {
511         errno = ENOSYS;
512         return -1;
513 }
514
515 struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
516                                                   const SMB_STRUCT_STAT *sbuf)
517 {
518         struct file_id id;
519         ZERO_STRUCT(id);
520         errno = ENOSYS;
521         return id;
522 }
523
524 uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
525                                         const SMB_STRUCT_STAT *sbuf)
526 {
527         errno = ENOSYS;
528         return 0;
529 }
530
531 struct vfs_not_implemented_offload_read_state {
532         bool dummy;
533 };
534
535 struct tevent_req *vfs_not_implemented_offload_read_send(
536                         TALLOC_CTX *mem_ctx,
537                         struct tevent_context *ev,
538                         struct vfs_handle_struct *handle,
539                         struct files_struct *fsp,
540                         uint32_t fsctl,
541                         uint32_t ttl,
542                         off_t offset,
543                         size_t to_copy)
544 {
545         struct tevent_req *req = NULL;
546         struct vfs_not_implemented_offload_read_state *state = NULL;
547
548         req = tevent_req_create(mem_ctx, &state,
549                                 struct vfs_not_implemented_offload_read_state);
550         if (req == NULL) {
551                 return NULL;
552         }
553
554         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
555         return tevent_req_post(req, ev);
556 }
557
558 NTSTATUS vfs_not_implemented_offload_read_recv(struct tevent_req *req,
559                                        struct vfs_handle_struct *handle,
560                                        TALLOC_CTX *mem_ctx,
561                                        DATA_BLOB *_token_blob)
562 {
563         NTSTATUS status;
564
565         if (tevent_req_is_nterror(req, &status)) {
566                 tevent_req_received(req);
567                 return status;
568         }
569
570         tevent_req_received(req);
571         return NT_STATUS_OK;
572 }
573
574 struct vfs_not_implemented_offload_write_state {
575         uint64_t unused;
576 };
577
578 struct tevent_req *vfs_not_implemented_offload_write_send(
579                         struct vfs_handle_struct *handle,
580                         TALLOC_CTX *mem_ctx,
581                         struct tevent_context *ev,
582                         uint32_t fsctl,
583                         DATA_BLOB *token,
584                         off_t transfer_offset,
585                         struct files_struct *dest_fsp,
586                         off_t dest_off,
587                         off_t num)
588 {
589         struct tevent_req *req;
590         struct vfs_not_implemented_offload_write_state *state;
591
592         req = tevent_req_create(mem_ctx, &state,
593                                 struct vfs_not_implemented_offload_write_state);
594         if (req == NULL) {
595                 return NULL;
596         }
597
598         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
599         return tevent_req_post(req, ev);
600 }
601
602 NTSTATUS vfs_not_implemented_offload_write_recv(struct vfs_handle_struct *handle,
603                                                 struct tevent_req *req,
604                                                 off_t *copied)
605 {
606         NTSTATUS status;
607
608         if (tevent_req_is_nterror(req, &status)) {
609                 tevent_req_received(req);
610                 return status;
611         }
612
613         tevent_req_received(req);
614         return NT_STATUS_OK;
615 }
616
617 NTSTATUS vfs_not_implemented_fget_compression(struct vfs_handle_struct *handle,
618                                              TALLOC_CTX *mem_ctx,
619                                              struct files_struct *fsp,
620                                              uint16_t *_compression_fmt)
621 {
622         return NT_STATUS_INVALID_DEVICE_REQUEST;
623 }
624
625 NTSTATUS vfs_not_implemented_set_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_fstreaminfo(struct vfs_handle_struct *handle,
634                                         struct files_struct *fsp,
635                                         TALLOC_CTX *mem_ctx,
636                                         unsigned int *num_streams,
637                                         struct stream_struct **streams)
638 {
639         return NT_STATUS_NOT_IMPLEMENTED;
640 }
641
642 int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
643                                           const struct smb_filename *path,
644                                           const char *name,
645                                           TALLOC_CTX *mem_ctx,
646                                           char **found_name)
647 {
648         errno = ENOSYS;
649         return -1;
650 }
651
652 const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
653                                             const struct smb_filename *smb_fname)
654 {
655         errno = ENOSYS;
656         return NULL;
657 }
658
659 NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
660                                               struct byte_range_lock *br_lck,
661                                               struct lock_struct *plock)
662 {
663         return NT_STATUS_NOT_IMPLEMENTED;
664 }
665
666 bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
667                                             struct byte_range_lock *br_lck,
668                                             const struct lock_struct *plock)
669 {
670         errno = ENOSYS;
671         return false;
672 }
673
674 bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,
675                                            struct files_struct *fsp,
676                                            struct lock_struct *plock)
677 {
678         errno = ENOSYS;
679         return false;
680 }
681
682 NTSTATUS vfs_not_implemented_translate_name(struct vfs_handle_struct *handle,
683                                             const char *mapped_name,
684                                             enum vfs_translate_direction direction,
685                                             TALLOC_CTX *mem_ctx, char **pmapped_name)
686 {
687         return NT_STATUS_NOT_IMPLEMENTED;
688 }
689
690 NTSTATUS vfs_not_implemented_fsctl(struct vfs_handle_struct *handle,
691                                    struct files_struct *fsp,
692                                    TALLOC_CTX *ctx,
693                                    uint32_t function,
694                                    uint16_t req_flags,  /* Needed for UNICODE ... */
695                                    const uint8_t *_in_data,
696                                    uint32_t in_len,
697                                    uint8_t **_out_data,
698                                    uint32_t max_out_len, uint32_t *out_len)
699 {
700         return NT_STATUS_NOT_IMPLEMENTED;
701 }
702
703 NTSTATUS vfs_not_implemented_readdir_attr(struct vfs_handle_struct *handle,
704                                           const struct smb_filename *fname,
705                                           TALLOC_CTX *mem_ctx,
706                                           struct readdir_attr_data **pattr_data)
707 {
708         return NT_STATUS_NOT_IMPLEMENTED;
709 }
710
711 NTSTATUS vfs_not_implemented_freaddir_attr(struct vfs_handle_struct *handle,
712                                         struct files_struct *fsp,
713                                         TALLOC_CTX *mem_ctx,
714                                         struct readdir_attr_data **pattr_data)
715 {
716         return NT_STATUS_NOT_IMPLEMENTED;
717 }
718
719 struct vfs_not_implemented_get_dos_attributes_state {
720         struct vfs_aio_state aio_state;
721         uint32_t dosmode;
722 };
723
724 struct tevent_req *vfs_not_implemented_get_dos_attributes_send(
725                         TALLOC_CTX *mem_ctx,
726                         struct tevent_context *ev,
727                         struct vfs_handle_struct *handle,
728                         files_struct *dir_fsp,
729                         struct smb_filename *smb_fname)
730 {
731         struct tevent_req *req = NULL;
732         struct vfs_not_implemented_get_dos_attributes_state *state = NULL;
733
734         req = tevent_req_create(mem_ctx, &state,
735                         struct vfs_not_implemented_get_dos_attributes_state);
736         if (req == NULL) {
737                 return NULL;
738         }
739
740         tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
741         return tevent_req_post(req, ev);
742 }
743
744 NTSTATUS vfs_not_implemented_get_dos_attributes_recv(
745                         struct tevent_req *req,
746                         struct vfs_aio_state *aio_state,
747                         uint32_t *dosmode)
748 {
749         struct vfs_not_implemented_get_dos_attributes_state *state =
750                 tevent_req_data(req,
751                 struct vfs_not_implemented_get_dos_attributes_state);
752         NTSTATUS status;
753
754         if (tevent_req_is_nterror(req, &status)) {
755                 tevent_req_received(req);
756                 return status;
757         }
758
759         *aio_state = state->aio_state;
760         *dosmode = state->dosmode;
761         tevent_req_received(req);
762         return NT_STATUS_OK;
763 }
764
765 NTSTATUS vfs_not_implemented_fget_dos_attributes(struct vfs_handle_struct *handle,
766                                                  struct files_struct *fsp,
767                                                  uint32_t *dosmode)
768 {
769         return NT_STATUS_NOT_IMPLEMENTED;
770 }
771
772 NTSTATUS vfs_not_implemented_fset_dos_attributes(struct vfs_handle_struct *handle,
773                                                  struct files_struct *fsp,
774                                                  uint32_t dosmode)
775 {
776         return NT_STATUS_NOT_IMPLEMENTED;
777 }
778
779 NTSTATUS vfs_not_implemented_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
780                                          uint32_t security_info,
781                                          TALLOC_CTX *mem_ctx,
782                                          struct security_descriptor **ppdesc)
783 {
784         return NT_STATUS_NOT_IMPLEMENTED;
785 }
786
787 NTSTATUS vfs_not_implemented_get_nt_acl_at(vfs_handle_struct *handle,
788                                         struct files_struct *dirfsp,
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_fd(vfs_handle_struct *handle,
839                                        struct files_struct *fsp,
840                                        SMB_ACL_TYPE_T type,
841                                        SMB_ACL_T theacl)
842 {
843         errno = ENOSYS;
844         return -1;
845 }
846
847 int vfs_not_implemented_sys_acl_delete_def_file(vfs_handle_struct *handle,
848                                         const struct smb_filename *smb_fname)
849 {
850         errno = ENOSYS;
851         return -1;
852 }
853
854 ssize_t vfs_not_implemented_getxattr(vfs_handle_struct *handle,
855                                 const struct smb_filename *smb_fname,
856                                 const char *name,
857                                 void *value,
858                                 size_t size)
859 {
860         errno = ENOSYS;
861         return -1;
862 }
863
864 struct vfs_not_implemented_getxattrat_state {
865         struct vfs_aio_state aio_state;
866         ssize_t xattr_size;
867         uint8_t *xattr_value;
868 };
869
870 struct tevent_req *vfs_not_implemented_getxattrat_send(
871                         TALLOC_CTX *mem_ctx,
872                         struct tevent_context *ev,
873                         struct vfs_handle_struct *handle,
874                         files_struct *dir_fsp,
875                         const struct smb_filename *smb_fname,
876                         const char *xattr_name,
877                         size_t alloc_hint)
878 {
879         struct tevent_req *req = NULL;
880         struct vfs_not_implemented_getxattrat_state *state = NULL;
881
882         req = tevent_req_create(mem_ctx, &state,
883                                 struct vfs_not_implemented_getxattrat_state);
884         if (req == NULL) {
885                 return NULL;
886         }
887
888         tevent_req_error(req, ENOSYS);
889         return tevent_req_post(req, ev);
890 }
891
892 ssize_t vfs_not_implemented_getxattrat_recv(struct tevent_req *req,
893                                     struct vfs_aio_state *aio_state,
894                                     TALLOC_CTX *mem_ctx,
895                                     uint8_t **xattr_value)
896 {
897         struct vfs_not_implemented_getxattrat_state *state = tevent_req_data(
898                 req, struct vfs_not_implemented_getxattrat_state);
899         ssize_t xattr_size;
900
901         if (tevent_req_is_unix_error(req, &aio_state->error)) {
902                 tevent_req_received(req);
903                 return -1;
904         }
905
906         *aio_state = state->aio_state;
907         xattr_size = state->xattr_size;
908         if (xattr_value != NULL) {
909                 *xattr_value = talloc_move(mem_ctx, &state->xattr_value);
910         }
911
912         tevent_req_received(req);
913         return xattr_size;
914 }
915
916 ssize_t vfs_not_implemented_fgetxattr(vfs_handle_struct *handle,
917                               struct files_struct *fsp, const char *name,
918                               void *value, size_t size)
919 {
920         errno = ENOSYS;
921         return -1;
922 }
923
924 ssize_t vfs_not_implemented_flistxattr(vfs_handle_struct *handle,
925                                        struct files_struct *fsp, char *list,
926                                        size_t size)
927 {
928         errno = ENOSYS;
929         return -1;
930 }
931
932 int vfs_not_implemented_fremovexattr(vfs_handle_struct *handle,
933                                      struct files_struct *fsp, const char *name)
934 {
935         errno = ENOSYS;
936         return -1;
937 }
938
939 int vfs_not_implemented_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
940                                   const char *name, const void *value, size_t size,
941                                   int flags)
942 {
943         errno = ENOSYS;
944         return -1;
945 }
946
947 bool vfs_not_implemented_aio_force(struct vfs_handle_struct *handle,
948                                    struct files_struct *fsp)
949 {
950         errno = ENOSYS;
951         return false;
952 }
953
954 NTSTATUS vfs_not_implemented_audit_file(struct vfs_handle_struct *handle,
955                                         struct smb_filename *file,
956                                         struct security_acl *sacl,
957                                         uint32_t access_requested,
958                                         uint32_t access_denied)
959 {
960         return NT_STATUS_NOT_IMPLEMENTED;
961 }
962
963 NTSTATUS vfs_not_implemented_durable_cookie(struct vfs_handle_struct *handle,
964                                             struct files_struct *fsp,
965                                             TALLOC_CTX *mem_ctx,
966                                             DATA_BLOB *cookie)
967 {
968         return NT_STATUS_NOT_IMPLEMENTED;
969 }
970
971 NTSTATUS vfs_not_implemented_durable_disconnect(struct vfs_handle_struct *handle,
972                                                 struct files_struct *fsp,
973                                                 const DATA_BLOB old_cookie,
974                                                 TALLOC_CTX *mem_ctx,
975                                                 DATA_BLOB *new_cookie)
976 {
977         return NT_STATUS_NOT_IMPLEMENTED;
978 }
979
980 NTSTATUS vfs_not_implemented_durable_reconnect(struct vfs_handle_struct *handle,
981                                                struct smb_request *smb1req,
982                                                struct smbXsrv_open *op,
983                                                const DATA_BLOB old_cookie,
984                                                TALLOC_CTX *mem_ctx,
985                                                struct files_struct **fsp,
986                                                DATA_BLOB *new_cookie)
987 {
988         return NT_STATUS_NOT_IMPLEMENTED;
989 }
990
991 /* VFS operations structure */
992
993 static struct vfs_fn_pointers vfs_not_implemented_fns = {
994         /* Disk operations */
995
996         .connect_fn = vfs_not_implemented_connect,
997         .disconnect_fn = vfs_not_implemented_disconnect,
998         .disk_free_fn = vfs_not_implemented_disk_free,
999         .get_quota_fn = vfs_not_implemented_get_quota,
1000         .set_quota_fn = vfs_not_implemented_set_quota,
1001         .get_shadow_copy_data_fn = vfs_not_implemented_get_shadow_copy_data,
1002         .statvfs_fn = vfs_not_implemented_statvfs,
1003         .fs_capabilities_fn = vfs_not_implemented_fs_capabilities,
1004         .get_dfs_referrals_fn = vfs_not_implemented_get_dfs_referrals,
1005         .create_dfs_pathat_fn = vfs_not_implemented_create_dfs_pathat,
1006         .read_dfs_pathat_fn = vfs_not_implemented_read_dfs_pathat,
1007         .snap_check_path_fn = vfs_not_implemented_snap_check_path,
1008         .snap_create_fn = vfs_not_implemented_snap_create,
1009         .snap_delete_fn = vfs_not_implemented_snap_delete,
1010
1011         /* Directory operations */
1012
1013         .fdopendir_fn = vfs_not_implemented_fdopendir,
1014         .readdir_fn = vfs_not_implemented_readdir,
1015         .seekdir_fn = vfs_not_implemented_seekdir,
1016         .telldir_fn = vfs_not_implemented_telldir,
1017         .rewind_dir_fn = vfs_not_implemented_rewind_dir,
1018         .mkdirat_fn = vfs_not_implemented_mkdirat,
1019         .closedir_fn = vfs_not_implemented_closedir,
1020
1021         /* File operations */
1022
1023         .openat_fn = vfs_not_implemented_openat,
1024         .create_file_fn = vfs_not_implemented_create_file,
1025         .close_fn = vfs_not_implemented_close_fn,
1026         .pread_fn = vfs_not_implemented_pread,
1027         .pread_send_fn = vfs_not_implemented_pread_send,
1028         .pread_recv_fn = vfs_not_implemented_pread_recv,
1029         .pwrite_fn = vfs_not_implemented_pwrite,
1030         .pwrite_send_fn = vfs_not_implemented_pwrite_send,
1031         .pwrite_recv_fn = vfs_not_implemented_pwrite_recv,
1032         .lseek_fn = vfs_not_implemented_lseek,
1033         .sendfile_fn = vfs_not_implemented_sendfile,
1034         .recvfile_fn = vfs_not_implemented_recvfile,
1035         .renameat_fn = vfs_not_implemented_renameat,
1036         .fsync_send_fn = vfs_not_implemented_fsync_send,
1037         .fsync_recv_fn = vfs_not_implemented_fsync_recv,
1038         .stat_fn = vfs_not_implemented_stat,
1039         .fstat_fn = vfs_not_implemented_fstat,
1040         .lstat_fn = vfs_not_implemented_lstat,
1041         .get_alloc_size_fn = vfs_not_implemented_get_alloc_size,
1042         .unlinkat_fn = vfs_not_implemented_unlinkat,
1043         .fchmod_fn = vfs_not_implemented_fchmod,
1044         .fchown_fn = vfs_not_implemented_fchown,
1045         .lchown_fn = vfs_not_implemented_lchown,
1046         .chdir_fn = vfs_not_implemented_chdir,
1047         .getwd_fn = vfs_not_implemented_getwd,
1048         .fntimes_fn = vfs_not_implemented_fntimes,
1049         .ftruncate_fn = vfs_not_implemented_ftruncate,
1050         .fallocate_fn = vfs_not_implemented_fallocate,
1051         .lock_fn = vfs_not_implemented_lock,
1052         .kernel_flock_fn = vfs_not_implemented_kernel_flock,
1053         .fcntl_fn = vfs_not_implemented_fcntl,
1054         .linux_setlease_fn = vfs_not_implemented_linux_setlease,
1055         .getlock_fn = vfs_not_implemented_getlock,
1056         .symlinkat_fn = vfs_not_implemented_symlinkat,
1057         .readlinkat_fn = vfs_not_implemented_vfs_readlinkat,
1058         .linkat_fn = vfs_not_implemented_linkat,
1059         .mknodat_fn = vfs_not_implemented_mknodat,
1060         .realpath_fn = vfs_not_implemented_realpath,
1061         .chflags_fn = vfs_not_implemented_chflags,
1062         .file_id_create_fn = vfs_not_implemented_file_id_create,
1063         .fs_file_id_fn = vfs_not_implemented_fs_file_id,
1064         .offload_read_send_fn = vfs_not_implemented_offload_read_send,
1065         .offload_read_recv_fn = vfs_not_implemented_offload_read_recv,
1066         .offload_write_send_fn = vfs_not_implemented_offload_write_send,
1067         .offload_write_recv_fn = vfs_not_implemented_offload_write_recv,
1068         .fget_compression_fn = vfs_not_implemented_fget_compression,
1069         .set_compression_fn = vfs_not_implemented_set_compression,
1070
1071         .fstreaminfo_fn = vfs_not_implemented_fstreaminfo,
1072         .get_real_filename_fn = vfs_not_implemented_get_real_filename,
1073         .connectpath_fn = vfs_not_implemented_connectpath,
1074         .brl_lock_windows_fn = vfs_not_implemented_brl_lock_windows,
1075         .brl_unlock_windows_fn = vfs_not_implemented_brl_unlock_windows,
1076         .strict_lock_check_fn = vfs_not_implemented_strict_lock_check,
1077         .translate_name_fn = vfs_not_implemented_translate_name,
1078         .fsctl_fn = vfs_not_implemented_fsctl,
1079         .readdir_attr_fn = vfs_not_implemented_readdir_attr,
1080         .freaddir_attr_fn = vfs_not_implemented_freaddir_attr,
1081         .audit_file_fn = vfs_not_implemented_audit_file,
1082
1083         /* DOS attributes. */
1084         .get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
1085         .get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
1086         .fget_dos_attributes_fn = vfs_not_implemented_fget_dos_attributes,
1087         .fset_dos_attributes_fn = vfs_not_implemented_fset_dos_attributes,
1088
1089         /* NT ACL operations. */
1090
1091         .fget_nt_acl_fn = vfs_not_implemented_fget_nt_acl,
1092         .get_nt_acl_at_fn = vfs_not_implemented_get_nt_acl_at,
1093         .fset_nt_acl_fn = vfs_not_implemented_fset_nt_acl,
1094
1095         /* POSIX ACL operations. */
1096
1097         .sys_acl_get_file_fn = vfs_not_implemented_sys_acl_get_file,
1098         .sys_acl_get_fd_fn = vfs_not_implemented_sys_acl_get_fd,
1099         .sys_acl_blob_get_file_fn = vfs_not_implemented_sys_acl_blob_get_file,
1100         .sys_acl_blob_get_fd_fn = vfs_not_implemented_sys_acl_blob_get_fd,
1101         .sys_acl_set_fd_fn = vfs_not_implemented_sys_acl_set_fd,
1102         .sys_acl_delete_def_file_fn = vfs_not_implemented_sys_acl_delete_def_file,
1103
1104         /* EA operations. */
1105         .getxattr_fn = vfs_not_implemented_getxattr,
1106         .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
1107         .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
1108         .fgetxattr_fn = vfs_not_implemented_fgetxattr,
1109         .flistxattr_fn = vfs_not_implemented_flistxattr,
1110         .fremovexattr_fn = vfs_not_implemented_fremovexattr,
1111         .fsetxattr_fn = vfs_not_implemented_fsetxattr,
1112
1113         /* aio operations */
1114         .aio_force_fn = vfs_not_implemented_aio_force,
1115
1116         /* durable handle operations */
1117         .durable_cookie_fn = vfs_not_implemented_durable_cookie,
1118         .durable_disconnect_fn = vfs_not_implemented_durable_disconnect,
1119         .durable_reconnect_fn = vfs_not_implemented_durable_reconnect,
1120 };
1121
1122 static_decl_vfs;
1123 NTSTATUS vfs_not_implemented_init(TALLOC_CTX *ctx)
1124 {
1125         /*
1126          * smb_vfs_assert_all_fns() makes sure every
1127          * call is implemented.
1128          */
1129         smb_vfs_assert_all_fns(&vfs_not_implemented_fns, "vfs_not_implemented");
1130         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "vfs_not_implemented",
1131                                 &vfs_not_implemented_fns);
1132 }