xref: /freebsd/crypto/krb5/doc/doxy_examples/cc_unique.c (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /** @example  cc_unique.c
2*7f2fe78bSCy Schubert  *
3*7f2fe78bSCy Schubert  *  Usage example for krb5_cc_new_unique function
4*7f2fe78bSCy Schubert  */
5*7f2fe78bSCy Schubert #include "k5-int.h"
6*7f2fe78bSCy Schubert 
7*7f2fe78bSCy Schubert krb5_error_code
func(krb5_context context)8*7f2fe78bSCy Schubert func(krb5_context context)
9*7f2fe78bSCy Schubert {
10*7f2fe78bSCy Schubert     krb5_error_code ret;
11*7f2fe78bSCy Schubert     krb5_ccache ccache = NULL;
12*7f2fe78bSCy Schubert 
13*7f2fe78bSCy Schubert     ret = krb5_cc_new_unique(context, "MEMORY", NULL, &ccache);
14*7f2fe78bSCy Schubert     if (ret){
15*7f2fe78bSCy Schubert         ccache = NULL;
16*7f2fe78bSCy Schubert         return ret;
17*7f2fe78bSCy Schubert     }
18*7f2fe78bSCy Schubert     /* do something */
19*7f2fe78bSCy Schubert     if (ccache)
20*7f2fe78bSCy Schubert         (void)krb5_cc_destroy(context, ccache);
21*7f2fe78bSCy Schubert     return 0;
22*7f2fe78bSCy Schubert }
23*7f2fe78bSCy Schubert 
24