aboutsummaryrefslogtreecommitdiff
path: root/tests/tap/kerberos.c
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2016-01-17 14:30:53 -0800
committerRuss Allbery <eagle@eyrie.org>2016-01-17 14:30:53 -0800
commit57a5a0095c3fe0f22dcbb9d99a82cc94f2b608c7 (patch)
treed7ab6169e2c5af79d97711964c34fbc1f5bbab13 /tests/tap/kerberos.c
parent884297fc439a4c3eba2365cdb810214dfc4f5799 (diff)
Update to rra-c-util 5.10 and C TAP Harness 3.4
Update to rra-c-util 5.10: * Add missing va_end to xasprintf implementation. * Fix Perl test suite framework for new Automake relative paths. * Improve portability to Kerberos included in Solaris 10. * Use appropriate warning flags with Clang (currently not warning clean). Update to C TAP Harness 3.4: * Fix segfault in runtests with an empty test list. * Display verbose test results with -v or C_TAP_VERBOSE. * Test infrastructure builds cleanly with Clang warnings. * Support comments and blank lines in test lists.
Diffstat (limited to 'tests/tap/kerberos.c')
-rw-r--r--tests/tap/kerberos.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/tap/kerberos.c b/tests/tap/kerberos.c
index 578a858..6a5025a 100644
--- a/tests/tap/kerberos.c
+++ b/tests/tap/kerberos.c
@@ -55,7 +55,9 @@
* Disable the requirement that format strings be literals, since it's easier
* to handle the possible patterns for kinit commands as an array.
*/
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) || defined(__clang__)
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
/*
@@ -219,6 +221,8 @@ kerberos_free(void)
free(config->userprinc);
free(config->username);
free(config->password);
+ free(config->pkinit_principal);
+ free(config->pkinit_cert);
free(config);
config = NULL;
}
@@ -351,6 +355,31 @@ kerberos_setup(enum kerberos_needs needs)
test_file_path_free(path);
/*
+ * If we have PKINIT configuration, read it and fill out the relevant
+ * members of our config struct.
+ */
+ path = test_file_path("config/pkinit-principal");
+ if (path != NULL)
+ file = fopen(path, "r");
+ if (file != NULL) {
+ if (fgets(buffer, sizeof(buffer), file) == NULL)
+ bail("cannot read %s", path);
+ if (buffer[strlen(buffer) - 1] != '\n')
+ bail("no newline in %s", path);
+ buffer[strlen(buffer) - 1] = '\0';
+ fclose(file);
+ test_file_path_free(path);
+ path = test_file_path("config/pkinit-cert");
+ if (path != NULL) {
+ config->pkinit_principal = bstrdup(buffer);
+ config->pkinit_cert = bstrdup(path);
+ }
+ }
+ test_file_path_free(path);
+ if (config->pkinit_cert == NULL && (needs & TAP_KRB_NEEDS_PKINIT) != 0)
+ skip_all("PKINIT tests not configured");
+
+ /*
* Register the cleanup function so that the caller doesn't have to do
* explicit cleanup.
*/