copy_ticket is now a global
authorJohn Kohl <jtkohl@mit.edu>
Tue, 8 May 1990 15:59:53 +0000 (15:59 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 8 May 1990 15:59:53 +0000 (15:59 +0000)
fix up keyblock usage.

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

src/lib/krb5/krb/rd_req_dec.c

index ff9f8310098d48dabef323d0db624056c1dc8404..b36b57aacb2c5f03c826e97313634fe38f7dae1a 100644 (file)
@@ -55,8 +55,6 @@ static char rd_req_dec_c[] =
 
 static krb5_error_code decrypt_authenticator PROTOTYPE((const krb5_ap_req *,
                                                        krb5_authenticator **));
-static krb5_error_code copy_ticket PROTOTYPE((krb5_ticket *, krb5_ticket **));
-
 extern krb5_deltat krb5_clockskew;
 #define in_clock_skew(date) (abs((date)-currenttime) < krb5_clockskew)
 
@@ -105,8 +103,10 @@ krb5_tkt_authent *tktauthent;
        retval = krb5_kt_get_entry(keytabid, req->ticket->server,
                                   req->ticket->skvno, &ktentry);
        (void) krb5_kt_close(keytabid);
-       tkt_key_real = ktentry.key;
-       tkt_key = &tkt_key_real;
+       if (!retval) {
+           retval = krb5_copy_keyblock(&ktentry.key, &tkt_key_real);
+           tkt_key = &tkt_key_real;
+       }
        (void) krb5_kt_free_entry(&ktentry);
     }
     if (retval)
@@ -164,7 +164,7 @@ krb5_tkt_authent *tktauthent;
        clean_authenticator();
        return KRB5KRB_AP_ERR_TKT_INVALID;
     }
-    if (retval = copy_ticket(req->ticket, &tktauthent->ticket)) {
+    if (retval = krb5_copy_ticket(req->ticket, &tktauthent->ticket)) {
        clean_authenticator();
     } else
        tktauthent->ap_options = req->ap_options;
@@ -223,23 +223,4 @@ krb5_authenticator **authpp;
     clean_scratch();
     return retval;
 }
-static krb5_error_code
-copy_ticket(from, pto)
-krb5_ticket *from;
-krb5_ticket **pto;
-{
-    krb5_error_code retval;
-    krb5_data *scratch;
 
-    /* use a trick here---encoding a ticket & decoding it will
-       result in a freshly allocated data structure */
-    
-    if (retval = encode_krb5_ticket(from, &scratch))
-       return ENOMEM;                  /* lie a little, since we cheat */
-    retval = decode_krb5_ticket(scratch, pto);
-    krb5_free_data(scratch);
-    if (retval)
-       return ENOMEM;
-    else
-       return 0;
-}