summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-04-23 13:59:12 -0700
committerVijay Bellur <vbellur@redhat.com>2013-04-24 01:05:03 -0700
commit714c9776c5374496ebcecb0b139718ff5fef494b (patch)
tree2bc05bd80a4b718f618849dc68ade1e48e8dc36f /libglusterfs
parentfdde66da060fefcbdec664b6420658936f18b345 (diff)
syncop: set credentials of running process in @frame
Inherit the pid/euid/egid/groups of the running process in the frame. Do this only in cases where a loaded frame was not presented to the synctask. This behavior is required for Samba VFS. Change-Id: Ib181c90f47c6741197b9ce9f67a19e2914b647d2 BUG: 953694 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/4878 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/syncop.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index ee8a3277d36..0bb34a24156 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -190,7 +190,7 @@ struct syncargs {
if (task) \
frame = task->opframe; \
else \
- frame = create_frame (THIS, THIS->ctx->pool); \
+ frame = syncop_create_frame (THIS); \
\
if (task) { \
frame->root->uid = task->uid; \
@@ -232,6 +232,23 @@ int synctask_setid (struct synctask *task, uid_t uid, gid_t gid);
#define SYNCTASK_SETID(uid, gid) synctask_setid (synctask_get(), uid, gid);
+static inline call_frame_t *
+syncop_create_frame (xlator_t *this)
+{
+ call_frame_t *frame = NULL;
+
+ frame = create_frame (this, this->ctx->pool);
+ if (!frame)
+ return NULL;
+
+ frame->root->pid = getpid();
+ frame->root->uid = geteuid ();
+ frame->root->gid = getegid ();
+ frame->root->ngrps = getgroups (GF_MAX_AUX_GROUPS, frame->root->groups);
+
+ return frame;
+}
+
int synclock_init (synclock_t *lock);
int synclock_destory (synclock_t *lock);
int synclock_lock (synclock_t *lock);