aboutsummaryrefslogtreecommitdiff
path: root/src/pam-freerdp.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-19 22:03:38 -0500
committerTed Gould <ted@gould.cx>2012-08-19 22:03:38 -0500
commit09706973403a6ae0934f55780ac81159bf8d6200 (patch)
treef92f80a47a5d2a461a4a076c591ee2cd3761e8db /src/pam-freerdp.c
parentec14991fdc6915a88cd213e37ab776b6e28ce738 (diff)
downloadlibpam-x2go-09706973403a6ae0934f55780ac81159bf8d6200.tar.gz
libpam-x2go-09706973403a6ae0934f55780ac81159bf8d6200.tar.bz2
libpam-x2go-09706973403a6ae0934f55780ac81159bf8d6200.zip
Fixing pointers to make PAM happy. Uhg. No segfault though
Diffstat (limited to 'src/pam-freerdp.c')
-rw-r--r--src/pam-freerdp.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index a1e2bfa..bf533c4 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -16,45 +16,48 @@ get_item (pam_handle_t * pamh, int type)
/* Check to see if we just have the value. If we do, great
let's dup it some we're consitently allocating memory */
if (type != PAM_TYPE_DOMAIN) {
- char * value;
- if (pam_get_item(pamh, type, (const void **)&value) == PAM_SUCCESS) {
+ char * value = NULL;
+ if (pam_get_item(pamh, type, (const void **)&value) == PAM_SUCCESS && value != NULL) {
return strdup(value);
}
}
/* Now we need to prompt */
/* Build up the message we're prompting for */
- struct pam_message message[1];
- message[0].msg_style = PAM_PROMPT_ECHO_ON;
+ struct pam_message message;
+ const struct pam_message * pmessage = &message;
+
+ message.msg = NULL;
+ message.msg_style = PAM_PROMPT_ECHO_ON;
switch (type) {
case PAM_USER:
- message[0].msg = "login:";
+ message.msg = "login:";
break;
case PAM_RUSER:
- message[0].msg = "remote login:";
+ message.msg = "remote login:";
break;
case PAM_RHOST:
- message[0].msg = "remote host:";
+ message.msg = "remote host:";
break;
case PAM_AUTHTOK:
- message[0].msg = "password:";
- message[0].msg_style = PAM_PROMPT_ECHO_OFF;
+ message.msg = "password:";
+ message.msg_style = PAM_PROMPT_ECHO_OFF;
break;
case PAM_TYPE_DOMAIN:
- message[0].msg = "domain:";
+ message.msg = "domain:";
break;
default:
return NULL;
}
- struct pam_conv * conv;
- if (pam_get_item(pamh, PAM_CONV, (const void **)&conv) != PAM_SUCCESS) {
+ struct pam_conv * conv = NULL;
+ if (pam_get_item(pamh, PAM_CONV, (const void **)&conv) != PAM_SUCCESS || conv == NULL || conv->conv == NULL) {
return NULL;
}
struct pam_response * responses = NULL;
- if (conv->conv(1, (const struct pam_message **)&message, &responses, conv->appdata_ptr) != PAM_SUCCESS) {
+ if (conv->conv(1, &pmessage, &responses, conv->appdata_ptr) != PAM_SUCCESS) {
return NULL;
}
@@ -166,7 +169,7 @@ pam_sm_close_session (pam_handle_t *pamh, int flags, int argc, const char **argv
#ifdef PAM_STATIC
-struct pam_module _pam_temp_account_modstruct = {
+struct pam_module _pam_freerdp_modstruct = {
"pam-freerdp",
pam_sm_authenticate,
NULL,