mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Rewrite dns-cert.c to not use the gpg-only iobuf stuff.
* common/dns-cert.c: Remove iobuf.h. (get_dns_cert): Rename to _get_dns_cert. Remove MAX_SIZE arg. Change iobuf arg to a estream-t. Rewrite function to make use of estream instead of iobuf. Require all parameters. Return an gpg_error_t error instead of the type. Add arg ERRSOURCE. * common/dns-cert.h (get_dns_cert): New macro to pass the error source to _gpg_dns_cert. * common/t-dns-cert.c (main): Adjust for changes in get_dns_cert. * g10/keyserver.c (keyserver_import_cert): Ditto. * doc/gpg.texi (GPG Configuration Options): Remove max-cert-size.
This commit is contained in:
parent
8cf2356fa8
commit
31f548a18a
7 changed files with 186 additions and 109 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-11-30 Werner Koch <wk@g10code.com>
|
||||
|
||||
* keyserver.c (keyserver_import_cert): Adjust for changed
|
||||
get_dns_cert.
|
||||
|
||||
2011-11-28 Werner Koch <wk@g10code.com>
|
||||
|
||||
* keyserver.c (DEFAULT_MAX_CERT_SIZE): Increase from 16k to 64k.
|
||||
|
|
|
@ -1691,9 +1691,10 @@ int
|
|||
keyserver_import_cert (ctrl_t ctrl,
|
||||
const char *name,unsigned char **fpr,size_t *fpr_len)
|
||||
{
|
||||
gpg_error_t err;
|
||||
char *domain,*look,*url;
|
||||
IOBUF key;
|
||||
int type,rc=G10ERR_GENERAL;
|
||||
estream_t key;
|
||||
|
||||
|
||||
look=xstrdup(name);
|
||||
|
||||
|
@ -1701,30 +1702,25 @@ keyserver_import_cert (ctrl_t ctrl,
|
|||
if(domain)
|
||||
*domain='.';
|
||||
|
||||
type=get_dns_cert(look,max_cert_size,&key,fpr,fpr_len,&url);
|
||||
if (!type || type == -1)
|
||||
{
|
||||
/* There might be an error in res_query which leads to an error
|
||||
return (-1) in the case that nothing was found. Thus we take
|
||||
all errors as key not found. */
|
||||
rc = G10ERR_NO_PUBKEY;
|
||||
}
|
||||
else if (type==1)
|
||||
err = get_dns_cert (look, &key, fpr, fpr_len, &url);
|
||||
if (err)
|
||||
;
|
||||
else if (key)
|
||||
{
|
||||
int armor_status=opt.no_armor;
|
||||
|
||||
/* CERTs are always in binary format */
|
||||
opt.no_armor=1;
|
||||
|
||||
/* FIXME: Pass CTRL. */
|
||||
rc = import_keys_stream (NULL, key, NULL, fpr, fpr_len,
|
||||
opt.keyserver_options.import_options);
|
||||
err = import_keys_es_stream (ctrl, key, NULL, fpr, fpr_len,
|
||||
opt.keyserver_options.import_options);
|
||||
|
||||
opt.no_armor=armor_status;
|
||||
|
||||
iobuf_close(key);
|
||||
es_fclose (key);
|
||||
key = NULL;
|
||||
}
|
||||
else if(type==2 && *fpr)
|
||||
else if (*fpr)
|
||||
{
|
||||
/* We only consider the IPGP type if a fingerprint was provided.
|
||||
This lets us select the right key regardless of what a URL
|
||||
|
@ -1736,7 +1732,7 @@ keyserver_import_cert (ctrl_t ctrl,
|
|||
spec=parse_keyserver_uri(url,1,NULL,0);
|
||||
if(spec)
|
||||
{
|
||||
rc = keyserver_import_fprint (ctrl, *fpr,*fpr_len,spec);
|
||||
err = keyserver_import_fprint (ctrl, *fpr,*fpr_len,spec);
|
||||
free_keyserver_spec(spec);
|
||||
}
|
||||
}
|
||||
|
@ -1745,7 +1741,7 @@ keyserver_import_cert (ctrl_t ctrl,
|
|||
/* If only a fingerprint is provided, try and fetch it from
|
||||
our --keyserver */
|
||||
|
||||
rc = keyserver_import_fprint (ctrl, *fpr,*fpr_len,opt.keyserver);
|
||||
err = keyserver_import_fprint (ctrl, *fpr,*fpr_len,opt.keyserver);
|
||||
}
|
||||
else
|
||||
log_info(_("no keyserver known (use option --keyserver)\n"));
|
||||
|
@ -1754,12 +1750,12 @@ keyserver_import_cert (ctrl_t ctrl,
|
|||
found, but no keyserver" " known (use option
|
||||
--keyserver)\n" ? */
|
||||
|
||||
xfree(url);
|
||||
}
|
||||
|
||||
xfree(url);
|
||||
xfree(look);
|
||||
|
||||
return rc;
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Import key pointed to by a PKA record. Return the requested
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue