Commit Diff
Diff:
3887ce045c4b4a45b7b9c24f992070912a0eaaf9
d67bdb6273c79e8d6bde41acd4bf0d0fdd3fc664
Commit:
d67bdb6273c79e8d6bde41acd4bf0d0fdd3fc664
Tree:
8435f53919ed326977ada2cf0228a3398da91b11
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Tue Apr 22 08:01:47 2014 UTC
Message:
* The SSHFP is not a hex representation inside the record, but a binary one This fixes SSHFP
blob - cda649efbdf1dbf1ec8499fb9c2a849a911a0f8c
blob + 2ce49977f3ea5592b394e4a8c4b7c3c38c02bc93
--- dns.h
+++ dns.h
@@ -171,8 +171,8 @@ struct dns_question_hdr {
/* SSHFP fingerprint sizes */
-#define DNS_SSHFP_SIZE_SHA1 40 /* RFC 4255 */
-#define DNS_SSHFP_SIZE_SHA256 64 /* RFC 6594 */
+#define DNS_SSHFP_SIZE_SHA1 20 /* RFC 4255 */
+#define DNS_SSHFP_SIZE_SHA256 32 /* RFC 6594 */
struct question {
blob - 573a03a8e7eb42874273f078ff0d966013fb41ce
blob + 0de34bae29bce4b78698b28460a0d5a19231fa4c
--- parse.y
+++ parse.y
@@ -58,7 +58,7 @@ typedef struct {
int lineno;
} YYSTYPE;
-static const char rcsid[] = "$Id: parse.y,v 1.14 2014/04/21 19:26:15 pjp Exp $";
+static const char rcsid[] = "$Id: parse.y,v 1.15 2014/04/22 08:01:47 pjp Exp $";
static int version = 0;
static int state = 0;
static uint8_t region = 0;
@@ -1649,6 +1649,7 @@ fill_sshfp(char *name, char *type, int myttl, int alg,
struct domain sdomain;
int converted_namelen;
char *converted_name;
+ char *p, *ep, save;
int len, i;
for (i = 0; i < strlen(name); i++) {
@@ -1696,7 +1697,14 @@ fill_sshfp(char *name, char *type, int myttl, int alg,
return -1;
}
- memcpy((char *)&sdomain.sshfp[sdomain.sshfp_count].fingerprint, fingerprint, len);
+ p = fingerprint;
+ for (i = 0; i < len; i++) {
+ save = p[2];
+ p[2] = '\0';
+ sdomain.sshfp[sdomain.sshfp_count].fingerprint[i] = strtol(p, &ep, 16);
+ p[2] = save;
+ p += 2;
+ }
sdomain.sshfp_count++;
repomaster@centroid.eu