aboutsummaryrefslogtreecommitdiff
path: root/src/pam-freerdp.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-28 08:58:18 -0500
committerTed Gould <ted@gould.cx>2012-08-28 08:58:18 -0500
commit2395425d42fd56122913cf2c09fded980cf2bbac (patch)
treed32db2a26eede8ef49cfd4ccc5b07806c227eb2c /src/pam-freerdp.c
parentd67a26ba2585bd8bc74fed85e3ba0f4bc48f6f35 (diff)
downloadlibpam-freerdp2-2395425d42fd56122913cf2c09fded980cf2bbac.tar.gz
libpam-freerdp2-2395425d42fd56122913cf2c09fded980cf2bbac.tar.bz2
libpam-freerdp2-2395425d42fd56122913cf2c09fded980cf2bbac.zip
Saving the values once we get them
Diffstat (limited to 'src/pam-freerdp.c')
-rw-r--r--src/pam-freerdp.c17
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;
}