From 714c9776c5374496ebcecb0b139718ff5fef494b Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Tue, 23 Apr 2013 13:59:12 -0700 Subject: 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 Reviewed-on: http://review.gluster.org/4878 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/syncop.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/syncop.h') diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index ee8a3277..0bb34a24 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); -- cgit