1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

* cert.c (get_cert): Properly chase down CNAMEs pointing to CERTs.

This commit is contained in:
David Shaw 2005-12-24 15:35:39 +00:00
parent 846eefaa71
commit 74117cf4d3
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2005-12-24 David Shaw <dshaw@jabberwocky.com>
* cert.c (get_cert): Properly chase down CNAMEs pointing to CERTs.
2005-12-23 David Shaw <dshaw@jabberwocky.com> 2005-12-23 David Shaw <dshaw@jabberwocky.com>
* cert.c, Makefile.am: New code to do DNS CERT queries. * cert.c, Makefile.am: New code to do DNS CERT queries.

View File

@ -96,9 +96,6 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
type=*pt++ << 8; type=*pt++ << 8;
type|=*pt++; type|=*pt++;
/* We asked for CERT and got something else !? */
if(type!=T_CERT)
break;
class=*pt++ << 8; class=*pt++ << 8;
class|=*pt++; class|=*pt++;
@ -113,6 +110,14 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
dlen=*pt++ << 8; dlen=*pt++ << 8;
dlen|=*pt++; dlen|=*pt++;
/* We asked for CERT and got something else - might be a
CNAME, so loop around again. */
if(type!=T_CERT)
{
pt+=dlen;
continue;
}
/* The CERT type */ /* The CERT type */
ctype=*pt++ << 8; ctype=*pt++ << 8;
ctype|=*pt++; ctype|=*pt++;
@ -125,7 +130,7 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
if(ctype==3 && iobuf) if(ctype==3 && iobuf)
{ {
/* PGP type */ /* PGP type */
*iobuf=iobuf_temp_with_content(pt,dlen); *iobuf=iobuf_temp_with_content((char *)pt,dlen);
ret=1; ret=1;
break; break;
} }
@ -136,6 +141,7 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
*url=xmalloc(dlen+1); *url=xmalloc(dlen+1);
memcpy(*url,pt,dlen); memcpy(*url,pt,dlen);
(*url)[dlen]='\0';
ret=2; ret=2;
break; break;
} }