summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-08-21 12:03:25 -0700
committerJeremy Allison <jra@samba.org>2013-08-26 09:01:16 -0700
commitbd0156988b34feaf91c3046f7ec78f0833222395 (patch)
treedeea98b8ea5ebbd79eaacbe75317982fbc3fcb2d
parent76142780fb6d69bdf6e15ea27b0436da3fa49fae (diff)
downloadsamba-bd0156988b34feaf91c3046f7ec78f0833222395.tar.gz
samba-bd0156988b34feaf91c3046f7ec78f0833222395.tar.bz2
samba-bd0156988b34feaf91c3046f7ec78f0833222395.zip
Fix the erroneous masking of chmod requests via the UNIX extensions.
Changed from switch statement to if, as "create mask", "force create mode" are only applied to new files, not existing ones. "directory mask", "force directory mode" are only applied to new directories, not existing ones. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
-rw-r--r--source3/smbd/trans2.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index e7c0da1c20..945fe434d9 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1392,20 +1392,22 @@ static NTSTATUS unix_perms_from_wire( connection_struct *conn,
ret |= ((perms & UNIX_SET_UID ) ? S_ISUID : 0);
#endif
- switch (ptype) {
- case PERM_NEW_FILE:
- case PERM_EXISTING_FILE:
- /* Apply mode mask */
+ if (ptype == PERM_NEW_FILE) {
+ /*
+ * "create mask"/"force create mode" are
+ * only applied to new files, not existing ones.
+ */
ret &= lp_create_mask(SNUM(conn));
/* Add in force bits */
ret |= lp_force_create_mode(SNUM(conn));
- break;
- case PERM_NEW_DIR:
- case PERM_EXISTING_DIR:
+ } else if (ptype == PERM_NEW_DIR) {
+ /*
+ * "directory mask"/"force directory mode" are
+ * only applied to new directories, not existing ones.
+ */
ret &= lp_dir_mask(SNUM(conn));
/* Add in force bits */
ret |= lp_force_dir_mode(SNUM(conn));
- break;
}
*ret_perms = ret;