(acc_resolve): if open_default_ccache failed with ccErrCCacheNotFound

try again with create_default_ccache, this fixes the problem where the
security server apperenly haven't started yet on Mac OS X


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14832 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-04-18 19:19:04 +00:00
parent 9d57c47c64
commit 050cc7b7f3

View File

@@ -382,6 +382,23 @@ acc_alloc(krb5_context context, krb5_ccache *id)
return 0;
}
static krb5_error_code
get_default_principal(krb5_context context, char **p)
{
krb5_error_code ret;
krb5_principal principal;
*p = NULL;
ret = _krb5_get_default_principal_local(context, &principal);
if (ret)
return ret;
ret = krb5_unparse_name(context, principal, p);
krb5_free_principal(context, principal);
return ret;
}
static krb5_error_code
acc_resolve(krb5_context context, krb5_ccache *id, const char *res)
{
@@ -398,6 +415,18 @@ acc_resolve(krb5_context context, krb5_ccache *id, const char *res)
if (res == NULL || res[0] == '\0') {
error = (*a->context->func->open_default_ccache)(a->context,
&a->ccache);
if (error == ccErrCCacheNotFound) {
char *p;
ret = get_default_principal(context, &p);
if (ret == 0) {
error = (*a->context->func->create_default_ccache)(a->context,
cc_credentials_v5,
p,
&a->ccache);
free(p);
}
}
if (error == 0)
a->cache_name = get_cc_name(a->ccache);
} else {
@@ -422,20 +451,12 @@ acc_resolve(krb5_context context, krb5_ccache *id, const char *res)
static krb5_error_code
acc_gen_new(krb5_context context, krb5_ccache *id)
{
krb5_principal principal;
krb5_error_code ret;
cc_int32 error;
krb5_acc *a;
char *p;
ret = krb5_get_default_principal(context, &principal);
if (ret)
return ret;
ret = krb5_unparse_name(context, principal, &p);
krb5_free_principal(context, principal);
if (ret)
return ret;
ret = get_default_principal(context, &p);
ret = acc_alloc(context, id);
if (ret) {