1krb5_ccache_intro(3) HeimdalKerberos5library krb5_ccache_intro(3)
2
3
4
6 krb5_ccache_introThe credential cache functions
7 -
8
10 krb5_ccache structure holds a Kerberos credential cache.
11
12 Heimdal support the follow types of credential caches:
13
14 · SCC Store the credential in a database
15
16 · FILE Store the credential in memory
17
18 · MEMORY Store the credential in memory
19
20 · API A credential cache server based solution for Mac OS X
21
22 · KCM A credential cache server based solution for all platforms
23
24 Example
25 This is a minimalistic version of klist:
26
27 #include <krb5.h>
28
29 int
30 main (int argc, char **argv)
31 {
32 krb5_context context;
33 krb5_cc_cursor cursor;
34 krb5_error_code ret;
35 krb5_ccache id;
36 krb5_creds creds;
37
38 if (krb5_init_context (&context) != 0)
39 errx(1, "krb5_context");
40
41 ret = krb5_cc_default (context, &id);
42 if (ret)
43 krb5_err(context, 1, ret, "krb5_cc_default");
44
45 ret = krb5_cc_start_seq_get(context, id, &cursor);
46 if (ret)
47 krb5_err(context, 1, ret, "krb5_cc_start_seq_get");
48
49 while((ret = krb5_cc_next_cred(context, id, &cursor, &creds)) == 0){
50 char *principal;
51
52 krb5_unparse_name(context, creds.server, &principal);
53 printf("principal: %s\n", principal);
54 free(principal);
55 krb5_free_cred_contents (context, &creds);
56 }
57 ret = krb5_cc_end_seq_get(context, id, &cursor);
58 if (ret)
59 krb5_err(context, 1, ret, "krb5_cc_end_seq_get");
60
61 krb5_cc_close(context, id);
62
63 krb5_free_context(context);
64 return 0;
65 }
66
67
68Version 7.7.0 Fri Jun 7 2019 krb5_ccache_intro(3)