agent: Fix --extra-socket on Windows.

* agent/gpg-agent.c (start_connection_thread): Rename to ...
(do_start_connection_thread): this.  Factor nonce checking out to ...
(start_connection_thread_std): this,
(start_connection_thread_extra): this,
(start_connection_thread_browser): and this.
--

Although not tested, the code did not worked on Windows becuase we
were checning the wrong nonce.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-06-11 09:43:32 +02:00
parent 008435b95c
commit 985918aab0
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 25 additions and 11 deletions

View File

@ -2166,15 +2166,8 @@ putty_message_thread (void *arg)
static void *
start_connection_thread (ctrl_t ctrl)
do_start_connection_thread (ctrl_t ctrl)
{
if (check_nonce (ctrl, &socket_nonce))
{
log_error ("handler 0x%lx nonce check FAILED\n",
(unsigned long) npth_self());
return NULL;
}
agent_init_default_ctrl (ctrl);
if (opt.verbose)
log_info (_("handler 0x%lx for fd %d started\n"),
@ -2197,7 +2190,14 @@ start_connection_thread_std (void *arg)
{
ctrl_t ctrl = arg;
return start_connection_thread (ctrl);
if (check_nonce (ctrl, &socket_nonce))
{
log_error ("handler 0x%lx nonce check FAILED\n",
(unsigned long) npth_self());
return NULL;
}
return do_start_connection_thread (ctrl);
}
@ -2207,8 +2207,15 @@ start_connection_thread_extra (void *arg)
{
ctrl_t ctrl = arg;
if (check_nonce (ctrl, &socket_nonce_extra))
{
log_error ("handler 0x%lx nonce check FAILED\n",
(unsigned long) npth_self());
return NULL;
}
ctrl->restricted = 1;
return start_connection_thread (ctrl);
return do_start_connection_thread (ctrl);
}
@ -2218,8 +2225,15 @@ start_connection_thread_browser (void *arg)
{
ctrl_t ctrl = arg;
if (check_nonce (ctrl, &socket_nonce_browser))
{
log_error ("handler 0x%lx nonce check FAILED\n",
(unsigned long) npth_self());
return NULL;
}
ctrl->restricted = 2;
return start_connection_thread (ctrl);
return do_start_connection_thread (ctrl);
}