diff options
author | Csaba Henk <csaba@gluster.com> | 2011-07-30 16:45:50 +0300 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-12 06:22:51 -0700 |
commit | 78170472e6c7f0bce95ab035cc4ed86ec662e80d (patch) | |
tree | 336328e8359b21bb41bf2f293100745410e87e5f /xlators/mount/fuse/src/fuse-bridge.c | |
parent | 32b96d66890a16fd23c8ae065297c7a98097d340 (diff) |
add --user-map-root option
This makes client fake that given user is a superuser,
by changing FUSE requests coming with uid of user so that uid
is set to 0.
User can be given in numeric form, in which case it's treated
as an uid directly, or else it's tried to be resolved to an
uid with getpwnam(3).
Implies --acl.
Change-Id: I2d5a3d3e178be7ffdf22b46a56f33a7eeaaa7fe1
BUG: 3242
Reviewed-on: http://review.gluster.com/127
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mount/fuse/src/fuse-bridge.c')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 29e9787ed..174938a68 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3211,6 +3211,10 @@ fuse_thread_proc (void *data) msg = finh + 1; } + if (priv->uid_map_root && + finh->uid == priv->uid_map_root) + finh->uid = 0; + #ifdef GF_DARWIN_HOST_OS if (finh->opcode >= FUSE_OP_HIGH) /* turn down MacFUSE specific messages */ @@ -3599,6 +3603,11 @@ init (xlator_t *this_xl) if (ret == 0) priv->client_pid_set = _gf_true; + ret = dict_get_uint32 (options, "uid-map-root", + &priv->uid_map_root); + if (ret != 0) + priv->uid_map_root = 0; + priv->direct_io_mode = 2; ret = dict_get_str (options, ZR_DIRECT_IO_OPT, &value_string); if (ret == 0) { @@ -3620,6 +3629,8 @@ init (xlator_t *this_xl) ret = gf_string2boolean (value_string, &priv->acl); GF_ASSERT (ret == 0); } + if (priv->uid_map_root) + priv->acl = 1; priv->fuse_dump_fd = -1; @@ -3779,6 +3790,9 @@ struct volume_options options[] = { { .key = {"client-pid"}, .type = GF_OPTION_TYPE_INT }, + { .key = {"uid-map-root"}, + .type = GF_OPTION_TYPE_INT + }, { .key = {"sync-mtab"}, .type = GF_OPTION_TYPE_BOOL }, |