summaryrefslogtreecommitdiff
path: root/source3/smbd/vfs-wrap.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-14 00:19:12 +0000
committerJeremy Allison <jra@samba.org>2001-04-14 00:19:12 +0000
commit53850c51caf1c4d53ff285b2e5505e0615beeeee (patch)
tree03e7d594efd340da6909e0efa2cf3dd05b6a610b /source3/smbd/vfs-wrap.c
parent9444e9d9f350961b594a1acbe7a7652d97faec0a (diff)
downloadsamba-53850c51caf1c4d53ff285b2e5505e0615beeeee.tar.gz
samba-53850c51caf1c4d53ff285b2e5505e0615beeeee.tar.bz2
samba-53850c51caf1c4d53ff285b2e5505e0615beeeee.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. (This used to be commit 32397e5bc6d995ce7ca37c82d6aedc1e5b1b6fbd)
Diffstat (limited to 'source3/smbd/vfs-wrap.c')
-rw-r--r--source3/smbd/vfs-wrap.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c
index a4057eb7ce..da8484e14e 100644
--- a/source3/smbd/vfs-wrap.c
+++ b/source3/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;