summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dns_wizard/Bind.pm21
1 files changed, 10 insertions, 11 deletions
diff --git a/dns_wizard/Bind.pm b/dns_wizard/Bind.pm
index 1fa11d24..ce59d3a3 100644
--- a/dns_wizard/Bind.pm
+++ b/dns_wizard/Bind.pm
@@ -83,6 +83,7 @@ sub list_hosts {
my $iprev = get_spe_ip('iprev', $IPSERVER);
my $db = "$ZONE_DIR/db.$iprev.hosts";
my $ipnor = get_spe_ip('iprev', $IPSERVER);
+ push @list_hosts, "";
foreach (cat_($db)) {
my ($h) = /\d{1,3}\tIN\tPTR\t(.*)/;
!$h or push @list_hosts,$h;
@@ -728,17 +729,15 @@ sub do_it_add {
sub do_it_remove {
return if $::testing;
my $iprev = get_spe_ip('iprev', $IPSERVER);
- my $SNAME= $o->{var}{CLIENTNAME};
-# if (any { /^$SNAME.$DOMAINNAME./ } cat_("$ZONE_DIR/db.$DOMAINNAME.hosts")) {
- substInFile {
- s/^$SNAME.*//;
- } "$ZONE_DIR/db.$DOMAINNAME.hosts";
- substInFile {
- s/\W+\tIN\tPTR\t$SNAME.$//;
- } "$ZONE_DIR/db.$iprev.hosts";
-# } else {
-# return 'error_remove';
-# }
+ my $NAME= $o->{var}{CLIENTNAME};
+ substInFile {
+ s/^\b$NAME.\b.*//;
+ s/^\s*$//;
+ } "$ZONE_DIR/db.$DOMAINNAME.hosts";
+ substInFile {
+ s/^\d+\tIN\tPTR\t$NAME//;
+ s/^\s*$//;
+ } "$ZONE_DIR/db.$iprev.hosts";
system("service named reload");
}