diff options
author | Ted Gould <ted@gould.cx> | 2012-08-28 14:17:50 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-08-28 14:17:50 -0500 |
commit | 817ff829b60891959d4b947fbd79c7bd3e2e67dd (patch) | |
tree | 951edb20d883817c4d96a98d61d6f6d847b14c01 | |
parent | 645af42abcb4b3ac922705751d134d31d8959912 (diff) | |
download | libpam-x2go-817ff829b60891959d4b947fbd79c7bd3e2e67dd.tar.gz libpam-x2go-817ff829b60891959d4b947fbd79c7bd3e2e67dd.tar.bz2 libpam-x2go-817ff829b60891959d4b947fbd79c7bd3e2e67dd.zip |
Caching the password between authenticate and open_session
-rw-r--r-- | src/pam-freerdp.c | 14 |
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; |