1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

w32: On socket nonce mismatch close the socket.

* agent/gpg-agent.c (start_connection_thread_std): Close socket on
nonce mismatch.
(start_connection_thread_extra): Ditto.
(start_connection_thread_browser): Ditto.
(start_connection_thread_ssh): Ditto.
* dirmngr/dirmngr.c (start_connection_thread): Ditto.
* kbx/keyboxd.c (start_connection_thread): Ditto.
--

Usually Libassuan takes care of closing the socket but because we do
the nonce check before setting up Assuan we need to explicit close
it.

GnuPG-bug-id: 7434
This commit is contained in:
Werner Koch 2025-03-05 15:31:50 +01:00
parent 41cf76b8c1
commit 73f6c2dd4d
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 19 additions and 11 deletions

View file

@ -2877,8 +2877,9 @@ start_connection_thread_std (void *arg)
if (check_nonce (ctrl, &socket_nonce))
{
log_error ("handler 0x%lx nonce check FAILED\n",
(unsigned long) npth_self());
log_error ("handler 0x%lx for fd %d FAILED nonce check\n",
(unsigned long) npth_self(), FD_DBG (ctrl->thread_startup.fd));
assuan_sock_close (ctrl->thread_startup.fd);
return NULL;
}
@ -2894,8 +2895,9 @@ start_connection_thread_extra (void *arg)
if (check_nonce (ctrl, &socket_nonce_extra))
{
log_error ("handler 0x%lx nonce check FAILED\n",
(unsigned long) npth_self());
log_error ("handler 0x%lx for fd %d FAILED nonce check\n",
(unsigned long) npth_self(), FD_DBG (ctrl->thread_startup.fd));
assuan_sock_close (ctrl->thread_startup.fd);
return NULL;
}
@ -2912,8 +2914,9 @@ start_connection_thread_browser (void *arg)
if (check_nonce (ctrl, &socket_nonce_browser))
{
log_error ("handler 0x%lx nonce check FAILED\n",
(unsigned long) npth_self());
log_error ("handler 0x%lx for fd %d FAILED nonce check\n",
(unsigned long) npth_self(), FD_DBG (ctrl->thread_startup.fd));
assuan_sock_close (ctrl->thread_startup.fd);
return NULL;
}
@ -2929,7 +2932,10 @@ start_connection_thread_ssh (void *arg)
ctrl_t ctrl = arg;
if (check_nonce (ctrl, &socket_nonce_ssh))
return NULL;
{
assuan_sock_close (ctrl->thread_startup.fd);
return NULL;
}
active_connections++;
agent_init_default_ctrl (ctrl);