]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Provide unique hostname to CSD script
authorDavid Woodhouse <dwmw2@infradead.org>
Thu, 9 Aug 2018 09:56:21 +0000 (10:56 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Thu, 9 Aug 2018 09:56:21 +0000 (10:56 +0100)
We see failures when DNS gives us a different IP address and the CSD
trojan ends up talking to a different host to the one we're actually
trying to authenticate to. Since we use pinned certificate hashes, it
shouldn't matter that we lose the hostname and can't validate the cert
against it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
auth.c

diff --git a/auth.c b/auth.c
index 510c4f9783b4ea48142106e1967a37afafaf3777..58839888abdd1dd04d5636790bfd34a1f7dd3b86 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -1144,7 +1144,7 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle
 
 
                        csd_argv[i++] = (char *)"-url";
-                       if (asprintf(&csd_argv[i++], "\"https://%s%s\"", vpninfo->hostname, vpninfo->csd_starturl) == -1)
+                       if (asprintf(&csd_argv[i++], "\"https://%s%s\"", openconnect_get_hostname(vpninfo), vpninfo->csd_starturl) == -1)
                                goto out;
 
                        csd_argv[i++] = (char *)"-langselen";
@@ -1154,7 +1154,7 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle
                                goto out;
                        if (setenv("CSD_TOKEN", vpninfo->csd_token, 1))
                                goto out;
-                       if (setenv("CSD_HOSTNAME", vpninfo->hostname, 1))
+                       if (setenv("CSD_HOSTNAME", openconnect_get_hostname(vpninfo), 1))
                                goto out;
 
                        apply_script_env(vpninfo->csd_env);