diff options
| author | Pranith Kumar K <pkarampu@redhat.com> | 2014-05-21 17:15:34 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-05-23 03:11:08 -0700 | 
| commit | f0ccf3ac43cd6e0fe1b3dc1a429cb3ec18a25db7 (patch) | |
| tree | c1a79526a4d9ec784c180fa5bb9e53a4a9b0713b /xlators/encryption/crypt/src/crypt.c | |
| parent | 5efeba0f44f9d2f79af8f51fe01ec66c59851d54 (diff) | |
encryption/crypt: Don't perform open on symlinks
Change-Id: I9be8634f8f3b09def21ba977050330aa3f26c230
BUG: 1099858
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/7824
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/encryption/crypt/src/crypt.c')
| -rw-r--r-- | xlators/encryption/crypt/src/crypt.c | 18 | 
1 files changed, 12 insertions, 6 deletions
diff --git a/xlators/encryption/crypt/src/crypt.c b/xlators/encryption/crypt/src/crypt.c index 13b1bd96248..f43989bb901 100644 --- a/xlators/encryption/crypt/src/crypt.c +++ b/xlators/encryption/crypt/src/crypt.c @@ -3127,8 +3127,6 @@ static int32_t linkop_begin(call_frame_t *frame,  	unwind_fn = linkop_unwind_dispatch(local->fop);  	mop = linkop_mtdop_dispatch(local->fop); -	if (local->fd->inode->ia_type == IA_IFLNK) -		goto wind;  	if (op_ret < 0)  		/*  		 * verification failed @@ -3230,9 +3228,6 @@ static int32_t linkop_begin(call_frame_t *frame,  		   0,  		   NULL);  	return 0; - wind: -	wind_fn(frame, this); -	return 0;   error:  	local->op_ret = -1;  	local->op_errno = op_errno; @@ -3332,13 +3327,19 @@ static int32_t linkop(call_frame_t *frame,  	dict_t *dict;  	crypt_local_t *local;  	void (*unwind_fn)(call_frame_t *frame); +        void (*wind_fn)(call_frame_t *frame, xlator_t *this); +        wind_fn = linkop_wind_dispatch(op);  	unwind_fn = linkop_unwind_dispatch(op);  	ret = linkop_grab_local(frame, this, oldloc, newloc, flags, xdata, op);  	local = frame->local;  	if (ret)  		goto error; + +        if (local->fd->inode->ia_type == IA_IFLNK) +                goto wind; +  	dict = dict_new();  	if (!dict) {  		gf_log(this->name, GF_LOG_ERROR, "Can not create dict"); @@ -3375,7 +3376,12 @@ static int32_t linkop(call_frame_t *frame,  		   dict);  	dict_unref(dict);  	return 0; - error: + +wind: +        wind_fn(frame, this); +        return 0; + +error:  	local->op_ret = -1;  	local->op_errno = ret;  	unwind_fn(frame);  | 
