summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-12-03 05:15:09 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-03 02:59:28 -0800
commit5821d2cf591789760e790d4af0575d1b9754c08d (patch)
treebc1c51179718031180f3bdacf54fb66176aa42c1 /libglusterfs/src
parent930f709881d85774baab1df57c2c03de93110bf7 (diff)
core, client, server: Support auxiliary group ids
Support for auxiliary group ids is needed for transmission of more than one group id right through the xlator tree so that posix can use these group ids to perform in-house permission tests. The in-house permission checks are needed so that we do not have to depend on non-POSIX calls like setfs[ug]id for changing the user for each fop. The setfs[ug]id are also limited since they do not allow setting multiple group id as required for operation with NFS, which sends us all the group ids for a process issuing file system requests. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 400 (Support auxiliary gids in GlusterFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=400
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/protocol.h14
-rw-r--r--libglusterfs/src/stack.h6
2 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h
index ede5adae4e8..450e38731c2 100644
--- a/libglusterfs/src/protocol.h
+++ b/libglusterfs/src/protocol.h
@@ -959,10 +959,24 @@ typedef struct {
typedef struct { } __attribute__((packed)) gf_cbk_forget_rsp_t;
+/* This corresponds to the max 16 number of group IDs that are sent through an
+ * RPC request. Since NFS is the only one going to set this, we can be safe
+ * in keeping this size hardcoded.
+ */
+#define GF_REQUEST_MAXGROUPS 16
+
typedef struct {
uint32_t pid;
uint32_t uid;
uint32_t gid;
+
+ /* Number of groups being sent through the array above. */
+ uint32_t ngrps;
+
+ /* Array of groups to which the uid belongs apart from the primary group
+ * in gid.
+ */
+ uint32_t groups[GF_REQUEST_MAXGROUPS];
} __attribute__ ((packed)) gf_hdr_req_t;
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index d4941a39f49..0af9ed35991 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -42,6 +42,7 @@ typedef struct _call_pool_t call_pool_t;
#include "list.h"
#include "common-utils.h"
#include "globals.h"
+#include "protocol.h"
typedef int32_t (*ret_fn_t) (call_frame_t *frame,
@@ -92,6 +93,8 @@ struct _call_stack_t {
uid_t uid;
gid_t gid;
pid_t pid;
+ uint32_t ngrps;
+ uint32_t groups[GF_REQUEST_MAXGROUPS];
call_frame_t frames;
int32_t op;
@@ -253,6 +256,9 @@ copy_frame (call_frame_t *frame)
newstack->uid = oldstack->uid;
newstack->gid = oldstack->gid;
newstack->pid = oldstack->pid;
+ newstack->ngrps = oldstack->ngrps;
+ memcpy (newstack->groups, oldstack->groups,
+ sizeof (uint32_t) * GF_REQUEST_MAXGROUPS);
newstack->unique = oldstack->unique;
newstack->frames.this = frame->this;