[PATCH] Restore mapping of "security." xattr namespace prefix to EXTATTR_NAMESPACE_USER on FreeBSD

Ralph Böhme slow at samba.org
Sat Jul 7 13:21:52 UTC 2018


Hi,

cf bug https://bugzilla.samba.org/show_bug.cgi?id=12912.

I think we should push the attached patch to master.

Thoughts?

-slow

-- 
Ralph Boehme, Samba Team       https://samba.org/
Samba Developer, SerNet GmbH   https://sernet.de/en/samba/
GPG Key Fingerprint:           FAE2 C608 8A24 2520 51C5
                               59E4 AA1E 9B71 2639 9E46
-------------- next part --------------
From bf28b91663f3510b0699514a5eaf3b437d3decf3 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sun, 16 Jul 2017 17:14:54 +0200
Subject: [PATCH] lib/replace: fix use of "security" namespace on FreeBSD

The fix in 738797d8ad6908de457786cc948dcde151e2b9e1 for bug #12490
caused the "security." xattr prefix to fail all xattr calls with EINVAL.

This restores the previous behaviour of mapping "security." to
EXTATTR_NAMESPACE_USER.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12912

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 lib/replace/xattr.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/replace/xattr.c b/lib/replace/xattr.c
index 2479c21b553..a9d383e7beb 100644
--- a/lib/replace/xattr.c
+++ b/lib/replace/xattr.c
@@ -71,6 +71,9 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si
 	} else if (strncmp(name, "user.", 5) == 0) {
 		attrnamespace = EXTATTR_NAMESPACE_USER;
 		attrname = name + 5;
+	} else if (strncmp(name, "security.", 9) == 0) {
+		attrnamespace = EXTATTR_NAMESPACE_USER;
+		attrname = name + 9;
 	} else {
 		errno = EINVAL;
 		return -1;
@@ -145,6 +148,9 @@ ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
 	} else if (strncmp(name, "user.", 5) == 0) {
 		attrnamespace = EXTATTR_NAMESPACE_USER;
 		attrname = name + 5;
+	} else if (strncmp(name, "security.", 9) == 0) {
+		attrnamespace = EXTATTR_NAMESPACE_USER;
+		attrname = name + 9;
 	} else {
 		errno = EINVAL;
 		return -1;
@@ -442,6 +448,9 @@ int rep_removexattr (const char *path, const char *name)
 	} else if (strncmp(name, "user.", 5) == 0) {
 		attrnamespace = EXTATTR_NAMESPACE_USER;
 		attrname = name + 5;
+	} else if (strncmp(name, "security.", 9) == 0) {
+		attrnamespace = EXTATTR_NAMESPACE_USER;
+		attrname = name + 9;
 	} else {
 		errno = EINVAL;
 		return -1;
@@ -492,6 +501,9 @@ int rep_fremovexattr (int filedes, const char *name)
 	} else if (strncmp(name, "user.", 5) == 0) {
 		attrnamespace = EXTATTR_NAMESPACE_USER;
 		attrname = name + 5;
+	} else if (strncmp(name, "security.", 9) == 0) {
+		attrnamespace = EXTATTR_NAMESPACE_USER;
+		attrname = name + 9;
 	} else {
 		errno = EINVAL;
 		return -1;
@@ -543,6 +555,9 @@ int rep_setxattr (const char *path, const char *name, const void *value, size_t
 	} else if (strncmp(name, "user.", 5) == 0) {
 		attrnamespace = EXTATTR_NAMESPACE_USER;
 		attrname = name + 5;
+	} else if (strncmp(name, "security.", 9) == 0) {
+		attrnamespace = EXTATTR_NAMESPACE_USER;
+		attrname = name + 9;
 	} else {
 		errno = EINVAL;
 		return -1;
@@ -620,6 +635,9 @@ int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size
 	} else if (strncmp(name, "user.", 5) == 0) {
 		attrnamespace = EXTATTR_NAMESPACE_USER;
 		attrname = name + 5;
+	} else if (strncmp(name, "security.", 9) == 0) {
+		attrnamespace = EXTATTR_NAMESPACE_USER;
+		attrname = name + 9;
 	} else {
 		errno = EINVAL;
 		return -1;
-- 
2.13.6



More information about the samba-technical mailing list