aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2007-11-27 08:01:19 +0000
committerWerner Koch <[email protected]>2007-11-27 08:01:19 +0000
commit598a3d0ab4a401f929c03d08cea5c272bf49abda (patch)
tree3c1e527c7fc15b8da3599d81832e195a0fbde3c2
parentAdd option --data to GETAUDITLOG command. (diff)
downloadgnupg-598a3d0ab4a401f929c03d08cea5c272bf49abda.tar.gz
gnupg-598a3d0ab4a401f929c03d08cea5c272bf49abda.zip
[W32] Changed default socket for dirmngr.
[W32] Add some code for event notifications between scdaemon and gpg-agent.
Diffstat (limited to '')
-rw-r--r--agent/ChangeLog12
-rw-r--r--agent/agent.h3
-rw-r--r--agent/call-scd.c17
-rw-r--r--agent/command.c4
-rw-r--r--agent/gpg-agent.c64
-rw-r--r--common/ChangeLog4
-rw-r--r--common/homedir.c9
-rw-r--r--doc/ChangeLog3
-rw-r--r--doc/gpg.texi2
-rw-r--r--po/de.po4
-rw-r--r--tests/openpgp/ChangeLog5
-rw-r--r--tests/openpgp/Makefile.am2
12 files changed, 107 insertions, 22 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 7a4716c3d..adb278868 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,15 @@
+2007-11-20 Werner Koch <[email protected]>
+
+ * gpg-agent.c (get_agent_scd_notify_event): New.
+ (handle_signal): Factor SIGUSR2 code out to:
+ (agent_sigusr2_action): .. New.
+ (agent_sighup_action): Print info message here and not in
+ handle_signal.
+ (handle_connections) [PTH_EVENT_HANDLE]: Call agent_sigusr2_action.
+
+ * call-scd.c (agent_scd_check_aliveness) [W32]: Implemented.
+ (start_scd) [W32]: Send event-signal option.
+
2007-11-19 Werner Koch <[email protected]>
* call-pinentry.c (agent_askpin): Set the tooltip for the quality
diff --git a/agent/agent.h b/agent/agent.h
index beb70111e..f824fe615 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -205,6 +205,9 @@ cache_mode_t;
void agent_exit (int rc) JNLIB_GCC_A_NR; /* Also implemented in other tools */
const char *get_agent_socket_name (void);
const char *get_agent_ssh_socket_name (void);
+#ifdef HAVE_W32_SYSTEM
+void *get_agent_scd_notify_event (void);
+#endif
void agent_sighup_action (void);
/*-- command.c --*/
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 42f3f8e12..872ba3433 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -374,14 +374,17 @@ start_scd (ctrl_t ctrl)
}
/* Tell the scdaemon we want him to send us an event signal. */
-#ifndef HAVE_W32_SYSTEM
{
char buf[100];
- sprintf (buf, "OPTION event-signal=%d", SIGUSR2);
+#ifdef HAVE_W32_SYSTEM
+ snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
+ (unsigned long)get_agent_scd_notify_event ());
+#else
+ snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2);
+#endif
assuan_transact (ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL);
}
-#endif
primary_scd_ctx = ctx;
primary_scd_ctx_reusable = 0;
@@ -408,6 +411,9 @@ agent_scd_check_aliveness (void)
pth_event_t evt;
pid_t pid;
int rc;
+#ifdef HAVE_W32_SYSTEM
+ DWORD dummyec;
+#endif
if (!primary_scd_ctx)
return; /* No scdaemon running. */
@@ -435,10 +441,12 @@ agent_scd_check_aliveness (void)
{
pid = assuan_get_pid (primary_scd_ctx);
#ifdef HAVE_W32_SYSTEM
-#warning Need to implement an alive test for scdaemon
+ if (pid != (pid_t)(void*)(-1) && pid
+ && !GetExitCodeProcess ((HANDLE)pid, &dummyec))
#else
if (pid != (pid_t)(-1) && pid
&& ((rc=waitpid (pid, NULL, WNOHANG))==-1 || (rc == pid)) )
+#endif
{
/* Okay, scdaemon died. Disconnect the primary connection
now but take care that it won't do another wait. Also
@@ -467,7 +475,6 @@ agent_scd_check_aliveness (void)
xfree (socket_name);
socket_name = NULL;
}
-#endif
}
if (!pth_mutex_release (&start_scd_lock))
diff --git a/agent/command.c b/agent/command.c
index c0c21bf79..91279fa0f 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -353,7 +353,7 @@ cmd_geteventcounter (assuan_context_t ctx, char *line)
/* This function should be called once for all key removals or
- additions. Thus function is assured not to do any context
+ additions. This function is assured not to do any context
switches. */
void
bump_key_eventcounter (void)
@@ -363,7 +363,7 @@ bump_key_eventcounter (void)
}
/* This function should be called for all card reader status
- changes. Thus function is assured not to do any context
+ changes. This function is assured not to do any context
switches. */
void
bump_card_eventcounter (void)
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index e4d8f3e13..48087db63 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1246,6 +1246,28 @@ get_agent_ssh_socket_name (void)
}
+/* Under W32, this function returns the handle of the scdaemon
+ notification event. Calling it the first time creates that
+ event. */
+#ifdef HAVE_W32_SYSTEM
+void *
+get_agent_scd_notify_event (void)
+{
+ static HANDLE the_event;
+
+ if (!the_event)
+ {
+ SECURITY_ATTRIBUTES sa = { sizeof (SECURITY_ATTRIBUTES), NULL, TRUE};
+
+ the_event = CreateEvent ( &sa, FALSE, FALSE, NULL);
+ if (!the_event)
+ log_error ("can't create scd notify event: %s\n", w32_strerror (-1) );
+ }
+ return the_event;
+}
+#endif /*HAVE_W32_SYSTEM*/
+
+
/* Create a name for the socket. With USE_STANDARD_SOCKET given as
true using STANDARD_NAME in the home directory or if given as
@@ -1486,11 +1508,13 @@ handle_tick (void)
}
-/* A global fucntion which allows us to call the reload stuff from
- other palces too. This is only used when build for W32. */
+/* A global function which allows us to call the reload stuff from
+ other places too. This is only used when build for W32. */
void
agent_sighup_action (void)
{
+ log_info ("SIGHUP received - "
+ "re-reading configuration and flushing cache\n");
agent_flush_cache ();
reread_configuration ();
agent_reload_trustlist ();
@@ -1498,14 +1522,22 @@ agent_sighup_action (void)
static void
+agent_sigusr2_action (void)
+{
+ if (opt.verbose)
+ log_info ("SIGUSR2 received - checking smartcard status\n");
+ /* Nothing to check right now. We only increment a counter. */
+ bump_card_eventcounter ();
+}
+
+
+static void
handle_signal (int signo)
{
switch (signo)
{
#ifndef HAVE_W32_SYSTEM
case SIGHUP:
- log_info ("SIGHUP received - "
- "re-reading configuration and flushing cache\n");
agent_sighup_action ();
break;
@@ -1517,10 +1549,7 @@ handle_signal (int signo)
break;
case SIGUSR2:
- if (opt.verbose)
- log_info ("SIGUSR2 received - checking smartcard status\n");
- /* Nothing to check right now. We only increment a counter. */
- bump_card_eventcounter ();
+ agent_sigusr2_action ();
break;
case SIGTERM:
@@ -1652,8 +1681,15 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
pth_sigmask (SIG_UNBLOCK, &sigs, NULL);
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
#else
+# ifdef PTH_EVENT_HANDLE
+ sigs = 0;
+ ev = pth_event (PTH_EVENT_HANDLE, get_agent_scd_notify_event ());
+ signo = 0;
+# else
+ /* Use a dummy event. */
sigs = 0;
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
+# endif
#endif
time_ev = NULL;
@@ -1706,7 +1742,13 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
|| (time_ev && pth_event_occurred (time_ev)))
{
if (pth_event_occurred (ev))
- handle_signal (signo);
+ {
+#if defined(HAVE_W32_SYSTEM) && defined(PTH_EVENT_HANDLE)
+ agent_sigusr2_action ();
+#else
+ handle_signal (signo);
+#endif
+ }
if (time_ev && pth_event_occurred (time_ev))
{
pth_event_free (time_ev, PTH_FREE_ALL);
@@ -1723,7 +1765,11 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
if (pth_event_occurred (ev))
{
+#if defined(HAVE_W32_SYSTEM) && defined(PTH_EVENT_HANDLE)
+ agent_sigusr2_action ();
+#else
handle_signal (signo);
+#endif
}
if (time_ev && pth_event_occurred (time_ev))
diff --git a/common/ChangeLog b/common/ChangeLog
index 9db29d908..d398d2a77 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-27 Werner Koch <[email protected]>
+
+ * homedir.c (dirmngr_socket_name): Use CSIDL_WINDOWS.
+
2007-11-15 Werner Koch <[email protected]>
* asshelp.c (send_pinentry_environment): Add args XAUTHORITY and
diff --git a/common/homedir.c b/common/homedir.c
index b85f760a0..6f1b49c21 100644
--- a/common/homedir.c
+++ b/common/homedir.c
@@ -299,8 +299,13 @@ dirmngr_socket_name (void)
if (!name)
{
- const char *s1, *s2;
- s1 = w32_rootdir ();
+ char s1[MAX_PATH];
+ const char *s2;
+
+ /* We need something akin CSIDL_COMMON_PROGRAMS, but local
+ (non-roaming). */
+ if (w32_shgetfolderpath (NULL, CSIDL_WINDOWS, NULL, 0, s1) < 0)
+ strcpy (s1, "C:\\WINDOWS");
s2 = DIRSEP_S "S.dirmngr";
name = xmalloc (strlen (s1) + strlen (s2) + 1);
strcpy (stpcpy (name, s1), s2);
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1e276e2a3..6fbde7c95 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,8 @@
2007-11-19 Werner Koch <[email protected]>
+ * gpg.texi (GPG Configuration Options): English Grammar fix.
+ Thanks to Gerg Troxel.
+
* gpgsm.texi (Certificate Options): Document
--auto-issuer-key-retrieve.
diff --git a/doc/gpg.texi b/doc/gpg.texi
index 0a1b92ab9..f7b7df856 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -1141,7 +1141,7 @@ found.
Set the name of the native character set. This is used to convert
some informational strings like user IDs to the proper UTF-8 encoding.
Note that this has nothing to do with the character set of data to be
-encrypted or signed; GnuPG does not recode user supplied data. If
+encrypted or signed; GnuPG does not recode user-supplied data. If
this option is not used, the default character set is determined from
the current locale. A verbosity level of 3 shows the chosen set.
Valid values for @code{name} are:
diff --git a/po/de.po b/po/de.po
index aa136f1fe..566deae3d 100644
--- a/po/de.po
+++ b/po/de.po
@@ -10,7 +10,7 @@ msgstr ""
"Project-Id-Version: gnupg-2.0.6\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2007-11-19 16:02+0100\n"
-"PO-Revision-Date: 2007-11-19 16:41+0100\n"
+"PO-Revision-Date: 2007-11-20 14:43+0100\n"
"Last-Translator: Walter Koch <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"MIME-Version: 1.0\n"
@@ -7009,7 +7009,7 @@ msgstr "Der Herausgeber wird von einer externen Stelle gesucht\n"
#: sm/certchain.c:498
#, c-format
msgid "number of issuers matching: %d\n"
-msgstr "Anzahl der übereinstimmenden Heruasgeber: %d\n"
+msgstr "Anzahl der übereinstimmenden Herausgeber: %d\n"
#: sm/certchain.c:651 sm/certchain.c:1069 sm/certchain.c:1674 sm/decrypt.c:259
#: sm/encrypt.c:341 sm/sign.c:327 sm/verify.c:113
diff --git a/tests/openpgp/ChangeLog b/tests/openpgp/ChangeLog
index 9e3b96a85..07a21357b 100644
--- a/tests/openpgp/ChangeLog
+++ b/tests/openpgp/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-22 Werner Koch <[email protected]>
+
+ * Makefile.am (./gpg_dearmor): Add --homedir so that we don't
+ auto create a ~/.gnupg/. From Gentoo.
+
2007-10-25 Werner Koch <[email protected]>
Add missing copyright notices to *.test.
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index cf32bb9b0..3bc6d9cb8 100644
--- a/tests/openpgp/Makefile.am
+++ b/tests/openpgp/Makefile.am
@@ -61,7 +61,7 @@ prepared.stamp: ./pubring.gpg ./secring.gpg ./plain-1 ./plain-2 ./plain-3 \
./gpg_dearmor:
echo '#!/bin/sh' >./gpg_dearmor
- echo "../../g10/gpg2 --no-options --no-greeting \
+ echo "../../g10/gpg2 --no-options --no-greeting --homedir . \
--no-secmem-warning --batch --dearmor" >>./gpg_dearmor
chmod 755 ./gpg_dearmor