From: John Kohl Date: Mon, 23 Apr 1990 10:03:32 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: krb5-1.0-alpha2~848 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ba07dd13cb2bd65d8ac746cf1dd9f8a16561f94b;p=krb5.git *** empty log message *** git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@547 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/get_creds.c b/src/lib/krb5/krb/get_creds.c new file mode 100644 index 000000000..ddbfbf2a3 --- /dev/null +++ b/src/lib/krb5/krb/get_creds.c @@ -0,0 +1,76 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * krb5_get_credentials() + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_get_creds_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include + +/* + Attempts to use the credentials cache or TGS exchange to get an additional + ticket for the + client identified by creds->client, the server identified by + creds->server, with options options, expiration date specified in + creds->times.endtime (0 means as long as possible), session key type + specified in creds->keyblock.keytype (if non-zero) + + Any returned ticket and intermediate ticket-granting tickets are + stored in ccache. + + returns errors from encryption routines, system errors + */ + +#include +#include +#include + +krb5_error_code +krb5_get_credentials(options, ccache, creds) +const krb5_flags options; +krb5_ccache ccache; +krb5_creds *creds; +{ + krb5_error_code retval, rv2; + krb5_creds **tgts; + krb5_creds mcreds; + krb5_flags fields; + + bzero((char *)&mcreds, sizeof(mcreds)); + mcreds.server = creds->server; + mcreds.client = creds->client; + mcreds.times.endtime = creds->times.endtime; + mcreds.keyblock = creds->keyblock; + + fields = KRB5_TC_MATCH_TIMES /*XXX |KRB5_TC_MATCH_SKEY_TYPE */ ; + + switch(retval = krb5_cc_retrieve_cred(ccache, fields, &mcreds, creds)) { + case KRB5_CC_NOTFOUND: + break; + default: + return retval; + } + retval = krb5_get_cred_from_kdc(ccache, creds, &tgts); + if (tgts) { + register int i = 0; + while (tgts[i]) { + if (rv2 = krb5_cc_store_cred(ccache, tgts[i])) { + retval = rv2; + break; + } + i++; + } + krb5_free_tgt_creds(tgts); + } + return retval; +}