summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dns_wizard/Bind.pm29
1 files changed, 16 insertions, 13 deletions
diff --git a/dns_wizard/Bind.pm b/dns_wizard/Bind.pm
index dea69c92..1fa11d24 100644
--- a/dns_wizard/Bind.pm
+++ b/dns_wizard/Bind.pm
@@ -77,7 +77,9 @@ my %level = (
my @list_hosts;
+
sub list_hosts {
+# undef @list_hosts;
my $iprev = get_spe_ip('iprev', $IPSERVER);
my $db = "$ZONE_DIR/db.$iprev.hosts";
my $ipnor = get_spe_ip('iprev', $IPSERVER);
@@ -123,7 +125,7 @@ $o->{pages} = {
removehost => {
name => N('Remove Host') . "\n\n" . N('Remove a host in existing dns configuration.') . "\n\n" . N('Choose the host you want to remove in the following list.'),
data => [
- { label => N("Name of the machine:"), val => \$o->{var}{N}, fixed_list => \@list_hosts },
+ { label => N("Name of the machine:"), val => \$o->{var}{CLIENTNAME}, fixed_list => \@list_hosts },
],
post => \&list_hosts,
next => 'summaryremove',
@@ -211,7 +213,7 @@ $o->{pages} = {
summaryremove => {
name => N('Client with this identification will be removed to your DNS'),
data => [
- { label => N("Name of the machine:"), val => \$o->{var}{N}, fixed_list => \@list_hosts },
+ { label => N("Name of the machine:"), val => \$o->{var}{CLIENTNAME}, fixed_list => \@list_hosts },
],
post => \&do_it_remove,
next => 'endremove',
@@ -233,9 +235,10 @@ $o->{pages} = {
next => 'addhost',
},
endremove => {
- name => N('Congratulations'),
- data => [ { label => N('The wizard successfully remove host in your DNS.') } ],
- next => 'removehost',
+ name => N('Congratulations'),
+ data => [ { label => N('The wizard successfully remove host in your DNS.') } ],
+ end => 1,
+ next => 0,
},
end => {
name => N('Congratulations'),
@@ -708,7 +711,7 @@ sub do_it_add {
my $iprev = get_spe_ip('iprev', $IPSERVER);
my $ipend = get_spe_ip('ipend', $o->{var}{CLIENTIP});
my $SNAME= get_shortname($o->{var}{CLIENTNAME});
- if (any { /$o->{var}{CLIENTIP}/ } cat_("$ZONE_DIR/db.$DOMAINNAME.hosts")) {
+ if (any { /$ipend\tIN/ } cat_("$ZONE_DIR/db.$iprev.hosts")) {
return 'error_add';
} elsif (any { /$SNAME.$DOMAINNAME.$/ } cat_("$ZONE_DIR/db.$iprev.hosts")) {
return 'error_add';
@@ -725,17 +728,17 @@ sub do_it_add {
sub do_it_remove {
return if $::testing;
my $iprev = get_spe_ip('iprev', $IPSERVER);
- my $ipend = get_spe_ip('ipend', $o->{var}{CLIENTIP});
- if (!any { /$o->{var}{CLIENTIP}$/ } cat_("$ZONE_DIR/db.$DOMAINNAME.hosts")) {
- return 'error_remove';
- } else {
+ my $SNAME= $o->{var}{CLIENTNAME};
+# if (any { /^$SNAME.$DOMAINNAME./ } cat_("$ZONE_DIR/db.$DOMAINNAME.hosts")) {
substInFile {
- s/.*$o->{var}{CLIENTIP}$//;
+ s/^$SNAME.*//;
} "$ZONE_DIR/db.$DOMAINNAME.hosts";
substInFile {
- s/^$ipend\S*.*//;
+ s/\W+\tIN\tPTR\t$SNAME.$//;
} "$ZONE_DIR/db.$iprev.hosts";
- }
+# } else {
+# return 'error_remove';
+# }
system("service named reload");
}