summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <dshaw@jabberwocky.com>2005-12-24 16:35:39 +0100
committerDavid Shaw <dshaw@jabberwocky.com>2005-12-24 16:35:39 +0100
commit74117cf4d3935e6c191a8b11d1b672b5b0e100b6 (patch)
treee5969e0d04ea3f459addc2db13ffa6c410d8296a
parent* keyserver.c (keyserver_import_pka): New. Moved from (diff)
downloadgnupg2-74117cf4d3935e6c191a8b11d1b672b5b0e100b6.tar.xz
gnupg2-74117cf4d3935e6c191a8b11d1b672b5b0e100b6.zip
* cert.c (get_cert): Properly chase down CNAMEs pointing to CERTs.
Diffstat (limited to '')
-rw-r--r--util/ChangeLog4
-rw-r--r--util/cert.c14
2 files changed, 14 insertions, 4 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index c8e151b3a..9b596cebe 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -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>
* cert.c, Makefile.am: New code to do DNS CERT queries.
diff --git a/util/cert.c b/util/cert.c
index 94e6bed64..11a30161e 100644
--- a/util/cert.c
+++ b/util/cert.c
@@ -96,9 +96,6 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
type=*pt++ << 8;
type|=*pt++;
- /* We asked for CERT and got something else !? */
- if(type!=T_CERT)
- break;
class=*pt++ << 8;
class|=*pt++;
@@ -113,6 +110,14 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
dlen=*pt++ << 8;
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 */
ctype=*pt++ << 8;
ctype|=*pt++;
@@ -125,7 +130,7 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
if(ctype==3 && iobuf)
{
/* PGP type */
- *iobuf=iobuf_temp_with_content(pt,dlen);
+ *iobuf=iobuf_temp_with_content((char *)pt,dlen);
ret=1;
break;
}
@@ -136,6 +141,7 @@ get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url)
*url=xmalloc(dlen+1);
memcpy(*url,pt,dlen);
+ (*url)[dlen]='\0';
ret=2;
break;
}