diff options
author | Venky Shankar <venky@gluster.com> | 2011-10-05 16:56:30 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-10-28 08:08:40 -0700 |
commit | a29f1a0e36bde5ca7b8f3762f10b210b5e12a875 (patch) | |
tree | e44c9bd019796c61e7f7059f34f40de0f984b5c7 /libglusterfs | |
parent | af708e9fc2eb2104b9e8e3b5a3eaf99201664324 (diff) |
fuse: flip xattr key from user to trusted namespace for certain
clients.
This is needed for gsyncd/hadoop-plugin running as non-super
user to be able to request extended attributes under trusted
namespace. Request for a key is made under 'user.' namespace
and is flipped by fuse xlator for specific xattr name to the
corresponding 'trusted.' extended attribute.
Both applications set a identifier (client-pid) while doing a
FUSE mount, which is checked by get/set/remove interfaces in
FUSE translator.
Change-Id: I72f77a5dd1ee1d69c8b0e09209449348dbcf879a
BUG: 3701
Reviewed-on: http://review.gluster.com/563
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 8 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index e7d54d48b22..6a5e2504b75 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1946,3 +1946,11 @@ get_mem_size () return memsize; } + + +int +gf_client_pid_check (gf_client_pid_t npid) +{ + return ( (npid > GF_CLIENT_PID_MIN) && (npid < GF_CLIENT_PID_MAX) ) + ? 0 : -1; +} diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 2a5e00c5e11..6c83a100427 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -78,7 +78,23 @@ enum _gf_boolean _gf_true = 1 }; +/* + * we could have initialized these as +ve values and treated + * them as negative while comparing etc.. (which would have + * saved us with the pain of assigning values), but since we + * only have a couple of clients that use this feature, it's + * okay. + */ +enum _gf_client_pid +{ + GF_CLIENT_PID_MAX = 0, + GF_CLIENT_PID_GSYNCD = -1, + GF_CLIENT_PID_HADOOP = -2, + GF_CLIENT_PID_MIN = -3 +}; + typedef enum _gf_boolean gf_boolean_t; +typedef enum _gf_client_pid gf_client_pid_t; typedef int (*gf_cmp) (void *, void *); void gf_global_variable_init(void); @@ -401,4 +417,5 @@ char *get_host_name (char *word, char **host); char *get_path_name (char *word, char **path); void gf_path_strip_trailing_slashes (char *path); uint64_t get_mem_size (); +int gf_client_pid_check (gf_client_pid_t npid); #endif /* _COMMON_UTILS_H */ |