diff options
author | Jeremy Allison <jra@samba.org> | 2019-10-08 13:45:45 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-10-15 18:46:36 +0000 |
commit | 2dbc68e2c0212e3e14f304e359d4d0b1ab514ce2 (patch) | |
tree | 3c3ba09261a1784452046762becc3d4f5cdd8a00 /source3/smbd | |
parent | c16cc9a7ef3dc50df511d6a39437347ebc36383e (diff) | |
download | samba-2dbc68e2c0212e3e14f304e359d4d0b1ab514ce2.tar.gz |
s3: smbd: set_nt_acl(). Now we know we always have a valid file handle, always use VFS_FCHOWN.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/posix_acls.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index e0df84bc3f0..23aa5b575a0 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3578,15 +3578,16 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn, NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid) { NTSTATUS status; + int ret; if(!CAN_WRITE(fsp->conn)) { return NT_STATUS_MEDIA_WRITE_PROTECTED; } /* Case (1). */ - status = vfs_chown_fsp(fsp, uid, gid); - if (NT_STATUS_IS_OK(status)) { - return status; + ret = SMB_VFS_FCHOWN(fsp, uid, gid); + if (ret == 0) { + return NT_STATUS_OK; } /* Case (2) / (3) */ @@ -3610,8 +3611,12 @@ NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid) } if (has_take_ownership_priv || has_restore_priv) { + status = NT_STATUS_OK; become_root(); - status = vfs_chown_fsp(fsp, uid, gid); + ret = SMB_VFS_FCHOWN(fsp, uid, gid); + if (ret != 0) { + status = map_nt_error_from_unix(errno); + } unbecome_root(); return status; } @@ -3630,9 +3635,13 @@ NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid) return NT_STATUS_INVALID_OWNER; } + status = NT_STATUS_OK; become_root(); /* Keep the current file gid the same. */ - status = vfs_chown_fsp(fsp, uid, (gid_t)-1); + ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1); + if (ret != 0) { + status = map_nt_error_from_unix(errno); + } unbecome_root(); return status; |