aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsacl.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index f02fdef463a7..c312adcba4fc 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -134,9 +134,10 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
134 pmode is the existing mode (we only want to overwrite part of this 134 pmode is the existing mode (we only want to overwrite part of this
135 bits to set can be: S_IRWXU, S_IRWXG or S_IRWXO ie 00700 or 00070 or 00007 135 bits to set can be: S_IRWXU, S_IRWXG or S_IRWXO ie 00700 or 00070 or 00007
136*/ 136*/
137static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode, 137static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
138 umode_t *pbits_to_set) 138 umode_t *pbits_to_set)
139{ 139{
140 __u32 flags = le32_to_cpu(ace_flags);
140 /* the order of ACEs is important. The canonical order is to begin with 141 /* the order of ACEs is important. The canonical order is to begin with
141 DENY entries followed by ALLOW, otherwise an allow entry could be 142 DENY entries followed by ALLOW, otherwise an allow entry could be
142 encountered first, making the subsequent deny entry like "dead code" 143 encountered first, making the subsequent deny entry like "dead code"
@@ -146,17 +147,17 @@ static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode,
146 /* For deny ACEs we change the mask so that subsequent allow access 147 /* For deny ACEs we change the mask so that subsequent allow access
147 control entries do not turn on the bits we are denying */ 148 control entries do not turn on the bits we are denying */
148 if (type == ACCESS_DENIED) { 149 if (type == ACCESS_DENIED) {
149 if (ace_flags & GENERIC_ALL) { 150 if (flags & GENERIC_ALL) {
150 *pbits_to_set &= ~S_IRWXUGO; 151 *pbits_to_set &= ~S_IRWXUGO;
151 } 152 }
152 if ((ace_flags & GENERIC_WRITE) || 153 if ((flags & GENERIC_WRITE) ||
153 ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) 154 ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS))
154 *pbits_to_set &= ~S_IWUGO; 155 *pbits_to_set &= ~S_IWUGO;
155 if ((ace_flags & GENERIC_READ) || 156 if ((flags & GENERIC_READ) ||
156 ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) 157 ((flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS))
157 *pbits_to_set &= ~S_IRUGO; 158 *pbits_to_set &= ~S_IRUGO;
158 if ((ace_flags & GENERIC_EXECUTE) || 159 if ((flags & GENERIC_EXECUTE) ||
159 ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) 160 ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
160 *pbits_to_set &= ~S_IXUGO; 161 *pbits_to_set &= ~S_IXUGO;
161 return; 162 return;
162 } else if (type != ACCESS_ALLOWED) { 163 } else if (type != ACCESS_ALLOWED) {
@@ -165,25 +166,25 @@ static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode,
165 } 166 }
166 /* else ACCESS_ALLOWED type */ 167 /* else ACCESS_ALLOWED type */
167 168
168 if (ace_flags & GENERIC_ALL) { 169 if (flags & GENERIC_ALL) {
169 *pmode |= (S_IRWXUGO & (*pbits_to_set)); 170 *pmode |= (S_IRWXUGO & (*pbits_to_set));
170#ifdef CONFIG_CIFS_DEBUG2 171#ifdef CONFIG_CIFS_DEBUG2
171 cFYI(1, ("all perms")); 172 cFYI(1, ("all perms"));
172#endif 173#endif
173 return; 174 return;
174 } 175 }
175 if ((ace_flags & GENERIC_WRITE) || 176 if ((flags & GENERIC_WRITE) ||
176 ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) 177 ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS))
177 *pmode |= (S_IWUGO & (*pbits_to_set)); 178 *pmode |= (S_IWUGO & (*pbits_to_set));
178 if ((ace_flags & GENERIC_READ) || 179 if ((flags & GENERIC_READ) ||
179 ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) 180 ((flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS))
180 *pmode |= (S_IRUGO & (*pbits_to_set)); 181 *pmode |= (S_IRUGO & (*pbits_to_set));
181 if ((ace_flags & GENERIC_EXECUTE) || 182 if ((flags & GENERIC_EXECUTE) ||
182 ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) 183 ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
183 *pmode |= (S_IXUGO & (*pbits_to_set)); 184 *pmode |= (S_IXUGO & (*pbits_to_set));
184 185
185#ifdef CONFIG_CIFS_DEBUG2 186#ifdef CONFIG_CIFS_DEBUG2
186 cFYI(1, ("access flags 0x%x mode now 0x%x", ace_flags, *pmode)); 187 cFYI(1, ("access flags 0x%x mode now 0x%x", flags, *pmode));
187#endif 188#endif
188 return; 189 return;
189} 190}