aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r--fs/cifs/cifsacl.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index ec445802d903..dabbce00712b 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -138,9 +138,9 @@ static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode,
138 umode_t *pbits_to_set) 138 umode_t *pbits_to_set)
139{ 139{
140 /* the order of ACEs is important. The canonical order is to begin with 140 /* the order of ACEs is important. The canonical order is to begin with
141 DENY entries then follow with ALLOW, otherwise an allow entry could be 141 DENY entries followed by ALLOW, otherwise an allow entry could be
142 encountered first, making the subsequent deny entry like "dead code" 142 encountered first, making the subsequent deny entry like "dead code"
143 which would be superflous since Windows stops when a match is made 143 which would be superflous since Windows stops when a match is made
144 for the operation you are trying to perform for your user */ 144 for the operation you are trying to perform for your user */
145 145
146 /* For deny ACEs we change the mask so that subsequent allow access 146 /* For deny ACEs we change the mask so that subsequent allow access
@@ -188,6 +188,37 @@ static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode,
188 return; 188 return;
189} 189}
190 190
191/*
192 Generate access flags to reflect permissions mode is the existing mode.
193 This function is called for every ACE in the DACL whose SID matches
194 with either owner or group or everyone.
195*/
196
197static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
198 __u32 *pace_flags)
199{
200 /* reset access mask */
201 *pace_flags = 0x0;
202
203 /* bits to use are either S_IRWXU or S_IRWXG or S_IRWXO */
204 mode &= bits_to_use;
205
206 /* check for R/W/X UGO since we do not know whose flags
207 is this but we have cleared all the bits sans RWX for
208 either user or group or other as per bits_to_use */
209 if (mode & S_IRUGO)
210 *pace_flags |= SET_FILE_READ_RIGHTS;
211 if (mode & S_IWUGO)
212 *pace_flags |= SET_FILE_WRITE_RIGHTS;
213 if (mode & S_IXUGO)
214 *pace_flags |= SET_FILE_EXEC_RIGHTS;
215
216#ifdef CONFIG_CIFS_DEBUG2
217 cFYI(1, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags));
218#endif
219 return;
220}
221
191 222
192#ifdef CONFIG_CIFS_DEBUG2 223#ifdef CONFIG_CIFS_DEBUG2
193static void dump_ace(struct cifs_ace *pace, char *end_of_acl) 224static void dump_ace(struct cifs_ace *pace, char *end_of_acl)