(krb5_cc_get_prefix_ops): change the behavior to return NULL when its

not found, and fcc when the name starts with a '/'. Almost matches
behavior in other parts of the code, but can't really do that since
the name passed in to this function may only contain the prefix itself
without the colon.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16306 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-11-29 09:10:47 +00:00
parent 459932f3ef
commit 6ccf928a53

View File

@@ -691,9 +691,8 @@ krb5_cc_clear_mcred(krb5_creds *mcred)
/* /*
* Get the cc ops that is registered in `context' to handle the * Get the cc ops that is registered in `context' to handle the
* `prefix'. `prefix' can be a complete credential cache name or a * `prefix'. `prefix' can be a complete credential cache name or a
* prefix, the function will only use part up to the first colon (:). * prefix, the function will only use part up to the first colon (:)
* If there are no colon, a file credential cache will be returned for * if there is one. Returns NULL if ops not found.
* compatibility reasons. Returns NULL if ops not found.
*/ */
const krb5_cc_ops * const krb5_cc_ops *
@@ -702,17 +701,17 @@ krb5_cc_get_prefix_ops(krb5_context context, const char *prefix)
char *p, *p1; char *p, *p1;
int i; int i;
if (prefix[0] == '/')
return &krb5_fcc_ops;
p = strdup(prefix); p = strdup(prefix);
if (p == NULL) { if (p == NULL) {
krb5_set_error_string(context, "malloc - out of memory"); krb5_set_error_string(context, "malloc - out of memory");
return NULL; return NULL;
} }
p1 = strchr(p, ':'); p1 = strchr(p, ':');
if (p1 == NULL) { if (p1)
free(p1); *p1 = '\0';
return &krb5_fcc_ops;
}
*p1 = '\0';
for(i = 0; i < context->num_cc_ops && context->cc_ops[i].prefix; i++) { for(i = 0; i < context->num_cc_ops && context->cc_ops[i].prefix; i++) {
if(strcmp(context->cc_ops[i].prefix, p) == 0) { if(strcmp(context->cc_ops[i].prefix, p) == 0) {