diff options
author | Ted Gould <ted@gould.cx> | 2012-08-28 08:58:18 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-08-28 08:58:18 -0500 |
commit | 2395425d42fd56122913cf2c09fded980cf2bbac (patch) | |
tree | d32db2a26eede8ef49cfd4ccc5b07806c227eb2c | |
parent | d67a26ba2585bd8bc74fed85e3ba0f4bc48f6f35 (diff) | |
download | libpam-freerdp2-2395425d42fd56122913cf2c09fded980cf2bbac.tar.gz libpam-freerdp2-2395425d42fd56122913cf2c09fded980cf2bbac.tar.bz2 libpam-freerdp2-2395425d42fd56122913cf2c09fded980cf2bbac.zip |
Saving the values once we get them
-rw-r--r-- | src/pam-freerdp.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c index d1a6578..63b6baf 100644 --- a/src/pam-freerdp.c +++ b/src/pam-freerdp.c @@ -32,6 +32,8 @@ #define PAM_TYPE_DOMAIN 1234 +static char * global_domain = NULL; + /* Either grab a value or prompt for it */ static char * get_item (pam_handle_t * pamh, int type) @@ -43,6 +45,10 @@ get_item (pam_handle_t * pamh, int type) if (pam_get_item(pamh, type, (const void **)&value) == PAM_SUCCESS && value != NULL) { return strdup(value); } + } else { + if (global_domain != NULL) { + return strdup(global_domain); + } } /* Now we need to prompt */ @@ -103,6 +109,17 @@ get_item (pam_handle_t * pamh, int type) } } + if (retval != NULL) { /* Can't believe it really would be at this point, but let's be sure */ + if (type != PAM_TYPE_DOMAIN) { + pam_set_item(pamh, type, (const void *)retval); + } else { + if (global_domain != NULL) { + free(global_domain); + } + global_domain = strdup(retval); + } + } + return retval; } |