test krb5_cc_get_prefix_ops

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

View File

@@ -424,6 +424,19 @@ test_copy(krb5_context context, const char *fromtype, const char *totype)
krb5_cc_destroy(context, toid);
}
static void
test_prefix_ops(krb5_context context, const char *name, const krb5_cc_ops *ops)
{
const krb5_cc_ops *o;
o = krb5_cc_get_prefix_ops(context, name);
if (o == NULL)
krb5_errx(context, 1, "found no match for prefix '%s'", name);
if (strcmp(o->prefix, ops->prefix) != 0)
krb5_errx(context, 1, "ops for prefix '%s' is not "
"the expected %s != %s", name, o->prefix, ops->prefix);
}
static struct getargs args[] = {
{"debug", 'd', arg_flag, &debug_flag,
@@ -500,6 +513,12 @@ main(int argc, char **argv)
test_copy(context, "FILE", "MEMORY");
test_copy(context, "MEMORY", "FILE");
test_prefix_ops(context, "FILE:/tmp/foo", &krb5_fcc_ops);
test_prefix_ops(context, "FILE", &krb5_fcc_ops);
test_prefix_ops(context, "MEMORY", &krb5_mcc_ops);
test_prefix_ops(context, "MEMORY:foo", &krb5_mcc_ops);
test_prefix_ops(context, "/tmp/kaka", &krb5_fcc_ops);
krb5_free_context(context);
return 0;