dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From ef631f9e61e7a0e168cce9071470839a4c04114c Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Fri, 9 Nov 2018 14:04:38 +0100
Subject: [PATCH 67/74] pam_test_srv: set default value for SOFTHSM2_CONF

Currently the SOFTHSM2_CONF is not set by any fixture but some tests
sets them and other might rely on the setting done by a previous test.
This means that the tests have to run in a given order and depend on
each other.

To remove this dependency SOFTHSM2_CONF is set in the fixture to the
"default" SoftHSM2 configuration with one valid certificate. Any test
which needs a different setup must now set SOFTHSM2_CONF explicitly.

Related to https://pagure.io/SSSD/sssd/issue/3887

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
 src/tests/cmocka/test_pam_srv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/tests/cmocka/test_pam_srv.c b/src/tests/cmocka/test_pam_srv.c
index 7fc9224e1..b29961255 100644
--- a/src/tests/cmocka/test_pam_srv.c
+++ b/src/tests/cmocka/test_pam_srv.c
@@ -356,6 +356,10 @@ static void pam_test_setup_common(void)
 {
     errno_t ret;
 
+#ifndef HAVE_NSS
+    putenv(discard_const("SOFTHSM2_CONF=" ABS_BUILD_DIR "/src/tests/test_CA/softhsm2_one.conf"));
+#endif
+
     pam_test_ctx->pam_user_fqdn = \
                     sss_create_internal_fqname(pam_test_ctx,
                                                "pamuser",
@@ -1926,6 +1930,7 @@ void test_pam_preauth_cert_nocert(void **state)
     set_cert_auth_param(pam_test_ctx->pctx, "/no/path");
 #else
     set_cert_auth_param(pam_test_ctx->pctx, CA_DB);
+    unsetenv("SOFTHSM2_CONF");
 #endif
 
 
-- 
2.19.1