Initial Windows port

This commit is contained in:
Asanka Herath
2009-07-22 15:55:45 -04:00
committed by Love Hornquist Astrand
parent 25a2ac726b
commit b1063ea8fc
361 changed files with 11994 additions and 1334 deletions

View File

@@ -114,7 +114,7 @@ main (int argc, char **argv)
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_register(krb5_context context,
const krb5_cc_ops *ops,
krb5_boolean override)
@@ -186,13 +186,34 @@ allocate_ccache (krb5_context context,
krb5_ccache *id)
{
krb5_error_code ret;
char * exp_residual = NULL;
ret = _krb5_cc_allocate(context, ops, id);
#ifdef KRB5_USE_PATH_TOKENS
ret = _krb5_expand_path_tokens(context, residual, &exp_residual);
if (ret)
return ret;
residual = exp_residual;
#endif
ret = _krb5_cc_allocate(context, ops, id);
if (ret) {
#ifdef KRB5_USE_PATH_TOKENS
if (exp_residual)
free(exp_residual);
#endif
return ret;
}
ret = (*id)->ops->resolve(context, id, residual);
if(ret)
free(*id);
#ifdef KRB5_USE_PATH_TOKENS
if (exp_residual)
free(exp_residual);
#endif
return ret;
}
@@ -211,7 +232,7 @@ allocate_ccache (krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_resolve(krb5_context context,
const char *name,
krb5_ccache *id)
@@ -251,7 +272,7 @@ krb5_cc_resolve(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_new_unique(krb5_context context, const char *type,
const char *hint, krb5_ccache *id)
{
@@ -283,7 +304,7 @@ krb5_cc_new_unique(krb5_context context, const char *type,
*/
const char* KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL
krb5_cc_get_name(krb5_context context,
krb5_ccache id)
{
@@ -297,7 +318,7 @@ krb5_cc_get_name(krb5_context context,
*/
const char* KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL
krb5_cc_get_type(krb5_context context,
krb5_ccache id)
{
@@ -317,7 +338,7 @@ krb5_cc_get_type(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_get_full_name(krb5_context context,
krb5_ccache id,
char **str)
@@ -368,6 +389,7 @@ krb5_cc_get_ops(krb5_context context, krb5_ccache id)
krb5_error_code
_krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
{
#ifndef KRB5_USE_PATH_TOKENS
size_t tlen, len = 0;
char *tmp, *tmp2, *append;
@@ -385,7 +407,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
} else if (tmp) {
tmp2 = strchr(tmp, '}');
if (tmp2 == NULL) {
free(*res);
if (*res)
free(*res);
*res = NULL;
krb5_set_error_message(context, KRB5_CONFIG_BADFORMAT,
"variable missing }");
@@ -396,7 +419,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
else if (strncasecmp(tmp, "%{null}", 7) == 0)
append = strdup("");
else {
free(*res);
if (*res)
free(*res);
*res = NULL;
krb5_set_error_message(context,
KRB5_CONFIG_BADFORMAT,
@@ -411,7 +435,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
str = NULL;
}
if (append == NULL) {
free(*res);
if (*res)
free(*res);
*res = NULL;
krb5_set_error_message(context, ENOMEM,
N_("malloc: out of memory", ""));
@@ -422,7 +447,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
tmp = realloc(*res, len + tlen + 1);
if (tmp == NULL) {
free(append);
free(*res);
if (*res)
free(*res);
*res = NULL;
krb5_set_error_message(context, ENOMEM,
N_("malloc: out of memory", ""));
@@ -434,6 +460,13 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
free(append);
}
return 0;
#else /* _WIN32 */
/* On Windows, we use the more generic _krb5_expand_path_tokens()
function which also handles path tokens in addition to %{uid}
and %{null} */
return _krb5_expand_path_tokens(context, str, res);
#endif
}
/*
@@ -517,7 +550,7 @@ krb5_cc_support_switch(krb5_context context, const char *type)
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_set_default_name(krb5_context context, const char *name)
{
krb5_error_code ret = 0;
@@ -573,6 +606,20 @@ krb5_cc_set_default_name(krb5_context context, const char *name)
return ENOMEM;
}
#ifdef KRB5_USE_PATH_TOKENS
{
char * exp_p = NULL;
if (_krb5_expand_path_tokens(context, p, &exp_p) == 0) {
free (p);
p = exp_p;
} else {
free (p);
return EINVAL;
}
}
#endif
if (context->default_cc_name)
free(context->default_cc_name);
@@ -591,7 +638,7 @@ krb5_cc_set_default_name(krb5_context context, const char *name)
*/
const char* KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL
krb5_cc_default_name(krb5_context context)
{
if (context->default_cc_name == NULL || environment_changed(context))
@@ -609,7 +656,7 @@ krb5_cc_default_name(krb5_context context)
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_default(krb5_context context,
krb5_ccache *id)
{
@@ -631,7 +678,7 @@ krb5_cc_default(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_initialize(krb5_context context,
krb5_ccache id,
krb5_principal primary_principal)
@@ -649,7 +696,7 @@ krb5_cc_initialize(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_destroy(krb5_context context,
krb5_ccache id)
{
@@ -669,7 +716,7 @@ krb5_cc_destroy(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_close(krb5_context context,
krb5_ccache id)
{
@@ -688,7 +735,7 @@ krb5_cc_close(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_store_cred(krb5_context context,
krb5_ccache id,
krb5_creds *creds)
@@ -714,7 +761,7 @@ krb5_cc_store_cred(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_retrieve_cred(krb5_context context,
krb5_ccache id,
krb5_flags whichfields,
@@ -752,7 +799,7 @@ krb5_cc_retrieve_cred(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_get_principal(krb5_context context,
krb5_ccache id,
krb5_principal *principal)
@@ -770,7 +817,7 @@ krb5_cc_get_principal(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_start_seq_get (krb5_context context,
const krb5_ccache id,
krb5_cc_cursor *cursor)
@@ -788,7 +835,7 @@ krb5_cc_start_seq_get (krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_next_cred (krb5_context context,
const krb5_ccache id,
krb5_cc_cursor *cursor,
@@ -804,7 +851,7 @@ krb5_cc_next_cred (krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_end_seq_get (krb5_context context,
const krb5_ccache id,
krb5_cc_cursor *cursor)
@@ -819,7 +866,7 @@ krb5_cc_end_seq_get (krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_remove_cred(krb5_context context,
krb5_ccache id,
krb5_flags which,
@@ -842,7 +889,7 @@ krb5_cc_remove_cred(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_set_flags(krb5_context context,
krb5_ccache id,
krb5_flags flags)
@@ -856,7 +903,7 @@ krb5_cc_set_flags(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_get_flags(krb5_context context,
krb5_ccache id,
krb5_flags *flags)
@@ -881,7 +928,7 @@ krb5_cc_get_flags(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_copy_match_f(krb5_context context,
const krb5_ccache from,
krb5_ccache to,
@@ -934,7 +981,7 @@ krb5_cc_copy_match_f(krb5_context context,
* @ingroup @krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_copy_cache(krb5_context context,
const krb5_ccache from,
krb5_ccache to)
@@ -949,7 +996,7 @@ krb5_cc_copy_cache(krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_get_version(krb5_context context,
const krb5_ccache id)
{
@@ -966,7 +1013,7 @@ krb5_cc_get_version(krb5_context context,
*/
void KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_cc_clear_mcred(krb5_creds *mcred)
{
memset(mcred, 0, sizeof(*mcred));
@@ -1034,7 +1081,7 @@ struct krb5_cc_cache_cursor_data {
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_cache_get_first (krb5_context context,
const char *type,
krb5_cc_cache_cursor *cursor)
@@ -1092,7 +1139,7 @@ krb5_cc_cache_get_first (krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_cache_next (krb5_context context,
krb5_cc_cache_cursor cursor,
krb5_ccache *id)
@@ -1109,7 +1156,7 @@ krb5_cc_cache_next (krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_cache_end_seq_get (krb5_context context,
krb5_cc_cache_cursor cursor)
{
@@ -1135,7 +1182,7 @@ krb5_cc_cache_end_seq_get (krb5_context context,
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_cache_match (krb5_context context,
krb5_principal client,
krb5_ccache *id)
@@ -1269,7 +1316,7 @@ build_conf_principals(krb5_context context, krb5_ccache id,
* @ingroup krb5_ccache
*/
krb5_boolean KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
krb5_is_config_principal(krb5_context context,
krb5_const_principal principal)
{
@@ -1297,7 +1344,7 @@ krb5_is_config_principal(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_set_config(krb5_context context, krb5_ccache id,
krb5_const_principal principal,
const char *name, krb5_data *data)
@@ -1345,7 +1392,7 @@ out:
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_get_config(krb5_context context, krb5_ccache id,
krb5_const_principal principal,
const char *name, krb5_data *data)
@@ -1393,7 +1440,7 @@ struct krb5_cccol_cursor_data {
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor)
{
*cursor = calloc(1, sizeof(**cursor));
@@ -1425,7 +1472,7 @@ krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor)
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor,
krb5_ccache *cache)
{
@@ -1476,7 +1523,7 @@ krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor)
{
krb5_cccol_cursor c = *cursor;
@@ -1503,7 +1550,7 @@ krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor)
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_last_change_time(krb5_context context,
krb5_ccache id,
krb5_timestamp *mtime)
@@ -1526,7 +1573,7 @@ krb5_cc_last_change_time(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cccol_last_change_time(krb5_context context,
const char *type,
krb5_timestamp *mtime)
@@ -1567,7 +1614,7 @@ krb5_cccol_last_change_time(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_get_friendly_name(krb5_context context,
krb5_ccache id,
char **name)
@@ -1604,7 +1651,7 @@ krb5_cc_get_friendly_name(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_set_friendly_name(krb5_context context,
krb5_ccache id,
const char *name)
@@ -1632,7 +1679,7 @@ krb5_cc_set_friendly_name(krb5_context context,
* @ingroup krb5_ccache
*/
krb5_error_code KRB5_LIB_FUNCTION
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_get_lifetime(krb5_context context, krb5_ccache id, time_t *t)
{
krb5_cc_cursor cursor;