xref: /freebsd/crypto/krb5/doc/doxy_examples/verify_init_creds.c (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /** @example  verify_init_creds.c
2*7f2fe78bSCy Schubert  *
3*7f2fe78bSCy Schubert  *  Usage example for krb5_verify_init_creds function family
4*7f2fe78bSCy Schubert  */
5*7f2fe78bSCy Schubert #include "k5-int.h"
6*7f2fe78bSCy Schubert 
7*7f2fe78bSCy Schubert krb5_error_code
func(krb5_context context,krb5_creds * creds,krb5_principal server_principal)8*7f2fe78bSCy Schubert func(krb5_context context,  krb5_creds *creds, krb5_principal server_principal)
9*7f2fe78bSCy Schubert {
10*7f2fe78bSCy Schubert     krb5_error_code ret = KRB5_OK;
11*7f2fe78bSCy Schubert     krb5_verify_init_creds_opt options;
12*7f2fe78bSCy Schubert 
13*7f2fe78bSCy Schubert     krb5_verify_init_creds_opt_init (&options);
14*7f2fe78bSCy Schubert     krb5_verify_init_creds_opt_set_ap_req_nofail (&options, 1);
15*7f2fe78bSCy Schubert 
16*7f2fe78bSCy Schubert     ret = krb5_verify_init_creds(context,
17*7f2fe78bSCy Schubert                                  creds,
18*7f2fe78bSCy Schubert                                  server_principal,
19*7f2fe78bSCy Schubert                                  NULL /* use default keytab */,
20*7f2fe78bSCy Schubert                                  NULL /* don't store creds in ccache */,
21*7f2fe78bSCy Schubert                                  &options);
22*7f2fe78bSCy Schubert     if (ret) {
23*7f2fe78bSCy Schubert         /* error while verifying credentials for server */
24*7f2fe78bSCy Schubert     }
25*7f2fe78bSCy Schubert 
26*7f2fe78bSCy Schubert     return ret;
27*7f2fe78bSCy Schubert }
28*7f2fe78bSCy Schubert 
29