diff options
author | Steve French <sfrench@us.ibm.com> | 2007-11-08 16:12:01 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-11-08 16:12:01 -0500 |
commit | ce06c9f025120dbb2978d9b84641d76c25f17902 (patch) | |
tree | eaa5bb27f2b05fe922e6fe697e242ba13856b739 /fs/cifs | |
parent | 15b0395911eb45a0834755f0d9e84570644a8c22 (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')
-rw-r--r-- | fs/cifs/CHANGES | 3 | ||||
-rw-r--r-- | fs/cifs/cifsacl.c | 35 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 2 |
3 files changed, 37 insertions, 3 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 6d3e736612ba..53629b8bc8a8 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,6 @@ | |||
1 | Version 1.52 | ||
2 | ------------ | ||
3 | |||
1 | Version 1.51 | 4 | Version 1.51 |
2 | ------------ | 5 | ------------ |
3 | Fix memory leak in statfs when mounted to very old servers (e.g. | 6 | Fix memory leak in statfs when mounted to very old servers (e.g. |
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 | |||
197 | static 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 |
193 | static void dump_ace(struct cifs_ace *pace, char *end_of_acl) | 224 | static void dump_ace(struct cifs_ace *pace, char *end_of_acl) |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 0a3ee5a322b0..62357d228c07 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -106,5 +106,5 @@ extern int cifs_ioctl(struct inode *inode, struct file *filep, | |||
106 | extern struct export_operations cifs_export_ops; | 106 | extern struct export_operations cifs_export_ops; |
107 | #endif /* EXPERIMENTAL */ | 107 | #endif /* EXPERIMENTAL */ |
108 | 108 | ||
109 | #define CIFS_VERSION "1.51" | 109 | #define CIFS_VERSION "1.52" |
110 | #endif /* _CIFSFS_H */ | 110 | #endif /* _CIFSFS_H */ |