From 3b4d753fc5169469da270c831654a8fae407cfdf Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 24 Apr 2004 20:22:31 +0000 Subject: [PATCH] * gssapi_krb5.c (kg_get_ccache_name): Don't test err while it's still known to be 0. (kg_set_ccache_name): Likewise. Return after an error rather than continuing. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16267 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/ChangeLog | 7 +++++ src/lib/gssapi/krb5/gssapi_krb5.c | 52 ++++++++++++------------------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index caceb6e40..f55b779da 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,10 @@ +2004-04-24 Ken Raeburn + + * gssapi_krb5.c (kg_get_ccache_name): Don't test err while it's + still known to be 0. + (kg_set_ccache_name): Likewise. Return after an error rather + than continuing. + 2004-04-13 Jeffrey Altman * k5unseal.c: gss_krb5int_unseal_token_v3() takes a pointer to diff --git a/src/lib/gssapi/krb5/gssapi_krb5.c b/src/lib/gssapi/krb5/gssapi_krb5.c index a77b9541d..2ce34e24e 100644 --- a/src/lib/gssapi/krb5/gssapi_krb5.c +++ b/src/lib/gssapi/krb5/gssapi_krb5.c @@ -209,12 +209,10 @@ kg_get_ccache_name (OM_uint32 *minor_status, const char **out_name) OM_uint32 err = 0; OM_uint32 minor; - if (!err) { - if (GSS_ERROR(kg_get_context (&minor, &context))) { - err = minor; - } + if (GSS_ERROR(kg_get_context (&minor, &context))) { + err = minor; } - + if (!err) { if (kg_ccache_name != NULL) { name = kg_ccache_name; @@ -241,32 +239,22 @@ OM_uint32 kg_set_ccache_name (OM_uint32 *minor_status, const char *name) { char *new_name = NULL; - OM_uint32 err = 0; - - if (!err) { - if (name) { - new_name = malloc(strlen(name) + 1); - if (new_name == NULL) { - err = ENOMEM; - } else { - strcpy(new_name, name); - } - } - } - - if (!err) { - char *swap = NULL; - - swap = kg_ccache_name; - kg_ccache_name = new_name; - new_name = swap; - } - - if (new_name != NULL) { - free (new_name); + char *swap = NULL; + + if (name) { + new_name = malloc(strlen(name) + 1); + if (new_name == NULL) { + *minor_status = ENOMEM; + return GSS_S_FAILURE; + } + strcpy(new_name, name); } - - *minor_status = err; - return (*minor_status == 0) ? GSS_S_COMPLETE : GSS_S_FAILURE; -} + swap = kg_ccache_name; + kg_ccache_name = new_name; + new_name = swap; + + free (new_name); + *minor_status = 0; + return GSS_S_COMPLETE; +} -- 2.26.2