1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Allow requesting only an IPGP certtype with dns_cert().

* util/cert.c (get_cert): Add arg want_ipgp.  Change callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-02-26 15:17:56 +01:00
parent 0d286a11c8
commit d2323ce6fd
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 9 additions and 7 deletions

View File

@ -2164,7 +2164,7 @@ keyserver_import_cert(const char *name,unsigned char **fpr,size_t *fpr_len)
if(domain)
*domain='.';
type=get_cert(look,max_cert_size,&key,fpr,fpr_len,&url);
type = get_cert (look, 0, max_cert_size, &key, fpr, fpr_len, &url);
if(type==1)
{
int armor_status=opt.no_armor;

View File

@ -244,8 +244,8 @@ char *xtryvasprintf (const char *fmt, va_list arg_ptr);
char *get_pka_info (const char *address, unsigned char *fpr);
/*-- cert.c --*/
int get_cert(const char *name,size_t max_size,IOBUF *iobuf,
unsigned char **fpr,size_t *fpr_len,char **url);
int get_cert (const char *name, int want_ipgp, size_t max_size, IOBUF *iobuf,
unsigned char **fpr,size_t *fpr_len,char **url);
/*-- convert.c --*/
int hex2bin (const char *string, void *buffer, size_t length);

View File

@ -48,8 +48,8 @@
/* Returns -1 on error, 0 for no answer, 1 for PGP provided and 2 for
IPGP provided. */
int
get_cert(const char *name,size_t max_size,IOBUF *iobuf,
unsigned char **fpr,size_t *fpr_len,char **url)
get_cert (const char *name, int want_ipgp, size_t max_size,IOBUF *iobuf,
unsigned char **fpr, size_t *fpr_len, char **url)
{
unsigned char *answer;
int r,ret=-1;
@ -140,7 +140,9 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,
/* 15 bytes takes us to here */
if(ctype==3 && iobuf && dlen)
if (want_ipgp && ctype != 6)
; /* Skip non IPGP cert records. */
else if (ctype==3 && iobuf && dlen)
{
/* PGP type */
*iobuf=iobuf_temp_with_content((char *)pt,dlen);
@ -216,7 +218,7 @@ main(int argc,char *argv[])
printf("CERT lookup on %s\n",argv[1]);
rc=get_cert(argv[1],16384,&iobuf,&fpr,&fpr_len,&url);
rc=get_cert (argv[1], 0, 16384, &iobuf, &fpr, &fpr_len, &url);
if(rc==-1)
printf("error\n");
else if(rc==0)