From a246de8bd1b37f1b9881b38036a736305e3e4052 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 5 May 2018 00:40:13 +0200 Subject: unit tests: Fix them and reenable them. --- tests/mock_pam.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tests/mock_pam.c') diff --git a/tests/mock_pam.c b/tests/mock_pam.c index a07c9af..8b8e2f5 100644 --- a/tests/mock_pam.c +++ b/tests/mock_pam.c @@ -11,6 +11,7 @@ #include #include "mock_pam.h" +#include "pam-x2go.h" struct pam_handle { void *item[PAM_NUM_ITEMS]; @@ -31,15 +32,15 @@ int fake_conv (int num_msg, const struct pam_message **msg, response->resp_retcode = 0; - if (strcmp((*msg)->msg, "login:") == 0) + if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_GUESTLOGIN) == 0) response->resp = strdup ("guest"); /* IMPORTANT: this needs to be in /etc/passwd */ - else if (strcmp((*msg)->msg, "remote login:") == 0) + else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_USER) == 0) response->resp = strdup ("ruser"); - else if (strcmp((*msg)->msg, "remote host:") == 0) + else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_HOST) == 0) response->resp = strdup ("protocol://rhost/dummy"); - else if (strcmp((*msg)->msg, "password:") == 0) + else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_PASSWORD) == 0) response->resp = strdup ("password"); - else if (strcmp((*msg)->msg, "remote command:") == 0) + else if (strcmp((*msg)->msg, PAM_X2GO_PROMPT_COMMAND) == 0) response->resp = strdup ("rcommand"); else return PAM_SYMBOL_ERR; /* leaks... */ @@ -63,7 +64,7 @@ pam_handle_t *pam_handle_new (void) return newh; } -int pam_get_item (const pam_handle_t *pamh, int type, const void **value) +int PAM_NONNULL((1)) pam_get_item (const pam_handle_t *pamh, int type, const void **value) { if (pamh == NULL) return PAM_SYSTEM_ERR; @@ -78,7 +79,7 @@ int pam_get_item (const pam_handle_t *pamh, int type, const void **value) return PAM_SUCCESS; } -int pam_set_item (pam_handle_t *pamh, int type, const void *value) +int PAM_NONNULL((1)) pam_set_item (pam_handle_t *pamh, int type, const void *value) { if (pamh == NULL) return PAM_SYSTEM_ERR; -- cgit v1.2.3