Several GnuPG fixes.
authorWerner Koch <wk@gnupg.org>
Mon, 21 Apr 2008 18:37:09 +0000 (18:37 +0000)
committerWerner Koch <wk@gnupg.org>
Mon, 21 Apr 2008 18:37:09 +0000 (18:37 +0000)
ChangeLog
Makefile.am
patches/gnupg2-2.0.9/03-i18n+etc.patch
patches/gnupg2-2.0.9/04-ks-w32init.patch [new file with mode: 0755]
patches/gnupg2-2.0.9/05-w32-http.patch [new file with mode: 0755]

index af71ad2..d18ac2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-04-21  Werner Koch  <wk@g10code.com>
+
+       * patches/gnupg2-2.0.9/05-w32-http.patch: New.
+       * patches/gnupg2-2.0.9/04-ks-w32init.patch: New.
+       * Makefile.am (EXTRA_DIST): Add new patches.  Correct name of
+       gpgol/01-always-encrypt.patch.
+       
+2008-04-18  Werner Koch  <wk@g10code.com>
+
+       * patches/gpgol/01-always-encrypt.patch: New.
+
 2008-04-16  Werner Koch  <wk@g10code.com>
 
        * src/inst-winpt.nsi: Do not select by default.
index f3fcfc3..2fe604c 100644 (file)
@@ -60,10 +60,12 @@ EXTRA_DIST = autogen.sh README.SVN \
        patches/gpgme/01-gpg2.patch \
         patches/gnupg-1.4.8/01-gpgconf-list.patch \
        patches/winpt/01-gpg-path.patch \
-       patches/gpgol/01-always-encrypt.patch \
+       patches/gpgol/01-always-decrypt.patch \
        patches/gnupg2-2.0.9/01-close-all-handle.patch \
        patches/gnupg2-2.0.9/02-de.po-fix.patch \
        patches/gnupg2-2.0.9/03-i18n+etc.patch \
+       patches/gnupg2-2.0.9/04-ks-w32init.patch \
+       patches/gnupg2-2.0.9/05-w32-http.patch \
        patches/gpgol-0.9.91/01-gpgme.patch
 
 copy-news:
index c3dd0ca..21670c2 100755 (executable)
@@ -232,7 +232,7 @@ exit $?
 -#ifdef ENABLE_NLS
 +#ifdef USE_SIMPLE_GETTEXT
 +  gettext_select_utf8 (1);
-+#elif define(ENABLE_NLS)
++#elif defined(ENABLE_NLS)
    char *orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL);
 -#ifdef HAVE_LANGINFO_CODESET
 +# ifdef HAVE_LANGINFO_CODESET
diff --git a/patches/gnupg2-2.0.9/04-ks-w32init.patch b/patches/gnupg2-2.0.9/04-ks-w32init.patch
new file mode 100755 (executable)
index 0000000..cc0404c
--- /dev/null
@@ -0,0 +1,175 @@
+#! /bin/sh
+cd keyserver && patch -p0 -f $* < $0
+exit $?
+
+
+2008-04-21  Werner Koch  <wk@g10code.com>
+
+       * ksutil.c (w32_init_sockets) [HAVE_W32_SYSTEM]: New.
+       * curl-shim.c (curl_easy_init) [HAVE_W32_SYSTEM]: Call it.
+       * gpgkeys_finger.c: s/_WIN32/HAVE_W32_SYSTEM/.
+       (init_sockets): Remove.
+       (connect_server) [HAVE_W32_SYSTEM]: Call new function.  
+
+
+Index: ksutil.h
+===================================================================
+--- ksutil.h   (revision 4750)
++++ ksutil.h   (working copy)
+@@ -79,6 +79,11 @@
+ unsigned int set_timeout(unsigned int seconds);
+ int register_timeout(void);
++#ifdef HAVE_W32_SYSTEM
++void w32_init_sockets (void);
++#endif
++
++
+ enum ks_action {KS_UNKNOWN=0,KS_GET,KS_GETNAME,KS_SEND,KS_SEARCH};
+ enum ks_search_type {KS_SEARCH_SUBSTR,KS_SEARCH_EXACT,
+Index: curl-shim.c
+===================================================================
+--- curl-shim.c        (revision 4750)
++++ curl-shim.c        (working copy)
+@@ -89,6 +89,10 @@
+ {
+   CURL *handle;
++#ifdef HAVE_W32_SYSTEM
++  w32_init_sockets ();
++#endif
++
+   handle=calloc(1,sizeof(CURL));
+   if(handle)
+     handle->errors=stderr;
+Index: gpgkeys_finger.c
+===================================================================
+--- gpgkeys_finger.c   (revision 4750)
++++ gpgkeys_finger.c   (working copy)
+@@ -27,7 +27,7 @@
+ #include <getopt.h>
+ #endif
+-#ifdef _WIN32
++#ifdef HAVE_W32_SYSTEM
+ #include <windows.h>
+ #else
+ #include <unistd.h>
+@@ -46,7 +46,7 @@
+ #include "ksutil.h"
+ #include "iobuf.h"
+-#ifdef _WIN32
++#ifdef HAVE_W32_SYSTEM
+ #define sock_close(a)  closesocket(a)
+ #else
+ #define sock_close(a)  close(a)
+@@ -58,41 +58,7 @@
+ static FILE *input,*output,*console;
+ static struct ks_options *opt;
+-#ifdef _WIN32
+-static void
+-deinit_sockets (void)
+-{
+-  WSACleanup();
+-}
+-static void
+-init_sockets (void)
+-{
+-  static int initialized;
+-  static WSADATA wsdata;
+-
+-  if (initialized)
+-    return;
+-
+-  if (WSAStartup (0x0101, &wsdata) )
+-    {
+-      fprintf (console, "error initializing socket library: ec=%d\n", 
+-               (int)WSAGetLastError () );
+-      return;
+-    }
+-  if (wsdata.wVersion < 0x0001)
+-    {
+-      fprintf (console, "socket library version is %x.%x - but 1.1 needed\n",
+-               LOBYTE(wsdata.wVersion), HIBYTE(wsdata.wVersion));
+-      WSACleanup();
+-      return;
+-    }
+-  atexit  (deinit_sockets);
+-  initialized = 1;
+-}
+-#endif /*_WIN32*/
+-
+-
+ /* Connect to SERVER at PORT and return a file descriptor or -1 on
+    error. */
+ static int
+@@ -100,12 +66,12 @@
+ {
+   int sock = -1;
+-#ifdef _WIN32
++#ifdef HAVE_W32_SYSTEM
+   struct hostent *hp;
+   struct sockaddr_in addr;
+   unsigned long l;
+-  init_sockets ();
++  w32_init_sockets ();
+   memset (&addr, 0, sizeof addr);
+   addr.sin_family = AF_INET;
+@@ -201,7 +167,7 @@
+     {
+       int nwritten;
+       
+-#ifdef _WIN32  
++#ifdef HAVE_W32_SYSTEM  
+       nwritten = send (sock, data, nleft, 0);
+       if ( nwritten == SOCKET_ERROR )
+         {
+
+
+
+Index: ksutil.c
+===================================================================
+--- ksutil.c   (revision 4750)
++++ ksutil.c   (working copy)
+@@ -35,6 +35,11 @@
+ #include <string.h>
+ #include <stdlib.h>
++#ifdef HAVE_W32_SYSTEM
++
++#include <windows.h>
++#endif
++
+ #ifdef HAVE_LIBCURL
+ #include <curl/curl.h>
+ #else
+@@ -83,6 +88,22 @@
+ #endif /* !HAVE_DOSISH_SYSTEM */
++#ifdef HAVE_W32_SYSTEM
++void
++w32_init_sockets (void)
++{
++  static int initialized;
++  static WSADATA wsdata;
++
++  if (!initialized)
++    {
++      WSAStartup (0x0202, &wsdata);
++      initialized = 1;
++    }
++}
++#endif /*HAVE_W32_SYSTEM*/
++
++
+ struct ks_options *
+ init_ks_options(void)
+ {
diff --git a/patches/gnupg2-2.0.9/05-w32-http.patch b/patches/gnupg2-2.0.9/05-w32-http.patch
new file mode 100755 (executable)
index 0000000..0478896
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/sh
+cd common && patch -p0 -f $* < $0
+exit $?
+
+
+2008-04-21  Werner Koch  <wk@g10code.com>
+
+       * http.c (http_wait_response) [W32]: Use DuplicateHandle because
+       it is a socket.
+       (cookie_read) [W32]: Use recv in place of read.
+
+
+
+Index: http.c
+===================================================================
+--- http.c     (revision 4748)
++++ http.c     (working copy)
+@@ -396,7 +396,16 @@
+   else
+ #endif /*HTTP_USE_ESTREAM*/
+     {
++#ifdef HAVE_W32_SYSTEM
++      HANDLE handle = (HANDLE)hd->sock;
++      if (!DuplicateHandle (GetCurrentProcess(), handle,
++                          GetCurrentProcess(), &handle, 0,
++                          TRUE, DUPLICATE_SAME_ACCESS ))
++      return gpg_error_from_syserror ();
++      hd->sock = (int)handle;
++#else
+       hd->sock = dup (hd->sock);
++#endif
+       if (hd->sock == -1)
+         return gpg_error_from_syserror ();
+     }
+@@ -1490,7 +1499,7 @@
+ }
+ #endif
+-/* Actually connect to a server.  Returns the file descripto or -1 on
++/* Actually connect to a server.  Returns the file descriptor or -1 on
+    error.  ERRNO is set on error. */
+ static int
+ connect_server (const char *server, unsigned short port,
+@@ -1765,7 +1774,12 @@
+     {
+       do
+         {
++#ifdef HAVE_W32_SYSTEM
++          /* Under Windows we need to use recv for a socket.  */
++          nread = recv (c->fd, buffer, size, 0);
++#else          
+           nread = read (c->fd, buffer, size);
++#endif
+         }
+       while (nread == -1 && errno == EINTR);
+     }
+
+
+