(krb5_cc_resolve): fall-back to files if there's no prefix. also
clean-up a little bit. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6424 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -78,6 +78,30 @@ krb5_cc_register(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static krb5_error_code
|
||||||
|
allocate_ccache (krb5_context context,
|
||||||
|
const krb5_cc_ops *ops,
|
||||||
|
const char *residual,
|
||||||
|
krb5_ccache *id)
|
||||||
|
{
|
||||||
|
krb5_error_code ret;
|
||||||
|
krb5_ccache p;
|
||||||
|
|
||||||
|
p = malloc(sizeof(*p));
|
||||||
|
if(p == NULL)
|
||||||
|
return KRB5_CC_NOMEM;
|
||||||
|
p->ops = (krb5_cc_ops *)ops;
|
||||||
|
*id = p;
|
||||||
|
ret = p->ops->resolve(context, id, residual);
|
||||||
|
if(ret)
|
||||||
|
free(p);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find and allocate a ccache in `id' from the specification in `residual'.
|
||||||
|
*/
|
||||||
|
|
||||||
krb5_error_code
|
krb5_error_code
|
||||||
krb5_cc_resolve(krb5_context context,
|
krb5_cc_resolve(krb5_context context,
|
||||||
const char *residual,
|
const char *residual,
|
||||||
@@ -93,21 +117,20 @@ krb5_cc_resolve(krb5_context context,
|
|||||||
if(ret) return ret;
|
if(ret) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < context->num_ops && context->cc_ops[i].prefix; i++)
|
for(i = 0; i < context->num_ops && context->cc_ops[i].prefix; i++) {
|
||||||
if(strncmp(context->cc_ops[i].prefix, residual,
|
size_t prefix_len = strlen(context->cc_ops[i].prefix);
|
||||||
strlen(context->cc_ops[i].prefix)) == 0){
|
|
||||||
krb5_ccache p;
|
if(strncmp(context->cc_ops[i].prefix, residual, prefix_len) == 0
|
||||||
p = malloc(sizeof(*p));
|
&& residual[prefix_len] == ':') {
|
||||||
if(p == NULL)
|
return allocate_ccache (context, &context->cc_ops[i],
|
||||||
return KRB5_CC_NOMEM;
|
residual + prefix_len + 1,
|
||||||
p->ops = &context->cc_ops[i];
|
id);
|
||||||
*id = p;
|
|
||||||
ret = p->ops->resolve(context, id, residual +
|
|
||||||
strlen(p->ops->prefix) + 1);
|
|
||||||
if(ret) free(p);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
return KRB5_CC_UNKNOWN_TYPE;
|
}
|
||||||
|
if (strchr (residual, ':') == NULL)
|
||||||
|
return allocate_ccache (context, &krb5_fcc_ops, residual, id);
|
||||||
|
else
|
||||||
|
return KRB5_CC_UNKNOWN_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
krb5_error_code
|
krb5_error_code
|
||||||
|
Reference in New Issue
Block a user