From 817ff829b60891959d4b947fbd79c7bd3e2e67dd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 28 Aug 2012 14:17:50 -0500 Subject: Caching the password between authenticate and open_session --- src/pam-freerdp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c index 8331a27..e284619 100644 --- a/src/pam-freerdp.c +++ b/src/pam-freerdp.c @@ -33,6 +33,11 @@ #define PAM_TYPE_DOMAIN 1234 static char * global_domain = NULL; +/* FIXME? This is a work around to the fact that PAM seems to be clearing + the auth token between authorize and open_session. Which then requires + us to save it. Seems like we're the wrong people to do it, but we have + no choice */ +static char * global_password = NULL; /* Either grab a value or prompt for it */ static char * @@ -45,6 +50,9 @@ get_item (pam_handle_t * pamh, int type) if (pam_get_item(pamh, type, (const void **)&value) == PAM_SUCCESS && value != NULL) { return strdup(value); } + if (type == PAM_AUTHTOK && global_password != NULL) { + return strdup(global_password); + } } else { if (global_domain != NULL) { return strdup(global_domain); @@ -118,6 +126,12 @@ get_item (pam_handle_t * pamh, int type) } global_domain = strdup(retval); } + if (type == PAM_AUTHTOK) { + if (global_password != NULL) { + free(global_password); + } + global_password = strdup(retval); + } } return retval; -- cgit v1.2.3