diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2018-04-19 22:32:22 +0500 |
---|---|---|
committer | Vladislav Grishenko <themiron@mail.ru> | 2018-04-19 22:34:49 +0500 |
commit | 4cc0861dacaaa3bd735245ba20d7147ac2f4b87d (patch) | |
tree | ff1847882c6d61fb0bea0e356804a1aa6b4639c0 /accel-pppd/ctrl | |
parent | 1eaf9b4fc806c233e66a86e80705e1e580029599 (diff) | |
download | accel-ppp-4cc0861dacaaa3bd735245ba20d7147ac2f4b87d.tar.gz accel-ppp-4cc0861dacaaa3bd735245ba20d7147ac2f4b87d.zip |
sstp: fix coexistance of host-name= & port= options
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/sstp/sstp.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c index d6262e8b..18bffdac 100644 --- a/accel-pppd/ctrl/sstp/sstp.c +++ b/accel-pppd/ctrl/sstp/sstp.c @@ -834,7 +834,7 @@ static int http_send_response(struct sstp_conn_t *conn, char *proto, char *statu static int http_recv_request(struct sstp_conn_t *conn, uint8_t *data, int len) { char linebuf[1024], protobuf[sizeof("HTTP/1.x")]; - char *line, *method, *request, *proto, *host; + char *line, *method, *request, *proto, *host, *ptr; struct buffer_t buf; int ret = -1; @@ -878,8 +878,10 @@ static int http_recv_request(struct sstp_conn_t *conn, uint8_t *data, int len) if (!host && conf_hostname) { host = http_getvalue(line, "Host", sizeof("Host") - 1); - if (host) - host = _strdup(host); + if (host) { + ptr = _strdup(host); + host = strsep(&ptr, ":"); + } } } @@ -2195,11 +2197,11 @@ static int sstp_connect(struct triton_md_handler_t *h) conn->ctrl.ifname = ""; conn->ctrl.mppe = MPPE_UNSET; - conn->ctrl.calling_station_id = strdup(addr_buf); + conn->ctrl.calling_station_id = _strdup(addr_buf); addr.len = sizeof(addr.u); getsockname(sock, &addr.u.sa, &addr.len); sockaddr_ntop(&addr, addr_buf, sizeof(addr_buf)); - conn->ctrl.called_station_id = strdup(addr_buf); + conn->ctrl.called_station_id = _strdup(addr_buf); ppp_init(&conn->ppp); conn->ppp.ses.ctrl = &conn->ctrl; |