dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0067-pam_test_srv-set-default-value-for-SOFTHSM2_CONF.patch

71e593
From ef631f9e61e7a0e168cce9071470839a4c04114c Mon Sep 17 00:00:00 2001
71e593
From: Sumit Bose <sbose@redhat.com>
71e593
Date: Fri, 9 Nov 2018 14:04:38 +0100
71e593
Subject: [PATCH 67/74] pam_test_srv: set default value for SOFTHSM2_CONF
71e593
71e593
Currently the SOFTHSM2_CONF is not set by any fixture but some tests
71e593
sets them and other might rely on the setting done by a previous test.
71e593
This means that the tests have to run in a given order and depend on
71e593
each other.
71e593
71e593
To remove this dependency SOFTHSM2_CONF is set in the fixture to the
71e593
"default" SoftHSM2 configuration with one valid certificate. Any test
71e593
which needs a different setup must now set SOFTHSM2_CONF explicitly.
71e593
71e593
Related to https://pagure.io/SSSD/sssd/issue/3887
71e593
71e593
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
71e593
---
71e593
 src/tests/cmocka/test_pam_srv.c | 5 +++++
71e593
 1 file changed, 5 insertions(+)
71e593
71e593
diff --git a/src/tests/cmocka/test_pam_srv.c b/src/tests/cmocka/test_pam_srv.c
71e593
index 7fc9224e1..b29961255 100644
71e593
--- a/src/tests/cmocka/test_pam_srv.c
71e593
+++ b/src/tests/cmocka/test_pam_srv.c
71e593
@@ -356,6 +356,10 @@ static void pam_test_setup_common(void)
71e593
 {
71e593
     errno_t ret;
71e593
 
71e593
+#ifndef HAVE_NSS
71e593
+    putenv(discard_const("SOFTHSM2_CONF=" ABS_BUILD_DIR "/src/tests/test_CA/softhsm2_one.conf"));
71e593
+#endif
71e593
+
71e593
     pam_test_ctx->pam_user_fqdn = \
71e593
                     sss_create_internal_fqname(pam_test_ctx,
71e593
                                                "pamuser",
71e593
@@ -1926,6 +1930,7 @@ void test_pam_preauth_cert_nocert(void **state)
71e593
     set_cert_auth_param(pam_test_ctx->pctx, "/no/path");
71e593
 #else
71e593
     set_cert_auth_param(pam_test_ctx->pctx, CA_DB);
71e593
+    unsetenv("SOFTHSM2_CONF");
71e593
 #endif
71e593
 
71e593
 
71e593
-- 
71e593
2.19.1
71e593