doxygen configuration
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22028 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
235
lib/krb5/cache.c
235
lib/krb5/cache.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2005 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1997 - 2007 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -35,10 +35,18 @@
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
/**
|
||||
* Add a new ccache type with operations `ops', overwriting any
|
||||
* existing one if `override'.
|
||||
* Return an error code or 0.
|
||||
*
|
||||
* @param context a Keberos context
|
||||
* @param ops type of plugin symbol
|
||||
* @param override flag to select if the registration is to overide
|
||||
* an existing ops with the same name.
|
||||
*
|
||||
* @return Return an error code or 0.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
@@ -101,8 +109,7 @@ _krb5_cc_allocate(krb5_context context,
|
||||
|
||||
/*
|
||||
* Allocate memory for a new ccache in `id' with operations `ops'
|
||||
* and name `residual'.
|
||||
* Return 0 or an error code.
|
||||
* and name `residual'. Return 0 or an error code.
|
||||
*/
|
||||
|
||||
static krb5_error_code
|
||||
@@ -122,12 +129,21 @@ allocate_ccache (krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Find and allocate a ccache in `id' from the specification in `residual'.
|
||||
* If the ccache name doesn't contain any colon, interpret it as a file name.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @param context a Keberos context.
|
||||
* @param name string name of a credential cache.
|
||||
* @param id return pointer to a found credential cache.
|
||||
*
|
||||
* @return Return 0 or an error code. In case of an error, id is set
|
||||
* to NULL.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_resolve(krb5_context context,
|
||||
const char *name,
|
||||
@@ -135,6 +151,8 @@ krb5_cc_resolve(krb5_context context,
|
||||
{
|
||||
int i;
|
||||
|
||||
*id = NULL;
|
||||
|
||||
for(i = 0; i < context->num_cc_ops && context->cc_ops[i].prefix; i++) {
|
||||
size_t prefix_len = strlen(context->cc_ops[i].prefix);
|
||||
|
||||
@@ -153,11 +171,15 @@ krb5_cc_resolve(krb5_context context,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Generate a new ccache of type `ops' in `id'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_gen_new(krb5_context context,
|
||||
const krb5_cc_ops *ops,
|
||||
@@ -171,14 +193,16 @@ krb5_cc_gen_new(krb5_context context,
|
||||
return (*id)->ops->gen_new(context, id);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Generates a new unique ccache of `type` in `id'. If `type' is NULL,
|
||||
* the library chooses the default credential cache type. The supplied
|
||||
* `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
|
||||
* its easier for the user to differentiate the credentials.
|
||||
*
|
||||
* Returns 0 or an error code.
|
||||
* @return Returns 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
@@ -200,10 +224,13 @@ krb5_cc_new_unique(krb5_context context, const char *type,
|
||||
return krb5_cc_gen_new(context, ops, id);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the name of the ccache `id'
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
const char* KRB5_LIB_FUNCTION
|
||||
krb5_cc_get_name(krb5_context context,
|
||||
krb5_ccache id)
|
||||
@@ -211,10 +238,13 @@ krb5_cc_get_name(krb5_context context,
|
||||
return id->ops->get_name(context, id);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the type of the ccache `id'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
const char* KRB5_LIB_FUNCTION
|
||||
krb5_cc_get_type(krb5_context context,
|
||||
krb5_ccache id)
|
||||
@@ -222,12 +252,15 @@ krb5_cc_get_type(krb5_context context,
|
||||
return id->ops->prefix;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the complete resolvable name the ccache `id' in `str<74>.
|
||||
* `str` should be freed with free(3).
|
||||
* Returns 0 or an error (and then *str is set to NULL).
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_get_full_name(krb5_context context,
|
||||
krb5_ccache id,
|
||||
@@ -257,10 +290,13 @@ krb5_cc_get_full_name(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return krb5_cc_ops of a the ccache `id'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
const krb5_cc_ops *
|
||||
krb5_cc_get_ops(krb5_context context, krb5_ccache id)
|
||||
{
|
||||
@@ -367,10 +403,13 @@ environment_changed(krb5_context context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set the default cc name for `context' to `name'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_set_default_name(krb5_context context, const char *name)
|
||||
{
|
||||
@@ -414,11 +453,16 @@ krb5_cc_set_default_name(krb5_context context, const char *name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return a pointer to a context static string containing the default
|
||||
* ccache name.
|
||||
*
|
||||
* @return String to the default credential cache name.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
const char* KRB5_LIB_FUNCTION
|
||||
krb5_cc_default_name(krb5_context context)
|
||||
{
|
||||
@@ -428,11 +472,15 @@ krb5_cc_default_name(krb5_context context)
|
||||
return context->default_cc_name;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Open the default ccache in `id'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_default(krb5_context context,
|
||||
krb5_ccache *id)
|
||||
@@ -446,11 +494,15 @@ krb5_cc_default(krb5_context context,
|
||||
return krb5_cc_resolve(context, p, id);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Create a new ccache in `id' for `primary_principal'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_initialize(krb5_context context,
|
||||
krb5_ccache id,
|
||||
@@ -460,11 +512,15 @@ krb5_cc_initialize(krb5_context context,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Remove the ccache `id'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_destroy(krb5_context context,
|
||||
krb5_ccache id)
|
||||
@@ -476,11 +532,15 @@ krb5_cc_destroy(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Stop using the ccache `id' and free the related resources.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_close(krb5_context context,
|
||||
krb5_ccache id)
|
||||
@@ -491,11 +551,15 @@ krb5_cc_close(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Store `creds' in the ccache `id'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_store_cred(krb5_context context,
|
||||
krb5_ccache id,
|
||||
@@ -504,13 +568,17 @@ krb5_cc_store_cred(krb5_context context,
|
||||
return (*id->ops->store)(context, id, creds);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Retrieve the credential identified by `mcreds' (and `whichfields')
|
||||
* from `id' in `creds'. 'creds' must be free by the caller using
|
||||
* krb5_free_cred_contents.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_retrieve_cred(krb5_context context,
|
||||
krb5_ccache id,
|
||||
@@ -540,11 +608,15 @@ krb5_cc_retrieve_cred(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the principal of `id' in `principal'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_get_principal(krb5_context context,
|
||||
krb5_ccache id,
|
||||
@@ -553,12 +625,16 @@ krb5_cc_get_principal(krb5_context context,
|
||||
return (*id->ops->get_princ)(context, id, principal);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Start iterating over `id', `cursor' is initialized to the
|
||||
* beginning.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_start_seq_get (krb5_context context,
|
||||
const krb5_ccache id,
|
||||
@@ -567,12 +643,16 @@ krb5_cc_start_seq_get (krb5_context context,
|
||||
return (*id->ops->get_first)(context, id, cursor);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Retrieve the next cred pointed to by (`id', `cursor') in `creds'
|
||||
* and advance `cursor'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_next_cred (krb5_context context,
|
||||
const krb5_ccache id,
|
||||
@@ -582,7 +662,12 @@ krb5_cc_next_cred (krb5_context context,
|
||||
return (*id->ops->get_next)(context, id, cursor, creds);
|
||||
}
|
||||
|
||||
/* like krb5_cc_next_cred, but allow for selective retrieval */
|
||||
/**
|
||||
* Like krb5_cc_next_cred, but allow for selective retrieval
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_next_cred_match(krb5_context context,
|
||||
@@ -603,10 +688,13 @@ krb5_cc_next_cred_match(krb5_context context,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Destroy the cursor `cursor'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_end_seq_get (krb5_context context,
|
||||
const krb5_ccache id,
|
||||
@@ -615,10 +703,13 @@ krb5_cc_end_seq_get (krb5_context context,
|
||||
return (*id->ops->end_get)(context, id, cursor);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Remove the credential identified by `cred', `which' from `id'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_remove_cred(krb5_context context,
|
||||
krb5_ccache id,
|
||||
@@ -634,10 +725,13 @@ krb5_cc_remove_cred(krb5_context context,
|
||||
return (*id->ops->remove_cred)(context, id, which, cred);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set the flags of `id' to `flags'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_set_flags(krb5_context context,
|
||||
krb5_ccache id,
|
||||
@@ -646,10 +740,13 @@ krb5_cc_set_flags(krb5_context context,
|
||||
return (*id->ops->set_flags)(context, id, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Copy the contents of `from' to `to'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_copy_cache_match(krb5_context context,
|
||||
const krb5_ccache from,
|
||||
@@ -691,6 +788,13 @@ krb5_cc_copy_cache_match(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Just like krb5_cc_copy_cache_match, but copy everything.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_copy_cache(krb5_context context,
|
||||
const krb5_ccache from,
|
||||
@@ -699,10 +803,13 @@ krb5_cc_copy_cache(krb5_context context,
|
||||
return krb5_cc_copy_cache_match(context, from, to, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the version of `id'.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_get_version(krb5_context context,
|
||||
const krb5_ccache id)
|
||||
@@ -713,23 +820,30 @@ krb5_cc_get_version(krb5_context context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Clear `mcreds' so it can be used with krb5_cc_retrieve_cred
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
void KRB5_LIB_FUNCTION
|
||||
krb5_cc_clear_mcred(krb5_creds *mcred)
|
||||
{
|
||||
memset(mcred, 0, sizeof(*mcred));
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the cc ops that is registered in `context' to handle the
|
||||
* `prefix'. `prefix' can be a complete credential cache name or a
|
||||
* prefix, the function will only use part up to the first colon (:)
|
||||
* if there is one. Returns NULL if ops not found.
|
||||
* if there is one.
|
||||
* Returns NULL if ops not found.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
const krb5_cc_ops *
|
||||
krb5_cc_get_prefix_ops(krb5_context context, const char *prefix)
|
||||
{
|
||||
@@ -763,12 +877,16 @@ struct krb5_cc_cache_cursor_data {
|
||||
krb5_cc_cursor cursor;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Start iterating over all caches of `type'. If `type' is NULL, the
|
||||
* default type is * used. `cursor' is initialized to the beginning.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_cache_get_first (krb5_context context,
|
||||
const char *type,
|
||||
@@ -809,12 +927,16 @@ krb5_cc_cache_get_first (krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Retrieve the next cache pointed to by (`cursor') in `id'
|
||||
* and advance `cursor'.
|
||||
* Return 0 or an error code.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_cache_next (krb5_context context,
|
||||
krb5_cc_cache_cursor cursor,
|
||||
@@ -823,10 +945,15 @@ krb5_cc_cache_next (krb5_context context,
|
||||
return cursor->ops->get_cache_next(context, cursor->cursor, id);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Destroy the cursor `cursor'.
|
||||
*
|
||||
* @return Return 0 or an error code.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_cache_end_seq_get (krb5_context context,
|
||||
krb5_cc_cache_cursor cursor)
|
||||
@@ -838,14 +965,18 @@ krb5_cc_cache_end_seq_get (krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Search for a matching credential cache of type `type' that have the
|
||||
* `principal' as the default principal. If NULL is used for `type',
|
||||
* the default type is used. On success, `id' needs to be freed with
|
||||
* krb5_cc_close or krb5_cc_destroy. On failure, error code is
|
||||
* returned and `id' is set to NULL.
|
||||
* krb5_cc_close or krb5_cc_destroy.
|
||||
*
|
||||
* @return On failure, error code is returned and `id' is set to NULL.
|
||||
*
|
||||
* @ingroup krb5_ccache
|
||||
*/
|
||||
|
||||
|
||||
krb5_error_code KRB5_LIB_FUNCTION
|
||||
krb5_cc_cache_match (krb5_context context,
|
||||
krb5_principal client,
|
||||
|
Reference in New Issue
Block a user