1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3 <title>HeimdalKerberos5library: The credential cache functions</title>
4 <link href="doxygen.css" rel="stylesheet" type="text/css">
5 <link href="tabs.css" rel="stylesheet" type="text/css">
8 <a href="http://www.h5l.org/"><img src="http://www.h5l.org/keyhole-heimdal.png" alt="keyhole logo"/></a>
10 <!-- end of header marker -->
11 <!-- Generated by Doxygen 1.5.6 -->
12 <div class="navigation" id="top">
15 <li><a href="index.html"><span>Main Page</span></a></li>
16 <li><a href="pages.html"><span>Related Pages</span></a></li>
17 <li><a href="modules.html"><span>Modules</span></a></li>
18 <li><a href="annotated.html"><span>Data Structures</span></a></li>
22 <div class="contents">
23 <h1><a class="anchor" name="krb5_ccache_intro">The credential cache functions </a></h1><h2><a class="anchor" name="section_krb5_ccache">
24 Kerberos credential caches</a></h2>
25 krb5_ccache structure holds a Kerberos credential cache.<p>
26 Heimdal support the follow types of credential caches:<p>
28 <li>SCC Store the credential in a database</li><li>FILE Store the credential in memory</li><li>MEMORY Store the credential in memory</li><li>API A credential cache server based solution for Mac OS X</li><li>KCM A credential cache server based solution for all platforms</li></ul>
29 <h3><a class="anchor" name="Example">
31 This is a minimalistic version of klist: <div class="fragment"><pre class="fragment"><span class="preprocessor">#include <krb5.h></span>
33 <span class="keywordtype">int</span>
34 main (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
37 krb5_cc_cursor cursor;
42 <span class="keywordflow">if</span> (<a class="code" href="group__krb5.html#gbd94206e186c58a093975424a4a567a8">krb5_init_context</a> (&context) != 0)
43 errx(1, <span class="stringliteral">"krb5_context"</span>);
45 ret = <a class="code" href="group__krb5__ccache.html#gd7d54822ef022f3e27f7f0f457d9c751">krb5_cc_default</a> (context, &<span class="keywordtype">id</span>);
46 <span class="keywordflow">if</span> (ret)
47 krb5_err(context, 1, ret, <span class="stringliteral">"krb5_cc_default"</span>);
49 ret = <a class="code" href="group__krb5__ccache.html#gcbf766cea6b49dd64b76628c7708b979">krb5_cc_start_seq_get</a>(context, <span class="keywordtype">id</span>, &cursor);
50 <span class="keywordflow">if</span> (ret)
51 krb5_err(context, 1, ret, <span class="stringliteral">"krb5_cc_start_seq_get"</span>);
53 <span class="keywordflow">while</span>((ret = <a class="code" href="group__krb5__ccache.html#gd9cd0ebcc7bdf3ca2b0ed166ea2f8df6">krb5_cc_next_cred</a>(context, <span class="keywordtype">id</span>, &cursor, &creds)) == 0){
54 <span class="keywordtype">char</span> *principal;
56 <a class="code" href="group__krb5__principal.html#gac881051ed59fe0dcd08cee62280b332">krb5_unparse_name</a>(context, creds.server, &principal);
57 printf(<span class="stringliteral">"principal: %s\\n"</span>, principal);
59 <a class="code" href="group__krb5.html#gd89c4c7b633646c39e4a34a7230c94e1">krb5_free_cred_contents</a> (context, &creds);
61 ret = <a class="code" href="group__krb5__ccache.html#g024ce036ebf277f918354d4681bd0550">krb5_cc_end_seq_get</a>(context, <span class="keywordtype">id</span>, &cursor);
62 <span class="keywordflow">if</span> (ret)
63 krb5_err(context, 1, ret, <span class="stringliteral">"krb5_cc_end_seq_get"</span>);
65 <a class="code" href="group__krb5__ccache.html#gebc0dd2a77529c05fb49e27235da7017">krb5_cc_close</a>(context, <span class="keywordtype">id</span>);
67 <a class="code" href="group__krb5.html#ge51d83f5d5f589883f1cd10887892777">krb5_free_context</a>(context);
68 <span class="keywordflow">return</span> 0;
71 <hr size="1"><address style="text-align: right;"><small>
72 Generated on Wed Jan 11 14:07:47 2012 for HeimdalKerberos5library by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>