]> eyrie.org Git - kerberos/pam-krb5.git/commitdiff
Generate testing krb5.conf files for more tests main
authorRuss Allbery <eagle@eyrie.org>
Wed, 29 Jun 2022 18:23:21 +0000 (11:23 -0700)
committerRuss Allbery <eagle@eyrie.org>
Wed, 29 Jun 2022 18:23:21 +0000 (11:23 -0700)
Ensure that tests have a krb5.conf file with a default realm set,
since otherwise they may fail for reasons other than the test is
designed to detect.

Fixes #25.

tests/module/long-t.c
tests/module/trace-t.c

index 73614b0f6ec9a5daa1d18af1d92e9f163150765f..4c2188516d6ec102944b43299fd9e7d6be53d86b 100644 (file)
@@ -5,7 +5,7 @@
  * be done without having Kerberos configured and a username and password
  * available.
  *
- * Copyright 2020 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2020, 2022 Russ Allbery <eagle@eyrie.org>
  *
  * SPDX-License-Identifier: BSD-3-clause or GPL-1+
  */
@@ -15,6 +15,7 @@
 
 #include <tests/fakepam/script.h>
 #include <tests/tap/basic.h>
+#include <tests/tap/kerberos.h>
 
 
 int
@@ -25,6 +26,12 @@ main(void)
 
     plan_lazy();
 
+    /*
+     * Generate a testing krb5.conf file with a nonexistent default realm so
+     * that this test will run on any system.
+     */
+    kerberos_generate_conf("bogus.example.com");
+
     memset(&config, 0, sizeof(config));
     config.user = "test";
 
index db3aa67f9e24a1882b8d485a7b37d5575144b47e..2a8f180564d114e4ca26009efe00991de936d412 100644 (file)
@@ -5,7 +5,7 @@
  * simple and just checks that the file is created.
  *
  * Written by Russ Allbery <eagle@eyrie.org>
- * Copyright 2020 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2020, 2022 Russ Allbery <eagle@eyrie.org>
  * Copyright 2012
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -17,6 +17,7 @@
 
 #include <tests/fakepam/script.h>
 #include <tests/tap/basic.h>
+#include <tests/tap/kerberos.h>
 #include <tests/tap/string.h>
 
 
@@ -28,6 +29,12 @@ main(void)
 
     plan_lazy();
 
+    /*
+     * Generate a testing krb5.conf file with a nonexistent default realm so
+     * that this test will run on any system.
+     */
+    kerberos_generate_conf("bogus.example.com");
+
     memset(&config, 0, sizeof(config));
     config.user = "testuser";
     tmpdir = test_tmpdir();