1226031Sstas<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2226031Sstas<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 3226031Sstas<title>HeimdalKerberos5library: The credential cache functions</title> 4226031Sstas<link href="doxygen.css" rel="stylesheet" type="text/css"> 5226031Sstas<link href="tabs.css" rel="stylesheet" type="text/css"> 6226031Sstas</head><body> 7226031Sstas<p> 8226031Sstas<a href="http://www.h5l.org/"><img src="http://www.h5l.org/keyhole-heimdal.png" alt="keyhole logo"/></a> 9226031Sstas</p> 10226031Sstas<!-- end of header marker --> 11226031Sstas<!-- Generated by Doxygen 1.5.6 --> 12226031Sstas<div class="navigation" id="top"> 13226031Sstas <div class="tabs"> 14226031Sstas <ul> 15226031Sstas <li><a href="index.html"><span>Main Page</span></a></li> 16226031Sstas <li><a href="pages.html"><span>Related Pages</span></a></li> 17226031Sstas <li><a href="modules.html"><span>Modules</span></a></li> 18226031Sstas <li><a href="annotated.html"><span>Data Structures</span></a></li> 19226031Sstas </ul> 20226031Sstas </div> 21226031Sstas</div> 22226031Sstas<div class="contents"> 23226031Sstas<h1><a class="anchor" name="krb5_ccache_intro">The credential cache functions </a></h1><h2><a class="anchor" name="section_krb5_ccache"> 24226031SstasKerberos credential caches</a></h2> 25226031Sstaskrb5_ccache structure holds a Kerberos credential cache.<p> 26226031SstasHeimdal support the follow types of credential caches:<p> 27226031Sstas<ul> 28226031Sstas<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> 29226031Sstas<h3><a class="anchor" name="Example"> 30226031SstasExample</a></h3> 31226031SstasThis is a minimalistic version of klist: <div class="fragment"><pre class="fragment"><span class="preprocessor">#include <krb5.h></span> 32226031Sstas 33226031Sstas<span class="keywordtype">int</span> 34226031Sstasmain (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv) 35226031Sstas{ 36226031Sstas krb5_context context; 37226031Sstas krb5_cc_cursor cursor; 38226031Sstas krb5_error_code ret; 39226031Sstas krb5_ccache id; 40226031Sstas krb5_creds creds; 41226031Sstas 42226031Sstas <span class="keywordflow">if</span> (<a class="code" href="group__krb5.html#gbd94206e186c58a093975424a4a567a8">krb5_init_context</a> (&context) != 0) 43226031Sstas errx(1, <span class="stringliteral">"krb5_context"</span>); 44226031Sstas 45226031Sstas ret = <a class="code" href="group__krb5__ccache.html#gd7d54822ef022f3e27f7f0f457d9c751">krb5_cc_default</a> (context, &<span class="keywordtype">id</span>); 46226031Sstas <span class="keywordflow">if</span> (ret) 47226031Sstas krb5_err(context, 1, ret, <span class="stringliteral">"krb5_cc_default"</span>); 48226031Sstas 49226031Sstas ret = <a class="code" href="group__krb5__ccache.html#gcbf766cea6b49dd64b76628c7708b979">krb5_cc_start_seq_get</a>(context, <span class="keywordtype">id</span>, &cursor); 50226031Sstas <span class="keywordflow">if</span> (ret) 51226031Sstas krb5_err(context, 1, ret, <span class="stringliteral">"krb5_cc_start_seq_get"</span>); 52226031Sstas 53226031Sstas <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){ 54226031Sstas <span class="keywordtype">char</span> *principal; 55226031Sstas 56226031Sstas <a class="code" href="group__krb5__principal.html#gac881051ed59fe0dcd08cee62280b332">krb5_unparse_name</a>(context, creds.server, &principal); 57226031Sstas printf(<span class="stringliteral">"principal: %s\\n"</span>, principal); 58226031Sstas free(principal); 59226031Sstas <a class="code" href="group__krb5.html#gd89c4c7b633646c39e4a34a7230c94e1">krb5_free_cred_contents</a> (context, &creds); 60226031Sstas } 61226031Sstas ret = <a class="code" href="group__krb5__ccache.html#g024ce036ebf277f918354d4681bd0550">krb5_cc_end_seq_get</a>(context, <span class="keywordtype">id</span>, &cursor); 62226031Sstas <span class="keywordflow">if</span> (ret) 63226031Sstas krb5_err(context, 1, ret, <span class="stringliteral">"krb5_cc_end_seq_get"</span>); 64226031Sstas 65226031Sstas <a class="code" href="group__krb5__ccache.html#gebc0dd2a77529c05fb49e27235da7017">krb5_cc_close</a>(context, <span class="keywordtype">id</span>); 66226031Sstas 67226031Sstas <a class="code" href="group__krb5.html#ge51d83f5d5f589883f1cd10887892777">krb5_free_context</a>(context); 68226031Sstas <span class="keywordflow">return</span> 0; 69226031Sstas} 70226031Sstas</pre></div> </div> 71226031Sstas<hr size="1"><address style="text-align: right;"><small> 72234027SstasGenerated 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> 73226031Sstas</body> 74226031Sstas</html> 75