Poster of Linux kernelThe best gift for a Linux geek
KRB5_CCACHE

KRB5_CCACHE

Section: C Library Functions (3)
Local index Up

BSD mandoc
HEIMDAL  

NAME

krb5_ccache krb5_cc_cursor krb5_cc_ops krb5_fcc_ops krb5_mcc_ops krb5_cc_clear_mcred krb5_cc_close krb5_cc_copy_cache krb5_cc_default krb5_cc_default_name krb5_cc_destroy krb5_cc_end_seq_get krb5_cc_gen_new krb5_cc_get_full_name krb5_cc_get_name krb5_cc_get_ops krb5_cc_get_prefix_ops krb5_cc_get_principal krb5_cc_get_type krb5_cc_get_version krb5_cc_initialize krb5_cc_next_cred krb5_cc_next_cred_match krb5_cc_new_unique krb5_cc_register krb5_cc_remove_cred krb5_cc_resolve krb5_cc_retrieve_cred krb5_cc_set_default_name krb5_cc_set_flags krb5_cc_start_seq_get krb5_cc_store_cred - mange credential cache  

LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)  

SYNOPSIS

In krb5.h

struct krb5_ccache;

struct krb5_cc_cursor;

struct krb5_cc_ops;

struct krb5_cc_ops *krb5_fcc_ops;

struct krb5_cc_ops *krb5_mcc_ops;

Ft void Fo krb5_cc_clear_mcred Fa krb5_creds *mcred Fc Ft krb5_error_code Fo krb5_cc_close Fa krb5_context context Fa krb5_ccache id Fc Ft krb5_error_code Fo krb5_cc_copy_cache Fa krb5_context context Fa const krb5_ccache from Fa krb5_ccache to Fc Ft krb5_error_code Fo krb5_cc_default Fa krb5_context context Fa krb5_ccache *id Fc Ft const char * Fo krb5_cc_default_name Fa krb5_context context Fc Ft krb5_error_code Fo krb5_cc_destroy Fa krb5_context context Fa krb5_ccache id Fc Ft krb5_error_code Fo krb5_cc_end_seq_get Fa krb5_context context Fa const krb5_ccache id Fa krb5_cc_cursor *cursor Fc Ft krb5_error_code Fo krb5_cc_gen_new Fa krb5_context context Fa const krb5_cc_ops *ops Fa krb5_ccache *id Fc Ft krb5_error_code Fo krb5_cc_get_full_name Fa krb5_context context Fa krb5_ccache id Fa char **str Fc Ft const char * Fo krb5_cc_get_name Fa krb5_context context Fa krb5_ccache id Fc Ft krb5_error_code Fo krb5_cc_get_principal Fa krb5_context context Fa krb5_ccache id Fa krb5_principal *principal Fc Ft const char * Fo krb5_cc_get_type Fa krb5_context context Fa krb5_ccache id Fc Ft const krb5_cc_ops * Fo krb5_cc_get_ops Fa krb5_context context Fa krb5_ccache id Fc Ft const krb5_cc_ops * Fo krb5_cc_get_prefix_ops Fa krb5_context context Fa const char *prefix Fc Ft krb5_error_code Fo krb5_cc_get_version Fa krb5_context context Fa const krb5_ccache id Fc Ft krb5_error_code Fo krb5_cc_initialize Fa krb5_context context Fa krb5_ccache id Fa krb5_principal primary_principal Fc Ft krb5_error_code Fo krb5_cc_register Fa krb5_context context Fa const krb5_cc_ops *ops Fa krb5_boolean override Fc Ft krb5_error_code Fo krb5_cc_resolve Fa krb5_context context Fa const char *name Fa krb5_ccache *id Fc Ft krb5_error_code Fo krb5_cc_retrieve_cred Fa krb5_context context Fa krb5_ccache id Fa krb5_flags whichfields Fa const krb5_creds *mcreds Fa krb5_creds *creds Fc Ft krb5_error_code Fo krb5_cc_remove_cred Fa krb5_context context Fa krb5_ccache id Fa krb5_flags which Fa krb5_creds *cred Fc Ft krb5_error_code Fo krb5_cc_set_default_name Fa krb5_context context Fa const char *name Fc Ft krb5_error_code Fo krb5_cc_start_seq_get Fa krb5_context context Fa const krb5_ccache id Fa krb5_cc_cursor *cursor Fc Ft krb5_error_code Fo krb5_cc_store_cred Fa krb5_context context Fa krb5_ccache id Fa krb5_creds *creds Fc Ft krb5_error_code Fo krb5_cc_set_flags Fa krb5_context context Fa krb5_cc_set_flags id Fa krb5_flags flags Fc Ft krb5_error_code Fo krb5_cc_next_cred Fa krb5_context context Fa const krb5_ccache id Fa krb5_cc_cursor *cursor Fa krb5_creds *creds Fc Ft krb5_error_code Fo krb5_cc_next_cred_match Fa krb5_context context Fa const krb5_ccache id Fa krb5_cc_cursor *cursor Fa krb5_creds *creds Fa krb5_flags whichfields Fa const krb5_creds *mcreds Fc Ft krb5_error_code Fo krb5_cc_new_unique Fa krb5_context context Fa const char *type Fa const char *hint Fa krb5_ccache *id Fc  

DESCRIPTION

The krb5_ccache structure holds a Kerberos credential cache.

The krb5_cc_cursor structure holds current position in a credential cache when iterating over the cache.

The krb5_cc_ops structure holds a set of operations that can me preformed on a credential cache.

There is no component inside krb5_ccache krb5_cc_cursor nor krb5_fcc_ops that is directly referable.

The krb5_creds holds a Kerberos credential, see manpage for krb5_creds3.

Fn krb5_cc_default_name and Fn krb5_cc_set_default_name gets and sets the default name for the Fa context .

Fn krb5_cc_default opens the default credential cache in Fa id . Return 0 or an error code.

Fn krb5_cc_gen_new generates a new credential cache of type Fa ops in Fa id . Return 0 or an error code. The Heimdal version of this function also runs Fn krb5_cc_initialize on the credential cache, but since the MIT version doesn't, portable code must call krb5_cc_initialize.

Fn krb5_cc_new_unique generates a new unique credential cache of Fa type in Fa id . If type is NULL the library chooses the default credential cache type. The supplied Fa hint (that can be NULL is a string that the credential cache type can use to base the name of the credential on, this is to make it easier for the user to differentiate the credentials. The returned credential cache Fa id should be freed using Fn krb5_cc_close or Fn krb5_cc_destroy . Returns 0 or an error code.

Fn krb5_cc_resolve finds and allocates a credential cache in Fa id from the specification in Fa residual . If the credential cache name doesn't contain any colon (:), interpret it as a file name. Return 0 or an error code.

Fn krb5_cc_initialize creates a new credential cache in Fa id for Fa primary_principal . Return 0 or an error code.

Fn krb5_cc_close stops using the credential cache Fa id and frees the related resources. Return 0 or an error code. Fn krb5_cc_destroy removes the credential cache and closes (by calling Fn krb5_cc_close ) Fa id . Return 0 or an error code.

Fn krb5_cc_copy_cache copys the contents of Fa from to Fa to .

Fn krb5_cc_get_full_name returns the complete resolvable name of the credential cache Fa id in Fa str . Fa str should be freed with free(3). Returns 0 or an error, on error Fa *str is set to NULL

Fn krb5_cc_get_name returns the name of the credential cache Fa id .

Fn krb5_cc_get_principal returns the principal of Fa id in Fa principal . Return 0 or an error code.

Fn krb5_cc_get_type returns the type of the credential cache Fa id .

Fn krb5_cc_get_ops returns the ops of the credential cache Fa id .

Fn krb5_cc_get_version returns the version of Fa id .

Fn krb5_cc_register Adds a new credential cache type with operations Fa ops , overwriting any existing one if Fa override . Return an error code or 0.

Fn krb5_cc_get_prefix_ops Get the cc ops that is registered in Fa context to handle the Fa prefix . Returns NULL if ops not found.

Fn krb5_cc_remove_cred removes the credential identified by Fa ( cred , Fa which ) from Fa id .

Fn krb5_cc_store_cred stores Fa creds in the credential cache Fa id . Return 0 or an error code.

Fn krb5_cc_set_flags sets the flags of Fa id to Fa flags .

Fn krb5_cc_clear_mcred clears the Fa mcreds argument so it is reset and can be used with Fa krb5_cc_retrieve_cred .

Fn krb5_cc_retrieve_cred , retrieves the credential identified by Fa mcreds (and Fa whichfields ) from Fa id in Fa creds . Fa creds should be freed using Fn krb5_free_cred_contents . Return 0 or an error code.

Fn krb5_cc_start_seq_get initiates the krb5_cc_cursor structure to be used for iteration over the credential cache.

Fn krb5_cc_next_cred retrieves the next cred pointed to by Fa ( id , Fa cursor ) in Fa creds , and advance Fa cursor . Return 0 or an error code.

Fn krb5_cc_next_cred_match is similar to Fn krb5_cc_next_cred except that it will only return creds matching Fa whichfields and Fa mcreds (as interpreted by krb5_compare_creds3.)

Fn krb5_cc_end_seq_get Destroys the cursor Fa cursor .  

EXAMPLE

This is a minimalistic version of klist

#include <krb5.h>

int
main (int argc, char **argv)
{
    krb5_context context;
    krb5_cc_cursor cursor;
    krb5_error_code ret;
    krb5_ccache id;
    krb5_creds creds;

    if (krb5_init_context (&context) != 0)
        errx(1, "krb5_context");

    ret = krb5_cc_default (context, &id);
    if (ret)
        krb5_err(context, 1, ret, "krb5_cc_default");

    ret = krb5_cc_start_seq_get(context, id, &cursor);
    if (ret)
        krb5_err(context, 1, ret, "krb5_cc_start_seq_get");

    while((ret = krb5_cc_next_cred(context, id, &cursor, &creds)) == 0){
        char *principal;

        krb5_unparse_name_short(context, creds.server, &principal);
        printf("principal: %s\n", principal);
        free(principal);
        krb5_free_cred_contents (context, &creds);
    }
    ret = krb5_cc_end_seq_get(context, id, &cursor);
    if (ret)
        krb5_err(context, 1, ret, "krb5_cc_end_seq_get");

    krb5_cc_close(context, id);

    krb5_free_context(context);
    return 0;
}
 

SEE ALSO

krb5(3), krb5.conf5, kerberos(8)


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
EXAMPLE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 22:37:56 GMT, April 16, 2011