diff options
| author | Anand Avati <avati@redhat.com> | 2013-04-23 13:59:12 -0700 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2013-06-08 14:46:32 -0700 | 
| commit | 0a2f71d2fc8987e7226ae3ef7bc0cb05b5c53188 (patch) | |
| tree | 3b2d156fd6c785a8ac335e89d9f5ab00b670117e /libglusterfs | |
| parent | 1e2211d47c9fae3eb8dcb32aa7f170ba9d104134 (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/5153
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.h | 19 | 
1 files changed, 18 insertions, 1 deletions
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 9344d7067..004336d4c 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -196,7 +196,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;                   \                          frame->root->gid = task->gid;                   \ @@ -234,6 +234,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);  | 
