aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-28 08:11:57 +0000
committerTarmac <>2012-08-28 08:11:57 +0000
commit733fde7fe2415f983ed8f2045dffda16d30d1c14 (patch)
tree4fed2e6f3eab07c70c79ceb82b5f33d93130ca2c /src
parente3a8eb3f68140e51e972fde3e025e6d26157d12f (diff)
parent8a85c086263fda4baea7128592fefedb61f83aee (diff)
downloadlibpam-x2go-733fde7fe2415f983ed8f2045dffda16d30d1c14.tar.gz
libpam-x2go-733fde7fe2415f983ed8f2045dffda16d30d1c14.tar.bz2
libpam-x2go-733fde7fe2415f983ed8f2045dffda16d30d1c14.zip
Handle URLs as the remote host value. Approved by Albert Astals Cid, jenkins.
Diffstat (limited to 'src')
-rw-r--r--src/freerdp-auth-check.c9
-rw-r--r--src/pam-freerdp.c17
2 files changed, 26 insertions, 0 deletions
diff --git a/src/freerdp-auth-check.c b/src/freerdp-auth-check.c
index 83bab2f..d50833b 100644
--- a/src/freerdp-auth-check.c
+++ b/src/freerdp-auth-check.c
@@ -79,6 +79,15 @@ main (int argc, char * argv[])
instance->settings->password = password;
instance->settings->ignore_certificate = true;
+ char * colonloc = strstr(argv[1], ":");
+ if (colonloc != NULL) {
+ /* We've got a port to deal with */
+ colonloc[0] = '\0';
+ colonloc++;
+
+ instance->settings->port = strtoul(colonloc, NULL, 10);
+ }
+
if (freerdp_connect(instance)) {
freerdp_disconnect(instance);
return 0;
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 5295098..d1a6578 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -86,6 +86,23 @@ get_item (pam_handle_t * pamh, int type)
char * retval = responses->resp;
free(responses);
+
+ if (type == PAM_RHOST) {
+ char * subloc = strstr(retval, "://");
+ if (subloc != NULL) {
+ char * original = retval;
+ char * newish = subloc + strlen("://");
+ char * endslash = strstr(newish, "/");
+
+ if (endslash != NULL) {
+ endslash[0] = '\0';
+ }
+
+ retval = strdup(newish);
+ free(original);
+ }
+ }
+
return retval;
}