gnupg/g10 (ChangeLog keyserver.c)

cvs user dshaw cvs at cvs.gnupg.org
Thu Mar 31 05:44:00 CEST 2005


    Date: Thursday, March 31, 2005 @ 05:58:53
  Author: dshaw
    Path: /cvs/gnupg/gnupg/g10

Modified: ChangeLog keyserver.c

* keyserver.c (keyserver_spawn): Don't mess about with the $PATH.
Rather, call keyserver helpers with the full path.  This fixes some
PATH-inspired DLL problems on W32.  Noted by Carlo Luciano Bianco.


-------------+
 ChangeLog   |    7 +++++++
 keyserver.c |   44 +++++++++++++++++++++++++++++++++++---------
 2 files changed, 42 insertions(+), 9 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.714 gnupg/g10/ChangeLog:1.715
--- gnupg/g10/ChangeLog:1.714	Wed Mar 30 12:39:13 2005
+++ gnupg/g10/ChangeLog	Thu Mar 31 05:58:53 2005
@@ -1,3 +1,10 @@
+2005-03-30  David Shaw  <dshaw at jabberwocky.com>
+
+	* keyserver.c (keyserver_spawn): Don't mess about with the $PATH.
+	Rather, call keyserver helpers with the full path.  This fixes
+	some PATH-inspired DLL problems on W32.  Noted by Carlo Luciano
+	Bianco.
+
 2005-03-30  Werner Koch  <wk at g10code.com>
 
 	* cardglue.c (pin_cb): Print a warning if the info string hack is
Index: gnupg/g10/keyserver.c
diff -u gnupg/g10/keyserver.c:1.82 gnupg/g10/keyserver.c:1.83
--- gnupg/g10/keyserver.c:1.82	Thu Mar 17 23:55:17 2005
+++ gnupg/g10/keyserver.c	Thu Mar 31 05:58:53 2005
@@ -43,6 +43,8 @@
 #define SEND   1
 #define SEARCH 2
 
+#define GPGKEYS_PREFIX "gpgkeys_"
+
 struct keyrec
 {
   KEYDB_SEARCH_DESC desc;
@@ -860,20 +862,43 @@
   opt.keyserver_options.options|=KEYSERVER_USE_TEMP_FILES;
 #endif
 
-  /* Push the libexecdir into path.  If DISABLE_KEYSERVER_PATH is set,
-     use the 0 arg to replace the path. */
+  /* Build the filename for the helper to execute */
+  scheme=keyserver_typemap(keyserver->scheme);
+
 #ifdef DISABLE_KEYSERVER_PATH
+  /* Destroy any path we might have.  This is a little tricky,
+     portability-wise.  It's not correct to delete the PATH
+     environment variable, as that may fall back to a system built-in
+     PATH.  Similarly, it is not correct to set PATH to the null
+     string (PATH="") since this actually deletes the PATH environment
+     variable under MinGW.  The safest thing to do here is to force
+     PATH to be GNUPG_LIBEXECDIR.  All this is not that meaningful on
+     Unix-like systems (since we're going to give a full path to
+     gpgkeys_foo), but on W32 it prevents loading any DLLs from
+     directories in %PATH%. */
   set_exec_path(GNUPG_LIBEXECDIR,0);
 #else
-  set_exec_path(GNUPG_LIBEXECDIR,opt.exec_path_set);
+  if(opt.exec_path_set)
+    {
+      /* If exec-path was set, and DISABLE_KEYSERVER_PATH is
+	 undefined, then don't specify a full path to gpgkeys_foo, so
+	 that the PATH can work. */
+      command=m_alloc(strlen(GPGKEYS_PREFIX)+strlen(scheme)+1);
+      command[0]='\0';
+    }
+  else
 #endif
+    {
+      /* Specify a full path to gpgkeys_foo. */
+      command=m_alloc(strlen(GNUPG_LIBEXECDIR)+strlen(DIRSEP_S)+
+		      strlen(GPGKEYS_PREFIX)+strlen(scheme)+1);
+      strcpy(command,GNUPG_LIBEXECDIR);
+      strcat(command,DIRSEP_S);
+    }
 
-  /* Build the filename for the helper to execute */
-  scheme=keyserver_typemap(keyserver->scheme);
-  command=m_alloc(strlen("gpgkeys_")+strlen(scheme)+1);
-  strcpy(command,"gpgkeys_"); 
+  strcat(command,GPGKEYS_PREFIX); 
   strcat(command,scheme);
-  
+
   if(opt.keyserver_options.options&KEYSERVER_USE_TEMP_FILES)
     {
       if(opt.keyserver_options.options&KEYSERVER_KEEP_TEMP_FILES)
@@ -1334,7 +1359,8 @@
 	  break;
 
 	case KEYSERVER_VERSION_ERROR:
-	  log_error(_("gpgkeys_%s does not support handler version %d\n"),
+	  log_error(_(GPGKEYS_PREFIX "%s does not support"
+		      " handler version %d\n"),
 		    keyserver_typemap(keyserver->scheme),
 		    KEYSERVER_PROTO_VERSION);
 	  break;




More information about the Gnupg-commits mailing list