diff options
| author | John Kohl <jtkohl@mit.edu> | 1990-03-26 12:04:20 +0000 |
|---|---|---|
| committer | John Kohl <jtkohl@mit.edu> | 1990-03-26 12:04:20 +0000 |
| commit | a8480ca801332ab8fa5ca999517a8a62807d6f62 (patch) | |
| tree | 887cccab9e5cda47256623ca7c19bc9d8b815c14 /src | |
| parent | e92f2896db56232f502d5fa359ff1d481ef85c8f (diff) | |
| download | krb5-a8480ca801332ab8fa5ca999517a8a62807d6f62.tar.gz krb5-a8480ca801332ab8fa5ca999517a8a62807d6f62.tar.xz krb5-a8480ca801332ab8fa5ca999517a8a62807d6f62.zip | |
use key copy function
add a cleanup_key() #define, and use it
cleanup:
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@409 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/krb5/krb/get_in_tkt.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/krb5/krb/get_in_tkt.c b/src/lib/krb5/krb/get_in_tkt.c index 4d158713d..f8722e17d 100644 --- a/src/lib/krb5/krb/get_in_tkt.c +++ b/src/lib/krb5/krb/get_in_tkt.c @@ -144,14 +144,16 @@ OLDDECLARG(krb5_ccache, ccache) /* XXX check the contents for sanity... */ /* fill in the credentials */ - creds->keyblock = *as_reply->enc_part2->session; - if (!(creds->keyblock.contents = (krb5_octet *)malloc(creds->keyblock.length))) { + if (retval = krb5_copy_keyblock(as_reply->enc_part2->session, + &creds->keyblock)) { krb5_free_kdc_rep(as_reply); - return ENOMEM; + return retval; } - - bcopy((char *)as_reply->enc_part2->session->contents, - (char *)creds->keyblock.contents, creds->keyblock.length); +#define cleanup_key() {bzero((char *)creds->keyblock.contents, \ + creds->keyblock.length); \ + free((char *)creds->keyblock.contents); \ + creds->keyblock.contents = 0; \ + creds->keyblock.length = 0;} creds->times = as_reply->enc_part2->times; creds->is_skey = FALSE; /* this is an AS_REQ, so cannot @@ -160,11 +162,10 @@ OLDDECLARG(krb5_ccache, ccache) creds->second_ticket.length = 0; creds->second_ticket.data = 0; - retval = encode_krb5_ticket(as_reply->ticket, &packet); krb5_free_kdc_rep(as_reply); if (retval) { - free((char *)creds->keyblock.contents); + cleanup_key(); return retval; } creds->ticket = *packet; @@ -174,7 +175,7 @@ OLDDECLARG(krb5_ccache, ccache) if (retval = krb5_cc_store_cred(ccache, creds)) { /* clean up the pieces */ free((char *)creds->ticket.data); - free((char *)creds->keyblock.contents); + cleanup_key(); return retval; } return 0; |
