diff options
Diffstat (limited to 'src/pam-freerdp.c')
-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; } |