* add a few useful debug lines
[Samba/gebeck_regimport.git] / source / smbd / vfs-wrap.c
blob378a0a1e53cce96e1b8763902c626fa615198d2c
1 /*
2 Unix SMB/CIFS implementation.
3 Wrap disk only vfs functions to sidestep dodgy compilers.
4 Copyright (C) Tim Potter 1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "includes.h"
23 #undef DBGC_CLASS
24 #define DBGC_CLASS DBGC_VFS
27 /* Check for NULL pointer parameters in vfswrap_* functions */
29 /* We don't want to have NULL function pointers lying around. Someone
30 is sure to try and execute them. These stubs are used to prevent
31 this possibility. */
33 int vfswrap_dummy_connect(vfs_handle_struct *handle, connection_struct *conn, const char *service, const char *user)
35 return 0; /* Return >= 0 for success */
38 void vfswrap_dummy_disconnect(vfs_handle_struct *handle, connection_struct *conn)
42 /* Disk operations */
44 SMB_BIG_UINT vfswrap_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize,
45 SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
47 SMB_BIG_UINT result;
49 result = sys_disk_free(path, small_query, bsize, dfree, dsize);
50 return result;
53 int vfswrap_get_quota(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
55 #ifdef HAVE_SYS_QUOTAS
56 int result;
58 START_PROFILE(syscall_get_quota);
59 result = sys_get_quota(conn->connectpath, qtype, id, qt);
60 END_PROFILE(syscall_get_quota);
61 return result;
62 #else
63 errno = ENOSYS;
64 return -1;
65 #endif
68 int vfswrap_set_quota(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
70 #ifdef HAVE_SYS_QUOTAS
71 int result;
73 START_PROFILE(syscall_set_quota);
74 result = sys_set_quota(conn->connectpath, qtype, id, qt);
75 END_PROFILE(syscall_set_quota);
76 return result;
77 #else
78 errno = ENOSYS;
79 return -1;
80 #endif
83 int vfswrap_get_shadow_copy_data(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels)
85 errno = ENOSYS;
86 return -1; /* Not implemented. */
89 /* Directory operations */
91 DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname)
93 DIR *result;
95 START_PROFILE(syscall_opendir);
96 result = opendir(fname);
97 END_PROFILE(syscall_opendir);
98 return result;
101 struct dirent *vfswrap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
103 struct dirent *result;
105 START_PROFILE(syscall_readdir);
106 result = readdir(dirp);
107 END_PROFILE(syscall_readdir);
108 return result;
111 int vfswrap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode)
113 int result;
114 BOOL has_dacl = False;
116 START_PROFILE(syscall_mkdir);
118 if (lp_inherit_acls(SNUM(conn)) && (has_dacl = directory_has_default_acl(conn, parent_dirname(path))))
119 mode = 0777;
121 result = mkdir(path, mode);
123 if (result == 0 && !has_dacl) {
125 * We need to do this as the default behavior of POSIX ACLs
126 * is to set the mask to be the requested group permission
127 * bits, not the group permission bits to be the requested
128 * group permission bits. This is not what we want, as it will
129 * mess up any inherited ACL bits that were set. JRA.
131 int saved_errno = errno; /* We may get ENOSYS */
132 if ((SMB_VFS_CHMOD_ACL(conn, path, mode) == -1) && (errno == ENOSYS))
133 errno = saved_errno;
136 END_PROFILE(syscall_mkdir);
137 return result;
140 int vfswrap_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path)
142 int result;
144 START_PROFILE(syscall_rmdir);
145 result = rmdir(path);
146 END_PROFILE(syscall_rmdir);
147 return result;
150 int vfswrap_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
152 int result;
154 START_PROFILE(syscall_closedir);
155 result = closedir(dirp);
156 END_PROFILE(syscall_closedir);
157 return result;
160 /* File operations */
162 int vfswrap_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode)
164 int result;
166 START_PROFILE(syscall_open);
167 result = sys_open(fname, flags, mode);
168 END_PROFILE(syscall_open);
169 return result;
172 int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
174 int result;
176 START_PROFILE(syscall_close);
178 result = close(fd);
179 END_PROFILE(syscall_close);
180 return result;
183 ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n)
185 ssize_t result;
187 START_PROFILE_BYTES(syscall_read, n);
188 result = sys_read(fd, data, n);
189 END_PROFILE(syscall_read);
190 return result;
193 ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n)
195 ssize_t result;
197 START_PROFILE_BYTES(syscall_write, n);
198 result = sys_write(fd, data, n);
199 END_PROFILE(syscall_write);
200 return result;
203 SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
205 SMB_OFF_T result = 0;
207 START_PROFILE(syscall_lseek);
209 /* Cope with 'stat' file opens. */
210 if (filedes != -1)
211 result = sys_lseek(filedes, offset, whence);
214 * We want to maintain the fiction that we can seek
215 * on a fifo for file system purposes. This allows
216 * people to set up UNIX fifo's that feed data to Windows
217 * applications. JRA.
220 if((result == -1) && (errno == ESPIPE)) {
221 result = 0;
222 errno = 0;
225 END_PROFILE(syscall_lseek);
226 return result;
229 ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr,
230 SMB_OFF_T offset, size_t n)
232 ssize_t result;
234 START_PROFILE_BYTES(syscall_sendfile, n);
235 result = sys_sendfile(tofd, fromfd, hdr, offset, n);
236 END_PROFILE(syscall_sendfile);
237 return result;
240 /*********************************************************
241 For rename across filesystems Patch from Warren Birnbaum
242 <warrenb@hpcvscdp.cv.hp.com>
243 **********************************************************/
245 static int copy_reg(const char *source, const char *dest)
247 SMB_STRUCT_STAT source_stats;
248 int saved_errno;
249 int ifd = -1;
250 int ofd = -1;
252 if (sys_lstat (source, &source_stats) == -1)
253 return -1;
255 if (!S_ISREG (source_stats.st_mode))
256 return -1;
258 if((ifd = sys_open (source, O_RDONLY, 0)) < 0)
259 return -1;
261 if (unlink (dest) && errno != ENOENT)
262 return -1;
264 #ifdef O_NOFOLLOW
265 if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
266 #else
267 if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC , 0600)) < 0 )
268 #endif
269 goto err;
271 if (transfer_file(ifd, ofd, (size_t)-1) == -1)
272 goto err;
275 * Try to preserve ownership. For non-root it might fail, but that's ok.
276 * But root probably wants to know, e.g. if NFS disallows it.
279 if ((fchown(ofd, source_stats.st_uid, source_stats.st_gid) == -1) && (errno != EPERM))
280 goto err;
283 * fchown turns off set[ug]id bits for non-root,
284 * so do the chmod last.
287 #if defined(HAVE_FCHMOD)
288 if (fchmod (ofd, source_stats.st_mode & 07777))
289 #else
290 if (chmod (dest, source_stats.st_mode & 07777))
291 #endif
292 goto err;
294 if (close (ifd) == -1)
295 goto err;
297 if (close (ofd) == -1)
298 return -1;
300 /* Try to copy the old file's modtime and access time. */
302 struct utimbuf tv;
304 tv.actime = source_stats.st_atime;
305 tv.modtime = source_stats.st_mtime;
306 utime(dest, &tv);
309 if (unlink (source) == -1)
310 return -1;
312 return 0;
314 err:
316 saved_errno = errno;
317 if (ifd != -1)
318 close(ifd);
319 if (ofd != -1)
320 close(ofd);
321 errno = saved_errno;
322 return -1;
325 int vfswrap_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new)
327 int result;
329 START_PROFILE(syscall_rename);
330 result = rename(old, new);
331 if (errno == EXDEV) {
332 /* Rename across filesystems needed. */
333 result = copy_reg(old, new);
336 END_PROFILE(syscall_rename);
337 return result;
340 int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
342 #ifdef HAVE_FSYNC
343 int result;
345 START_PROFILE(syscall_fsync);
347 result = fsync(fd);
348 END_PROFILE(syscall_fsync);
349 return result;
350 #else
351 return 0;
352 #endif
355 int vfswrap_stat(vfs_handle_struct *handle, connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf)
357 int result;
359 START_PROFILE(syscall_stat);
360 result = sys_stat(fname, sbuf);
361 END_PROFILE(syscall_stat);
362 return result;
365 int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
367 int result;
369 START_PROFILE(syscall_fstat);
370 result = sys_fstat(fd, sbuf);
371 END_PROFILE(syscall_fstat);
372 return result;
375 int vfswrap_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf)
377 int result;
379 START_PROFILE(syscall_lstat);
380 result = sys_lstat(path, sbuf);
381 END_PROFILE(syscall_lstat);
382 return result;
385 int vfswrap_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path)
387 int result;
389 START_PROFILE(syscall_unlink);
390 result = unlink(path);
391 END_PROFILE(syscall_unlink);
392 return result;
395 int vfswrap_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode)
397 int result;
399 START_PROFILE(syscall_chmod);
402 * We need to do this due to the fact that the default POSIX ACL
403 * chmod modifies the ACL *mask* for the group owner, not the
404 * group owner bits directly. JRA.
409 int saved_errno = errno; /* We might get ENOSYS */
410 if ((result = SMB_VFS_CHMOD_ACL(conn, path, mode)) == 0) {
411 END_PROFILE(syscall_chmod);
412 return result;
414 /* Error - return the old errno. */
415 errno = saved_errno;
418 result = chmod(path, mode);
419 END_PROFILE(syscall_chmod);
420 return result;
423 int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
425 int result;
427 START_PROFILE(syscall_fchmod);
430 * We need to do this due to the fact that the default POSIX ACL
431 * chmod modifies the ACL *mask* for the group owner, not the
432 * group owner bits directly. JRA.
436 int saved_errno = errno; /* We might get ENOSYS */
437 if ((result = SMB_VFS_FCHMOD_ACL(fsp, fd, mode)) == 0) {
438 END_PROFILE(syscall_chmod);
439 return result;
441 /* Error - return the old errno. */
442 errno = saved_errno;
445 #if defined(HAVE_FCHMOD)
446 result = fchmod(fd, mode);
447 #else
448 result = -1;
449 errno = ENOSYS;
450 #endif
452 END_PROFILE(syscall_fchmod);
453 return result;
456 int vfswrap_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid)
458 int result;
460 START_PROFILE(syscall_chown);
461 result = sys_chown(path, uid, gid);
462 END_PROFILE(syscall_chown);
463 return result;
466 int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
468 #ifdef HAVE_FCHOWN
469 int result;
471 START_PROFILE(syscall_fchown);
473 result = fchown(fd, uid, gid);
474 END_PROFILE(syscall_fchown);
475 return result;
476 #else
477 errno = ENOSYS;
478 return -1;
479 #endif
482 int vfswrap_chdir(vfs_handle_struct *handle, connection_struct *conn, const char *path)
484 int result;
486 START_PROFILE(syscall_chdir);
487 result = chdir(path);
488 END_PROFILE(syscall_chdir);
489 return result;
492 char *vfswrap_getwd(vfs_handle_struct *handle, connection_struct *conn, char *path)
494 char *result;
496 START_PROFILE(syscall_getwd);
497 result = sys_getwd(path);
498 END_PROFILE(syscall_getwd);
499 return result;
502 int vfswrap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times)
504 int result;
506 START_PROFILE(syscall_utime);
507 result = utime(path, times);
508 END_PROFILE(syscall_utime);
509 return result;
512 /*********************************************************************
513 A version of ftruncate that will write the space on disk if strict
514 allocate is set.
515 **********************************************************************/
517 static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len)
519 SMB_STRUCT_STAT st;
520 SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
521 unsigned char zero_space[4096];
522 SMB_OFF_T space_to_write;
524 if (currpos == -1)
525 return -1;
527 if (SMB_VFS_FSTAT(fsp, fd, &st) == -1)
528 return -1;
530 space_to_write = len - st.st_size;
532 #ifdef S_ISFIFO
533 if (S_ISFIFO(st.st_mode))
534 return 0;
535 #endif
537 if (st.st_size == len)
538 return 0;
540 /* Shrink - just ftruncate. */
541 if (st.st_size > len)
542 return sys_ftruncate(fd, len);
544 /* Write out the real space on disk. */
545 if (SMB_VFS_LSEEK(fsp, fd, st.st_size, SEEK_SET) != st.st_size)
546 return -1;
548 space_to_write = len - st.st_size;
550 memset(zero_space, '\0', sizeof(zero_space));
551 while ( space_to_write > 0) {
552 SMB_OFF_T retlen;
553 SMB_OFF_T current_len_to_write = MIN(sizeof(zero_space),space_to_write);
555 retlen = SMB_VFS_WRITE(fsp,fsp->fd,(char *)zero_space,current_len_to_write);
556 if (retlen <= 0)
557 return -1;
559 space_to_write -= retlen;
562 /* Seek to where we were */
563 if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos)
564 return -1;
566 return 0;
569 int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len)
571 int result = -1;
572 SMB_STRUCT_STAT st;
573 char c = 0;
574 SMB_OFF_T currpos;
576 START_PROFILE(syscall_ftruncate);
578 if (lp_strict_allocate(SNUM(fsp->conn))) {
579 result = strict_allocate_ftruncate(handle, fsp, fd, len);
580 END_PROFILE(syscall_ftruncate);
581 return result;
584 /* we used to just check HAVE_FTRUNCATE_EXTEND and only use
585 sys_ftruncate if the system supports it. Then I discovered that
586 you can have some filesystems that support ftruncate
587 expansion and some that don't! On Linux fat can't do
588 ftruncate extend but ext2 can. */
590 result = sys_ftruncate(fd, len);
591 if (result == 0)
592 goto done;
594 /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
595 extend a file with ftruncate. Provide alternate implementation
596 for this */
597 currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
598 if (currpos == -1) {
599 goto done;
602 /* Do an fstat to see if the file is longer than the requested
603 size in which case the ftruncate above should have
604 succeeded or shorter, in which case seek to len - 1 and
605 write 1 byte of zero */
606 if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) {
607 goto done;
610 #ifdef S_ISFIFO
611 if (S_ISFIFO(st.st_mode)) {
612 result = 0;
613 goto done;
615 #endif
617 if (st.st_size == len) {
618 result = 0;
619 goto done;
622 if (st.st_size > len) {
623 /* the sys_ftruncate should have worked */
624 goto done;
627 if (SMB_VFS_LSEEK(fsp, fd, len-1, SEEK_SET) != len -1)
628 goto done;
630 if (SMB_VFS_WRITE(fsp, fd, &c, 1)!=1)
631 goto done;
633 /* Seek to where we were */
634 if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos)
635 goto done;
636 result = 0;
638 done:
640 END_PROFILE(syscall_ftruncate);
641 return result;
644 BOOL vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
646 BOOL result;
648 START_PROFILE(syscall_fcntl_lock);
650 result = fcntl_lock(fd, op, offset, count,type);
651 END_PROFILE(syscall_fcntl_lock);
652 return result;
655 int vfswrap_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath)
657 int result;
659 START_PROFILE(syscall_symlink);
660 result = sys_symlink(oldpath, newpath);
661 END_PROFILE(syscall_symlink);
662 return result;
665 int vfswrap_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz)
667 int result;
669 START_PROFILE(syscall_readlink);
670 result = sys_readlink(path, buf, bufsiz);
671 END_PROFILE(syscall_readlink);
672 return result;
675 int vfswrap_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath)
677 int result;
679 START_PROFILE(syscall_link);
680 result = sys_link(oldpath, newpath);
681 END_PROFILE(syscall_link);
682 return result;
685 int vfswrap_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *pathname, mode_t mode, SMB_DEV_T dev)
687 int result;
689 START_PROFILE(syscall_mknod);
690 result = sys_mknod(pathname, mode, dev);
691 END_PROFILE(syscall_mknod);
692 return result;
695 char *vfswrap_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path)
697 char *result;
699 START_PROFILE(syscall_realpath);
700 result = sys_realpath(path, resolved_path);
701 END_PROFILE(syscall_realpath);
702 return result;
705 size_t vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc)
707 size_t result;
709 START_PROFILE(fget_nt_acl);
710 result = get_nt_acl(fsp, security_info, ppdesc);
711 END_PROFILE(fget_nt_acl);
712 return result;
715 size_t vfswrap_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, SEC_DESC **ppdesc)
717 size_t result;
719 START_PROFILE(get_nt_acl);
720 result = get_nt_acl(fsp, security_info, ppdesc);
721 END_PROFILE(get_nt_acl);
722 return result;
725 BOOL vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
727 BOOL result;
729 START_PROFILE(fset_nt_acl);
730 result = set_nt_acl(fsp, security_info_sent, psd);
731 END_PROFILE(fset_nt_acl);
732 return result;
735 BOOL vfswrap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd)
737 BOOL result;
739 START_PROFILE(set_nt_acl);
740 result = set_nt_acl(fsp, security_info_sent, psd);
741 END_PROFILE(set_nt_acl);
742 return result;
745 int vfswrap_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode)
747 #ifdef HAVE_NO_ACL
748 errno = ENOSYS;
749 return -1;
750 #else
751 int result;
753 START_PROFILE(chmod_acl);
754 result = chmod_acl(conn, name, mode);
755 END_PROFILE(chmod_acl);
756 return result;
757 #endif
760 int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
762 #ifdef HAVE_NO_ACL
763 errno = ENOSYS;
764 return -1;
765 #else
766 int result;
768 START_PROFILE(fchmod_acl);
769 result = fchmod_acl(fsp, fd, mode);
770 END_PROFILE(fchmod_acl);
771 return result;
772 #endif
775 int vfswrap_sys_acl_get_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
777 return sys_acl_get_entry(theacl, entry_id, entry_p);
780 int vfswrap_sys_acl_get_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
782 return sys_acl_get_tag_type(entry_d, tag_type_p);
785 int vfswrap_sys_acl_get_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
787 return sys_acl_get_permset(entry_d, permset_p);
790 void * vfswrap_sys_acl_get_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d)
792 return sys_acl_get_qualifier(entry_d);
795 SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type)
797 return sys_acl_get_file(path_p, type);
800 SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
802 return sys_acl_get_fd(fd);
805 int vfswrap_sys_acl_clear_perms(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset)
807 return sys_acl_clear_perms(permset);
810 int vfswrap_sys_acl_add_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
812 return sys_acl_add_perm(permset, perm);
815 char * vfswrap_sys_acl_to_text(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen)
817 return sys_acl_to_text(theacl, plen);
820 SMB_ACL_T vfswrap_sys_acl_init(vfs_handle_struct *handle, connection_struct *conn, int count)
822 return sys_acl_init(count);
825 int vfswrap_sys_acl_create_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
827 return sys_acl_create_entry(pacl, pentry);
830 int vfswrap_sys_acl_set_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
832 return sys_acl_set_tag_type(entry, tagtype);
835 int vfswrap_sys_acl_set_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual)
837 return sys_acl_set_qualifier(entry, qual);
840 int vfswrap_sys_acl_set_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
842 return sys_acl_set_permset(entry, permset);
845 int vfswrap_sys_acl_valid(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl )
847 return sys_acl_valid(theacl );
850 int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
852 return sys_acl_set_file(name, acltype, theacl);
855 int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
857 return sys_acl_set_fd(fd, theacl);
860 int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path)
862 return sys_acl_delete_def_file(path);
865 int vfswrap_sys_acl_get_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
867 return sys_acl_get_perm(permset, perm);
870 int vfswrap_sys_acl_free_text(vfs_handle_struct *handle, connection_struct *conn, char *text)
872 return sys_acl_free_text(text);
875 int vfswrap_sys_acl_free_acl(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T posix_acl)
877 return sys_acl_free_acl(posix_acl);
880 int vfswrap_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype)
882 return sys_acl_free_qualifier(qualifier, tagtype);
885 /****************************************************************
886 Extended attribute operations.
887 *****************************************************************/
889 ssize_t vfswrap_getxattr(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size)
891 return sys_getxattr(path, name, value, size);
894 ssize_t vfswrap_lgetxattr(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size)
896 return sys_lgetxattr(path, name, value, size);
899 ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size)
901 return sys_fgetxattr(fd, name, value, size);
904 ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size)
906 return sys_listxattr(path, list, size);
909 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size)
911 return sys_llistxattr(path, list, size);
914 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size)
916 return sys_flistxattr(fd, list, size);
919 int vfswrap_removexattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name)
921 return sys_removexattr(path, name);
924 int vfswrap_lremovexattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name)
926 return sys_lremovexattr(path, name);
929 int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name)
931 return sys_fremovexattr(fd, name);
934 int vfswrap_setxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags)
936 return sys_setxattr(path, name, value, size, flags);
939 int vfswrap_lsetxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags)
941 return sys_lsetxattr(path, name, value, size, flags);
944 int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags)
946 return sys_fsetxattr(fd, name, value, size, flags);