From 58022d072122d6a1bf01767a78b2a84aed732855 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Thu, 27 May 2010 11:54:39 -0500 Subject: [PATCH] use _krb5_expand_path_tokens --- lib/krb5/cache.c | 77 ------------------------------------------------ 1 file changed, 77 deletions(-) diff --git a/lib/krb5/cache.c b/lib/krb5/cache.c index ce8040d07..05fc43c3e 100644 --- a/lib/krb5/cache.c +++ b/lib/krb5/cache.c @@ -389,84 +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; - - *res = NULL; - - while (str && *str) { - tmp = strstr(str, "%{"); - if (tmp && tmp != str) { - append = malloc((tmp - str) + 1); - if (append) { - memcpy(append, str, tmp - str); - append[tmp - str] = '\0'; - } - str = tmp; - } else if (tmp) { - tmp2 = strchr(tmp, '}'); - if (tmp2 == NULL) { - if (*res) - free(*res); - *res = NULL; - krb5_set_error_message(context, KRB5_CONFIG_BADFORMAT, - "variable missing }"); - return KRB5_CONFIG_BADFORMAT; - } - if (strncasecmp(tmp, "%{uid}", 6) == 0) - asprintf(&append, "%u", (unsigned)getuid()); - else if (strncasecmp(tmp, "%{null}", 7) == 0) - append = strdup(""); - else { - if (*res) - free(*res); - *res = NULL; - krb5_set_error_message(context, - KRB5_CONFIG_BADFORMAT, - "expand default cache unknown " - "variable \"%.*s\"", - (int)(tmp2 - tmp) - 2, tmp + 2); - return KRB5_CONFIG_BADFORMAT; - } - str = tmp2 + 1; - } else { - append = strdup(str); - str = NULL; - } - if (append == NULL) { - if (*res) - free(*res); - *res = NULL; - krb5_set_error_message(context, ENOMEM, - N_("malloc: out of memory", "")); - return ENOMEM; - } - - tlen = strlen(append); - tmp = realloc(*res, len + tlen + 1); - if (tmp == NULL) { - free(append); - if (*res) - free(*res); - *res = NULL; - krb5_set_error_message(context, ENOMEM, - N_("malloc: out of memory", "")); - return ENOMEM; - } - *res = tmp; - memcpy(*res + len, append, tlen + 1); - len = len + tlen; - 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 } /*