From f0ccf3ac43cd6e0fe1b3dc1a429cb3ec18a25db7 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 21 May 2014 17:15:34 +0530 Subject: encryption/crypt: Don't perform open on symlinks Change-Id: I9be8634f8f3b09def21ba977050330aa3f26c230 BUG: 1099858 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/7824 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/encryption/crypt/src/crypt.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'xlators/encryption') 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); -- cgit