From 8b43213ebe6ddd8d10f33a4bf4cc2f987c29ce7e Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Wed, 21 Sep 2005 23:01:26 +0000 Subject: [PATCH] minor_status not cleared sometimes (gsstest nits) * duplicate_name.c (krb5_gss_duplicate_name): * export_name.c (krb5_gss_export_name): Fix gsstest nit by clearing minor_status if no errors. ticket: new target_version: 1.4.3 tags: pullup component: krb5-libs git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17385 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/ChangeLog | 4 ++++ src/lib/gssapi/krb5/duplicate_name.c | 6 +++++- src/lib/gssapi/krb5/export_name.c | 12 +++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 3800195d1..17280db6a 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,5 +1,9 @@ 2005-09-21 Tom Yu + * duplicate_name.c (krb5_gss_duplicate_name): + * export_name.c (krb5_gss_export_name): Fix gsstest nit by + clearing minor_status if no errors. + * inq_cred.c (krb5_gss_inquire_cred): Initialize ret_name to NULL. Only call kg_save_name() if ret_name is actually non-NULL. Return GSS_C_NO_NAME for now if no principal name in the cred. diff --git a/src/lib/gssapi/krb5/duplicate_name.c b/src/lib/gssapi/krb5/duplicate_name.c index c186ed4f0..ffb762952 100644 --- a/src/lib/gssapi/krb5/duplicate_name.c +++ b/src/lib/gssapi/krb5/duplicate_name.c @@ -35,9 +35,13 @@ OM_uint32 krb5_gss_duplicate_name(OM_uint32 *minor_status, krb5_error_code code; krb5_principal princ, outprinc; + if (minor_status) + *minor_status = 0; + code = krb5_init_context(&context); if (code) { - *minor_status = code; + if (minor_status) + *minor_status = code; return GSS_S_FAILURE; } diff --git a/src/lib/gssapi/krb5/export_name.c b/src/lib/gssapi/krb5/export_name.c index c949d471e..7605d4342 100644 --- a/src/lib/gssapi/krb5/export_name.c +++ b/src/lib/gssapi/krb5/export_name.c @@ -36,9 +36,13 @@ OM_uint32 krb5_gss_export_name(OM_uint32 *minor_status, size_t length; char *str, *cp; + if (minor_status) + *minor_status = 0; + code = krb5_init_context(&context); if (code) { - *minor_status = code; + if (minor_status) + *minor_status = code; return GSS_S_FAILURE; } @@ -54,7 +58,8 @@ OM_uint32 krb5_gss_export_name(OM_uint32 *minor_status, if ((code = krb5_unparse_name(context, (krb5_principal) input_name, &str))) { - *minor_status = code; + if (minor_status) + *minor_status = code; krb5_free_context(context); return(GSS_S_FAILURE); } @@ -65,7 +70,8 @@ OM_uint32 krb5_gss_export_name(OM_uint32 *minor_status, exported_name->value = malloc(exported_name->length); if (!exported_name->value) { free(str); - *minor_status = ENOMEM; + if (minor_status) + *minor_status = ENOMEM; return(GSS_S_FAILURE); } cp = exported_name->value; -- 2.26.2