[svn] GnuPG - r5015 - in trunk: . agent common jnlib scd tools
svn author wk
cvs at cvs.gnupg.org
Wed May 20 00:39:45 CEST 2009
Author: wk
Date: 2009-05-20 00:39:45 +0200 (Wed, 20 May 2009)
New Revision: 5015
Modified:
trunk/NEWS
trunk/agent/ChangeLog
trunk/agent/gpg-agent.c
trunk/common/ChangeLog
trunk/common/simple-pwquery.c
trunk/common/sysutils.h
trunk/jnlib/ChangeLog
trunk/jnlib/logging.c
trunk/jnlib/mischelp.h
trunk/scd/ChangeLog
trunk/scd/scdaemon.c
trunk/tools/ChangeLog
trunk/tools/sockprox.c
trunk/tools/watchgnupg.c
Log:
Fix possible system freeze on Mac OS X.
Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/agent/ChangeLog 2009-05-19 22:39:45 UTC (rev 5015)
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk at g10code.com>
+
+ * gpg-agent.c (JNLIB_NEED_AFLOCAL): Define.
+ (create_server_socket): Use SUN_LEN macro.
+
2009-05-15 Werner Koch <wk at g10code.com>
Fix bug #1053.
Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/common/ChangeLog 2009-05-19 22:39:45 UTC (rev 5015)
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk at g10code.com>
+
+ * simple-pwquery.c (agent_open): Use SUN_LEN
+ (JNLIB_NEED_AFLOCAL): Define and include mischelp.h.
+
2009-05-07 Werner Koch <wk at g10code.com>
* sexputil.c (get_rsa_pk_from_canon_sexp): New.
Modified: trunk/jnlib/ChangeLog
===================================================================
--- trunk/jnlib/ChangeLog 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/jnlib/ChangeLog 2009-05-19 22:39:45 UTC (rev 5015)
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk at g10code.com>
+
+ * mischelp.h: Define PF_LOCAL, AF_LOCAL and SUN_LEN if requested.
+ * logging.c (fun_writer): Use SUN_LEN to fix a Mac OS X freeze.
+
2009-03-25 Werner Koch <wk at g10code.com>
* logging.c (fun_closer): Never close fd 2.
Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/scd/ChangeLog 2009-05-19 22:39:45 UTC (rev 5015)
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk at g10code.com>
+
+ * scdaemon.c (create_server_socket): Use SUN_LEN.
+ (JNLIB_NEED_AFLOCAL): Define.
+
2009-05-13 Werner Koch <wk at g10code.com>
* ccid-driver.c (abort_cmd): Add arg SEQNO and change callers.
Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/tools/ChangeLog 2009-05-19 22:39:45 UTC (rev 5015)
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk at g10code.com>
+
+ * watchgnupg.c: Include jnlib/mischelp.h if required.
+ (main): Use SUN_LEN.
+
2009-04-17 Werner Koch <wk at g10code.com>
* ccidmon.c: New.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/NEWS 2009-05-19 22:39:45 UTC (rev 5015)
@@ -24,8 +24,9 @@
* The gpg-protect-tool now uses gpg-agent via libassuan. Under
Windows the Pinentry will now be put into the foreground.
-
+ * Changed code to avoid a possible Mac OS X system freeze.
+
Noteworthy changes in version 2.0.11 (2009-03-03)
-------------------------------------------------
Modified: trunk/agent/gpg-agent.c
===================================================================
--- trunk/agent/gpg-agent.c 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/agent/gpg-agent.c 2009-05-19 22:39:45 UTC (rev 5015)
@@ -39,6 +39,7 @@
#include <pth.h>
#define JNLIB_NEED_LOG_LOGV
+#define JNLIB_NEED_AFLOCAL
#include "agent.h"
#include <assuan.h> /* Malloc hooks and socket wrappers. */
@@ -1457,9 +1458,7 @@
agent_exit (2);
}
strcpy (serv_addr->sun_path, name);
- len = (offsetof (struct sockaddr_un, sun_path)
- + strlen (serv_addr->sun_path) + 1);
-
+ len = SUN_LEN (serv_addr);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
if (use_standard_socket && rc == -1 && errno == EADDRINUSE)
{
Modified: trunk/common/simple-pwquery.c
===================================================================
--- trunk/common/simple-pwquery.c 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/common/simple-pwquery.c 2009-05-19 22:39:45 UTC (rev 5015)
@@ -39,6 +39,9 @@
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
+
+#define JNLIB_NEED_AFLOCAL
+#include "../jnlib/mischelp.h"
#ifdef HAVE_W32_SYSTEM
#include "../jnlib/w32-afunix.h"
#endif
@@ -379,8 +382,7 @@
memset (&client_addr, 0, sizeof client_addr);
client_addr.sun_family = AF_UNIX;
strcpy (client_addr.sun_path, infostr);
- len = (offsetof (struct sockaddr_un, sun_path)
- + strlen(client_addr.sun_path) + 1);
+ len = SUN_LEN (&client_addr);
#ifdef HAVE_W32_SYSTEM
rc = _w32_sock_connect (fd, (struct sockaddr*)&client_addr, len );
Modified: trunk/common/sysutils.h
===================================================================
--- trunk/common/sysutils.h 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/common/sysutils.h 2009-05-19 22:39:45 UTC (rev 5015)
@@ -56,7 +56,4 @@
#endif /*HAVE_W32_SYSTEM*/
-
-
-
#endif /*GNUPG_COMMON_SYSUTILS_H*/
Modified: trunk/jnlib/logging.c
===================================================================
--- trunk/jnlib/logging.c 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/jnlib/logging.c 2009-05-19 22:39:45 UTC (rev 5015)
@@ -39,6 +39,7 @@
#define JNLIB_NEED_LOG_LOGV 1
+#define JNLIB_NEED_AFLOCAL 1
#include "libjnlib-config.h"
#include "logging.h"
@@ -152,8 +153,7 @@
addr.sun_family = PF_LOCAL;
strncpy (addr.sun_path, cookie->name, sizeof (addr.sun_path)-1);
addr.sun_path[sizeof (addr.sun_path)-1] = 0;
- addrlen = (offsetof (struct sockaddr_un, sun_path)
- + strlen (addr.sun_path) + 1);
+ addrlen = SUN_LEN (&addr);
if (connect (cookie->fd, (struct sockaddr *) &addr, addrlen) == -1)
{
Modified: trunk/jnlib/mischelp.h
===================================================================
--- trunk/jnlib/mischelp.h 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/jnlib/mischelp.h 2009-05-19 22:39:45 UTC (rev 5015)
@@ -1,6 +1,6 @@
/* mischelp.h - Miscellaneous helper macros and functions
* Copyright (C) 1999, 2000, 2001, 2002, 2003,
- * 2006, 2007 Free Software Foundation, Inc.
+ * 2006, 2007, 2009 Free Software Foundation, Inc.
*
* This file is part of JNLIB.
*
@@ -60,5 +60,35 @@
#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
+/* Include hacks which are mainly required for Slowaris. */
+#if defined(JNLIB_NEED_AFLOCAL) && !defined(HAVE_W32_SYSTEM)
+#include <sys/socket.h>
+#include <sys/un.h>
+#ifndef PF_LOCAL
+# ifdef PF_UNIX
+# define PF_LOCAL PF_UNIX
+# else
+# define PF_LOCAL AF_UNIX
+# endif
+#endif /*PF_LOCAL*/
+#ifndef AF_LOCAL
+# define AF_LOCAL AF_UNIX
+#endif /*AF_UNIX*/
+
+/* We used to avoid this macro in GnuPG and inlined the AF_LOCAL name
+ length computation directly with the little twist of adding 1 extra
+ byte. It seems that this was needed once on an old HP/UX box and
+ there are also rumours that 4.3 Reno and DEC systems need it. This
+ one-off buglet did not harm any current system until it came to Mac
+ OS X where the kernel (as of May 2009) exhibited a strange bug: The
+ systems basically froze in the connect call if the passed name
+ contained an invalid directory part. Ignore the old Unices. */
+#ifndef SUN_LEN
+# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+ + strlen ((ptr)->sun_path))
+#endif /*SUN_LEN*/
+#endif /*JNLIB_NEED_AFLOCAL && !HAVE_W32_SYSTEM*/
+
+
#endif /*LIBJNLIB_MISCHELP_H*/
Modified: trunk/scd/scdaemon.c
===================================================================
--- trunk/scd/scdaemon.c 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/scd/scdaemon.c 2009-05-19 22:39:45 UTC (rev 5015)
@@ -38,6 +38,7 @@
#include <pth.h>
#define JNLIB_NEED_LOG_LOGV
+#define JNLIB_NEED_AFLOCAL
#include "scdaemon.h"
#include <ksba.h>
#include <gcrypt.h>
@@ -1032,8 +1033,7 @@
serv_addr->sun_family = AF_UNIX;
assert (strlen (name) + 1 < sizeof (serv_addr->sun_path));
strcpy (serv_addr->sun_path, name);
- len = (offsetof (struct sockaddr_un, sun_path)
- + strlen (serv_addr->sun_path) + 1);
+ len = SUN_LEN (serv_addr);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
if (is_standard_name && rc == -1 && errno == EADDRINUSE)
Modified: trunk/tools/sockprox.c
===================================================================
--- trunk/tools/sockprox.c 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/tools/sockprox.c 2009-05-19 22:39:45 UTC (rev 5015)
@@ -86,7 +86,6 @@
name.sun_family = AF_LOCAL;
strncpy (name.sun_path, filename, sizeof (name.sun_path));
name.sun_path[sizeof (name.sun_path) - 1] = '\0';
-
size = SUN_LEN (&name);
remove (filename);
Modified: trunk/tools/watchgnupg.c
===================================================================
--- trunk/tools/watchgnupg.c 2009-05-19 09:26:17 UTC (rev 5014)
+++ trunk/tools/watchgnupg.c 2009-05-19 22:39:45 UTC (rev 5015)
@@ -35,7 +35,7 @@
#define PGM "watchgnupg"
-/* Allow for a standalone build. */
+/* Allow for a standalone build on most systems. */
#ifdef VERSION
#define MYVERSION_LINE PGM " (GnuPG) " VERSION
#define BUGREPORT_LINE "\nReport bugs to <bug-gnupg at gnu.org>.\n"
@@ -43,16 +43,9 @@
#define MYVERSION_LINE PGM
#define BUGREPORT_LINE ""
#endif
-
-#ifndef PF_LOCAL
-# ifdef PF_UNIX
-# define PF_LOCAL PF_UNIX
-# else
-# define PF_LOCAL AF_UNIX
-# endif
-# ifndef AF_LOCAL
-# define AF_LOCAL AF_UNIX
-# endif
+#if !defined(SUN_LEN) || !defined(PF_LOCAL) || !defined(AF_LOCAL)
+#define JNLIB_NEED_AFLOCAL
+#include "../jnlib/mischelp.h"
#endif
@@ -285,8 +278,7 @@
srvr_addr.sun_family = AF_LOCAL;
strncpy (srvr_addr.sun_path, *argv, sizeof (srvr_addr.sun_path) - 1);
srvr_addr.sun_path[sizeof (srvr_addr.sun_path) - 1] = 0;
- addrlen = (offsetof (struct sockaddr_un, sun_path)
- + strlen (srvr_addr.sun_path) + 1);
+ addrlen = SUN_LEN (&srvr_addr);
again:
More information about the Gnupg-commits
mailing list