Hallo Roundcube developers. We are runnig ISPConfig hosting with dedicated mailserver. Here is small patch to login if web's A and MX is different. Please include it in new release.
Thanks Vitex diff -Naur /roundcubemail-0.8.4/config/main.inc.php.dist ./config/main.inc.php.dist --- /roundcubemail-0.8.4/config/main.inc.php.dist 2012-11-14 21:30:27.000000000 +0100 +++ ./config/main.inc.php.dist 2012-12-20 19:35:21.000000000 +0100 @@ -71,6 +71,7 @@ // %n - http hostname ($_SERVER['SERVER_NAME']) // %d - domain (http hostname without the first part) // %s - domain name after the '@' from e-mail address provided at login screen +// %x - MX for domain name after the '@' from e-mail address provided at login screen // For example %n = mail.domain.tld, %d = domain.tld $rcmail_config['default_host'] = ''; diff -Naur /roundcubemail-0.8.4/program/include/main.inc ./program/include/main.inc --- /roundcubemail-0.8.4/program/include/main.inc 2012-11-14 21:30:28.000000000 +0100 +++ ./program/include/main.inc 2012-12-20 19:27:50.000000000 +0100 @@ -1684,7 +1684,14 @@ return false; } - $name = str_replace(array('%n', '%d', '%h', '%z', '%s'), array($n, $d, $h, $z, $s[2]), $name); + if ( strpos($name, '%x') !== false ){ + $user_email = rcube_idn_convert(get_input_value('_user', RCUBE_INPUT_POST), true); + if ( preg_match('/(.*)@([a-z0-9\.\-\[\]\:]+)/i', $user_email, $s) < 1 || filter_var($s[1]."@".$s[2], FILTER_VALIDATE_EMAIL) === false ) + return false; + getmxrr ( $s[2] , $mx ); + } + + $name = str_replace(array('%n', '%d', '%h', '%z', '%s','%x'), array($n, $d, $h, $z, $s[2],$mx), $name); return $name; }
diff -Naur /home/vitex/Stažené/roundcubemail-0.8.4/config/main.inc.php.dist ./config/main.inc.php.dist --- /home/vitex/Stažené/roundcubemail-0.8.4/config/main.inc.php.dist 2012-11-14 21:30:27.000000000 +0100 +++ ./config/main.inc.php.dist 2012-12-20 19:35:21.000000000 +0100 @@ -71,6 +71,7 @@ // %n - http hostname ($_SERVER['SERVER_NAME']) // %d - domain (http hostname without the first part) // %s - domain name after the '@' from e-mail address provided at login screen +// %x - MX for domain name after the '@' from e-mail address provided at login screen // For example %n = mail.domain.tld, %d = domain.tld $rcmail_config['default_host'] = ''; diff -Naur /home/vitex/Stažené/roundcubemail-0.8.4/program/include/main.inc ./program/include/main.inc --- /home/vitex/Stažené/roundcubemail-0.8.4/program/include/main.inc 2012-11-14 21:30:28.000000000 +0100 +++ ./program/include/main.inc 2012-12-20 19:27:50.000000000 +0100 @@ -1684,7 +1684,14 @@ return false; } - $name = str_replace(array('%n', '%d', '%h', '%z', '%s'), array($n, $d, $h, $z, $s[2]), $name); + if ( strpos($name, '%x') !== false ){ + $user_email = rcube_idn_convert(get_input_value('_user', RCUBE_INPUT_POST), true); + if ( preg_match('/(.*)@([a-z0-9\.\-\[\]\:]+)/i', $user_email, $s) < 1 || filter_var($s[1]."@".$s[2], FILTER_VALIDATE_EMAIL) === false ) + return false; + getmxrr ( $s[2] , $mx ); + } + + $name = str_replace(array('%n', '%d', '%h', '%z', '%s','%x'), array($n, $d, $h, $z, $s[2],$mx), $name); return $name; }
_______________________________________________ Roundcube Development discussion mailing list dev@lists.roundcube.net http://lists.roundcube.net/mailman/listinfo/dev