/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*/
/*
*
* Copyright 1990,1991,1999,2007,2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
*/
#include "k5-int.h"
#include "cc-int.h"
#include "../krb/int-proto.h"
#define KRB5_OK 0
#define flags_match(a,b) (((a) & (b)) == (a))
static int
{
}
static krb5_boolean
{
if (t1->renew_till) {
return FALSE; /* this one expires too late */
}
return FALSE; /* this one expires too late */
}
/* only care about expiration on a times_match */
return TRUE;
}
static krb5_boolean
{
}
/* only match the server name portion, not the server realm portion */
static krb5_boolean
{
return retval;
/*
* Hack to ignore the server realm for the purposes of the compare.
*/
}
static krb5_boolean
{
return TRUE;
return FALSE;
mdata++;
data++;
}
}
static krb5_boolean
{
if (!data1) {
if (!data2)
return TRUE;
else
return FALSE;
}
}
static int
{
int i;
for (i = 0; i < nktypes; i++)
return i;
return -1;
}
/*
* Effects:
* Searches the credentials cache for a credential matching mcreds,
* with the fields specified by whichfields. If one if found, it is
* returned in creds, which should be freed by the caller with
* krb5_free_credentials().
*
* The fields are interpreted in the following way (all constants are
* preceded by KRB5_TC_). MATCH_IS_SKEY requires the is_skey field to
* match exactly. MATCH_TIMES requires the requested lifetime to be
* at least as great as that specified; MATCH_TIMES_EXACT requires the
* requested lifetime to be exactly that specified. MATCH_FLAGS
* requires only the set bits in mcreds be set in creds;
* MATCH_FLAGS_EXACT requires all bits to match.
*
* Flag SUPPORTED_KTYPES means check all matching entries that have
* any supported enctype (according to tgs_enctypes) and return the one
* with the enctype listed earliest. Return CC_NOT_KTYPE if a match
* is found *except* for having a supported enctype.
*
* Errors:
* system errors
* permission errors
* KRB5_CC_NOMEM
* KRB5_CC_NOT_KTYPE
*/
krb5int_cc_creds_match_request(krb5_context context, krb5_flags whichfields, krb5_creds *mcreds, krb5_creds *creds)
{
if (((set(KRB5_TC_MATCH_SRV_NAMEONLY) &&
&&
(! set(KRB5_TC_MATCH_IS_SKEY) ||
&&
(! set(KRB5_TC_MATCH_FLAGS_EXACT) ||
&&
(! set(KRB5_TC_MATCH_FLAGS) ||
&&
(! set(KRB5_TC_MATCH_TIMES_EXACT) ||
&&
(! set(KRB5_TC_MATCH_TIMES) ||
&&
( ! set(KRB5_TC_MATCH_AUTHDATA) ||
&&
(! set(KRB5_TC_MATCH_2ND_TKT) ||
&&
((! set(KRB5_TC_MATCH_KTYPE))||
return TRUE;
return FALSE;
}
static krb5_error_code
{
/* This function could be considerably faster if it kept indexing */
/* information.. sounds like a "next version" idea to me. :-) */
struct {
int pref;
int have_creds = 0;
/* Solaris Kerberos */
return kret;
if (oflags & KRB5_TC_OPENCLOSE)
if (oflags & KRB5_TC_OPENCLOSE)
return kret;
}
{
if (ktypes) {
if (have_creds)
else
have_creds = 1;
continue;
}
} else {
*creds = fetchcreds;
/* Solaris Kerberos */
if (oflags & KRB5_TC_OPENCLOSE)
return KRB5_OK;
}
}
/* This one doesn't match */
}
/* If we get here, a match wasn't found */
if (oflags & KRB5_TC_OPENCLOSE)
if (have_creds) {
/* Solaris Kerberos */
return KRB5_OK;
} else
return nomatch_err;
}
krb5_cc_retrieve_cred_default (krb5_context context, krb5_ccache id, krb5_flags flags, krb5_creds *mcreds, krb5_creds *creds)
{
int nktypes;
if (flags & KRB5_TC_SUPPORTED_KTYPES) {
if (ret)
return ret;
return ret;
} else {
0, 0);
}
}
/* The following function duplicates some of the functionality above and */
/* should probably be merged with it at some point. It is used by the */
/* CCAPI krb5_cc_remove to figure out if the opaque credentials object */
/* returned by the CCAPI is the same creds as the caller passed in. */
/* Unlike the code above it requires that all structures be identical. */
{
/* Set to 0 when we hit the first mismatch and then fall through */
if (equal) {
}
if (equal) {
}
if (equal) {
}
if (equal) {
}
if (equal) {
}
if (equal) {
}
if (equal) {
unsigned int i;
if (addresses && compare_addresses) {
compare_addresses[i]);
}
} else {
}
}
if (equal) {
}
if (equal) {
}
if (equal) {
unsigned int i;
if (authdata && compare_authdata) {
}
} else {
}
}
return equal;
}