|
|
1.1 root 1: /*
2: * $Source: /usr/src/kerberosIV/krb/RCS/get_tf_fullname.c,v $
3: * $Author: kfall $
4: *
5: * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
6: *
7: * For copying and distribution information, please see the file
8: * <mit-copyright.h>.
9: */
10:
11: #ifndef lint
12: static char rcsid_get_tf_fullname_c[] =
13: "$Id: get_tf_fullname.c,v 4.2 90/06/25 20:56:14 kfall Exp $";
14: #endif /* lint */
15:
16: #include <mit-copyright.h>
17: #include <des.h>
18: #include <krb.h>
19: #include <strings.h>
20:
21: /*
22: * This file contains a routine to extract the fullname of a user
23: * from the ticket file.
24: */
25:
26: /*
27: * krb_get_tf_fullname() takes four arguments: the name of the
28: * ticket file, and variables for name, instance, and realm to be
29: * returned in. Since the realm of a ticket file is not really fully
30: * supported, the realm used will be that of the the first ticket in
31: * the file as this is the one that was obtained with a password by
32: * krb_get_in_tkt().
33: */
34:
35: krb_get_tf_fullname(ticket_file, name, instance, realm)
36: char *ticket_file;
37: char *name;
38: char *instance;
39: char *realm;
40: {
41: int tf_status;
42: CREDENTIALS c;
43:
44: if ((tf_status = tf_init(ticket_file, R_TKT_FIL)) != KSUCCESS)
45: return(tf_status);
46:
47: if (((tf_status = tf_get_pname(c.pname)) != KSUCCESS) ||
48: ((tf_status = tf_get_pinst(c.pinst)) != KSUCCESS))
49: return (tf_status);
50:
51: if (name)
52: strcpy(name, c.pname);
53: if (instance)
54: strcpy(instance, c.pinst);
55: if ((tf_status = tf_get_cred(&c)) == KSUCCESS) {
56: if (realm)
57: strcpy(realm, c.realm);
58: }
59: else
60: return(tf_status);
61:
62: (void) tf_close();
63:
64: return(tf_status);
65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.