aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pam-freerdp.c14
1 files changed, 14 insertions, 0 deletions
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;