Skip to content

Commit

Permalink
http: Fix NULL vpninfo->hostname pointer on redirect
Browse files Browse the repository at this point in the history
Commit 1fe3f43 (Make openconnect_set_hostname() clear
vpninfo->peer_addr, use it more often) broke NEWHOST redirects:

    $ ./openconnect -v vpn.ufl.edu
    POST https://vpn.ufl.edu/
    Attempting to connect to server 128.227.166.118:443
    SSL negotiation with vpn.ufl.edu
    Matched DNS altname 'vpn.ufl.edu'
    Connected to HTTPS on vpn.ufl.edu
    Got HTTP response: HTTP/1.0 302 Temporary moved
    Content-Length: 0
    Cache-Control: no-cache
    Pragma: no-cache
    Connection: Close
    Date: Tue, 31 Dec 2013 19:43:47 GMT
    Location: https://ctx36-vpn-asa5500-1-g10-1.ns.ufl.edu/
    HTTP body length:  (0)
    POST https://(null)/
    Segmentation fault

Fix this by populating vpninfo->hostname with the correct value.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
  • Loading branch information
cernekee committed Dec 31, 2013
1 parent 3cb5435 commit c804961
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http.c
Expand Up @@ -759,7 +759,7 @@ static int handle_redirect(struct openconnect_info *vpninfo)
}

if (strcasecmp(vpninfo->hostname, host) || port != vpninfo->port) {
openconnect_set_hostname(vpninfo, NULL);
openconnect_set_hostname(vpninfo, host);
vpninfo->port = port;

/* Kill the existing connection, and a new one will happen */
Expand Down

0 comments on commit c804961

Please sign in to comment.