From 48df96792e41ff14f101fbb9829a059b0cdd3879 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 28 Aug 2012 08:58:18 -0500 Subject: Saving the values once we get them --- src/pam-freerdp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') 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; } -- cgit v1.2.3