Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct vpn_config {
int password_set;
char otp[OTP_SIZE + 1];
char *cookie;
char saml_host[GATEWAY_HOST_SIZE + 1];
uint16_t saml_port;
char saml_session_id[MAX_SAML_SESSION_ID_LENGTH + 1];
char *otp_prompt;
Expand Down
5 changes: 4 additions & 1 deletion src/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ int wait_for_http_request(struct vpn_config *config)
}

address.sin_family = AF_INET;
address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (config->saml_host != NULL)
address.sin_addr.s_addr = inet_addr(config->saml_host);
else
address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
address.sin_port = htons(config->saml_port);

// Forcefully attaching socket to the port
Expand Down
10 changes: 10 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ PPPD_USAGE \
" --cookie=<cookie> A valid session cookie (SVPNCOOKIE).\n" \
" --cookie-on-stdin Read the cookie (SVPNCOOKIE) from standard input.\n" \
" --saml-login[=port] Run a http server to handle SAML login requests\n" \
" --saml-host=<host> Listen for SAML login requests on different host \n" \
" -o <otp>, --otp=<otp> One-Time-Password.\n" \
" --otp-prompt=<prompt> Search for the OTP prompt starting with this string.\n" \
" --otp-delay=<delay> Wait <delay> seconds before sending the OTP.\n" \
Expand Down Expand Up @@ -227,6 +228,7 @@ int main(int argc, char *argv[])
.password = {'\0'},
.password_set = 0,
.cookie = NULL,
.saml_host = NULL,
.saml_port = 0,
.saml_session_id = {'\0'},
.otp = {'\0'},
Expand Down Expand Up @@ -291,6 +293,7 @@ int main(int argc, char *argv[])
{"cookie", required_argument, NULL, 0},
{"cookie-on-stdin", no_argument, NULL, 0},
{"saml-login", optional_argument, NULL, 0},
{"saml-host", optional_argument, NULL, 0},
{"otp", required_argument, NULL, 'o'},
{"otp-prompt", required_argument, NULL, 0},
{"otp-delay", required_argument, NULL, 0},
Expand Down Expand Up @@ -609,6 +612,13 @@ int main(int argc, char *argv[])
free(cookie);
break;
}
if (strcmp(long_options[option_index].name,
"saml-host") == 0) {
free(cli_cfg.saml_host);
strncpy(cli_cfg.saml_host, optarg, GATEWAY_HOST_SIZE);
cli_cfg.saml_host[GATEWAY_HOST_SIZE] = '\0';
break;
}
if (strcmp(long_options[option_index].name,
"saml-login") == 0) {
long port = 8020;
Expand Down