EOF and Zone Files

toniintc at gmail.com toniintc at gmail.com
Thu Oct 12 21:18:30 UTC 2006


Hi all,

  I have heavily modified DNS Control
(http://freshmeat.net/projects/dns/) for my needs.  I have an issue
with what I believe must be some kind of non-EOF terminated zone files
preventing named (9.3.2-P1) from reading it.  Here's the (unchanged)
code that writes the zone file:

$zone .= $records_mx . $recor);ds_a . $records_cname . "\n";
$f = fopen($this->path . "/$letter/" . $domain, "w");
fwrite($f, $zone);
fclose($f);

Now, when I execute the above code for "test.com" and do a "rndc
reload" from the shell, named spits to the log:

Oct 12 12:35:12 ns1 named[32669]: loading configuration from
'/etc/named.conf'
Oct 12 12:35:12 ns1 named[32669]: zone test.com/IN: loaded serial
1160670894
Oct 12 12:35:12 ns1 named[32669]: zone test.com/IN: sending notifies
(serial 1160670894)

and when I query test.com I get "server can't find test.com: NXDOMAIN".
 If I then edit the zone file with vi and do nothing more than go to
the end of the file and add a blank line, save, and do another "rndc
reload", the log output is:

Oct 12 12:35:47 ns1 named[32669]: loading configuration from
'/etc/named.conf'
Oct 12 12:35:47 ns1 named[32669]: zone test.com/IN: zone serial
unchanged
Oct 12 12:35:47 ns1 named[32669]: zone test.com/IN: loaded serial
1160670894
Oct 12 12:35:47 ns1 named[32669]: zone test.com/IN: sending notifies
(serial 1160670894)

and then I can query the zone successfully.  I've tried writing extra
newlines (\n), a carriage return (\r) and a bunch of chr codes to the
zone file from the code to no avail.  I've Google'd a couple hours to
no avail - just one reference that wasn't helpful (but pointed me to
the problem).

Interestingly, if I kill named altogether and restart it, it will load
the zone (without manually editing the file)!

What should I be using in the code?  What am I missing?

Thanks,
Toni



More information about the bind-users mailing list