aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-11-08 16:12:01 -0500
committerSteve French <sfrench@us.ibm.com>2007-11-08 16:12:01 -0500
commitce06c9f025120dbb2978d9b84641d76c25f17902 (patch)
treeeaa5bb27f2b05fe922e6fe697e242ba13856b739 /fs/cifs/cifsacl.c
parent15b0395911eb45a0834755f0d9e84570644a8c22 (diff)
[CIFS] add mode to acl conversion helper function
Acked-by: Shirish Pargaonkar <shirishp@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
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)