]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * fs/cifs/xattr.c | |
3 | * | |
79a58d1f | 4 | * Copyright (c) International Business Machines Corp., 2003, 2007 |
1da177e4 LT |
5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | |
7 | * This library is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU Lesser General Public License as published | |
9 | * by the Free Software Foundation; either version 2.1 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This library is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
15 | * the GNU Lesser General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU Lesser General Public License | |
18 | * along with this library; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | */ | |
21 | ||
22 | #include <linux/fs.h> | |
23 | #include <linux/posix_acl_xattr.h> | |
5a0e3ad6 | 24 | #include <linux/slab.h> |
f995e740 | 25 | #include <linux/xattr.h> |
1da177e4 LT |
26 | #include "cifsfs.h" |
27 | #include "cifspdu.h" | |
28 | #include "cifsglob.h" | |
29 | #include "cifsproto.h" | |
30 | #include "cifs_debug.h" | |
2baa2682 SF |
31 | #include "cifs_fs_sb.h" |
32 | #include "cifs_unicode.h" | |
1da177e4 | 33 | |
63d37fb4 | 34 | #define MAX_EA_VALUE_SIZE CIFSMaxBufSize |
438471b6 BP |
35 | #define CIFS_XATTR_CIFS_ACL "system.cifs_acl" /* DACL only */ |
36 | #define CIFS_XATTR_CIFS_NTSD "system.cifs_ntsd" /* owner plus DACL */ | |
3970acf7 | 37 | #define CIFS_XATTR_CIFS_NTSD_FULL "system.cifs_ntsd_full" /* owner/DACL/SACL */ |
a958fff2 | 38 | #define CIFS_XATTR_ATTRIB "cifs.dosattrib" /* full name: user.cifs.dosattrib */ |
66098044 | 39 | #define CIFS_XATTR_CREATETIME "cifs.creationtime" /* user.cifs.creationtime */ |
c4f7173a SF |
40 | /* |
41 | * Although these three are just aliases for the above, need to move away from | |
42 | * confusing users and using the 20+ year old term 'cifs' when it is no longer | |
43 | * secure, replaced by SMB2 (then even more highly secure SMB3) many years ago | |
44 | */ | |
438471b6 BP |
45 | #define SMB3_XATTR_CIFS_ACL "system.smb3_acl" /* DACL only */ |
46 | #define SMB3_XATTR_CIFS_NTSD "system.smb3_ntsd" /* owner plus DACL */ | |
3970acf7 | 47 | #define SMB3_XATTR_CIFS_NTSD_FULL "system.smb3_ntsd_full" /* owner/DACL/SACL */ |
c4f7173a SF |
48 | #define SMB3_XATTR_ATTRIB "smb3.dosattrib" /* full name: user.smb3.dosattrib */ |
49 | #define SMB3_XATTR_CREATETIME "smb3.creationtime" /* user.smb3.creationtime */ | |
f995e740 | 50 | /* BB need to add server (Samba e.g) support for security and trusted prefix */ |
1da177e4 | 51 | |
438471b6 | 52 | enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT, |
3970acf7 | 53 | XATTR_CIFS_NTSD, XATTR_CIFS_NTSD_FULL }; |
438471b6 BP |
54 | |
55 | static int cifs_attrib_set(unsigned int xid, struct cifs_tcon *pTcon, | |
56 | struct inode *inode, char *full_path, | |
57 | const void *value, size_t size) | |
58 | { | |
59 | ssize_t rc = -EOPNOTSUPP; | |
60 | __u32 *pattrib = (__u32 *)value; | |
61 | __u32 attrib; | |
62 | FILE_BASIC_INFO info_buf; | |
63 | ||
64 | if ((value == NULL) || (size != sizeof(__u32))) | |
65 | return -ERANGE; | |
66 | ||
67 | memset(&info_buf, 0, sizeof(info_buf)); | |
68 | attrib = *pattrib; | |
69 | info_buf.Attributes = cpu_to_le32(attrib); | |
70 | if (pTcon->ses->server->ops->set_file_info) | |
71 | rc = pTcon->ses->server->ops->set_file_info(inode, full_path, | |
72 | &info_buf, xid); | |
73 | if (rc == 0) | |
74 | CIFS_I(inode)->cifsAttrs = attrib; | |
75 | ||
76 | return rc; | |
77 | } | |
78 | ||
79 | static int cifs_creation_time_set(unsigned int xid, struct cifs_tcon *pTcon, | |
80 | struct inode *inode, char *full_path, | |
81 | const void *value, size_t size) | |
82 | { | |
83 | ssize_t rc = -EOPNOTSUPP; | |
84 | __u64 *pcreation_time = (__u64 *)value; | |
85 | __u64 creation_time; | |
86 | FILE_BASIC_INFO info_buf; | |
87 | ||
88 | if ((value == NULL) || (size != sizeof(__u64))) | |
89 | return -ERANGE; | |
90 | ||
91 | memset(&info_buf, 0, sizeof(info_buf)); | |
92 | creation_time = *pcreation_time; | |
93 | info_buf.CreationTime = cpu_to_le64(creation_time); | |
94 | if (pTcon->ses->server->ops->set_file_info) | |
95 | rc = pTcon->ses->server->ops->set_file_info(inode, full_path, | |
96 | &info_buf, xid); | |
97 | if (rc == 0) | |
98 | CIFS_I(inode)->createtime = creation_time; | |
99 | ||
100 | return rc; | |
101 | } | |
7ffec372 | 102 | |
a9ae008f | 103 | static int cifs_xattr_set(const struct xattr_handler *handler, |
59301226 AV |
104 | struct dentry *dentry, struct inode *inode, |
105 | const char *name, const void *value, | |
106 | size_t size, int flags) | |
1da177e4 LT |
107 | { |
108 | int rc = -EOPNOTSUPP; | |
6d5786a3 | 109 | unsigned int xid; |
a9ae008f | 110 | struct super_block *sb = dentry->d_sb; |
5fdccfef | 111 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
7ffec372 | 112 | struct tcon_link *tlink; |
96daf2b0 | 113 | struct cifs_tcon *pTcon; |
79a58d1f | 114 | char *full_path; |
1da177e4 | 115 | |
7ffec372 JL |
116 | tlink = cifs_sb_tlink(cifs_sb); |
117 | if (IS_ERR(tlink)) | |
118 | return PTR_ERR(tlink); | |
119 | pTcon = tlink_tcon(tlink); | |
120 | ||
6d5786a3 | 121 | xid = get_xid(); |
1da177e4 | 122 | |
a9ae008f | 123 | full_path = build_path_from_dentry(dentry); |
79a58d1f | 124 | if (full_path == NULL) { |
0f3bc09e | 125 | rc = -ENOMEM; |
a9ae008f | 126 | goto out; |
1da177e4 LT |
127 | } |
128 | /* return dos attributes as pseudo xattr */ | |
129 | /* return alt name if available as pseudo attr */ | |
130 | ||
131 | /* if proc/fs/cifs/streamstoxattr is set then | |
79a58d1f | 132 | search server for EAs or streams to |
1da177e4 | 133 | returns as xattrs */ |
a9ae008f | 134 | if (size > MAX_EA_VALUE_SIZE) { |
f96637be | 135 | cifs_dbg(FYI, "size of EA value too large\n"); |
7ffec372 | 136 | rc = -EOPNOTSUPP; |
a9ae008f | 137 | goto out; |
1da177e4 LT |
138 | } |
139 | ||
a9ae008f AG |
140 | switch (handler->flags) { |
141 | case XATTR_USER: | |
438471b6 BP |
142 | cifs_dbg(FYI, "%s:setting user xattr %s\n", __func__, name); |
143 | if ((strcmp(name, CIFS_XATTR_ATTRIB) == 0) || | |
144 | (strcmp(name, SMB3_XATTR_ATTRIB) == 0)) { | |
145 | rc = cifs_attrib_set(xid, pTcon, inode, full_path, | |
146 | value, size); | |
147 | if (rc == 0) /* force revalidate of the inode */ | |
148 | CIFS_I(inode)->time = 0; | |
149 | break; | |
150 | } else if ((strcmp(name, CIFS_XATTR_CREATETIME) == 0) || | |
151 | (strcmp(name, SMB3_XATTR_CREATETIME) == 0)) { | |
152 | rc = cifs_creation_time_set(xid, pTcon, inode, | |
153 | full_path, value, size); | |
154 | if (rc == 0) /* force revalidate of the inode */ | |
155 | CIFS_I(inode)->time = 0; | |
156 | break; | |
157 | } | |
158 | ||
79a58d1f | 159 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
a9ae008f | 160 | goto out; |
ad7a2926 | 161 | |
666753c3 SF |
162 | if (pTcon->ses->server->ops->set_EA) |
163 | rc = pTcon->ses->server->ops->set_EA(xid, pTcon, | |
a9ae008f | 164 | full_path, name, value, (__u16)size, |
5517554e | 165 | cifs_sb->local_nls, cifs_sb); |
a9ae008f | 166 | break; |
1da177e4 | 167 | |
438471b6 | 168 | case XATTR_CIFS_ACL: |
3970acf7 BP |
169 | case XATTR_CIFS_NTSD: |
170 | case XATTR_CIFS_NTSD_FULL: { | |
b0f8ef20 | 171 | struct cifs_ntsd *pacl; |
a9ae008f AG |
172 | |
173 | if (!value) | |
174 | goto out; | |
175 | pacl = kmalloc(size, GFP_KERNEL); | |
b73b9a4b | 176 | if (!pacl) { |
b73b9a4b SF |
177 | rc = -ENOMEM; |
178 | } else { | |
a9ae008f | 179 | memcpy(pacl, value, size); |
3970acf7 BP |
180 | if (pTcon->ses->server->ops->set_acl) { |
181 | int aclflags = 0; | |
438471b6 | 182 | rc = 0; |
3970acf7 BP |
183 | |
184 | switch (handler->flags) { | |
185 | case XATTR_CIFS_NTSD_FULL: | |
186 | aclflags = (CIFS_ACL_OWNER | | |
187 | CIFS_ACL_DACL | | |
188 | CIFS_ACL_SACL); | |
189 | break; | |
190 | case XATTR_CIFS_NTSD: | |
191 | aclflags = (CIFS_ACL_OWNER | | |
192 | CIFS_ACL_DACL); | |
193 | break; | |
194 | case XATTR_CIFS_ACL: | |
195 | default: | |
196 | aclflags = CIFS_ACL_DACL; | |
438471b6 | 197 | } |
3970acf7 BP |
198 | |
199 | rc = pTcon->ses->server->ops->set_acl(pacl, | |
200 | size, inode, full_path, aclflags); | |
438471b6 | 201 | } else { |
83e3bc23 | 202 | rc = -EOPNOTSUPP; |
438471b6 | 203 | } |
b73b9a4b | 204 | if (rc == 0) /* force revalidate of the inode */ |
59301226 | 205 | CIFS_I(inode)->time = 0; |
b73b9a4b | 206 | kfree(pacl); |
b0f8ef20 | 207 | } |
a9ae008f AG |
208 | break; |
209 | } | |
210 | ||
211 | case XATTR_ACL_ACCESS: | |
1da177e4 | 212 | #ifdef CONFIG_CIFS_POSIX |
a9ae008f AG |
213 | if (!value) |
214 | goto out; | |
1751e8a6 | 215 | if (sb->s_flags & SB_POSIXACL) |
a9ae008f AG |
216 | rc = CIFSSMBSetPosixACL(xid, pTcon, full_path, |
217 | value, (const int)size, | |
218 | ACL_TYPE_ACCESS, cifs_sb->local_nls, | |
219 | cifs_remap(cifs_sb)); | |
220 | #endif /* CONFIG_CIFS_POSIX */ | |
221 | break; | |
222 | ||
223 | case XATTR_ACL_DEFAULT: | |
1da177e4 | 224 | #ifdef CONFIG_CIFS_POSIX |
a9ae008f AG |
225 | if (!value) |
226 | goto out; | |
1751e8a6 | 227 | if (sb->s_flags & SB_POSIXACL) |
a9ae008f AG |
228 | rc = CIFSSMBSetPosixACL(xid, pTcon, full_path, |
229 | value, (const int)size, | |
230 | ACL_TYPE_DEFAULT, cifs_sb->local_nls, | |
231 | cifs_remap(cifs_sb)); | |
232 | #endif /* CONFIG_CIFS_POSIX */ | |
233 | break; | |
1da177e4 LT |
234 | } |
235 | ||
a9ae008f | 236 | out: |
f99d49ad | 237 | kfree(full_path); |
6d5786a3 | 238 | free_xid(xid); |
7ffec372 | 239 | cifs_put_tlink(tlink); |
1da177e4 LT |
240 | return rc; |
241 | } | |
242 | ||
a958fff2 SF |
243 | static int cifs_attrib_get(struct dentry *dentry, |
244 | struct inode *inode, void *value, | |
245 | size_t size) | |
246 | { | |
247 | ssize_t rc; | |
248 | __u32 *pattribute; | |
249 | ||
250 | rc = cifs_revalidate_dentry_attr(dentry); | |
251 | ||
252 | if (rc) | |
253 | return rc; | |
254 | ||
255 | if ((value == NULL) || (size == 0)) | |
256 | return sizeof(__u32); | |
257 | else if (size < sizeof(__u32)) | |
258 | return -ERANGE; | |
259 | ||
260 | /* return dos attributes as pseudo xattr */ | |
261 | pattribute = (__u32 *)value; | |
262 | *pattribute = CIFS_I(inode)->cifsAttrs; | |
263 | ||
264 | return sizeof(__u32); | |
265 | } | |
266 | ||
66098044 SF |
267 | static int cifs_creation_time_get(struct dentry *dentry, struct inode *inode, |
268 | void *value, size_t size) | |
269 | { | |
270 | ssize_t rc; | |
438471b6 | 271 | __u64 *pcreatetime; |
66098044 SF |
272 | |
273 | rc = cifs_revalidate_dentry_attr(dentry); | |
274 | if (rc) | |
275 | return rc; | |
276 | ||
277 | if ((value == NULL) || (size == 0)) | |
278 | return sizeof(__u64); | |
279 | else if (size < sizeof(__u64)) | |
280 | return -ERANGE; | |
281 | ||
282 | /* return dos attributes as pseudo xattr */ | |
283 | pcreatetime = (__u64 *)value; | |
284 | *pcreatetime = CIFS_I(inode)->createtime; | |
285 | return sizeof(__u64); | |
66098044 SF |
286 | } |
287 | ||
a958fff2 | 288 | |
a9ae008f AG |
289 | static int cifs_xattr_get(const struct xattr_handler *handler, |
290 | struct dentry *dentry, struct inode *inode, | |
291 | const char *name, void *value, size_t size) | |
1da177e4 LT |
292 | { |
293 | ssize_t rc = -EOPNOTSUPP; | |
6d5786a3 | 294 | unsigned int xid; |
a9ae008f | 295 | struct super_block *sb = dentry->d_sb; |
5fdccfef | 296 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
7ffec372 | 297 | struct tcon_link *tlink; |
96daf2b0 | 298 | struct cifs_tcon *pTcon; |
79a58d1f | 299 | char *full_path; |
1da177e4 | 300 | |
7ffec372 JL |
301 | tlink = cifs_sb_tlink(cifs_sb); |
302 | if (IS_ERR(tlink)) | |
303 | return PTR_ERR(tlink); | |
304 | pTcon = tlink_tcon(tlink); | |
305 | ||
6d5786a3 | 306 | xid = get_xid(); |
1da177e4 | 307 | |
a9ae008f | 308 | full_path = build_path_from_dentry(dentry); |
79a58d1f | 309 | if (full_path == NULL) { |
0f3bc09e | 310 | rc = -ENOMEM; |
a9ae008f | 311 | goto out; |
1da177e4 | 312 | } |
a958fff2 | 313 | |
1da177e4 | 314 | /* return alt name if available as pseudo attr */ |
a9ae008f AG |
315 | switch (handler->flags) { |
316 | case XATTR_USER: | |
a958fff2 | 317 | cifs_dbg(FYI, "%s:querying user xattr %s\n", __func__, name); |
c4f7173a SF |
318 | if ((strcmp(name, CIFS_XATTR_ATTRIB) == 0) || |
319 | (strcmp(name, SMB3_XATTR_ATTRIB) == 0)) { | |
a958fff2 SF |
320 | rc = cifs_attrib_get(dentry, inode, value, size); |
321 | break; | |
c4f7173a SF |
322 | } else if ((strcmp(name, CIFS_XATTR_CREATETIME) == 0) || |
323 | (strcmp(name, SMB3_XATTR_CREATETIME) == 0)) { | |
66098044 SF |
324 | rc = cifs_creation_time_get(dentry, inode, value, size); |
325 | break; | |
a958fff2 SF |
326 | } |
327 | ||
79a58d1f | 328 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
a9ae008f | 329 | goto out; |
1da177e4 | 330 | |
666753c3 SF |
331 | if (pTcon->ses->server->ops->query_all_EAs) |
332 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, | |
67b4c889 | 333 | full_path, name, value, size, cifs_sb); |
a9ae008f | 334 | break; |
1da177e4 | 335 | |
438471b6 | 336 | case XATTR_CIFS_ACL: |
3970acf7 BP |
337 | case XATTR_CIFS_NTSD: |
338 | case XATTR_CIFS_NTSD_FULL: { | |
339 | /* | |
340 | * fetch owner, DACL, and SACL if asked for full descriptor, | |
341 | * fetch owner and DACL otherwise | |
342 | */ | |
9541b813 | 343 | u32 acllen, extra_info; |
a9ae008f AG |
344 | struct cifs_ntsd *pacl; |
345 | ||
346 | if (pTcon->ses->server->ops->get_acl == NULL) | |
347 | goto out; /* rc already EOPNOTSUPP */ | |
348 | ||
3970acf7 | 349 | if (handler->flags == XATTR_CIFS_NTSD_FULL) { |
9541b813 | 350 | extra_info = SACL_SECINFO; |
3970acf7 | 351 | } else { |
9541b813 | 352 | extra_info = 0; |
3970acf7 | 353 | } |
a9ae008f | 354 | pacl = pTcon->ses->server->ops->get_acl(cifs_sb, |
9541b813 | 355 | inode, full_path, &acllen, extra_info); |
a9ae008f AG |
356 | if (IS_ERR(pacl)) { |
357 | rc = PTR_ERR(pacl); | |
358 | cifs_dbg(VFS, "%s: error %zd getting sec desc\n", | |
359 | __func__, rc); | |
360 | } else { | |
361 | if (value) { | |
362 | if (acllen > size) | |
363 | acllen = -ERANGE; | |
364 | else | |
365 | memcpy(value, pacl, acllen); | |
366 | } | |
367 | rc = acllen; | |
368 | kfree(pacl); | |
369 | } | |
a9ae008f AG |
370 | break; |
371 | } | |
372 | ||
373 | case XATTR_ACL_ACCESS: | |
1da177e4 | 374 | #ifdef CONFIG_CIFS_POSIX |
1751e8a6 | 375 | if (sb->s_flags & SB_POSIXACL) |
1da0c78b | 376 | rc = CIFSSMBGetPosixACL(xid, pTcon, full_path, |
a9ae008f | 377 | value, size, ACL_TYPE_ACCESS, |
737b758c | 378 | cifs_sb->local_nls, |
2baa2682 | 379 | cifs_remap(cifs_sb)); |
a9ae008f AG |
380 | #endif /* CONFIG_CIFS_POSIX */ |
381 | break; | |
382 | ||
383 | case XATTR_ACL_DEFAULT: | |
1da177e4 | 384 | #ifdef CONFIG_CIFS_POSIX |
1751e8a6 | 385 | if (sb->s_flags & SB_POSIXACL) |
1da0c78b | 386 | rc = CIFSSMBGetPosixACL(xid, pTcon, full_path, |
a9ae008f | 387 | value, size, ACL_TYPE_DEFAULT, |
737b758c | 388 | cifs_sb->local_nls, |
2baa2682 | 389 | cifs_remap(cifs_sb)); |
a9ae008f AG |
390 | #endif /* CONFIG_CIFS_POSIX */ |
391 | break; | |
392 | } | |
1da177e4 | 393 | |
79a58d1f | 394 | /* We could add an additional check for streams ie |
1da177e4 | 395 | if proc/fs/cifs/streamstoxattr is set then |
79a58d1f | 396 | search server for EAs or streams to |
1da177e4 LT |
397 | returns as xattrs */ |
398 | ||
79a58d1f SF |
399 | if (rc == -EINVAL) |
400 | rc = -EOPNOTSUPP; | |
1da177e4 | 401 | |
a9ae008f | 402 | out: |
f99d49ad | 403 | kfree(full_path); |
6d5786a3 | 404 | free_xid(xid); |
7ffec372 | 405 | cifs_put_tlink(tlink); |
1da177e4 LT |
406 | return rc; |
407 | } | |
408 | ||
79a58d1f | 409 | ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) |
1da177e4 LT |
410 | { |
411 | ssize_t rc = -EOPNOTSUPP; | |
6d5786a3 | 412 | unsigned int xid; |
5fdccfef | 413 | struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb); |
7ffec372 | 414 | struct tcon_link *tlink; |
96daf2b0 | 415 | struct cifs_tcon *pTcon; |
79a58d1f | 416 | char *full_path; |
1da177e4 | 417 | |
79a58d1f | 418 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
ea4c07d7 SF |
419 | return -EOPNOTSUPP; |
420 | ||
7ffec372 JL |
421 | tlink = cifs_sb_tlink(cifs_sb); |
422 | if (IS_ERR(tlink)) | |
423 | return PTR_ERR(tlink); | |
424 | pTcon = tlink_tcon(tlink); | |
425 | ||
6d5786a3 | 426 | xid = get_xid(); |
ea4c07d7 | 427 | |
1da177e4 | 428 | full_path = build_path_from_dentry(direntry); |
79a58d1f | 429 | if (full_path == NULL) { |
0f3bc09e | 430 | rc = -ENOMEM; |
7ffec372 | 431 | goto list_ea_exit; |
1da177e4 LT |
432 | } |
433 | /* return dos attributes as pseudo xattr */ | |
434 | /* return alt name if available as pseudo attr */ | |
435 | ||
436 | /* if proc/fs/cifs/streamstoxattr is set then | |
79a58d1f | 437 | search server for EAs or streams to |
1da177e4 | 438 | returns as xattrs */ |
1da177e4 | 439 | |
666753c3 SF |
440 | if (pTcon->ses->server->ops->query_all_EAs) |
441 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, | |
67b4c889 | 442 | full_path, NULL, data, buf_size, cifs_sb); |
7ffec372 | 443 | list_ea_exit: |
f99d49ad | 444 | kfree(full_path); |
6d5786a3 | 445 | free_xid(xid); |
7ffec372 | 446 | cifs_put_tlink(tlink); |
1da177e4 LT |
447 | return rc; |
448 | } | |
a9ae008f AG |
449 | |
450 | static const struct xattr_handler cifs_user_xattr_handler = { | |
451 | .prefix = XATTR_USER_PREFIX, | |
452 | .flags = XATTR_USER, | |
453 | .get = cifs_xattr_get, | |
454 | .set = cifs_xattr_set, | |
455 | }; | |
456 | ||
457 | /* os2.* attributes are treated like user.* attributes */ | |
458 | static const struct xattr_handler cifs_os2_xattr_handler = { | |
459 | .prefix = XATTR_OS2_PREFIX, | |
460 | .flags = XATTR_USER, | |
461 | .get = cifs_xattr_get, | |
462 | .set = cifs_xattr_set, | |
463 | }; | |
464 | ||
465 | static const struct xattr_handler cifs_cifs_acl_xattr_handler = { | |
466 | .name = CIFS_XATTR_CIFS_ACL, | |
467 | .flags = XATTR_CIFS_ACL, | |
468 | .get = cifs_xattr_get, | |
469 | .set = cifs_xattr_set, | |
470 | }; | |
471 | ||
c4f7173a SF |
472 | /* |
473 | * Although this is just an alias for the above, need to move away from | |
474 | * confusing users and using the 20 year old term 'cifs' when it is no | |
475 | * longer secure and was replaced by SMB2/SMB3 a long time ago, and | |
476 | * SMB3 and later are highly secure. | |
477 | */ | |
478 | static const struct xattr_handler smb3_acl_xattr_handler = { | |
479 | .name = SMB3_XATTR_CIFS_ACL, | |
480 | .flags = XATTR_CIFS_ACL, | |
481 | .get = cifs_xattr_get, | |
482 | .set = cifs_xattr_set, | |
483 | }; | |
484 | ||
438471b6 BP |
485 | static const struct xattr_handler cifs_cifs_ntsd_xattr_handler = { |
486 | .name = CIFS_XATTR_CIFS_NTSD, | |
487 | .flags = XATTR_CIFS_NTSD, | |
488 | .get = cifs_xattr_get, | |
489 | .set = cifs_xattr_set, | |
490 | }; | |
491 | ||
492 | /* | |
493 | * Although this is just an alias for the above, need to move away from | |
494 | * confusing users and using the 20 year old term 'cifs' when it is no | |
495 | * longer secure and was replaced by SMB2/SMB3 a long time ago, and | |
496 | * SMB3 and later are highly secure. | |
497 | */ | |
498 | static const struct xattr_handler smb3_ntsd_xattr_handler = { | |
499 | .name = SMB3_XATTR_CIFS_NTSD, | |
500 | .flags = XATTR_CIFS_NTSD, | |
501 | .get = cifs_xattr_get, | |
502 | .set = cifs_xattr_set, | |
503 | }; | |
504 | ||
3970acf7 BP |
505 | static const struct xattr_handler cifs_cifs_ntsd_full_xattr_handler = { |
506 | .name = CIFS_XATTR_CIFS_NTSD_FULL, | |
507 | .flags = XATTR_CIFS_NTSD_FULL, | |
508 | .get = cifs_xattr_get, | |
509 | .set = cifs_xattr_set, | |
510 | }; | |
511 | ||
512 | /* | |
513 | * Although this is just an alias for the above, need to move away from | |
514 | * confusing users and using the 20 year old term 'cifs' when it is no | |
515 | * longer secure and was replaced by SMB2/SMB3 a long time ago, and | |
516 | * SMB3 and later are highly secure. | |
517 | */ | |
518 | static const struct xattr_handler smb3_ntsd_full_xattr_handler = { | |
519 | .name = SMB3_XATTR_CIFS_NTSD_FULL, | |
520 | .flags = XATTR_CIFS_NTSD_FULL, | |
521 | .get = cifs_xattr_get, | |
522 | .set = cifs_xattr_set, | |
523 | }; | |
524 | ||
525 | ||
a9ae008f AG |
526 | static const struct xattr_handler cifs_posix_acl_access_xattr_handler = { |
527 | .name = XATTR_NAME_POSIX_ACL_ACCESS, | |
528 | .flags = XATTR_ACL_ACCESS, | |
529 | .get = cifs_xattr_get, | |
530 | .set = cifs_xattr_set, | |
531 | }; | |
532 | ||
533 | static const struct xattr_handler cifs_posix_acl_default_xattr_handler = { | |
534 | .name = XATTR_NAME_POSIX_ACL_DEFAULT, | |
535 | .flags = XATTR_ACL_DEFAULT, | |
536 | .get = cifs_xattr_get, | |
537 | .set = cifs_xattr_set, | |
538 | }; | |
539 | ||
540 | const struct xattr_handler *cifs_xattr_handlers[] = { | |
541 | &cifs_user_xattr_handler, | |
542 | &cifs_os2_xattr_handler, | |
543 | &cifs_cifs_acl_xattr_handler, | |
c4f7173a | 544 | &smb3_acl_xattr_handler, /* alias for above since avoiding "cifs" */ |
438471b6 BP |
545 | &cifs_cifs_ntsd_xattr_handler, |
546 | &smb3_ntsd_xattr_handler, /* alias for above since avoiding "cifs" */ | |
3970acf7 BP |
547 | &cifs_cifs_ntsd_full_xattr_handler, |
548 | &smb3_ntsd_full_xattr_handler, /* alias for above since avoiding "cifs" */ | |
a9ae008f AG |
549 | &cifs_posix_acl_access_xattr_handler, |
550 | &cifs_posix_acl_default_xattr_handler, | |
551 | NULL | |
552 | }; |