Reduce the scope of the temporary assignment to tktauthent->ticket
authorJohn Carr <jfc@mit.edu>
Fri, 21 Aug 1992 02:50:22 +0000 (02:50 +0000)
committerJohn Carr <jfc@mit.edu>
Fri, 21 Aug 1992 02:50:22 +0000 (02:50 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2342 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/rd_req_dec.c

index eada12355bb70796c18d4df1d8b5a0a9fdbb4e0c..cb2c73a8397317883cd37e479c9abc0f22ead673 100644 (file)
@@ -169,15 +169,17 @@ krb5_tkt_authent **authdat;
        goto cleanup;
     }
 
-    tktauthent->ticket = req->ticket;  /* only temporarily...allocated
-                                          below */
 
     /* only check rcache if sender has provided one---some services
        may not be able to use replay caches (such as datagram servers) */
     if (rcache) {
        krb5_donot_replay rep;
 
-       if (retval = krb5_auth_to_rep(tktauthent, &rep))
+       tktauthent->ticket = req->ticket;       /* Temporary; allocated below */
+       retval = krb5_auth_to_rep(tktauthent, &rep);
+       tktauthent->ticket = 0;                 /* Don't allow cleanup to free
+                                                  original ticket.  */
+       if (retval)
            goto cleanup;
        retval = krb5_rc_store(rcache, &rep);
        xfree(rep.server);
@@ -185,7 +187,6 @@ krb5_tkt_authent **authdat;
        if (retval)
            goto cleanup;
     }
-    tktauthent->ticket = 0;
 
     /* if starttime is not in ticket, then treat it as authtime */
     if (req->ticket->enc_part2->times.starttime != 0)