From df039a4aba685990e47e5edb7bc9e09ff7daf56a Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Fri, 18 Nov 2011 10:06:22 +0100 Subject: [PATCH] Don't overwrite minor error code before retrieving the error message --- plugins/gs2.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) Index: cyrus-sasl-2.1.25/plugins/gs2.c =================================================================== --- cyrus-sasl-2.1.25.orig/plugins/gs2.c +++ cyrus-sasl-2.1.25/plugins/gs2.c @@ -531,6 +531,11 @@ fprintf(stderr,"gss_acquire_cred over an ret = SASL_OK; cleanup: + if (ret == SASL_OK && maj_stat != GSS_S_COMPLETE) { + sasl_gs2_seterror(text->utils, maj_stat, min_stat); + ret = SASL_FAIL; + } + if (initialContextToken) gss_release_buffer(&min_stat, &input_token); gss_release_buffer(&min_stat, &name_buf); @@ -538,10 +543,6 @@ cleanup: gss_release_buffer(&min_stat, &output_token); gss_release_name(&min_stat, &without); - if (ret == SASL_OK && maj_stat != GSS_S_COMPLETE) { - sasl_gs2_seterror(text->utils, maj_stat, min_stat); - ret = SASL_FAIL; - } if (ret < SASL_OK) sasl_gs2_free_context_contents(text); @@ -838,13 +839,14 @@ static int gs2_client_mech_step(void *co oparams->doneflag = 1; cleanup: - gss_release_buffer(&min_stat, &output_token); - gss_release_buffer(&min_stat, &name_buf); - if (ret == SASL_OK && maj_stat != GSS_S_COMPLETE) { sasl_gs2_seterror(text->utils, maj_stat, min_stat); ret = SASL_FAIL; } + + gss_release_buffer(&min_stat, &output_token); + gss_release_buffer(&min_stat, &name_buf); + if (ret < SASL_OK) sasl_gs2_free_context_contents(text);