OS: Centos 6.3
Webmin Version: 1.690
b9ddns version: 1.0.4
Attempting to create an A record in a dynamic-master where the IP address is already in use by another A record. Filling out the new host information, entering in the already-in-use IP address and clicking CREATE causes the error...
...to be printed on the results webpage and the record is not saved.
If the space between #! and /usr/bin/perl is taken out of the shebang line in save_record.cgi, then the following error occurs.
Error - Perl execution failed
...and the record is not saved.
NOTE: Creating a CNAME record for the host that already has an A record does work properly but that doesn't solve the original issue because eventually the CNAME record will need to be deleted and a new A record created when the services on the original host move to a new ip address.
It is beacuse the $rec_name is undefined while calling ip_in_use at save_record.cgi
Change it to:
It should ignore when it is undefined.
Additionally, you can copy the error subrotine from web-lib-funcs.pl to b9ddns-lib.pl as terror.
Something like below after "do 'records-lib.pl';":
sub terror
{
$main::no_miniserv_userdb = 1;
my $msg = join("", @);
$msg =~ s/<[^>]*>//g;
if (!$main::error_must_die) {
print STDERR "Error: ",$msg,"\n";
}
&load_theme_library();
if ($main::error_must_die) {
if ($gconfig{'error_stack'}) {
print STDERR "Error: ",$msg,"\n";
for(my $i=0; my @stack = caller($i); $i++) {
print STDERR "File: $stack[1] Line: $stack[2] ",
"Function: $stack[3]\n";
}
}
die @;
}
elsif (!$ENV{'REQUEST_METHOD'}) {
# Show text-only error
print STDERR "$text{'error'}\n";
print STDERR "-----\n";
print STDERR ($main::whatfailed ? "$main::whatfailed : " : ""),
$msg,"\n";
print STDERR "-----\n";
if ($gconfig{'error_stack'}) {
# Show call stack
print STDERR $text{'error_stack'},"\n";
for(my $i=0; my @stack = caller($i); $i++) {
print STDERR &text('error_stackline',
$stack[1], $stack[2], $stack[3]),"\n";
}
}
elsif (defined(&theme_error)) {
&theme_error(@);
}
else {
&header($text{'error'}, "");
print "
\n";
print "
",($main::whatfailed ? "$main::whatfailed : " : ""),
\n";@,"
if ($gconfig{'error_stack'}) {
# Show call stack
print "
$text{'error_stack'}
\n";print "\n";
}
print "
\n";
if ($ENV{'HTTP_REFERER'} && $main::completed_referers_check) {
&footer("javascript:history.back()", $text{'error_previous'});
}
else {
&footer();
}
}
&unlock_all_files();
&cleanup_tempnames();
exit(1);
}