lease->duid_len = len;
}
- if ((c = tb[LEASE_ATTR_HOSTID]))
- if (odhcpd_unhexlify((uint8_t*)&lease->hostid, sizeof(lease->hostid),
- blobmsg_get_string(c)) < 0)
+ if ((c = tb[LEASE_ATTR_HOSTID])) {
+ errno = 0;
+ lease->hostid = strtoul(blobmsg_get_string(c), NULL, 16);
+ if (errno)
goto err;
+ }
list_add(&lease->head, &leases);
return 0;
continue;
uint8_t buf[256];
- int len = dn_comp(blobmsg_get_string(cur), buf, sizeof(buf), NULL, NULL);
+ char *domain = blobmsg_get_string(cur);
+ size_t domainlen = strlen(domain);
+ if (domainlen > 0 && domain[domainlen - 1] == '.')
+ domain[domainlen - 1] = 0;
+
+ int len = dn_comp(domain, buf, sizeof(buf), NULL, NULL);
+ free(domain);
if (len <= 0)
goto err;