From: Daniel Lenski <dlenski@gmail.com> Date: Tue, 4 May 2021 20:16:10 +0000 (-0700) Subject: Keep comments next to live code in fortinet.c X-Git-Tag: v8.20~235 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=98f477b943a6e4ec59753db94e83a338beadb7cc;p=users%2Fdwmw2%2Fopenconnect.git Keep comments next to live code in fortinet.c In c0ca8c632566bf423d3ac23b8b21ef353e399c33, the fetch of the legacy/HTML Fortinet config was preprocessor'ed out. The comment about the subtle behavior of unfetched redirects should be kept next to live code. Signed-off-by: Daniel Lenski <dlenski@gmail.com> --- diff --git a/fortinet.c b/fortinet.c index 9ccea1cb..f2db4258 100644 --- a/fortinet.c +++ b/fortinet.c @@ -541,17 +541,8 @@ static int fortinet_configure(struct openconnect_info *vpninfo) ret = do_https_request(vpninfo, "GET", NULL, NULL, &res_buf, 0); if (ret < 0) goto out; - else if (ret == 0) { - /* This is normally a redirect to /remote/login, which - * indicates that the auth session/cookie is no longer valid. - * - * XX: See do_https_request() for why ret==0 can only happen - * if there was a successful-but-unfetched redirect. - */ - invalid_cookie: - ret = -EPERM; - goto out; - } + else if (ret == 0) + goto invalid_cookie; /* We don't care what it returned as long as it was successful */ free(res_buf); res_buf = NULL; @@ -567,6 +558,13 @@ static int fortinet_configure(struct openconnect_info *vpninfo) _("Server doesn't support XML config format. Ancient HTML format is not currently implemented.\n")); goto out; } else if (ret == 0) { + /* This is normally a redirect to /remote/login, which + * indicates that the auth session/cookie is no longer valid. + * + * XX: See do_https_request() for why ret==0 can only happen + * if there was a successful-but-unfetched redirect. + */ + invalid_cookie: ret = -EPERM; goto out; }