if (option_bool(OPT_DNSSEC_VALID))
{
#ifdef HAVE_DNSSEC
- if (!daemon->ds)
- die(_("no trust anchors provided for DNSSEC"), NULL, EC_BADCONF);
+ struct ds_config *ds;
+
+ /* Must have at least a root trust anchor, or the DNSSEC code
+ can loop forever. */
+ for (ds = daemon->ds; ds; ds = ds->next)
+ if (ds->name[0] == 0)
+ break;
+
+ if (!ds)
+ die(_("no root trust anchor provided for DNSSEC"), NULL, EC_BADCONF);
if (daemon->cachesize < CACHESIZ)
die(_("cannot reduce cache size from default when DNSSEC enabled"), NULL, EC_BADCONF);
*/
static int zone_status(char *name, int class, char *keyname, time_t now)
{
- int name_start = strlen(name);
+ int name_start = strlen(name); /* for when TA is root */
struct crec *crecp;
char *p;
+
+ /* First, work towards the root, looking for a trust anchor.
+ This can either be one configured, or one previously cached.
+ We can assume, if we don't find one first, that there is
+ a trust anchor at the root. */
+ for (p = name; p; p = strchr(p, '.'))
+ {
+ if (*p == '.')
+ p++;
+
+ if (cache_find_by_name(NULL, p, now, F_DS))
+ {
+ name_start = p - name;
+ break;
+ }
+ }
+ /* Now work away from the trust anchor */
while (1)
{
strcpy(keyname, &name[name_start]);