Module Name:    src
Committed By:   manu
Date:           Tue Jun 28 07:50:03 UTC 2011

Modified Files:
        src/sys/kern: vfs_xattr.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/kern/vfs_xattr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_xattr.c
diff -u src/sys/kern/vfs_xattr.c:1.24 src/sys/kern/vfs_xattr.c:1.25
--- src/sys/kern/vfs_xattr.c:1.24	Mon Jun 27 16:39:43 2011
+++ src/sys/kern/vfs_xattr.c	Tue Jun 28 07:50:03 2011
@@ -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:

Reply via email to