isc_token_t token;
unsigned char eui48[6];
unsigned int l0, l1, l2, l3, l4, l5;
+ char buf[sizeof("xx-xx-xx-xx-xx-xx")];
int n;
REQUIRE(type == dns_rdatatype_eui48);
return DNS_R_BADEUI;
}
+ /*
+ * Check that leading zeros were present and that there wasn't
+ * trailing garbage.
+ */
+ n = snprintf(buf, sizeof(buf), "%02x-%02x-%02x-%02x-%02x-%02x", l0, l1,
+ l2, l3, l4, l5);
+ if (n != sizeof(buf) - 1 || strcasecmp(DNS_AS_STR(token), buf) != 0) {
+ return DNS_R_BADEUI;
+ }
+
eui48[0] = l0;
eui48[1] = l1;
eui48[2] = l2;
isc_token_t token;
unsigned char eui64[8];
unsigned int l0, l1, l2, l3, l4, l5, l6, l7;
+ char buf[sizeof("xx-xx-xx-xx-xx-xx-xx-xx")];
int n;
REQUIRE(type == dns_rdatatype_eui64);
return DNS_R_BADEUI;
}
+ /*
+ * Check that leading zeros were present and that there wasn't
+ * trailing garbage.
+ */
+ n = snprintf(buf, sizeof(buf),
+ "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x", l0, l1, l2, l3,
+ l4, l5, l6, l7);
+ if (n != sizeof(buf) - 1 || strcasecmp(DNS_AS_STR(token), buf) != 0) {
+ return DNS_R_BADEUI;
+ }
+
eui64[0] = l0;
eui64[1] = l1;
eui64[2] = l2;