[svn] GnuPG - r4627 - in trunk: agent common doc po tests/openpgp
svn author wk
cvs at cvs.gnupg.org
Tue Nov 27 09:01:22 CET 2007
Author: wk
Date: 2007-11-27 09:01:19 +0100 (Tue, 27 Nov 2007)
New Revision: 4627
Modified:
trunk/agent/ChangeLog
trunk/agent/agent.h
trunk/agent/call-scd.c
trunk/agent/command.c
trunk/agent/gpg-agent.c
trunk/common/ChangeLog
trunk/common/homedir.c
trunk/doc/ChangeLog
trunk/doc/gpg.texi
trunk/po/de.po
trunk/tests/openpgp/ChangeLog
trunk/tests/openpgp/Makefile.am
Log:
[W32] Changed default socket for dirmngr.
[W32] Add some code for event notifications
between scdaemon and gpg-agent.
Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/agent/ChangeLog 2007-11-27 08:01:19 UTC (rev 4627)
@@ -1,3 +1,15 @@
+2007-11-20 Werner Koch <wk at g10code.com>
+
+ * 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 <wk at g10code.com>
* call-pinentry.c (agent_askpin): Set the tooltip for the quality
Modified: trunk/agent/agent.h
===================================================================
--- trunk/agent/agent.h 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/agent/agent.h 2007-11-27 08:01:19 UTC (rev 4627)
@@ -205,6 +205,9 @@
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 --*/
Modified: trunk/agent/call-scd.c
===================================================================
--- trunk/agent/call-scd.c 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/agent/call-scd.c 2007-11-27 08:01:19 UTC (rev 4627)
@@ -374,14 +374,17 @@
}
/* 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 @@
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 @@
{
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 @@
xfree (socket_name);
socket_name = NULL;
}
-#endif
}
if (!pth_mutex_release (&start_scd_lock))
Modified: trunk/agent/command.c
===================================================================
--- trunk/agent/command.c 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/agent/command.c 2007-11-27 08:01:19 UTC (rev 4627)
@@ -353,7 +353,7 @@
/* 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 @@
}
/* 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)
Modified: trunk/agent/gpg-agent.c
===================================================================
--- trunk/agent/gpg-agent.c 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/agent/gpg-agent.c 2007-11-27 08:01:19 UTC (rev 4627)
@@ -1246,7 +1246,29 @@
}
+/* 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
false from the mkdir type name TEMPLATE. In the latter case a
@@ -1486,11 +1508,13 @@
}
-/* 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 @@
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 @@
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 @@
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 @@
|| (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 @@
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))
Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/common/ChangeLog 2007-11-27 08:01:19 UTC (rev 4627)
@@ -1,3 +1,7 @@
+2007-11-27 Werner Koch <wk at g10code.com>
+
+ * homedir.c (dirmngr_socket_name): Use CSIDL_WINDOWS.
+
2007-11-15 Werner Koch <wk at g10code.com>
* asshelp.c (send_pinentry_environment): Add args XAUTHORITY and
Modified: trunk/common/homedir.c
===================================================================
--- trunk/common/homedir.c 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/common/homedir.c 2007-11-27 08:01:19 UTC (rev 4627)
@@ -299,8 +299,13 @@
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);
Modified: trunk/doc/ChangeLog
===================================================================
--- trunk/doc/ChangeLog 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/doc/ChangeLog 2007-11-27 08:01:19 UTC (rev 4627)
@@ -1,5 +1,8 @@
2007-11-19 Werner Koch <wk at g10code.com>
+ * gpg.texi (GPG Configuration Options): English Grammar fix.
+ Thanks to Gerg Troxel.
+
* gpgsm.texi (Certificate Options): Document
--auto-issuer-key-retrieve.
Modified: trunk/doc/gpg.texi
===================================================================
--- trunk/doc/gpg.texi 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/doc/gpg.texi 2007-11-27 08:01:19 UTC (rev 4627)
@@ -1141,7 +1141,7 @@
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:
Modified: trunk/po/de.po
===================================================================
--- trunk/po/de.po 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/po/de.po 2007-11-27 08:01:19 UTC (rev 4627)
@@ -10,7 +10,7 @@
"Project-Id-Version: gnupg-2.0.6\n"
"Report-Msgid-Bugs-To: translations at gnupg.org\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 <koch at u32.de>\n"
"Language-Team: German <de at li.org>\n"
"MIME-Version: 1.0\n"
@@ -7009,7 +7009,7 @@
#: 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
Modified: trunk/tests/openpgp/ChangeLog
===================================================================
--- trunk/tests/openpgp/ChangeLog 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/tests/openpgp/ChangeLog 2007-11-27 08:01:19 UTC (rev 4627)
@@ -1,3 +1,8 @@
+2007-11-22 Werner Koch <wk at g10code.com>
+
+ * Makefile.am (./gpg_dearmor): Add --homedir so that we don't
+ auto create a ~/.gnupg/. From Gentoo.
+
2007-10-25 Werner Koch <wk at g10code.com>
Add missing copyright notices to *.test.
Modified: trunk/tests/openpgp/Makefile.am
===================================================================
--- trunk/tests/openpgp/Makefile.am 2007-11-26 11:00:39 UTC (rev 4626)
+++ trunk/tests/openpgp/Makefile.am 2007-11-27 08:01:19 UTC (rev 4627)
@@ -61,7 +61,7 @@
./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
More information about the Gnupg-commits
mailing list