View Single Post
  #2  
Old 2nd March 2006, 06:07
Switched Switched is offline
Junior Member
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nice work!

May I suggest a small improvement?

In your dupcheck function you use this

chop($dupcheck = `grep -ic $domain /var/named/named.conf`);

The problem with that is it matches too much. For example, as a webhost I find my users will often get their country specific domain, and the .com. So, if they start with foobar.com.au and later add foobar.com, your test will fail when it really shouldn't.

Looking at the structure of a secondary zone entry, we should be able to match the first line uniquely.

ie.

Code:
zone "foobar.com.au" {
        type slave;
        file "/path/to/zones/db.foobar.com.au";
        masters { www.xxx.yyy.zzz; };
};
should make

chop($dupcheck = `grep -ic "zone \"$domain\" {" /var/named/named.conf`);

Cheers! And thanks again for posting all of that.
Reply With Quote