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