Blame SOURCES/0155-tests-fix-test_pam_preauth_cert_no_logon_name.patch

ecf709
From 7487682e505735f2143ccecfc5e7e0fc2dac37f2 Mon Sep 17 00:00:00 2001
ecf709
From: Sumit Bose <sbose@redhat.com>
ecf709
Date: Mon, 8 May 2017 15:28:20 +0200
ecf709
Subject: [PATCH 155/160] tests: fix test_pam_preauth_cert_no_logon_name()
ecf709
MIME-Version: 1.0
ecf709
Content-Type: text/plain; charset=UTF-8
ecf709
Content-Transfer-Encoding: 8bit
ecf709
ecf709
Currently a name is provided for test_pam_preauth_cert_no_logon_name()
ecf709
so it is not a no-logon-name test. This patch removes the name and adds
ecf709
the now missing mocked reply manually.
ecf709
ecf709
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
ecf709
(cherry picked from commit 89ff140d7ab92fce52d6730a7d27c8d73c7d9e4a)
ecf709
---
ecf709
 src/tests/cmocka/test_pam_srv.c | 10 +++++++---
ecf709
 1 file changed, 7 insertions(+), 3 deletions(-)
ecf709
ecf709
diff --git a/src/tests/cmocka/test_pam_srv.c b/src/tests/cmocka/test_pam_srv.c
ecf709
index 4d351a3707d2a49604595b728fff7705560c871a..35afbdd81d004236885ee80914771ccb4b8acff4 100644
ecf709
--- a/src/tests/cmocka/test_pam_srv.c
ecf709
+++ b/src/tests/cmocka/test_pam_srv.c
ecf709
@@ -1873,10 +1873,14 @@ void test_pam_preauth_cert_no_logon_name(void **state)
ecf709
      * Since there is a matching user the upcoming lookup by name will find
ecf709
      * the user entry. But since we force the lookup by name to go to the
ecf709
      * backend to make sure the group-membership data is up to date the
ecf709
-     * backend response has to be mocked twice and the second argument of
ecf709
-     * mock_input_pam_cert cannot be NULL but must match the user name. */
ecf709
-    mock_input_pam_cert(pam_test_ctx, "pamuser", NULL, NULL,
ecf709
+     * backend response has to be mocked twice.
ecf709
+     * Additionally sss_parse_inp_recv() must be mocked because the cache
ecf709
+     * request will be done with the username found by the certificate
ecf709
+     * lookup. */
ecf709
+    mock_input_pam_cert(pam_test_ctx, NULL, NULL, NULL,
ecf709
                         test_lookup_by_cert_cb, TEST_TOKEN_CERT, false);
ecf709
+    mock_account_recv_simple();
ecf709
+    mock_parse_inp("pamuser", NULL, EOK);
ecf709
 
ecf709
     will_return(__wrap_sss_packet_get_cmd, SSS_PAM_PREAUTH);
ecf709
     will_return(__wrap_sss_packet_get_body, WRAP_CALL_REAL);
ecf709
-- 
ecf709
2.9.4
ecf709