summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2006-10-04 10:44:28 +0000
committerEzra Peisach <epeisach@mit.edu>2006-10-04 10:44:28 +0000
commit9175e66cdb298c4197a30d38ad1ace63a976c6ec (patch)
tree6cca39e06b5fc900eecf95128cc7255c8baa66d6 /src/lib
parent63a8ab15aa5ee116b26a50c073fe8ee33e147cbd (diff)
The keyring code introduced in r18638 also included tests of the KEYRING:
regardless of whether the type is registered or not in the library. Test to see if KEYRING: is registered - and if so - run the tests on it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18642 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/krb5/ccache/t_cc.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/lib/krb5/ccache/t_cc.c b/src/lib/krb5/ccache/t_cc.c
index 0db618b76..247145b6c 100644
--- a/src/lib/krb5/ccache/t_cc.c
+++ b/src/lib/krb5/ccache/t_cc.c
@@ -207,6 +207,37 @@ static void cc_test(krb5_context context, const char *name, int flags)
}
+/*
+ * Checks if a credential type is registered with the library
+ */
+static int check_registered(krb5_context context, const char *prefix)
+{
+
+ char name[300];
+ krb5_error_code kret;
+ krb5_ccache id;
+
+ sprintf(name, "%s/tmp/cctest.%ld", prefix, (long) getpid());
+
+ kret = krb5_cc_resolve(context, name, &id);
+ if(kret != KRB5_OK) {
+ if(kret == KRB5_CC_UNKNOWN_TYPE)
+ return 0;
+ com_err("Checking on credential type", kret,prefix);
+ fflush(stderr);
+ return 0;
+ }
+
+ kret = krb5_cc_close(context, id);
+ if(kret != KRB5_OK) {
+ com_err("Checking on credential type - closing", kret,prefix);
+ fflush(stderr);
+ }
+
+ return 1;
+}
+
+
static void do_test(krb5_context context, const char *prefix)
{
char name[300];
@@ -285,7 +316,12 @@ int main (void)
test_misc(context);
do_test(context, "");
- do_test(context, "KEYRING:");
+
+ if(check_registered(context, "KEYRING:"))
+ do_test(context, "KEYRING:");
+ else
+ printf("Skiping KEYRING: test - unregistered type\n");
+
do_test(context, "MEMORY:");
do_test(context, "FILE:");