summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-06-07 23:18:03 +0000
committerJeremy Allison <jra@samba.org>2002-06-07 23:18:03 +0000
commit766a78e6b8141f905d8741d3da2b59cb6f1e771e (patch)
tree4bfed028f7a00cdfb0b80cd64ae1b4d474786562 /source3
parent29744f4f4c67cbff1ff6963d0f7a203637b1a716 (diff)
downloadsamba-766a78e6b8141f905d8741d3da2b59cb6f1e771e.tar.gz
samba-766a78e6b8141f905d8741d3da2b59cb6f1e771e.tar.bz2
samba-766a78e6b8141f905d8741d3da2b59cb6f1e771e.zip
Ensure when allowing fchown with write access and dos filemodes that
we leave the gid alone. Jeremy. (This used to be commit 3f72910cf954b127c0cc06d6616ca2b8cd0d41ad)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/posix_acls.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index fd52c07e86..309dd0e719 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -2046,28 +2046,28 @@ static int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_
/* try the direct way first */
ret = vfs_chown(conn, fname, uid, gid);
- if (ret == 0) return 0;
+ if (ret == 0)
+ return 0;
if(!CAN_WRITE(conn) || !lp_dos_filemode(SNUM(conn)))
return -1;
- if (vfs_stat(conn,fname,&st)) {
+ if (vfs_stat(conn,fname,&st))
return -1;
- }
fsp = open_file_fchmod(conn,fname,&st);
- if (!fsp) {
+ if (!fsp)
return -1;
- }
/* only allow chown to the current user. This is more secure,
and also copes with the case where the SID in a take ownership ACL is
a local SID on the users workstation
*/
uid = current_user.uid;
-
+
become_root();
- ret = vfswrap_fchown(fsp, fsp->fd, uid, gid);
+ /* Keep the current file gid the same. */
+ ret = vfswrap_fchown(fsp, fsp->fd, uid, (gid_t)-1);
unbecome_root();
close_file_fchmod(fsp);