summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--agent/ChangeLog5
-rw-r--r--agent/gpg-agent.c5
-rw-r--r--common/ChangeLog5
-rw-r--r--common/simple-pwquery.c6
-rw-r--r--common/sysutils.h3
-rw-r--r--jnlib/ChangeLog5
-rw-r--r--jnlib/logging.c4
-rw-r--r--jnlib/mischelp.h32
-rw-r--r--scd/ChangeLog5
-rw-r--r--scd/scdaemon.c4
-rw-r--r--tools/ChangeLog5
-rw-r--r--tools/sockprox.c1
-rw-r--r--tools/watchgnupg.c18
14 files changed, 73 insertions, 28 deletions
diff --git a/NEWS b/NEWS
index 08703557b..24596058b 100644
--- a/NEWS
+++ b/NEWS
@@ -24,7 +24,8 @@ Noteworthy changes in version 2.0.12 (not released)
* 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)
-------------------------------------------------
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 9a07219a4..8c9cefea6 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk@g10code.com>
+
+ * gpg-agent.c (JNLIB_NEED_AFLOCAL): Define.
+ (create_server_socket): Use SUN_LEN macro.
+
2009-05-15 Werner Koch <wk@g10code.com>
Fix bug #1053.
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index b5f9a47e2..7093ee1e6 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -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 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
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)
{
diff --git a/common/ChangeLog b/common/ChangeLog
index 319b817a8..54ecd637f 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk@g10code.com>
+
+ * simple-pwquery.c (agent_open): Use SUN_LEN
+ (JNLIB_NEED_AFLOCAL): Define and include mischelp.h.
+
2009-05-07 Werner Koch <wk@g10code.com>
* sexputil.c (get_rsa_pk_from_canon_sexp): New.
diff --git a/common/simple-pwquery.c b/common/simple-pwquery.c
index 3a1f0365f..3598b3598 100644
--- a/common/simple-pwquery.c
+++ b/common/simple-pwquery.c
@@ -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 @@ agent_open (int *rfd)
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 );
diff --git a/common/sysutils.h b/common/sysutils.h
index de1e3bb1e..fd4340f3d 100644
--- a/common/sysutils.h
+++ b/common/sysutils.h
@@ -56,7 +56,4 @@ void gnupg_allow_set_foregound_window (pid_t pid);
#endif /*HAVE_W32_SYSTEM*/
-
-
-
#endif /*GNUPG_COMMON_SYSUTILS_H*/
diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog
index 8c12f5fc5..b9984235c 100644
--- a/jnlib/ChangeLog
+++ b/jnlib/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk@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@g10code.com>
* logging.c (fun_closer): Never close fd 2.
diff --git a/jnlib/logging.c b/jnlib/logging.c
index 40b58aeb9..6267dc11c 100644
--- a/jnlib/logging.c
+++ b/jnlib/logging.c
@@ -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 @@ fun_writer (void *cookie_arg, const char *buffer, my_funopen_hook_size_t size)
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)
{
diff --git a/jnlib/mischelp.h b/jnlib/mischelp.h
index 2f003e1ce..6bf7a9174 100644
--- a/jnlib/mischelp.h
+++ b/jnlib/mischelp.h
@@ -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 @@ time_t timegm (struct tm *tm);
#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*/
diff --git a/scd/ChangeLog b/scd/ChangeLog
index a6fa9eb55..e81544a5b 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk@g10code.com>
+
+ * scdaemon.c (create_server_socket): Use SUN_LEN.
+ (JNLIB_NEED_AFLOCAL): Define.
+
2009-05-13 Werner Koch <wk@g10code.com>
* ccid-driver.c (abort_cmd): Add arg SEQNO and change callers.
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 0afb5febc..49f09cf62 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -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 @@ create_server_socket (int is_standard_name, const char *name,
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)
diff --git a/tools/ChangeLog b/tools/ChangeLog
index 82328eeef..bc48ef80d 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk@g10code.com>
+
+ * watchgnupg.c: Include jnlib/mischelp.h if required.
+ (main): Use SUN_LEN.
+
2009-04-17 Werner Koch <wk@g10code.com>
* ccidmon.c: New.
diff --git a/tools/sockprox.c b/tools/sockprox.c
index 485b37a37..fe8d320a1 100644
--- a/tools/sockprox.c
+++ b/tools/sockprox.c
@@ -86,7 +86,6 @@ create_server_socket (const char *filename, int *new_sock)
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);
diff --git a/tools/watchgnupg.c b/tools/watchgnupg.c
index 213a2cb16..145a76b5e 100644
--- a/tools/watchgnupg.c
+++ b/tools/watchgnupg.c
@@ -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@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 @@ main (int argc, char **argv)
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: