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

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