1*7f2fe78bSCy Schubert /** @example cc_set_config.c
2*7f2fe78bSCy Schubert *
3*7f2fe78bSCy Schubert * Usage examples for krb5_cc_set_config and krb5_cc_get_config functions
4*7f2fe78bSCy Schubert */
5*7f2fe78bSCy Schubert #include <k5-int.h>
6*7f2fe78bSCy Schubert
7*7f2fe78bSCy Schubert krb5_error_code
func_set(krb5_context context,krb5_ccache id,krb5_const_principal principal,const char * key)8*7f2fe78bSCy Schubert func_set(krb5_context context, krb5_ccache id,
9*7f2fe78bSCy Schubert krb5_const_principal principal, const char *key)
10*7f2fe78bSCy Schubert {
11*7f2fe78bSCy Schubert krb5_data config_data;
12*7f2fe78bSCy Schubert
13*7f2fe78bSCy Schubert config_data.data = "yes";
14*7f2fe78bSCy Schubert config_data.length = strlen(config_data.data);
15*7f2fe78bSCy Schubert return krb5_cc_set_config(context, id, principal, key, &config_data);
16*7f2fe78bSCy Schubert }
17*7f2fe78bSCy Schubert
18*7f2fe78bSCy Schubert krb5_error_code
func_get(krb5_context context,krb5_ccache id,krb5_const_principal principal,const char * key)19*7f2fe78bSCy Schubert func_get(krb5_context context, krb5_ccache id,
20*7f2fe78bSCy Schubert krb5_const_principal principal, const char *key)
21*7f2fe78bSCy Schubert {
22*7f2fe78bSCy Schubert krb5_data config_data;
23*7f2fe78bSCy Schubert krb5_error_code ret;
24*7f2fe78bSCy Schubert
25*7f2fe78bSCy Schubert config_data.data = NULL;
26*7f2fe78bSCy Schubert ret = krb5_cc_get_config(context, id, principal, key, &config_data);
27*7f2fe78bSCy Schubert if (ret){
28*7f2fe78bSCy Schubert return ret;
29*7f2fe78bSCy Schubert }
30*7f2fe78bSCy Schubert /* do something */
31*7f2fe78bSCy Schubert krb5_free_data_contents(context, &config_data);
32*7f2fe78bSCy Schubert return ret;
33*7f2fe78bSCy Schubert }
34