aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-06-11 07:43:32 +0000
committerWerner Koch <[email protected]>2015-06-11 07:43:32 +0000
commit985918aab025cf0ac9db411b88a47c4b985e5e95 (patch)
tree4c54a8a7fce194d7323f3ad7cd5f0ffe77333164
parentagent: Add experimental option --browser-socket. (diff)
downloadgnupg-985918aab025cf0ac9db411b88a47c4b985e5e95.tar.gz
gnupg-985918aab025cf0ac9db411b88a47c4b985e5e95.zip
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 <[email protected]>
-rw-r--r--agent/gpg-agent.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 18beca9ca..e721d8a00 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -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);
}