mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* Makefile.am: No need to link with curl any longer.
* main.h, misc.c (path_access): New. Same as access() but does a PATH search like execlp. * keyserver.c (curl_can_handle): Removed. Replaced by... (curl_cant_handle): We are now relying on curl as the handler of last resort. This is necessary because PGP LDAP and curl LDAP are apples and oranges. (keyserver_typemap): Only test for ldap and ldaps. (keyserver_spawn): If a given handler is unusable (as determined by path_access()) then try gpgkeys_curl.
This commit is contained in:
parent
2e8c02b54b
commit
24adfe678d
5 changed files with 84 additions and 38 deletions
39
g10/misc.c
39
g10/misc.c
|
@ -1,6 +1,6 @@
|
|||
/* misc.c - miscellaneous functions
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||
* 2004, 2005 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
* 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
|
@ -1223,3 +1223,38 @@ get_libexecdir (void)
|
|||
|
||||
return GNUPG_LIBEXECDIR;
|
||||
}
|
||||
|
||||
int
|
||||
path_access(const char *file,int mode)
|
||||
{
|
||||
char *envpath;
|
||||
int ret=-1;
|
||||
|
||||
envpath=getenv("PATH");
|
||||
|
||||
if(file[0]=='/' || !envpath)
|
||||
return access(file,mode);
|
||||
else
|
||||
{
|
||||
/* At least as large as, but most often larger than we need. */
|
||||
char *buffer=xmalloc(strlen(envpath)+1+strlen(file)+1);
|
||||
char *split,*item,*path=xstrdup(envpath);
|
||||
|
||||
split=path;
|
||||
|
||||
while((item=strsep(&split,PATHSEP_S)))
|
||||
{
|
||||
strcpy(buffer,item);
|
||||
strcat(buffer,"/");
|
||||
strcat(buffer,file);
|
||||
ret=access(buffer,mode);
|
||||
if(ret==0)
|
||||
break;
|
||||
}
|
||||
|
||||
xfree(path);
|
||||
xfree(buffer);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue