summaryrefslogtreecommitdiffstats
path: root/dns_wizard/Bind.pm
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2004-01-22 12:45:05 +0000
committerAntoine Ginies <aginies@mandriva.com>2004-01-22 12:45:05 +0000
commitdd2fd4b75b207f314c7d1a4dacb70ec43089eb4b (patch)
treee704ce3061fc257d5dca2fce09fb70989338c76b /dns_wizard/Bind.pm
parent43a39d151459cc6ba85626c0b2068dce439dde18 (diff)
downloaddrakwizard-dd2fd4b75b207f314c7d1a4dacb70ec43089eb4b.tar
drakwizard-dd2fd4b75b207f314c7d1a4dacb70ec43089eb4b.tar.gz
drakwizard-dd2fd4b75b207f314c7d1a4dacb70ec43089eb4b.tar.bz2
drakwizard-dd2fd4b75b207f314c7d1a4dacb70ec43089eb4b.tar.xz
drakwizard-dd2fd4b75b207f314c7d1a4dacb70ec43089eb4b.zip
- fix pb of remove host
- fix some typo - clear CLIENTNAME CLIENTIP when add a new host
Diffstat (limited to 'dns_wizard/Bind.pm')
-rw-r--r--dns_wizard/Bind.pm58
1 files changed, 26 insertions, 32 deletions
diff --git a/dns_wizard/Bind.pm b/dns_wizard/Bind.pm
index d722c2b7..9df7464f 100644
--- a/dns_wizard/Bind.pm
+++ b/dns_wizard/Bind.pm
@@ -51,6 +51,7 @@ my $TEXTINFO = "dns Wizard";
my $REP_SAVE = "/tmp/bck";
my $ZONE_DIR = $NAMED_DIR . "/zone";
my $DATE = `date +%d-%m-20%y`;
+my $ft = "/var/named/master_srv";
my $o = {
@@ -87,11 +88,10 @@ 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);
- push @list_hosts, "";
+# push @list_hosts, "";
foreach (cat_($db)) {
my ($h) = /\d{1,3}\tIN\tPTR\t(.*)/;
!$h or push @list_hosts,$h;
@@ -107,6 +107,7 @@ $o->{pages} = {
$o->{var}{wiz_level} ||= 1;
},
post => sub {
+ -f $ft or return 'error_notmaster';
if ($o->{var}{wiz_level} == 2) {
return 'slave' }
elsif ($o->{var}{wiz_level} == 3) {
@@ -132,7 +133,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}{CLIENTNAME}, fixed_list => \@list_hosts },
+ { label => N("Computer Name:"), val => \$o->{var}{CLIENTNAME}, fixed_list => \@list_hosts },
],
post => \&list_hosts,
next => 'summaryremove',
@@ -140,16 +141,16 @@ $o->{pages} = {
slave => {
name => N("Slave DNS server") . "\n\n" . N("A slave name server will take some of the burden away from your primary name server, and will also function as a backup server, in case your master server is unreachable."),
data => [
- { label => N("IP of master DNS server:"), val => \$o->{var}{IPMASTER} },
+ { label => N("Address IP of the master DNS server:"), val => \$o->{var}{IPMASTER} },
],
post => \&check_ipm,
next => 'summaryslave',
},
ipforward => {
- name => N("IP of your forwarders") . "\n\n" . N("Forwarding occurs on only those queries for which the server is not authoritative and does not have the answer in its cache.") . "\n\n" . N("So if you need it and know your ip forwarder enter IP address of it, if you dont know leave it blank"),
+ name => N("IP of your forwarder") . "\n\n" . N("Forwarding occurs on only those queries for which the server is not authoritative and does not have the answer in its cache.") . "\n\n" . N("So if you need it and know your ip forwarder enter IP address of it, if you dont know leave it blank"),
data => [
- { label => N("IP forwarders:"), val => \$o->{var}{IPOFFORWARDER} },
+ { label => N("IP forwarder:"), val => \$o->{var}{IPOFFORWARDER} },
],
post => \&check_ipf,
next => 'addsearch',
@@ -163,17 +164,17 @@ $o->{pages} = {
next => 'summary',
},
error_ipf => {
- name => N("Error IP of forwarder.") . "\n\n" . N("This is not a valid IP address for your forwarder... press next to continue"),
+ name => N("This is not a valid IP address for your forwarder... press next to continue"),
ignore => 1,
next => 'ipforward',
},
error_ipm => {
- name => N("Error Ip of DNS master.") . "\n\n" . N("This is not a valid Master DNS IP address... press next to continue"),
+ name => N("This is not a valid Master DNS IP address... press next to continue"),
ignore => 1,
next => 'slave',
},
error_iph => {
- name => N("Error Ip of new host.") . "\n\n" . N("This is not a valid IP address... press next to continue"),
+ name => N("This is not a valid IP address... press next to continue"),
ignore => 1,
next => 'addhost',
},
@@ -204,8 +205,8 @@ $o->{pages} = {
},
summaryslave => {
name => N("Ok Now building your DNS slave configuration") . "\n\n" . N("with this configuration:"),
- data => [
- { label => N("Ip of master DNS server:"), fixed_val => \$o->{var}{IPMASTER} },
+ data => [
+ { label => N("Address IP of the master DNS server:"), fixed_val => \$o->{var}{IPMASTER} },
],
post => \&do_it_slave,
next => 'end',
@@ -213,8 +214,8 @@ $o->{pages} = {
summaryadd => {
name => N("Client with this identification will be added to your DNS"),
data => [
- { label => N("Name of the machine:"), fixed_val => \$o->{var}{CLIENTNAME} },
- { label => N("IP number of the machine:"), fixed_val => \$o->{var}{CLIENTIP} },
+ { label => N("Computer name:"), fixed_val => \$o->{var}{CLIENTNAME} },
+ { label => N("Computer IP number:"), fixed_val => \$o->{var}{CLIENTIP} },
],
post => \&do_it_add,
next => 'endadd',
@@ -222,17 +223,17 @@ $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}{CLIENTNAME}, fixed_list => \@list_hosts },
+ { label => N("Computer name:"), val => \$o->{var}{CLIENTNAME}, fixed_list => \@list_hosts },
],
post => \&do_it_remove,
next => 'endremove',
},
summary => {
- name => N("Ok Now building your DNS configuration") . "\n\n" . N("with this configuration:"),
+ name => N("The DNS server is about to be configured with the following configuration"),
data => [
{ label => N("Server Hostname:"), fixed_val => \$o->{var}{SHORTHOSTNAME} },
{ label => N("Domainname:"), fixed_val => \$o->{var}{DOMAINNAME} },
- { label => N("IP forwarders:"), fixed_val => \$o->{var}{IPOFFORWARDER} },
+ { label => N("IP forwarder:"), fixed_val => \$o->{var}{IPOFFORWARDER} },
{ label => N("add search domain:"), fixed_val => \$o->{var}{ADDSEARCH} },
],
post => \&do_it_master,
@@ -241,11 +242,17 @@ $o->{pages} = {
endadd => {
name => N("Congratulations"),
data => [ { label => N("The wizard successfully add host in your DNS.") } ],
+ post => sub {
+ $o->{var}{CLIENTNAME} = '';
+ $o->{var}{CLIENTIP} = '';
+ },
+ no_back => 1,
next => 'addhost',
},
endremove => {
name => N("Congratulations"),
data => [ { label => N("The wizard successfully remove host in your DNS.") } ],
+ no_back => 1,
end => 1,
next => 0,
},
@@ -258,20 +265,11 @@ $o->{pages} = {
},
};
-sub check_dhcp {
- $wiz->{net}->is_dhcp and return 'dhcp_warning';
-}
-
sub test_srv {
my $dir = "/var/named/zone";
-d $dir or return 'error_nosrv';
}
-sub test_master {
- my $ft = "/var/named/master_srv";
- -f $ft or return 'error_notmaster';
-}
-
sub interface_to_ip {
my ($interface) = @_;
my ($ip) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
@@ -680,7 +678,6 @@ sub do_it_master {
return if $::testing;
my $in = 'interactive'->vnew('su', 'dns');
my $w = $in->wait_message(N("Master DNS server"), N("Configuring your system as Master DNS server ..."));
- my $ft = "/var/named/master_srv";
system("touch $ft");
do_it();
crea_iprev($IPSERVER, $DOMAINNAME);
@@ -719,7 +716,6 @@ sub get_shortname {
sub do_it_add {
return if $::testing;
- test_master();
test_srv();
my $iprev = get_spe_ip('iprev', $IPSERVER);
my $ipend = get_spe_ip('ipend', $o->{var}{CLIENTIP});
@@ -729,18 +725,16 @@ sub do_it_add {
} elsif (any { /$SNAME.$DOMAINNAME.$/ } cat_("$ZONE_DIR/db.$iprev.hosts")) {
return 'error_add';
} else {
- print "good add\n";
append_to_file("$ZONE_DIR/db.$DOMAINNAME.hosts",
- "$SNAME.$DOMAINNAME\tIN\tA\t$o->{var}{CLIENTIP}\n");
+ "$SNAME.$DOMAINNAME.\tIN\tA\t$o->{var}{CLIENTIP}\n");
append_to_file("$ZONE_DIR/db.$iprev.hosts",
- "$ipend\tIN\tPTR\t$SNAME.$DOMAINNAME\n");
+ "$ipend\tIN\tPTR\t$SNAME.$DOMAINNAME.\n");
}
system("service named reload");
}
sub do_it_remove {
return if $::testing;
- test_master();
test_srv();
my $iprev = get_spe_ip('iprev', $IPSERVER);
my $NAME = $o->{var}{CLIENTNAME};
@@ -749,7 +743,7 @@ sub do_it_remove {
s/^\s*$//;
} "$ZONE_DIR/db.$DOMAINNAME.hosts";
substInFile {
- s/^\d+\tIN\tPTR\t$NAME//;
+ s/^\d+\tIN\tPTR\t$NAME.*//;
s/^\s*$//;
} "$ZONE_DIR/db.$iprev.hosts";
system("service named reload");