From bf8d0a6b832de4022fd789ce13eb082dc0bb5f50 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Fri, 26 Apr 1991 14:12:55 +0000 Subject: [PATCH] add KRB5_TC_MATCH_2ND_TKT field git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2041 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/file/fcc_retrv.c | 25 ++++++++++++++++++++++++- src/lib/krb5/ccache/stdio/scc_retrv.c | 21 +++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/ccache/file/fcc_retrv.c b/src/lib/krb5/ccache/file/fcc_retrv.c index 020f44476..af6633c35 100644 --- a/src/lib/krb5/ccache/file/fcc_retrv.c +++ b/src/lib/krb5/ccache/file/fcc_retrv.c @@ -36,6 +36,25 @@ static krb5_boolean srvname_match static krb5_boolean authdata_match PROTOTYPE ((krb5_authdata * const *, krb5_authdata * const *)); + +static krb5_boolean +data_match(data1, data2) +register const krb5_data *data1, *data2; +{ + if (!data1) { + if (!data2) + return TRUE; + else + return FALSE; + } + if (!data2) return FALSE; + + if (data1->length != data2->length) + return FALSE; + else + return memcmp(data1->data, data2->data, data1->length) ? FALSE : TRUE; +} + /* * Effects: * Searches the file cred cache is for a credential matching mcreds, @@ -95,7 +114,11 @@ krb5_fcc_retrieve(id, whichfields, mcreds, creds) times_match(&mcreds->times, &fetchcreds.times)) && ( ! set(KRB5_TC_MATCH_AUTHDATA) || - authdata_match(mcreds->authdata, fetchcreds.authdata))) + authdata_match(mcreds->authdata, fetchcreds.authdata)) + && + (! set(KRB5_TC_MATCH_2ND_TKT) || + data_match (mcreds->second_ticket, fetchcreds.second_ticket)) + ) { krb5_fcc_end_seq_get(id, &cursor); *creds = fetchcreds; diff --git a/src/lib/krb5/ccache/stdio/scc_retrv.c b/src/lib/krb5/ccache/stdio/scc_retrv.c index 2183d9a51..b0b7017d9 100644 --- a/src/lib/krb5/ccache/stdio/scc_retrv.c +++ b/src/lib/krb5/ccache/stdio/scc_retrv.c @@ -99,6 +99,24 @@ authdata_match(mdata, data) return !*mdata && !*data; } +static krb5_boolean +data_match(data1, data2) +register const krb5_data *data1, *data2; +{ + if (!data1) { + if (!data2) + return TRUE; + else + return FALSE; + } + if (!data2) return FALSE; + + if (data1->length != data2->length) + return FALSE; + else + return memcmp(data1->data, data2->data, data1->length) ? FALSE : TRUE; +} + /* * Effects: * Searches the file cred cache is for a credential matching mcreds, @@ -159,6 +177,9 @@ krb5_scc_retrieve(id, whichfields, mcreds, creds) && (! set(KRB5_TC_MATCH_AUTHDATA) || authdata_match (mcreds->authdata, fetchcreds.authdata)) + && + (! set(KRB5_TC_MATCH_2ND_TKT) || + data_match (mcreds->second_ticket, fetchcreds.second_ticket)) ) { krb5_scc_end_seq_get(id, &cursor); -- 2.26.2