diff options
author | Ted Gould <ted@gould.cx> | 2012-08-24 22:38:16 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-08-24 22:38:16 -0500 |
commit | 54985ce2584c25a6cc3886f0c4b3df593184a52a (patch) | |
tree | f68f6d8ce755e83f2054e45a33879cbb3a53c979 | |
parent | 5b36f6b97465461ebc87a984c853c81f2c67a4ac (diff) | |
download | libpam-freerdp2-54985ce2584c25a6cc3886f0c4b3df593184a52a.tar.gz libpam-freerdp2-54985ce2584c25a6cc3886f0c4b3df593184a52a.tar.bz2 libpam-freerdp2-54985ce2584c25a6cc3886f0c4b3df593184a52a.zip |
Crazy cheap URL parser
-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 5295098..2550767 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) { + if (strncmp(retval, "http://", strlen("http://")) == 0) { + char * original = retval; + char * newish = retval + strlen("http://"); + char * c; + for (c = newish; *c != '\0'; c++) { + if (*c == '/') { + *c = '\0'; + break; + } + } + retval = strdup(newish); + free(original); + } + } + return retval; } |