mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +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
|
@ -23,18 +23,17 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "iobuf.h"
|
||||
#include "dns-cert.h"
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
gpg_error_t err;
|
||||
unsigned char *fpr;
|
||||
size_t fpr_len;
|
||||
char *url;
|
||||
int rc;
|
||||
iobuf_t iobuf;
|
||||
estream_t key;
|
||||
char const *name;
|
||||
|
||||
if (argc)
|
||||
|
@ -55,18 +54,19 @@ main (int argc, char **argv)
|
|||
|
||||
printf ("CERT lookup on `%s'\n", name);
|
||||
|
||||
rc = get_dns_cert (name, 65536, &iobuf, &fpr, &fpr_len, &url);
|
||||
if (rc == -1)
|
||||
fputs ("lookup result: error\n", stdout);
|
||||
else if (!rc)
|
||||
fputs ("lookup result: no answer\n", stdout);
|
||||
else if (rc == 1)
|
||||
err = get_dns_cert (name, &key, &fpr, &fpr_len, &url);
|
||||
if (err)
|
||||
printf ("get_dns_cert failed: %s <%s>\n",
|
||||
gpg_strerror (err), gpg_strsource (err));
|
||||
else if (key)
|
||||
{
|
||||
printf ("lookup result: %d bytes\n",
|
||||
(int)iobuf_get_temp_length(iobuf));
|
||||
iobuf_close (iobuf);
|
||||
int count = 0;
|
||||
|
||||
while (es_getc (key) != EOF)
|
||||
count++;
|
||||
printf ("Key found (%d bytes)\n", count);
|
||||
}
|
||||
else if (rc == 2)
|
||||
else
|
||||
{
|
||||
if (fpr)
|
||||
{
|
||||
|
@ -85,9 +85,11 @@ main (int argc, char **argv)
|
|||
else
|
||||
printf ("No URL found\n");
|
||||
|
||||
xfree (fpr);
|
||||
xfree (url);
|
||||
}
|
||||
|
||||
es_fclose (key);
|
||||
xfree (fpr);
|
||||
xfree (url);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue