Never create record with clashing name and value
authorJamie Cameron <jcameron@webmin.com>
Tue, 30 Mar 2010 05:19:22 +0000 (22:19 -0700)
committerJamie Cameron <jcameron@webmin.com>
Tue, 30 Mar 2010 05:19:22 +0000 (22:19 -0700)
bind8/lang/en
bind8/mass_rcreate.cgi

index 9f95fed..02184fb 100644 (file)
@@ -994,6 +994,7 @@ rmass_ettl=Missing or invalid time-to-live
 rmass_doing=Adding record to zone $1 ..
 rmass_done=.. done
 rmass_eclash=.. a record with the same name and value $1 already exists.
+rmass_eclash2=.. a record with the same name and the same value $1 already exists.
 rmass_clash=Create even if record already exists?
 
 check_title=Check Records
index 5afa3fb..fe282b9 100755 (executable)
@@ -65,6 +65,7 @@ foreach $zi (@zones) {
                        $in{'name'}.".".$zi->{'name'}.".";
        @recs = &read_zone_file($zi->{'file'}, $zi->{'name'});
        if ($in{'type'} eq 'CNAME' || $in{'clash'}) {
+               # Check if a record with the same name exists
                ($clash) = grep { $_->{'name'} eq $fullname &&
                                  $_->{'type'} eq $in{'type'} } @recs;
                if ($clash) {
@@ -74,6 +75,15 @@ foreach $zi (@zones) {
                        next;
                        }
                }
+       # Check if a record with the same name and value exists
+       ($clash) = grep { $_->{'name'} eq $fullname &&
+                         $_->{'type'} eq $in{'type'} &&
+                         join(" ", @{$_->{'values'}} eq $in{'value'} } @recs;
+       if ($clash) {
+               print &text('rmass_eclash2',
+                   "<tt>".join(" ", @{$clash->{'values'}})."</tt>"),"<p>\n";
+               next;
+               }
        &create_record($zi->{'file'}, $in{'name'}, $in{'ttl'}, "IN",
                       $in{'type'}, $in{'value'});
        &bump_soa_record($zi->{'file'}, \@recs);