aboutsummaryrefslogtreecommitdiff
path: root/src/pam-freerdp.c
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
commit817ff829b60891959d4b947fbd79c7bd3e2e67dd (patch)
tree951edb20d883817c4d96a98d61d6f6d847b14c01 /src/pam-freerdp.c
parent645af42abcb4b3ac922705751d134d31d8959912 (diff)
downloadlibpam-x2go-817ff829b60891959d4b947fbd79c7bd3e2e67dd.tar.gz
libpam-x2go-817ff829b60891959d4b947fbd79c7bd3e2e67dd.tar.bz2
libpam-x2go-817ff829b60891959d4b947fbd79c7bd3e2e67dd.zip
Caching the password between authenticate and open_session
Diffstat (limited to 'src/pam-freerdp.c')
-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;