diff options
Diffstat (limited to 'tests/tap/kerberos.c')
| -rw-r--r-- | tests/tap/kerberos.c | 31 | 
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.       */ | 
