mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* keydb.h, getkey.c (release_akl), gpg.c (main): Add
--no-auto-key-locate. * options.h, gpg.c (main): Keep track of each keyserver registered so we can match on them later. * keyserver-internal.h, keyserver.c (cmp_keyserver_spec, keyserver_match), gpgv.c: New. Find a keyserver that matches ours and return its spec. * getkey.c (get_pubkey_byname): Use it here to get the per-keyserver options from an earlier keyserver.
This commit is contained in:
parent
4139587267
commit
f4f5ea43e7
8 changed files with 114 additions and 27 deletions
|
@ -1,5 +1,6 @@
|
|||
/* keyserver.c - generic keyserver code
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005,
|
||||
* 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
|
@ -196,6 +197,41 @@ free_keyserver_spec(struct keyserver_spec *keyserver)
|
|||
xfree(keyserver);
|
||||
}
|
||||
|
||||
/* Return 0 for match */
|
||||
static int
|
||||
cmp_keyserver_spec(struct keyserver_spec *one,struct keyserver_spec *two)
|
||||
{
|
||||
if(ascii_strcasecmp(one->scheme,two->scheme)==0)
|
||||
{
|
||||
if(one->host && two->host && ascii_strcasecmp(one->host,two->host)==0)
|
||||
{
|
||||
if((one->port && two->port
|
||||
&& ascii_strcasecmp(one->port,two->port)==0)
|
||||
|| (!one->port && !two->port))
|
||||
return 0;
|
||||
}
|
||||
else if(one->opaque && two->opaque
|
||||
&& ascii_strcasecmp(one->opaque,two->opaque)==0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Try and match one of our keyservers. If we can, return that. If
|
||||
we can't, return our input. */
|
||||
struct keyserver_spec *
|
||||
keyserver_match(struct keyserver_spec *spec)
|
||||
{
|
||||
struct keyserver_spec *ks;
|
||||
|
||||
for(ks=opt.keyserver;ks;ks=ks->next)
|
||||
if(cmp_keyserver_spec(spec,ks)==0)
|
||||
return ks;
|
||||
|
||||
return spec;
|
||||
}
|
||||
|
||||
/* TODO: once we cut over to an all-curl world, we don't need this
|
||||
parser any longer so it can be removed, or at least moved to
|
||||
keyserver/ksutil.c for limited use in gpgkeys_ldap or the like. */
|
||||
|
@ -1050,7 +1086,7 @@ keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc,
|
|||
|
||||
/* Write per-keyserver options */
|
||||
|
||||
for(temp=opt.keyserver->options;temp;temp=temp->next)
|
||||
for(temp=keyserver->options;temp;temp=temp->next)
|
||||
fprintf(spawn->tochild,"OPTION %s\n",temp->d);
|
||||
|
||||
switch(action)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue