* gssapi_krb5.c (kg_get_ccache_name): Don't test err while it's still known to
authorKen Raeburn <raeburn@mit.edu>
Sat, 24 Apr 2004 20:22:31 +0000 (20:22 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 24 Apr 2004 20:22:31 +0000 (20:22 +0000)
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
src/lib/gssapi/krb5/gssapi_krb5.c

index caceb6e40066cf5a8ee2e954131b3f0ee5b8983e..f55b779da3f305159395b039660fa839af13d906 100644 (file)
@@ -1,3 +1,10 @@
+2004-04-24  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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 <jaltman@mit.edu>
  
     * k5unseal.c: gss_krb5int_unseal_token_v3() takes a pointer to 
index a77b9541d21fa31dc87b489e5a27fc9fe90ed9a1..2ce34e24e8bdf4e527fef4d44053fda6eee70dde 100644 (file)
@@ -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;
+}