summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-05-10 19:27:00 +0000
committerJeremy Allison <jra@samba.org>2001-05-10 19:27:00 +0000
commit6e41b74e6d46a136ef9f7178d2d3cb1d3b4fe8f5 (patch)
treedd8b5a81a2b31e9b57fb6c3e8d1d093508446026
parent47cd09ee57d8f24022d60c1c52677a0e236b6853 (diff)
downloadsamba-6e41b74e6d46a136ef9f7178d2d3cb1d3b4fe8f5.tar.gz
samba-6e41b74e6d46a136ef9f7178d2d3cb1d3b4fe8f5.tar.bz2
samba-6e41b74e6d46a136ef9f7178d2d3cb1d3b4fe8f5.zip
Fixed nasty little bug found by Gerald where we were corrupting the mode
bits before checking if we should change them on non-acl systems. Jeremy. (This used to be commit aba243ca0867a0787f9f7c7b2cda6143bcc53087)
-rw-r--r--source3/smbd/posix_acls.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 53729a6f5d..0cc0f2bac6 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -1942,6 +1942,9 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
canon_ace *file_ace_list = NULL;
canon_ace *dir_ace_list = NULL;
BOOL acl_perms = False;
+ mode_t orig_mode = (mode_t)0;
+ uid_t orig_uid;
+ gid_t orig_gid;
DEBUG(10,("set_nt_acl: called for file %s\n", fsp->fsp_name ));
@@ -1957,6 +1960,11 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
return False;
}
+ /* Save the original elements we check against. */
+ orig_mode = sbuf.st_mode;
+ orig_uid = sbuf.st_uid;
+ orig_gid = sbuf.st_gid;
+
/*
* Unpack the user/group/world id's.
*/
@@ -1968,7 +1976,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
* Do we need to chown ?
*/
- if((user != (uid_t)-1 || grp != (uid_t)-1) && (sbuf.st_uid != user || sbuf.st_gid != grp)) {
+ if((user != (uid_t)-1 || grp != (uid_t)-1) && (orig_uid != user || orig_gid != grp)) {
DEBUG(3,("set_nt_acl: chown %s. uid = %u, gid = %u.\n",
fsp->fsp_name, (unsigned int)user, (unsigned int)grp ));
@@ -2000,6 +2008,11 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
if(ret != 0)
return False;
}
+
+ /* Save the original elements we check against. */
+ orig_mode = sbuf.st_mode;
+ orig_uid = sbuf.st_uid;
+ orig_gid = sbuf.st_gid;
}
create_file_sids(&sbuf, &file_owner_sid, &file_grp_sid);
@@ -2067,7 +2080,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
return False;
}
- if (sbuf.st_mode != posix_perms) {
+ if (orig_mode != posix_perms) {
DEBUG(3,("set_nt_acl: chmod %s. perms = 0%o.\n",
fsp->fsp_name, (unsigned int)posix_perms ));