diff mbox

rpc.gssd: Only clear the retval if it has not been set

Message ID 1438290916-12071-1-git-send-email-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson July 30, 2015, 9:15 p.m. UTC
In gssd_search_krb5_keytab() an error code can be
cleared by blindly setting retval to zero.

Reported-by: Jianhong Yin <jiyin@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/gssd/krb5_util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Steve Dickson July 31, 2015, 12:18 p.m. UTC | #1
On 07/30/2015 05:15 PM, Steve Dickson wrote:
> In gssd_search_krb5_keytab() an error code can be
> cleared by blindly setting retval to zero.
> 
> Reported-by: Jianhong Yin <jiyin@redhat.com>
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed... 

steved.
> ---
>  utils/gssd/krb5_util.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
> index f1ebc0d..ecf17a2 100644
> --- a/utils/gssd/krb5_util.c
> +++ b/utils/gssd/krb5_util.c
> @@ -772,7 +772,9 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
>  			    "keytab '%s'\n", k5err, kt_name);
>  	}
>  
> -	retval = 0;
> +	/* Only clear the retval if has not been set */
> +	if (retval < 0)
> +		retval = 0;
>    out:
>  	free(k5err);
>  	return retval;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index f1ebc0d..ecf17a2 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -772,7 +772,9 @@  gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
 			    "keytab '%s'\n", k5err, kt_name);
 	}
 
-	retval = 0;
+	/* Only clear the retval if has not been set */
+	if (retval < 0)
+		retval = 0;
   out:
 	free(k5err);
 	return retval;