Bug sur la génération des MX

This commit is contained in:
Alan Garcia 2011-03-28 12:28:37 +00:00
parent e44b5a153d
commit 886f8b9d9b
4 changed files with 33 additions and 21 deletions

View File

@ -73,6 +73,8 @@ class m_dom {
var $type_ipv6 = "IPV6"; var $type_ipv6 = "IPV6";
var $type_cname = "CNAME"; var $type_cname = "CNAME";
var $type_txt = "TXT"; var $type_txt = "TXT";
var $type_mx = "MX";
var $type_mx2 = "MX2";
var $action_insert = "0"; var $action_insert = "0";
var $action_update= "1"; var $action_update= "1";
@ -347,16 +349,16 @@ class m_dom {
if (!$force) { if (!$force) {
$v=checkhostallow($domain,$this->dns); $v=checkhostallow($domain,$this->dns);
if ($v==-1) { if ($v==-1) {
$err->raise("dom",7); // TLD interdit $err->raise("dom",7); // TLD interdit
return false; return false;
} }
if ($dns && $v==-2) { if ($dns && $v==-2) {
$err->raise("dom",12); // Domaine non trouvé dans le whois $err->raise("dom",12); // Domaine non trouvé dans le whois
return false; return false;
} }
if ($dns && $v==-3) { if ($dns && $v==-3) {
$err->raise("dom",23); // Domaine non trouvé dans le whois $err->raise("dom",23); // Domaine non trouvé dans le whois
return false; return false;
} }
if ($dns) $dns="1"; else $dns="0"; if ($dns) $dns="1"; else $dns="0";
@ -365,11 +367,11 @@ class m_dom {
if ($tld[$v]==5) $dns=0; if ($tld[$v]==5) $dns=0;
// It must be a real domain (no subdomain) // It must be a real domain (no subdomain)
if (!$dns) { if (!$dns) {
$v=checkhostallow_nodns($domain); $v=checkhostallow_nodns($domain);
if ($v) { if ($v) {
$err->raise("dom",22); $err->raise("dom",22);
return false; return false;
} }
} }
} }
// Check the quota : // Check the quota :
@ -385,8 +387,8 @@ class m_dom {
$db->query("SELECT domaine FROM domaines WHERE compte='$cuid' AND domaine='$slavedom';"); $db->query("SELECT domaine FROM domaines WHERE compte='$cuid' AND domaine='$slavedom';");
$db->next_record(); $db->next_record();
if (!$db->Record["domaine"]) { if (!$db->Record["domaine"]) {
$err->raise("dom",1,$slavedom); $err->raise("dom",1,$slavedom);
$isslave=false; $isslave=false;
} }
// Point to the master domain : // Point to the master domain :
$this->set_sub_domain($domain, '', $this->type_url, 'http://www.'.$slavedom); $this->set_sub_domain($domain, '', $this->type_url, 'http://www.'.$slavedom);
@ -399,7 +401,7 @@ class m_dom {
$domshort=str_replace("-","",str_replace(".","",$domain)); $domshort=str_replace("-","",str_replace(".","",$domain));
if (! is_dir($dest_root . "/". $domshort)) { if (! is_dir($dest_root . "/". $domshort)) {
mkdir($dest_root . "/". $domshort); mkdir($dest_root . "/". $domshort);
} }
// Creation des 3 sous-domaines par défaut : Vide, www et mail // Creation des 3 sous-domaines par défaut : Vide, www et mail
@ -407,24 +409,32 @@ class m_dom {
$this->set_sub_domain($domain, 'www', $this->type_local, '/'. $domshort); $this->set_sub_domain($domain, 'www', $this->type_local, '/'. $domshort);
$this->set_sub_domain($domain, 'mail', $this->type_webmail, ''); $this->set_sub_domain($domain, 'mail', $this->type_webmail, '');
} }
if ($mx) {
$this->set_sub_domain($domain, '', $this->type_mx, $GLOBALS['L_DEFAULT_MX']);
if (! empty($GLOBALS['L_DEFAULT_SECONDARY_MX'])) {
$this->set_sub_domain($domain, '', $this->type_mx2, $GLOBALS['L_DEFAULT_SECONDARY_MX']);
}
}
// DEPENDANCE : // DEPENDANCE :
// Lancement de add_dom sur les classes domain_sensitive : // Lancement de add_dom sur les classes domain_sensitive :
// Declenchons les autres classes. // Declenchons les autres classes.
foreach($classes as $c) { foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_add_domain")) { if (method_exists($GLOBALS[$c],"alternc_add_domain")) {
$GLOBALS[$c]->alternc_add_domain($domain); $GLOBALS[$c]->alternc_add_domain($domain);
} }
} }
foreach($classes as $c) { foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_add_mx_domain")) { if (method_exists($GLOBALS[$c],"alternc_add_mx_domain")) {
$GLOBALS[$c]->alternc_add_mx_domain($domain); $GLOBALS[$c]->alternc_add_mx_domain($domain);
} }
} }
if ($isslave) { if ($isslave) {
foreach($classes as $c) { foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_add_slave_domain")) { if (method_exists($GLOBALS[$c],"alternc_add_slave_domain")) {
$GLOBALS[$c]->alternc_add_slave_domain($domain,$slavedom); $GLOBALS[$c]->alternc_add_slave_domain($domain,$slavedom);
} }
} }
} }
return true; return true;

View File

@ -81,6 +81,9 @@ NS2_HOSTNAME=""
# Mail server hostname # Mail server hostname
DEFAULT_MX="" DEFAULT_MX=""
# Secondary mail server hostname
DEFAULT_SECONDARY_MX=""
# Note: MySQL username/password configuration now stored in /etc/alternc/my.cnf # Note: MySQL username/password configuration now stored in /etc/alternc/my.cnf
# quels clients mysql sont permis (%, localhost, etc) # quels clients mysql sont permis (%, localhost, etc)

2
debian/po/fr.po vendored
View File

@ -19,10 +19,10 @@ msgstr ""
"PO-Revision-Date: 2006-04-26 11:16+0200\n" "PO-Revision-Date: 2006-04-26 11:16+0200\n"
"Last-Translator: Benjamin Sonntag <benjamin@sonntag.fr>\n" "Last-Translator: Benjamin Sonntag <benjamin@sonntag.fr>\n"
"Language-Team: Team AlternC <team@alternc.org>\n" "Language-Team: Team AlternC <team@alternc.org>\n"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n" "Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#. Type: boolean #. Type: boolean
#. Description #. Description

View File

@ -16,4 +16,3 @@ $TTL 1D
IN NS %%ns1%%. IN NS %%ns1%%.
IN NS %%ns2%%. IN NS %%ns2%%.
IN MX 5 %%mx%%.