aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-28 14:17:50 -0500
committerTed Gould <ted@gould.cx>2012-08-28 14:17:50 -0500
commit62c656c77b1e9d5b426c8c569d57d39aeb976e78 (patch)
tree951edb20d883817c4d96a98d61d6f6d847b14c01 /src
parent76e697d6982a705fcc59dc6652aac1d57ba9dcac (diff)
downloadlibpam-freerdp2-62c656c77b1e9d5b426c8c569d57d39aeb976e78.tar.gz
libpam-freerdp2-62c656c77b1e9d5b426c8c569d57d39aeb976e78.tar.bz2
libpam-freerdp2-62c656c77b1e9d5b426c8c569d57d39aeb976e78.zip
Caching the password between authenticate and open_session
Diffstat (limited to 'src')
-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;