summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-08-25 12:27:21 +0530
committerVijay Bellur <vijay@gluster.com>2011-08-25 00:10:17 -0700
commitd120020fd5a0deb209be23da3ba936297f682c18 (patch)
tree40635ee193f248f26eea4ff8d67475d5d17d1e67
parent561bba7ae446062992597bcc16bd1749c9868586 (diff)
solaris_{f}setxattr(): filter reserved attributes from getting setv3.1.7qa2
currently 'SUNWattr_ro' and 'SUNWattr_rw' are being filtered. Change-Id: I3fce596c2d6b86d0b396a4443f7dbf5304d00c66 BUG: 3441 Reviewed-on: http://review.gluster.com/316 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--libglusterfs/src/compat.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index b94fe514fe1..d22a794c40b 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -39,6 +39,18 @@
#include "inode.h"
#ifdef GF_SOLARIS_HOST_OS
+int
+solaris_filter_special_keys (const char *key)
+{
+ xlator_t *this = THIS;
+
+ if ((strcmp ("SUNWattr_ro", key) == 0) ||
+ (strcmp ("SUNWattr_rw", key) == 0))
+ return 0;
+
+ return 1;
+}
+
int
solaris_fsetxattr(int fd,
const char* key,
@@ -48,7 +60,11 @@ solaris_fsetxattr(int fd,
{
int attrfd = -1;
int ret = 0;
-
+
+ ret = solaris_filter_special_keys (key);
+ if (!ret)
+ goto out;
+
attrfd = openat (fd, key, flags|O_CREAT|O_WRONLY|O_XATTR, 0777);
if (attrfd >= 0) {
ftruncate (attrfd, 0);
@@ -61,7 +77,8 @@ solaris_fsetxattr(int fd,
fd, errno);
return -1;
}
-
+
+out:
return 0;
}
@@ -229,6 +246,10 @@ solaris_setxattr(const char *path,
int ret = 0;
char *mapped_path = NULL;
+ ret = solaris_filter_special_keys (key);
+ if (!ret)
+ goto out;
+
ret = solaris_xattr_resolve_path (path, &mapped_path);
if (!ret) {
attrfd = attropen (mapped_path, key, flags|O_CREAT|O_WRONLY,
@@ -250,6 +271,8 @@ solaris_setxattr(const char *path,
}
if (mapped_path)
GF_FREE (mapped_path);
+
+out:
return ret;
}
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254