1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-23 21:59:57 +01:00

* 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.
This commit is contained in:
David Shaw 2005-03-31 03:58:53 +00:00
parent 0fae3c3738
commit 14fdbdc97a
2 changed files with 45 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2005-03-30 David Shaw <dshaw@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@g10code.com>
* cardglue.c (pin_cb): Print a warning if the info string hack is

View File

@ -43,6 +43,8 @@
#define SEND 1
#define SEARCH 2
#define GPGKEYS_PREFIX "gpgkeys_"
struct keyrec
{
KEYDB_SEARCH_DESC desc;
@ -860,20 +862,43 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
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. */
#ifdef DISABLE_KEYSERVER_PATH
set_exec_path(GNUPG_LIBEXECDIR,0);
#else
set_exec_path(GNUPG_LIBEXECDIR,opt.exec_path_set);
#endif
/* Build the filename for the helper to execute */
scheme=keyserver_typemap(keyserver->scheme);
command=m_alloc(strlen("gpgkeys_")+strlen(scheme)+1);
strcpy(command,"gpgkeys_");
#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
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);
}
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 @@ keyserver_work(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
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;