xattr: fix listing EAs on *BSD for non-root users
authorBjörn Jacke <bj@sernet.de>
Wed, 6 Nov 2013 11:37:07 +0000 (12:37 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 8 Nov 2013 19:43:29 +0000 (20:43 +0100)
Thanks to Stefan Rompf for reporting.

This fixes bug #10247

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov  8 20:43:30 CET 2013 on sn-devel-104

lib/replace/xattr.c

index a26ff674a13824bd9948a8949dc79e0e28905c60..459b7f3b65d67dabff761fe05d32e14d00c66cac 100644 (file)
@@ -194,6 +194,10 @@ static ssize_t bsd_attr_list (int type, extattr_arg arg, char *list, size_t size
        char *buf;
        /* Iterate through extattr(2) namespaces */
        for(t = 0; t < ARRAY_SIZE(extattr); t++) {
+               if (t != EXTATTR_NAMESPACE_USER && geteuid() != 0) {
+                       /* ignore all but user namespace when we are not root, see bug 10247 */
+                       continue;
+               }
                switch(type) {
 #if defined(HAVE_EXTATTR_LIST_FILE)
                        case 0: