API documentation: added a usage example for krb5_verify_init_creds function family
authorZhanna Tsitkov <tsitkova@mit.edu>
Tue, 3 May 2011 14:25:11 +0000 (14:25 +0000)
committerZhanna Tsitkov <tsitkova@mit.edu>
Tue, 3 May 2011 14:25:11 +0000 (14:25 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24912 dc483132-0cff-0310-8789-dd5450dbe970

doc/doxy_examples/verify_init_creds.c [new file with mode: 0644]

diff --git a/doc/doxy_examples/verify_init_creds.c b/doc/doxy_examples/verify_init_creds.c
new file mode 100644 (file)
index 0000000..c22e252
--- /dev/null
@@ -0,0 +1,28 @@
+/** @example  verify_init_creds.c
+ *
+ *  Usage example for krb5_verify_init_creds function family
+ */
+#include "k5-int.h"
+
+krb5_error_code
+func(krb5_context context,  krb5_creds *creds, krb5_principal server_principal)
+{
+    krb5_error_code ret = KRB5_OK;
+    krb5_verify_init_creds_opt options;
+
+    krb5_verify_init_creds_opt_init (&options);
+    krb5_verify_init_creds_opt_set_ap_req_nofail (&options, 1);
+
+    ret = krb5_verify_init_creds(context,
+                                 creds,
+                                 server_principal,
+                                 NULL /* use default keytab */,
+                                 NULL /* don't store creds in ccache */,
+                                 &options);
+    if (ret) {
+        /* error while verifying credentials for server */
+    }
+
+    return ret;
+}
+