]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - crypto/heimdal/doc/doxyout/krb5/man/man3/krb5_ccache_intro.3
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / crypto / heimdal / doc / doxyout / krb5 / man / man3 / krb5_ccache_intro.3
1 .TH "krb5_ccache_intro" 3 "11 Jan 2012" "Version 1.5.2" "HeimdalKerberos5library" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 krb5_ccache_intro \- The credential cache functions 
6 .SH "Kerberos credential caches"
7 .PP
8 krb5_ccache structure holds a Kerberos credential cache.
9 .PP
10 Heimdal support the follow types of credential caches:
11 .PP
12 .IP "\(bu" 2
13 SCC Store the credential in a database
14 .IP "\(bu" 2
15 FILE Store the credential in memory
16 .IP "\(bu" 2
17 MEMORY Store the credential in memory
18 .IP "\(bu" 2
19 API A credential cache server based solution for Mac OS X
20 .IP "\(bu" 2
21 KCM A credential cache server based solution for all platforms
22 .PP
23 .SS "Example"
24 This is a minimalistic version of klist: 
25 .PP
26 .nf
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 .fi
68 .PP
69