pull up r18887 from trunk
authorTom Yu <tlyu@mit.edu>
Thu, 30 Nov 2006 23:00:51 +0000 (23:00 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 30 Nov 2006 23:00:51 +0000 (23:00 +0000)
 r18887@cathode-dark-space:  tlyu | 2006-11-30 17:42:16 -0500
 ticket: 4805
 tags: pullup
 component: krb5-libs

  * src/lib/krb5/krb/vfy_increds.c (krb5_verify_init_creds): Use
  krb5_cc_new_unique().

  * src/lib/gssapi/krb5/accept_sec_context.c:
  (rd_and_store_for_creds): Use krb5_cc_new_unique().

ticket: 408
version_fixed: 1.6

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@18889 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/accept_sec_context.c
src/lib/krb5/krb/vfy_increds.c

index 618b012f98b3b4af3aca5f4622373d72d5238e52..7dcdd1a51a5b895f7e481ef4f6256f8a5b075606 100644 (file)
@@ -93,7 +93,6 @@ rd_and_store_for_creds(context, auth_context, inbuf, out_cred)
 {
     krb5_creds ** creds = NULL;
     krb5_error_code retval;
-    krb5_ccache template_ccache = NULL;
     krb5_ccache ccache = NULL;
     krb5_gss_cred_id_t cred = NULL;
     krb5_auth_context new_auth_ctx = NULL;
@@ -134,18 +133,11 @@ rd_and_store_for_creds(context, auth_context, inbuf, out_cred)
                        goto cleanup;
                }
 
-    /* Lots of kludging going on here... Some day the ccache interface
-       will be rewritten though */
-
-    if ((retval = krb5_cc_resolve(context, "MEMORY:GSSAPI", &template_ccache)))
-       goto cleanup;
-
-    ccache = template_ccache; /* krb5_cc_gen_new will replace so make a copy */
-    if ((retval = krb5_cc_gen_new(context, &ccache))) {
+    if ((retval = krb5_cc_new_unique(context, "MEMORY", NULL, &ccache))) {
        ccache = NULL;
         goto cleanup;
     }
-    
+
     if ((retval = krb5_cc_initialize(context, ccache, creds[0]->client)))
        goto cleanup;
 
@@ -200,9 +192,6 @@ cleanup:
     if (creds)
        krb5_free_tgt_creds(context, creds);
 
-    if (template_ccache)
-       (void)krb5_cc_close(context, template_ccache);
-
     if (ccache)
        (void)krb5_cc_destroy(context, ccache);
 
index 39fb1f083ec4a26b16a1fc52a704b1b731abffa8..37adb9b9351cc091dd077d53996a75c7a8e69f51 100644 (file)
@@ -60,7 +60,6 @@ krb5_verify_init_creds(krb5_context context,
    krb5_error_code ret;
    krb5_principal server;
    krb5_keytab keytab;
-   krb5_ccache template_ccache;
    krb5_ccache ccache;
    krb5_keytab_entry kte;
    krb5_creds in_creds, *out_creds;
@@ -71,7 +70,6 @@ krb5_verify_init_creds(krb5_context context,
 
    server = NULL;
    keytab = NULL;
-   template_ccache = NULL;
    ccache = NULL;
    out_creds = NULL;
    authcon = NULL;
@@ -139,15 +137,12 @@ krb5_verify_init_creds(krb5_context context,
         internals with a coherent idea of "in" and "out". */
 
       /* insert the initial cred into the ccache */
-      
-      if ((ret = krb5_cc_resolve(context, "MEMORY:rd_req", &template_ccache)))
-        goto cleanup;
-      ccache = template_ccache; /* krb5_cc_gen_new will replace so make a copy */
-      if ((ret = krb5_cc_gen_new(context, &ccache))) {
+
+      if ((ret = krb5_cc_new_unique(context, "MEMORY", NULL, &ccache))) {
          ccache = NULL;
          goto cleanup;
       }
-       
+
       if ((ret = krb5_cc_initialize(context, ccache, creds->client)))
         goto cleanup;
 
@@ -216,8 +211,6 @@ cleanup:
       krb5_free_principal(context, server);
    if (!keytab_arg && keytab)
       krb5_kt_close(context, keytab);
-   if (template_ccache)
-       krb5_cc_close(context, template_ccache);
    if (ccache)
       krb5_cc_destroy(context, ccache);
    if (out_creds)