Commit Diff
Diff:
9acb2154400b32a1494f7c4d54f069cd7fc6f60b
ac5bffe75ef721d12669af1d61f462188c668e20
Commit:
ac5bffe75ef721d12669af1d61f462188c668e20
Tree:
11ab70d5a91682377f921e22441ef960c77f718d
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Mon Feb 18 23:51:34 2019 UTC
Message:
use hex2bin() in sshfp instead of a weird multi-liner in parse.y adjust myrrtab in util.c
blob - 9b1fd4b2ff580caa992f492f7291ad200a236225
blob + 93b1e9a2683c637e10da56ac5db582d37ded544b
--- parse.y
+++ parse.y
@@ -21,7 +21,7 @@
*/
/*
- * $Id: parse.y,v 1.60 2019/02/15 19:46:58 pjp Exp $
+ * $Id: parse.y,v 1.61 2019/02/18 23:51:34 pjp Exp $
*/
%{
@@ -2549,8 +2549,8 @@ fill_sshfp(char *name, char *type, int myttl, int alg,
struct rbtree *rbt;
int converted_namelen;
char *converted_name;
- char *p, *ep, save;
int len, i;
+ int ret;
for (i = 0; i < strlen(name); i++) {
name[i] = tolower((int)name[i]);
@@ -2581,14 +2581,8 @@ fill_sshfp(char *name, char *type, int myttl, int alg,
return -1;
}
- p = fingerprint;
- for (i = 0; i < len; i++) {
- save = p[2];
- p[2] = '\0';
- sshfp->fingerprint[i] = strtol(p, &ep, 16);
- p[2] = save;
- p += 2;
- }
+ memset(sshfp->fingerprint, 0, sizeof(sshfp->fingerprint));
+ ret = hex2bin(fingerprint, strlen(fingerprint), sshfp->fingerprint);
sshfp->ttl = myttl;
blob - c9504b29ced991b8d2513286b1aeae55ff22fc01
blob + 04d2921c86fcd737a19196a3818fa0477daa71d4
--- util.c
+++ util.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: util.c,v 1.20 2019/02/18 14:59:55 pjp Exp $
+ * $Id: util.c,v 1.21 2019/02/18 23:51:34 pjp Exp $
*/
#include "ddd-include.h"
@@ -109,7 +109,7 @@ static struct rrtab myrrtab[] = {
{ "nsec3", DNS_TYPE_NSEC3, DNS_TYPE_NSEC3 },
{ "nsec3param", DNS_TYPE_NSEC3PARAM, DNS_TYPE_NSEC3PARAM },
{ "ptr", DNS_TYPE_PTR, DNS_TYPE_PTR },
- { "rrsig", DNS_TYPE_RRSIG, -1 },
+ { "rrsig", DNS_TYPE_RRSIG, DNS_TYPE_RRSIG },
{ "soa", DNS_TYPE_SOA, DNS_TYPE_SOA },
{ "srv", DNS_TYPE_SRV, DNS_TYPE_SRV },
{ "sshfp", DNS_TYPE_SSHFP, DNS_TYPE_SSHFP },
repomaster@centroid.eu