summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-gfid-path.c
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2017-07-10 10:31:27 -0400
committerJeff Darcy <jeff@pl.atyp.us>2017-07-24 13:05:48 +0000
commit96eece8abbb9c06f0b91f37e718ac9e337a3f714 (patch)
treec5d3498254327ef314ae29c038592ae35df22387 /xlators/storage/posix/src/posix-gfid-path.c
parent668df4e7e452aa26f0e0fbd15691fab0edc83014 (diff)
posix/gfid2path: Block access to gfid2path xattr via mount
gfid2path xattr is an internal xattr and should not be allowed to modify by other applications via gluster mount. This patch blocks the same. Updates: #139 Change-Id: Id2cb29797ee1bd77e0e0d2203a47469fd7203355 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: https://review.gluster.org/17744 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Aravinda VK <avishwan@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/storage/posix/src/posix-gfid-path.c')
-rw-r--r--xlators/storage/posix/src/posix-gfid-path.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix-gfid-path.c b/xlators/storage/posix/src/posix-gfid-path.c
index 500f4d8..7529f55 100644
--- a/xlators/storage/posix/src/posix-gfid-path.c
+++ b/xlators/storage/posix/src/posix-gfid-path.c
@@ -32,7 +32,8 @@ posix_set_gfid2path_xattr (xlator_t *this, const char *path, uuid_t pgfid,
bname);
gf_xxh64_wrapper ((unsigned char *) pgfid_bname,
strlen(pgfid_bname), GF_XXHSUM64_DEFAULT_SEED, xxh64);
- key_size = strlen(GFID2PATH_XATTR_KEY_PREFIX) + GF_XXH64_DIGEST_LENGTH*2+1;
+ key_size = GFID2PATH_XATTR_KEY_PREFIX_LENGTH +
+ GF_XXH64_DIGEST_LENGTH*2 + 1;
key = alloca (key_size);
snprintf (key, key_size, GFID2PATH_XATTR_KEY_PREFIX"%s", xxh64);
@@ -68,7 +69,8 @@ posix_remove_gfid2path_xattr (xlator_t *this, const char *path,
bname);
gf_xxh64_wrapper ((unsigned char *) pgfid_bname,
strlen(pgfid_bname), GF_XXHSUM64_DEFAULT_SEED, xxh64);
- key_size = strlen(GFID2PATH_XATTR_KEY_PREFIX) + GF_XXH64_DIGEST_LENGTH*2+1;
+ key_size = GFID2PATH_XATTR_KEY_PREFIX_LENGTH +
+ GF_XXH64_DIGEST_LENGTH*2 + 1;
key = alloca (key_size);
snprintf (key, key_size, GFID2PATH_XATTR_KEY_PREFIX"%s", xxh64);
@@ -83,3 +85,14 @@ posix_remove_gfid2path_xattr (xlator_t *this, const char *path,
err:
return -1;
}
+
+gf_boolean_t
+posix_is_gfid2path_xattr (const char *name)
+{
+ if (name && strncmp (GFID2PATH_XATTR_KEY_PREFIX, name,
+ GFID2PATH_XATTR_KEY_PREFIX_LENGTH) == 0) {
+ return _gf_true;
+ } else {
+ return _gf_false;
+ }
+}