Kerberos credential caches
krb5_ccache structure holds a Kerberos credential cache.
Heimdal support the follow types of credential caches:
- SCC Store the credential in a database
- FILE Store the credential in memory
- MEMORY Store the credential in memory
- API A credential cache server based solution for Mac OS X
- KCM A credential cache server based solution for all platforms
Example
This is a minimalistic version of klist:
#include <krb5.h>
int
main (int argc, char **argv)
{
krb5_context context;
krb5_cc_cursor cursor;
krb5_error_code ret;
krb5_ccache id;
krb5_creds creds;
errx(1, "krb5_context");
if (ret)
krb5_err(context, 1, ret,
"krb5_cc_default");
if (ret)
krb5_err(context, 1, ret,
"krb5_cc_start_seq_get");
char *principal;
printf("principal: %s\\n", principal);
free(principal);
}
if (ret)
krb5_err(context, 1, ret,
"krb5_cc_end_seq_get");
return 0;
}