minor_status not cleared sometimes (gsstest nits)
authorTom Yu <tlyu@mit.edu>
Wed, 21 Sep 2005 23:01:26 +0000 (23:01 +0000)
committerTom Yu <tlyu@mit.edu>
Wed, 21 Sep 2005 23:01:26 +0000 (23:01 +0000)
* 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
src/lib/gssapi/krb5/duplicate_name.c
src/lib/gssapi/krb5/export_name.c

index 3800195d1f8c6fa1fa2679f8aa8568fca1826ecb..17280db6a0bd68526fb4367fd4a1a488a0858f9d 100644 (file)
@@ -1,5 +1,9 @@
 2005-09-21  Tom Yu  <tlyu@mit.edu>
 
+       * 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.
index c186ed4f0f19c7f57ea623877c5624a87765c485..ffb762952bcf21d53784f669d9f535086eab2c9f 100644 (file)
@@ -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;
        }
 
index c949d471ec46368be647f1cc11b3d851de2bf988..7605d4342ad864f547832f0719195d93120a932d 100644 (file)
@@ -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;