xattr.c 12.1 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3
/*
 *   fs/cifs/xattr.c
 *
Steve French's avatar
Steve French committed
4
 *   Copyright (c) International Business Machines  Corp., 2003, 2007
Linus Torvalds's avatar
Linus Torvalds committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *   Author(s): Steve French (sfrench@us.ibm.com)
 *
 *   This library is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 *   the GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with this library; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#include <linux/fs.h>
#include <linux/posix_acl_xattr.h>
24
#include <linux/slab.h>
25
#include <linux/xattr.h>
Linus Torvalds's avatar
Linus Torvalds committed
26 27 28 29 30
#include "cifsfs.h"
#include "cifspdu.h"
#include "cifsglob.h"
#include "cifsproto.h"
#include "cifs_debug.h"
31 32
#include "cifs_fs_sb.h"
#include "cifs_unicode.h"
Linus Torvalds's avatar
Linus Torvalds committed
33 34 35

#define MAX_EA_VALUE_SIZE 65535
#define CIFS_XATTR_DOS_ATTRIB "user.DosAttrib"
36
#define CIFS_XATTR_CIFS_ACL "system.cifs_acl"
Linus Torvalds's avatar
Linus Torvalds committed
37

38
/* BB need to add server (Samba e.g) support for security and trusted prefix */
Linus Torvalds's avatar
Linus Torvalds committed
39

Steve French's avatar
Steve French committed
40
int cifs_removexattr(struct dentry *direntry, const char *ea_name)
Linus Torvalds's avatar
Linus Torvalds committed
41 42 43
{
	int rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
44
	unsigned int xid;
Linus Torvalds's avatar
Linus Torvalds committed
45
	struct cifs_sb_info *cifs_sb;
46
	struct tcon_link *tlink;
47
	struct cifs_tcon *pTcon;
Steve French's avatar
Steve French committed
48
	struct super_block *sb;
49
	char *full_path = NULL;
Steve French's avatar
Steve French committed
50 51

	if (direntry == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
52
		return -EIO;
Steve French's avatar
Steve French committed
53
	if (direntry->d_inode == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
54 55
		return -EIO;
	sb = direntry->d_inode->i_sb;
Steve French's avatar
Steve French committed
56
	if (sb == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
57
		return -EIO;
Steve French's avatar
Steve French committed
58

Linus Torvalds's avatar
Linus Torvalds committed
59
	cifs_sb = CIFS_SB(sb);
60 61 62 63 64
	tlink = cifs_sb_tlink(cifs_sb);
	if (IS_ERR(tlink))
		return PTR_ERR(tlink);
	pTcon = tlink_tcon(tlink);

65
	xid = get_xid();
Steve French's avatar
Steve French committed
66

Linus Torvalds's avatar
Linus Torvalds committed
67
	full_path = build_path_from_dentry(direntry);
Steve French's avatar
Steve French committed
68
	if (full_path == NULL) {
69
		rc = -ENOMEM;
70
		goto remove_ea_exit;
Linus Torvalds's avatar
Linus Torvalds committed
71
	}
Steve French's avatar
Steve French committed
72
	if (ea_name == NULL) {
73
		cifs_dbg(FYI, "Null xattr names not supported\n");
74 75
	} else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
		&& (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN))) {
76 77 78
		cifs_dbg(FYI,
			 "illegal xattr request %s (only user namespace supported)\n",
			 ea_name);
Linus Torvalds's avatar
Linus Torvalds committed
79 80 81 82
		/* BB what if no namespace prefix? */
		/* Should we just pass them to server, except for
		system and perhaps security prefixes? */
	} else {
Steve French's avatar
Steve French committed
83
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
Linus Torvalds's avatar
Linus Torvalds committed
84 85
			goto remove_ea_exit;

86
		ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
87 88 89
		if (pTcon->ses->server->ops->set_EA)
			rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
				full_path, ea_name, NULL, (__u16)0,
90
				cifs_sb->local_nls, cifs_remap(cifs_sb));
Linus Torvalds's avatar
Linus Torvalds committed
91 92
	}
remove_ea_exit:
Jesper Juhl's avatar
Jesper Juhl committed
93
	kfree(full_path);
94
	free_xid(xid);
95
	cifs_put_tlink(tlink);
Linus Torvalds's avatar
Linus Torvalds committed
96 97 98 99
#endif
	return rc;
}

Steve French's avatar
Steve French committed
100 101
int cifs_setxattr(struct dentry *direntry, const char *ea_name,
		  const void *ea_value, size_t value_size, int flags)
Linus Torvalds's avatar
Linus Torvalds committed
102 103 104
{
	int rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
105
	unsigned int xid;
Linus Torvalds's avatar
Linus Torvalds committed
106
	struct cifs_sb_info *cifs_sb;
107
	struct tcon_link *tlink;
108
	struct cifs_tcon *pTcon;
Steve French's avatar
Steve French committed
109 110
	struct super_block *sb;
	char *full_path;
Linus Torvalds's avatar
Linus Torvalds committed
111

Steve French's avatar
Steve French committed
112
	if (direntry == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
113
		return -EIO;
Steve French's avatar
Steve French committed
114
	if (direntry->d_inode == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
115 116
		return -EIO;
	sb = direntry->d_inode->i_sb;
Steve French's avatar
Steve French committed
117
	if (sb == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
118 119 120
		return -EIO;

	cifs_sb = CIFS_SB(sb);
121 122 123 124 125
	tlink = cifs_sb_tlink(cifs_sb);
	if (IS_ERR(tlink))
		return PTR_ERR(tlink);
	pTcon = tlink_tcon(tlink);

126
	xid = get_xid();
Linus Torvalds's avatar
Linus Torvalds committed
127 128

	full_path = build_path_from_dentry(direntry);
Steve French's avatar
Steve French committed
129
	if (full_path == NULL) {
130
		rc = -ENOMEM;
131
		goto set_ea_exit;
Linus Torvalds's avatar
Linus Torvalds committed
132 133 134 135 136
	}
	/* return dos attributes as pseudo xattr */
	/* return alt name if available as pseudo attr */

	/* if proc/fs/cifs/streamstoxattr is set then
Steve French's avatar
Steve French committed
137
		search server for EAs or streams to
Linus Torvalds's avatar
Linus Torvalds committed
138
		returns as xattrs */
Steve French's avatar
Steve French committed
139
	if (value_size > MAX_EA_VALUE_SIZE) {
140
		cifs_dbg(FYI, "size of EA value too large\n");
141 142
		rc = -EOPNOTSUPP;
		goto set_ea_exit;
Linus Torvalds's avatar
Linus Torvalds committed
143 144
	}

Steve French's avatar
Steve French committed
145
	if (ea_name == NULL) {
146
		cifs_dbg(FYI, "Null xattr names not supported\n");
147 148
	} else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
		   == 0) {
Steve French's avatar
Steve French committed
149
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
Linus Torvalds's avatar
Linus Torvalds committed
150
			goto set_ea_exit;
151
		if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0)
152
			cifs_dbg(FYI, "attempt to set cifs inode metadata\n");
153

154
		ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
155 156 157
		if (pTcon->ses->server->ops->set_EA)
			rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
				full_path, ea_name, ea_value, (__u16)value_size,
158
				cifs_sb->local_nls, cifs_remap(cifs_sb));
159 160
	} else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN)
		   == 0) {
Steve French's avatar
Steve French committed
161
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
Linus Torvalds's avatar
Linus Torvalds committed
162 163
			goto set_ea_exit;

164
		ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */
165 166 167
		if (pTcon->ses->server->ops->set_EA)
			rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
				full_path, ea_name, ea_value, (__u16)value_size,
168
				cifs_sb->local_nls, cifs_remap(cifs_sb));
169 170
	} else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL,
			strlen(CIFS_XATTR_CIFS_ACL)) == 0) {
171 172
#ifdef CONFIG_CIFS_ACL
		struct cifs_ntsd *pacl;
173 174 175 176 177
		pacl = kmalloc(value_size, GFP_KERNEL);
		if (!pacl) {
			rc = -ENOMEM;
		} else {
			memcpy(pacl, ea_value, value_size);
178 179 180 181 182 183
			if (pTcon->ses->server->ops->set_acl)
				rc = pTcon->ses->server->ops->set_acl(pacl,
						value_size, direntry->d_inode,
						full_path, CIFS_ACL_DACL);
			else
				rc = -EOPNOTSUPP;
184 185 186
			if (rc == 0) /* force revalidate of the inode */
				CIFS_I(direntry->d_inode)->time = 0;
			kfree(pacl);
187
		}
188
#else
189
		cifs_dbg(FYI, "Set CIFS ACL not supported yet\n");
190
#endif /* CONFIG_CIFS_ACL */
Linus Torvalds's avatar
Linus Torvalds committed
191
	} else {
Steve French's avatar
Steve French committed
192 193
		int temp;
		temp = strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
Linus Torvalds's avatar
Linus Torvalds committed
194 195 196
			strlen(POSIX_ACL_XATTR_ACCESS));
		if (temp == 0) {
#ifdef CONFIG_CIFS_POSIX
Steve French's avatar
Steve French committed
197 198 199 200
			if (sb->s_flags & MS_POSIXACL)
				rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
					ea_value, (const int)value_size,
					ACL_TYPE_ACCESS, cifs_sb->local_nls,
201
					cifs_remap(cifs_sb));
202
			cifs_dbg(FYI, "set POSIX ACL rc %d\n", rc);
Linus Torvalds's avatar
Linus Torvalds committed
203
#else
204
			cifs_dbg(FYI, "set POSIX ACL not supported\n");
Linus Torvalds's avatar
Linus Torvalds committed
205
#endif
Steve French's avatar
Steve French committed
206 207
		} else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
				   strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
Linus Torvalds's avatar
Linus Torvalds committed
208
#ifdef CONFIG_CIFS_POSIX
Steve French's avatar
Steve French committed
209 210 211
			if (sb->s_flags & MS_POSIXACL)
				rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
					ea_value, (const int)value_size,
212
					ACL_TYPE_DEFAULT, cifs_sb->local_nls,
213
					cifs_remap(cifs_sb));
214
			cifs_dbg(FYI, "set POSIX default ACL rc %d\n", rc);
Linus Torvalds's avatar
Linus Torvalds committed
215
#else
216
			cifs_dbg(FYI, "set default POSIX ACL not supported\n");
Linus Torvalds's avatar
Linus Torvalds committed
217 218
#endif
		} else {
219 220
			cifs_dbg(FYI, "illegal xattr request %s (only user namespace supported)\n",
				 ea_name);
Linus Torvalds's avatar
Linus Torvalds committed
221
		  /* BB what if no namespace prefix? */
Steve French's avatar
Steve French committed
222
		  /* Should we just pass them to server, except for
Linus Torvalds's avatar
Linus Torvalds committed
223 224 225 226 227
		  system and perhaps security prefixes? */
		}
	}

set_ea_exit:
Jesper Juhl's avatar
Jesper Juhl committed
228
	kfree(full_path);
229
	free_xid(xid);
230
	cifs_put_tlink(tlink);
Linus Torvalds's avatar
Linus Torvalds committed
231 232 233 234
#endif
	return rc;
}

Steve French's avatar
Steve French committed
235 236
ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
	void *ea_value, size_t buf_size)
Linus Torvalds's avatar
Linus Torvalds committed
237 238 239
{
	ssize_t rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
240
	unsigned int xid;
Linus Torvalds's avatar
Linus Torvalds committed
241
	struct cifs_sb_info *cifs_sb;
242
	struct tcon_link *tlink;
243
	struct cifs_tcon *pTcon;
Steve French's avatar
Steve French committed
244 245
	struct super_block *sb;
	char *full_path;
Linus Torvalds's avatar
Linus Torvalds committed
246

Steve French's avatar
Steve French committed
247
	if (direntry == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
248
		return -EIO;
Steve French's avatar
Steve French committed
249
	if (direntry->d_inode == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
250 251
		return -EIO;
	sb = direntry->d_inode->i_sb;
Steve French's avatar
Steve French committed
252
	if (sb == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
253 254 255
		return -EIO;

	cifs_sb = CIFS_SB(sb);
256 257 258 259 260
	tlink = cifs_sb_tlink(cifs_sb);
	if (IS_ERR(tlink))
		return PTR_ERR(tlink);
	pTcon = tlink_tcon(tlink);

261
	xid = get_xid();
Linus Torvalds's avatar
Linus Torvalds committed
262 263

	full_path = build_path_from_dentry(direntry);
Steve French's avatar
Steve French committed
264
	if (full_path == NULL) {
265
		rc = -ENOMEM;
266
		goto get_ea_exit;
Linus Torvalds's avatar
Linus Torvalds committed
267 268 269
	}
	/* return dos attributes as pseudo xattr */
	/* return alt name if available as pseudo attr */
Steve French's avatar
Steve French committed
270
	if (ea_name == NULL) {
271
		cifs_dbg(FYI, "Null xattr names not supported\n");
272 273
	} else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
		   == 0) {
Steve French's avatar
Steve French committed
274
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
Linus Torvalds's avatar
Linus Torvalds committed
275 276
			goto get_ea_exit;

Steve French's avatar
Steve French committed
277
		if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) {
278
			cifs_dbg(FYI, "attempt to query cifs inode metadata\n");
Linus Torvalds's avatar
Linus Torvalds committed
279 280
			/* revalidate/getattr then populate from inode */
		} /* BB add else when above is implemented */
281
		ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
282 283 284
		if (pTcon->ses->server->ops->query_all_EAs)
			rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
				full_path, ea_name, ea_value, buf_size,
285
				cifs_sb->local_nls, cifs_remap(cifs_sb));
286
	} else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) {
Steve French's avatar
Steve French committed
287
		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
Linus Torvalds's avatar
Linus Torvalds committed
288 289
			goto get_ea_exit;

290
		ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */
291 292 293
		if (pTcon->ses->server->ops->query_all_EAs)
			rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
				full_path, ea_name, ea_value, buf_size,
294
				cifs_sb->local_nls, cifs_remap(cifs_sb));
Steve French's avatar
Steve French committed
295
	} else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
296
			  strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
Linus Torvalds's avatar
Linus Torvalds committed
297
#ifdef CONFIG_CIFS_POSIX
Steve French's avatar
Steve French committed
298
		if (sb->s_flags & MS_POSIXACL)
299
			rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
Steve French's avatar
Steve French committed
300
				ea_value, buf_size, ACL_TYPE_ACCESS,
301
				cifs_sb->local_nls,
302
				cifs_remap(cifs_sb));
Steve French's avatar
Steve French committed
303
#else
304
		cifs_dbg(FYI, "Query POSIX ACL not supported yet\n");
Linus Torvalds's avatar
Linus Torvalds committed
305
#endif /* CONFIG_CIFS_POSIX */
Steve French's avatar
Steve French committed
306
	} else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
307
			  strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
Linus Torvalds's avatar
Linus Torvalds committed
308
#ifdef CONFIG_CIFS_POSIX
Steve French's avatar
Steve French committed
309
		if (sb->s_flags & MS_POSIXACL)
310
			rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
Steve French's avatar
Steve French committed
311
				ea_value, buf_size, ACL_TYPE_DEFAULT,
312
				cifs_sb->local_nls,
313
				cifs_remap(cifs_sb));
Steve French's avatar
Steve French committed
314
#else
315
		cifs_dbg(FYI, "Query POSIX default ACL not supported yet\n");
316 317 318 319 320 321 322
#endif /* CONFIG_CIFS_POSIX */
	} else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL,
				strlen(CIFS_XATTR_CIFS_ACL)) == 0) {
#ifdef CONFIG_CIFS_ACL
			u32 acllen;
			struct cifs_ntsd *pacl;

323 324 325 326 327
			if (pTcon->ses->server->ops->get_acl == NULL)
				goto get_ea_exit; /* rc already EOPNOTSUPP */

			pacl = pTcon->ses->server->ops->get_acl(cifs_sb,
					direntry->d_inode, full_path, &acllen);
328 329
			if (IS_ERR(pacl)) {
				rc = PTR_ERR(pacl);
330 331
				cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
					 __func__, rc);
332 333 334 335 336 337 338 339 340 341 342
			} else {
				if (ea_value) {
					if (acllen > buf_size)
						acllen = -ERANGE;
					else
						memcpy(ea_value, pacl, acllen);
				}
				rc = acllen;
				kfree(pacl);
			}
#else
343
			cifs_dbg(FYI, "Query CIFS ACL not supported yet\n");
344
#endif /* CONFIG_CIFS_ACL */
Steve French's avatar
Steve French committed
345
	} else if (strncmp(ea_name,
346
		  XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) {
347
		cifs_dbg(FYI, "Trusted xattr namespace not supported yet\n");
Steve French's avatar
Steve French committed
348
	} else if (strncmp(ea_name,
349
		  XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) {
350
		cifs_dbg(FYI, "Security xattr namespace not supported yet\n");
351
	} else
352 353 354
		cifs_dbg(FYI,
			 "illegal xattr request %s (only user namespace supported)\n",
			 ea_name);
Linus Torvalds's avatar
Linus Torvalds committed
355

Steve French's avatar
Steve French committed
356
	/* We could add an additional check for streams ie
Linus Torvalds's avatar
Linus Torvalds committed
357
	    if proc/fs/cifs/streamstoxattr is set then
Steve French's avatar
Steve French committed
358
		search server for EAs or streams to
Linus Torvalds's avatar
Linus Torvalds committed
359 360
		returns as xattrs */

Steve French's avatar
Steve French committed
361 362
	if (rc == -EINVAL)
		rc = -EOPNOTSUPP;
Linus Torvalds's avatar
Linus Torvalds committed
363 364

get_ea_exit:
Jesper Juhl's avatar
Jesper Juhl committed
365
	kfree(full_path);
366
	free_xid(xid);
367
	cifs_put_tlink(tlink);
Linus Torvalds's avatar
Linus Torvalds committed
368 369 370 371
#endif
	return rc;
}

Steve French's avatar
Steve French committed
372
ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
Linus Torvalds's avatar
Linus Torvalds committed
373 374 375
{
	ssize_t rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
376
	unsigned int xid;
Linus Torvalds's avatar
Linus Torvalds committed
377
	struct cifs_sb_info *cifs_sb;
378
	struct tcon_link *tlink;
379
	struct cifs_tcon *pTcon;
Steve French's avatar
Steve French committed
380 381
	struct super_block *sb;
	char *full_path;
Linus Torvalds's avatar
Linus Torvalds committed
382

Steve French's avatar
Steve French committed
383
	if (direntry == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
384
		return -EIO;
Steve French's avatar
Steve French committed
385
	if (direntry->d_inode == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
386 387
		return -EIO;
	sb = direntry->d_inode->i_sb;
Steve French's avatar
Steve French committed
388
	if (sb == NULL)
Linus Torvalds's avatar
Linus Torvalds committed
389 390 391
		return -EIO;

	cifs_sb = CIFS_SB(sb);
Steve French's avatar
Steve French committed
392
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
393 394
		return -EOPNOTSUPP;

395 396 397 398 399
	tlink = cifs_sb_tlink(cifs_sb);
	if (IS_ERR(tlink))
		return PTR_ERR(tlink);
	pTcon = tlink_tcon(tlink);

400
	xid = get_xid();
401

Linus Torvalds's avatar
Linus Torvalds committed
402
	full_path = build_path_from_dentry(direntry);
Steve French's avatar
Steve French committed
403
	if (full_path == NULL) {
404
		rc = -ENOMEM;
405
		goto list_ea_exit;
Linus Torvalds's avatar
Linus Torvalds committed
406 407 408 409 410
	}
	/* return dos attributes as pseudo xattr */
	/* return alt name if available as pseudo attr */

	/* if proc/fs/cifs/streamstoxattr is set then
Steve French's avatar
Steve French committed
411
		search server for EAs or streams to
Linus Torvalds's avatar
Linus Torvalds committed
412 413
		returns as xattrs */

414 415 416
	if (pTcon->ses->server->ops->query_all_EAs)
		rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
				full_path, NULL, data, buf_size,
417
				cifs_sb->local_nls, cifs_remap(cifs_sb));
418
list_ea_exit:
Jesper Juhl's avatar
Jesper Juhl committed
419
	kfree(full_path);
420
	free_xid(xid);
421
	cifs_put_tlink(tlink);
Linus Torvalds's avatar
Linus Torvalds committed
422 423 424
#endif
	return rc;
}