peer_addr needs to be reset if the host changes, or else we will connect to the wrong host, and probably trigger a certificate mismatch. References: Commit d9aa66ba2d (Clear cached peer_addr where necessary) http://lists.infradead.org/pipermail/openconnect-devel/2013-August/001136.html Signed-off-by: Kevin Cernekee <cernekee at gmail.com> --- http.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http.c b/http.c index 5adacaa..001c6a0 100644 --- a/http.c +++ b/http.c @@ -1048,6 +1048,8 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo) orig_host = NULL; free(vpninfo->urlpath); vpninfo->urlpath = orig_path; + free(vpninfo->peer_addr); + vpninfo->peer_addr = NULL; orig_path = NULL; vpninfo->port = orig_port; } -- 1.7.9.5