diff options
author | Jeremy Allison <jra@samba.org> | 2001-04-14 00:19:12 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-04-14 00:19:12 +0000 |
commit | 32397e5bc6d995ce7ca37c82d6aedc1e5b1b6fbd (patch) | |
tree | 0329edc74e135879ad9d581c22f358d51b37a85c /source/smbd/vfs-wrap.c | |
parent | 5870e6019b82d2088b99acdc0f84e9e4847a1fa5 (diff) | |
download | samba-32397e5bc6d995ce7ca37c82d6aedc1e5b1b6fbd.tar.gz samba-32397e5bc6d995ce7ca37c82d6aedc1e5b1b6fbd.tar.xz samba-32397e5bc6d995ce7ca37c82d6aedc1e5b1b6fbd.zip |
configure:
configure.in:
include/config.h.in:
include/profile.h:
smbd/vfs-wrap.c:
smbd/vfs.c:
Added fchmod and fchown to VFS (sorry Gerald - but we needed them anyway).
smbd/dosmode.c:
smbd/files.c:
printing/printfsp.c:
smbd/close.c:
smbd/open.c:
Fixed "dos filemode" correctly so there are no race conditions. Forces test
of open of file O_WRONLY before allowing fchmod as root. Afterwards, calls
standard close function that preserves POSIX locks due to POSIX-me-harder
braindamage. :-). Andrew please review this code.
Also - in removing the tmpdir param in smbrun an extra NULL parameter
was missed in each print_run_command() call (which is a varargs fn.).
Now fixed.
Jeremy.
Diffstat (limited to 'source/smbd/vfs-wrap.c')
-rw-r--r-- | source/smbd/vfs-wrap.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/source/smbd/vfs-wrap.c b/source/smbd/vfs-wrap.c index a4057eb7ce2..da8484e14ee 100644 --- a/source/smbd/vfs-wrap.c +++ b/source/smbd/vfs-wrap.c @@ -369,6 +369,34 @@ int vfswrap_chmod(connection_struct *conn, char *path, mode_t mode) return result; } +int vfswrap_fchmod(files_struct *fsp, int fd, mode_t mode) +{ + int result; + struct vfs_ops *vfs_ops = &fsp->conn->vfs_ops; + + START_PROFILE(syscall_fchmod); + + /* + * We need to do this due to the fact that the default POSIX ACL + * chmod modifies the ACL *mask* for the group owner, not the + * group owner bits directly. JRA. + */ + + if (vfs_ops->fchmod_acl != NULL) { + int saved_errno = errno; /* We might get ENOSYS */ + if ((result = vfs_ops->fchmod_acl(fsp, fd, mode)) == 0) { + END_PROFILE(syscall_chmod); + return result; + } + /* Error - return the old errno. */ + errno = saved_errno; + } + + result = fchmod(fd, mode); + END_PROFILE(syscall_fchmod); + return result; +} + int vfswrap_chown(connection_struct *conn, char *path, uid_t uid, gid_t gid) { int result; @@ -386,6 +414,17 @@ int vfswrap_chown(connection_struct *conn, char *path, uid_t uid, gid_t gid) return result; } +int vfswrap_fchown(files_struct *fsp, int fd, uid_t uid, gid_t gid) +{ + int result; + + START_PROFILE(syscall_fchown); + + result = fchown(fd, uid, gid); + END_PROFILE(syscall_fchown); + return result; +} + int vfswrap_chdir(connection_struct *conn, char *path) { int result; @@ -452,7 +491,7 @@ int vfswrap_ftruncate(files_struct *fsp, int fd, SMB_OFF_T len) extend a file with ftruncate. Provide alternate implementation for this */ - struct vfs_ops *vfs_ops = fsp->conn->vfs_ops; + struct vfs_ops *vfs_ops = &fsp->conn->vfs_ops; SMB_STRUCT_STAT st; char c = 0; SMB_OFF_T currpos; |