aboutsummaryrefslogtreecommitdiff
path: root/src
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
commit4254be2e97614fca4cfbf50f36dca5dd631b3879 (patch)
treef92f80a47a5d2a461a4a076c591ee2cd3761e8db /src
parent313f4d6363e8d8840adfb5bac401499fac5bb195 (diff)
downloadlibpam-freerdp2-4254be2e97614fca4cfbf50f36dca5dd631b3879.tar.gz
libpam-freerdp2-4254be2e97614fca4cfbf50f36dca5dd631b3879.tar.bz2
libpam-freerdp2-4254be2e97614fca4cfbf50f36dca5dd631b3879.zip
Fixing pointers to make PAM happy. Uhg. No segfault though
Diffstat (limited to 'src')
-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,