* rel_cred.c (krb5_gss_release_cred): Create and destroy a local krb5 context.
authorKen Raeburn <raeburn@mit.edu>
Sun, 21 Mar 2004 02:09:21 +0000 (02:09 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sun, 21 Mar 2004 02:09:21 +0000 (02:09 +0000)
* rel_name.c (krb5_gss_release_name): Likewise.
* val_cred.c (krb5_gss_validate_cred): Likewise.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16196 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/ChangeLog
src/lib/gssapi/krb5/rel_cred.c
src/lib/gssapi/krb5/rel_name.c
src/lib/gssapi/krb5/val_cred.c

index 08d2417bc4f0114a018857609140aa74bec73c54..40c7c6c09b6d4132bc56c7e5d7ed658c1a450b30 100644 (file)
@@ -1,3 +1,10 @@
+2004-03-20  Ken Raeburn  <raeburn@mit.edu>
+
+       * rel_cred.c (krb5_gss_release_cred): Create and destroy a local
+       krb5 context.
+       * rel_name.c (krb5_gss_release_name): Likewise.
+       * val_cred.c (krb5_gss_validate_cred): Likewise.
+
 2004-03-19  Ken Raeburn  <raeburn@mit.edu>
 
        * add_cred.c (krb5_gss_add_cred): Create and destroy a local krb5
index 43d5ca1c2efae7edd0166eb52c173caae543a323..fd8bb89456406a2827ed2163688c8ce30de6998b 100644 (file)
@@ -31,16 +31,21 @@ krb5_gss_release_cred(minor_status, cred_handle)
    krb5_gss_cred_id_t cred;
    krb5_error_code code1, code2, code3;
 
-   if (GSS_ERROR(kg_get_context(minor_status, &context)))
-      return(GSS_S_FAILURE);
+   code1 = krb5_init_context(&context);
+   if (code1) {
+       *minor_status = code1;
+       return GSS_S_FAILURE;
+   }
 
    if (*cred_handle == GSS_C_NO_CREDENTIAL) {
       *minor_status = 0;
+      krb5_free_context(context);
       return(GSS_S_COMPLETE);
    }
 
    if (! kg_delete_cred_id(*cred_handle)) {
       *minor_status = (OM_uint32) G_VALIDATE_FAILED;
+      krb5_free_context(context);
       return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_NO_CRED);
    }
 
@@ -63,6 +68,7 @@ krb5_gss_release_cred(minor_status, cred_handle)
    if (cred->princ)
       krb5_free_principal(context, cred->princ);
    xfree(cred);
+   krb5_free_context(context);
 
    *cred_handle = NULL;
 
index 56f56d060d49585c017a386a3fd2a2a2df29dda9..961ccb29c9f2ef9359ed601ebfdf15eff3db004b 100644 (file)
@@ -28,18 +28,24 @@ krb5_gss_release_name(minor_status, input_name)
      gss_name_t *input_name;
 {
    krb5_context context;
-    
-   if (GSS_ERROR(kg_get_context(minor_status, &context)))
-      return(GSS_S_FAILURE);
+   krb5_error_code code;
+
+   code = krb5_init_context(&context);
+   if (code) {
+       *minor_status = code;
+       return GSS_S_FAILURE;
+   }
 
    if (! kg_validate_name(*input_name)) {
       *minor_status = (OM_uint32) G_VALIDATE_FAILED;
+      krb5_free_context(context);
       return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME);
    }
 
    (void)kg_delete_name(*input_name);
 
    krb5_free_principal(context, (krb5_principal) *input_name);
+   krb5_free_context(context);
 
    *input_name = (gss_name_t) NULL;
 
index aea1765bc2a463323e7ee647ec1307672dbf70ee..fef848044011b6da4cc5ef747ace7e12916692df 100644 (file)
@@ -40,27 +40,34 @@ krb5_gss_validate_cred(minor_status, cred_handle)
     krb5_error_code code;
     krb5_principal princ;
        
-    if (GSS_ERROR(kg_get_context(minor_status, &context)))
-       return(GSS_S_FAILURE);
+    code = krb5_init_context(&context);
+    if (code) {
+       *minor_status = code;
+       return GSS_S_FAILURE;
+    }
 
     if (!kg_validate_cred_id(cred_handle)) {
        *minor_status = (OM_uint32) G_VALIDATE_FAILED;
+       krb5_free_context(context);
        return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_DEFECTIVE_CREDENTIAL);
     }
 
     cred = (krb5_gss_cred_id_t) cred_handle;
-       
+
     if (cred->ccache) {
        if ((code = krb5_cc_get_principal(context, cred->ccache, &princ))) {
            *minor_status = code;
+           krb5_free_context(context);
            return(GSS_S_DEFECTIVE_CREDENTIAL);
        }
        if (!krb5_principal_compare(context, princ, cred->princ)) {
            *minor_status = KG_CCACHE_NOMATCH;
+           krb5_free_context(context);
            return(GSS_S_DEFECTIVE_CREDENTIAL);
        }
        (void)krb5_free_principal(context, princ);
     }
+    krb5_free_context(context);
     *minor_status = 0;
     return GSS_S_COMPLETE;
 }