aboutsummaryrefslogtreecommitdiff
path: root/src
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
commit48df96792e41ff14f101fbb9829a059b0cdd3879 (patch)
treed32db2a26eede8ef49cfd4ccc5b07806c227eb2c /src
parent733fde7fe2415f983ed8f2045dffda16d30d1c14 (diff)
downloadlibpam-x2go-48df96792e41ff14f101fbb9829a059b0cdd3879.tar.gz
libpam-x2go-48df96792e41ff14f101fbb9829a059b0cdd3879.tar.bz2
libpam-x2go-48df96792e41ff14f101fbb9829a059b0cdd3879.zip
Saving the values once we get them
Diffstat (limited to 'src')
-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;
}