diff options
Diffstat (limited to 'crypto/krb5/doc/doxy_examples')
-rw-r--r-- | crypto/krb5/doc/doxy_examples/cc_set_config.c | 33 | ||||
-rw-r--r-- | crypto/krb5/doc/doxy_examples/cc_unique.c | 23 | ||||
-rwxr-xr-x | crypto/krb5/doc/doxy_examples/error_message.c | 20 | ||||
-rw-r--r-- | crypto/krb5/doc/doxy_examples/tkt_creds.c | 55 | ||||
-rw-r--r-- | crypto/krb5/doc/doxy_examples/verify_init_creds.c | 28 |
5 files changed, 0 insertions, 159 deletions
diff --git a/crypto/krb5/doc/doxy_examples/cc_set_config.c b/crypto/krb5/doc/doxy_examples/cc_set_config.c deleted file mode 100644 index 838ff7e22cf0..000000000000 --- a/crypto/krb5/doc/doxy_examples/cc_set_config.c +++ /dev/null @@ -1,33 +0,0 @@ -/** @example cc_set_config.c - * - * Usage examples for krb5_cc_set_config and krb5_cc_get_config functions - */ -#include <k5-int.h> - -krb5_error_code -func_set(krb5_context context, krb5_ccache id, - krb5_const_principal principal, const char *key) -{ - krb5_data config_data; - - config_data.data = "yes"; - config_data.length = strlen(config_data.data); - return krb5_cc_set_config(context, id, principal, key, &config_data); -} - -krb5_error_code -func_get(krb5_context context, krb5_ccache id, - krb5_const_principal principal, const char *key) -{ - krb5_data config_data; - krb5_error_code ret; - - config_data.data = NULL; - ret = krb5_cc_get_config(context, id, principal, key, &config_data); - if (ret){ - return ret; - } - /* do something */ - krb5_free_data_contents(context, &config_data); - return ret; -} diff --git a/crypto/krb5/doc/doxy_examples/cc_unique.c b/crypto/krb5/doc/doxy_examples/cc_unique.c deleted file mode 100644 index 0a03edb5250e..000000000000 --- a/crypto/krb5/doc/doxy_examples/cc_unique.c +++ /dev/null @@ -1,23 +0,0 @@ -/** @example cc_unique.c - * - * Usage example for krb5_cc_new_unique function - */ -#include "k5-int.h" - -krb5_error_code -func(krb5_context context) -{ - krb5_error_code ret; - krb5_ccache ccache = NULL; - - ret = krb5_cc_new_unique(context, "MEMORY", NULL, &ccache); - if (ret){ - ccache = NULL; - return ret; - } - /* do something */ - if (ccache) - (void)krb5_cc_destroy(context, ccache); - return 0; -} - diff --git a/crypto/krb5/doc/doxy_examples/error_message.c b/crypto/krb5/doc/doxy_examples/error_message.c deleted file mode 100755 index 1e1569760fc4..000000000000 --- a/crypto/krb5/doc/doxy_examples/error_message.c +++ /dev/null @@ -1,20 +0,0 @@ -/** @example error_message.c - * - * Demo for krb5_get/set/free_error_message function family - */ -#include <k5-int.h> - -krb5_error_code -func(krb5_context context) -{ - krb5_error_code ret; - - ret = krb5_func(context); - if (ret) { - const char *err_str = krb5_get_error_message(context, ret); - krb5_set_error_message(context, ret, - "Failed krb5_func: %s", err_str); - krb5_free_error_message(context, err_str); - } -} - diff --git a/crypto/krb5/doc/doxy_examples/tkt_creds.c b/crypto/krb5/doc/doxy_examples/tkt_creds.c deleted file mode 100644 index 9ddf5cc8e282..000000000000 --- a/crypto/krb5/doc/doxy_examples/tkt_creds.c +++ /dev/null @@ -1,55 +0,0 @@ -/** @example tkt_creds.c - * - * Usage example for krb5_tkt_creds function family - */ -#include "krb5.h" - -krb5_error_code -func(krb5_context context, krb5_flags options, - krb5_ccache ccache, krb5_creds *in_creds, - krb5_creds **out_creds) -{ - krb5_error_code code = KRB5_OK; - krb5_creds *ncreds = NULL; - krb5_tkt_creds_context ctx = NULL; - - *out_creds = NULL; - - /* Allocate a container. */ - ncreds = k5alloc(sizeof(*ncreds), &code); - if (ncreds == NULL) - goto cleanup; - - /* Make and execute a krb5_tkt_creds context to get the credential. */ - code = krb5_tkt_creds_init(context, ccache, in_creds, options, &ctx); - if (code != KRB5_OK) - goto cleanup; - code = krb5_tkt_creds_get(context, ctx); - if (code != KRB5_OK) - goto cleanup; - code = krb5_tkt_creds_get_creds(context, ctx, ncreds); - if (code != KRB5_OK) - goto cleanup; - - *out_creds = ncreds; - ncreds = NULL; - -cleanup: - krb5_free_creds(context, ncreds); - krb5_tkt_creds_free(context, ctx); - return code; -} - -/* Allocate zeroed memory; set *code to 0 on success or ENOMEM on failure. */ -static inline void * -k5alloc(size_t len, krb5_error_code *code) -{ - void *ptr; - - /* Allocate at least one byte since zero-byte allocs may return NULL. */ - ptr = calloc((len > 0) ? len : 1, 1); - *code = (ptr == NULL) ? ENOMEM : 0; - return ptr; -} - - diff --git a/crypto/krb5/doc/doxy_examples/verify_init_creds.c b/crypto/krb5/doc/doxy_examples/verify_init_creds.c deleted file mode 100644 index c22e2528424e..000000000000 --- a/crypto/krb5/doc/doxy_examples/verify_init_creds.c +++ /dev/null @@ -1,28 +0,0 @@ -/** @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; -} - |