aboutsummaryrefslogtreecommitdiff
path: root/tests/mock_pam.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mock_pam.c')
-rw-r--r--tests/mock_pam.c15
1 files changed, 8 insertions, 7 deletions
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 <string.h>
#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;