next up previous contents
Next: Per-type functions Up: Credentials cache functions Previous: Credentials cache functions   Contents

The krb5_cc_ops structure

In order to implement a new credentials cache type, the programmer should declare a krb5_cc_ops structure, and fill in the elements of the structure appropriately, by implementing each of the credential cache functions for the new credentials cache type.

The prefix element specifies the prefix name of the the new credential cache type. For example, if the prefix name is ``FILE'', then if the program calls krb5_cc_resolve with a credential cache name such as ``FILE:/tmp/krb5_cc_15806'', then krb5_cc_resolve will call the resolve function (as defined by the krb5_cc_ops structure where the prefix element is ``FILE'') and pass it the argument ``/tmp/krb5_cc_15806''.

Before a new credentials cache type can be recognized by krb5_cc_resolve, it must be registered with the Kerberos library by calling krb5_cc_register.

typedef struct _krb5_cc_ops {
	char *prefix;
	char *(*get_name)((krb5_ccache));
	krb5_error_code (*resolve)((krb5_ccache *, char *));
	krb5_error_code (*gen_new)((krb5_ccache *));
	krb5_error_code (*init)((krb5_ccache, krb5_principal));
	krb5_error_code (*destroy)((krb5_ccache));
	krb5_error_code (*close)((krb5_ccache));
	krb5_error_code (*store)((krb5_ccache, krb5_creds *));
	krb5_error_code (*retrieve)((krb5_ccache, krb5_flags,
				   krb5_creds *, krb5_creds *));
	krb5_error_code (*get_princ)((krb5_ccache,
						krb5_principal *));
	krb5_error_code (*get_first)((krb5_ccache,
						krb5_cc_cursor *));
	krb5_error_code (*get_next)((krb5_ccache, krb5_cc_cursor *,
				   krb5_creds *));
	krb5_error_code (*end_get)((krb5_ccache, krb5_cc_cursor *));
	krb5_error_code (*remove_cred)((krb5_ccache, krb5_flags,
				      krb5_creds *));
	krb5_error_code (*set_flags)((krb5_ccache, krb5_flags));
} krb5_cc_ops;



Autobuild 2006-06-16