Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Improve a bit listxattr(2). It attemps to list both...
details: https://anonhg.NetBSD.org/src/rev/22fba5d3494e
branches: trunk
changeset: 766578:22fba5d3494e
user: manu <manu%NetBSD.org@localhost>
date: Tue Jun 28 07:50:03 2011 +0000
description:
Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
diffstat:
sys/kern/vfs_xattr.c | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)
diffs (75 lines):
diff -r 0b0dbd17406e -r 22fba5d3494e sys/kern/vfs_xattr.c
--- a/sys/kern/vfs_xattr.c Tue Jun 28 07:24:14 2011 +0000
+++ b/sys/kern/vfs_xattr.c Tue Jun 28 07:50:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_xattr.c,v 1.24 2011/06/27 16:39:43 manu Exp $ */
+/* $NetBSD: vfs_xattr.c,v 1.25 2011/06/28 07:50:03 manu Exp $ */
/*-
* Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.24 2011/06/27 16:39:43 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.25 2011/06/28 07:50:03 manu Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1021,8 +1021,17 @@
error = extattr_list_vp(vp, EXTATTR_NAMESPACE_SYSTEM,
list, size, l, &listsize_sys);
- if (error)
+ switch (error) {
+ case EPERM:
+ error = 0; /* Ignore and just skip system EA */
+ listsize_sys = 0;
+ break;
+ case 0:
+ break;
+ default:
goto out;
+ break;
+ }
*retval = listsize_usr + listsize_sys;
@@ -1065,8 +1074,17 @@
error = extattr_list_vp(vp, EXTATTR_NAMESPACE_SYSTEM,
list, size, l, &listsize_sys);
- if (error)
+ switch (error) {
+ case EPERM:
+ error = 0; /* Ignore and just skip system EA */
+ listsize_sys = 0;
+ break;
+ case 0:
+ break;
+ default:
goto out;
+ break;
+ }
*retval = listsize_usr + listsize_sys;
out:
@@ -1109,8 +1127,17 @@
error = extattr_list_vp(vp, EXTATTR_NAMESPACE_SYSTEM,
list, size, l, &listsize_sys);
- if (error)
+ switch (error) {
+ case EPERM:
+ error = 0; /* Ignore and just skip system EA */
+ listsize_sys = 0;
+ break;
+ case 0:
+ break;
+ default:
goto out;
+ break;
+ }
*retval = listsize_usr + listsize_sys;
out:
Home |
Main Index |
Thread Index |
Old Index