From 60eba4fbac435f0dc02a278aeaff23aa04e9b271 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 8 Apr 2021 10:33:54 +0200 Subject: [PATCH] sql: test failure cases --- tests/pam_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/pam_test.c b/tests/pam_test.c index e5ad855..f29be5f 100644 --- a/tests/pam_test.c +++ b/tests/pam_test.c @@ -346,6 +346,10 @@ static int test_fail_authenticate_mysql1(void) { return pam_sm_authenticate((pam_handle_t *)1, 0, sizeof(mysql_cfg) / sizeof(char*), mysql_cfg); } +static int test_fail_authenticate_mysql2(void) { + return pam_sm_authenticate((pam_handle_t *)5, 0, sizeof(mysql_cfg) / sizeof(char*), mysql_cfg); +} + static pid_t run_mock(const char *port, const char *type) { pid_t pid = fork(); if(pid == 0) { @@ -452,6 +456,10 @@ int main(void) { ret = 2002; goto out; } + if(test_fail_authenticate_mysql2() != PAM_AUTH_ERR) { + ret = 2003; + goto out; + } #endif out: