DNS Import issue
Summary
In the DNS import module, I am encountering a problem. Once the domain-module is activated, I tried to import the first zone and it worked correctly (it was the very first zone; I had no active zones in this ISPConfig installation). Then I moved on to the second zone, but it gives an error saying, "This zone already exists, you must delete or rename it first." However, the second zone I am trying to import does not yet exist. I tried to do some debugging and the problem seems to be the foreach loop at line 191 of the file /usr/local/ispconfig/interface/web/dns/dns_import.php,which sets the variable $domain in an array while it should be an integer or at most a string, because a few lines (at 202) below, it is used in the method checkDomainModuleDomain, which does not accept an array as a parameter.
Steps to reproduce
- Enable domain-module
- Add domain to import to domain-module
- Import zone from DNS module
Correct behaviour
It should import the zone correctly.
Environment
Server OS + version: Ubuntu 20.04
ISPConfig version: 3.2.11p2
Proposed fix
To resolve this, I changed the name of the variable $domain set at line 66 in the file /usr/local/ispconfig/interface/web/dns/dns_import.php to $import_domain, also changing line 202 accordingly with the new variable name.
$domain= (isset($_POST['domain'])&&!empty($_POST['domain']))?$_POST['domain']:NULL;
to
$import_domain= (isset($_POST['domain'])&&!empty($_POST['domain']))?$_POST['domain']:NULL;
and
$domain_check = $app->tools_sites->checkDomainModuleDomain($domain);
to
$domain_check = $app->tools_sites->checkDomainModuleDomain($import_domain);