xref: /titanic_51/usr/src/lib/gss_mechs/mech_krb5/krb5/rcache/rc_conv.c (revision 159d09a20817016f09b3ea28d1bdada4a336bb91)
1 /*
2  * lib/krb5/rcache/rc_conv.c
3  *
4  * This file of the Kerberos V5 software is derived from public-domain code
5  * contributed by Daniel J. Bernstein, <brnstnd@acf10.nyu.edu>.
6  *
7  */
8 
9 
10 /*
11  * An implementation for the default replay cache type.
12  */
13 
14 /* Solaris Kerberos - resync */
15 #define FREE_RC(x) ((void) free((char *) (x)))
16 
17 #include "rc_base.h"
18 
19 /*
20 Local stuff:
21  krb5_auth_to_replay(context, krb5_tkt_authent *auth,krb5_donot_replay *rep)
22   given auth, take important information and make rep; return -1 if failed
23 */
24 
25 krb5_error_code
26 krb5_auth_to_rep(krb5_context context, krb5_tkt_authent *auth, krb5_donot_replay *rep)
27 {
28  krb5_error_code retval;
29  rep->cusec = auth->authenticator->cusec;
30  rep->ctime = auth->authenticator->ctime;
31  if ((retval = krb5_unparse_name(context, auth->ticket->server, &rep->server)))
32    return retval; /* shouldn't happen */
33  if ((retval = krb5_unparse_name(context, auth->authenticator->client,
34 				 &rep->client))) {
35      FREE_RC(rep->server);
36      return retval; /* shouldn't happen. */
37  }
38  return 0;
39 }
40