1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

dirmngr: Fix keep-alive flag handling.

* dirmngr/http.c (run_proxy_connect): Set KEEP_ALIVE if not Basic
Authentication.  Fix resource leak of FP_WRITE.

--

GnuPG-bug-id: 6997
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2024-02-16 16:24:26 +09:00
parent 848546b05a
commit 2810b93464
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -2553,7 +2553,7 @@ run_proxy_connect (http_t hd, proxy_info_t proxy,
* RFC-4559 - SPNEGO-based Kerberos and NTLM HTTP Authentication * RFC-4559 - SPNEGO-based Kerberos and NTLM HTTP Authentication
*/ */
auth_basic = !!proxy->uri->auth; auth_basic = !!proxy->uri->auth;
hd->keep_alive = 0; hd->keep_alive = !auth_basic; /* We may need to send more requests. */
/* For basic authentication we need to send just one request. */ /* For basic authentication we need to send just one request. */
if (auth_basic if (auth_basic
@ -2717,6 +2717,14 @@ run_proxy_connect (http_t hd, proxy_info_t proxy,
} }
leave: leave:
if (hd->keep_alive)
{
es_fclose (hd->fp_write);
hd->fp_write = NULL;
/* The close has released the cookie and thus we better set it
* to NULL. */
hd->write_cookie = NULL;
}
/* Restore flags, destroy stream, reset state. */ /* Restore flags, destroy stream, reset state. */
hd->flags = saved_flags; hd->flags = saved_flags;
es_fclose (hd->fp_read); es_fclose (hd->fp_read);