/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* Copyright 1990 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.
*
*
* krb5_get_credentials()
*/
/*
Attempts to use the credentials cache or TGS exchange to get an additional
ticket for the
client identified by in_creds->client, the server identified by
in_creds->server, with options options, expiration date specified in
in_creds->times.endtime (0 means as long as possible), session key type
specified in in_creds->keyblock.enctype (if non-zero)
Any returned ticket and intermediate ticket-granting tickets are
stored in ccache.
returns errors from encryption routines, system errors
*/
#include "k5-int.h"
/*ARGSUSED*/
static krb5_error_code
{
/* Solaris Kerberos */
return EINVAL;
/*
* Solaris Kerberos:
* Set endtime appropriately to make sure we do not rope in
* expired creds. If endtime is set to 0 (which it almost always
* krb5_get_credentials() with KRB5_TC_MATCH_TIMES will
* succeed and return the expired cred.
*
* Hence, endtime below is set to "now" if in_creds->times.endtime
* is 0, so that krb5_cc_retrieve_cred fails and we get fresh creds,
* if necessary. But, if in_creds has a non-zero endtime, we honor it.
*/
else
return (ret);
if (ret)
return (ret);
int i;
for (i = 0; ktypes[i]; i++)
break;
if (ktypes[i] == 0)
if (ret) {
return ret;
}
}
if (options & KRB5_GC_USER_USER) {
/* also match on identical 2nd tkt and tkt encrypted in a
session key */
return KRB5_NO_2ND_TKT;
}
}
return 0;
}
{
int not_ktype;
return ENOMEM;
}
/* The caller is now responsible for cleaning up in_creds */
/* Solaris Kerberos */
ncreds)) !=0) {
} else {
}
|| options & KRB5_GC_CACHED) {
return retval;
}
if (retval == KRB5_CC_NOT_KTYPE)
not_ktype = 1;
else
not_ktype = 0;
if (tgts) {
register int i = 0;
while (tgts[i]) {
/* Solaris Kerberos */
break;
}
i++;
}
}
/*
* Translate KRB5_CC_NOTFOUND if we previously got
* KRB5_CC_NOT_KTYPE from krb5_cc_retrieve_cred(), in order to
* handle the case where there is no TGT in the ccache and the
* input enctype didn't match. This handling is necessary because
* some callers, such as GSSAPI, iterate through enctypes and
* KRB5_CC_NOTFOUND passed through from the
* krb5_get_cred_from_kdc() is semantically incorrect, since the
* actual failure was the non-existence of a ticket of the correct
* enctype rather than the missing TGT.
*/
&& not_ktype)
if (!retval) {
/* the purpose of the krb5_get_credentials call is to
* obtain a set of credentials for the caller. the
* krb5_cc_store_cred() call is to optimize performance
* for future calls. Ignore any errors, since the credentials
* are still valid even if we fail to store them in the cache.
*/
/* Solaris Kerberos */
}
return retval;
}
/*ARGSUSED*/
static krb5_error_code
{
switch(which) {
case INT_GC_VALIDATE:
break;
case INT_GC_RENEW:
break;
default:
/* Should never happen */
retval = 255;
break;
}
/* Solaris Kerberos */
if (retval) {
return retval;
}
return retval;
}
{
}
{
INT_GC_RENEW));
}
static krb5_error_code
char *in_tkt_service, int validate)
{
if (in_tkt_service) {
/* this is ugly, because so are the data structures involved. I'm
in the library, so I'm going to manipulate the data structures
directly, otherwise, it will be worse. */
goto cleanup;
/* stuff the client realm into the server principal.
realloc if necessary */
goto cleanup;
}
} else {
0)))
goto cleanup;
}
if (validate)
else
/* ick. copy the struct contents, free the container */
if (out_creds) {
}
if (tgts)
return(ret);
}
krb5_get_validated_creds(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_ccache ccache, char *in_tkt_service)
{
in_tkt_service, 1));
}
krb5_get_renewed_creds(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_ccache ccache, char *in_tkt_service)
{
in_tkt_service, 0));
}