diff -Naur squirrelmail-1.4.13/config/config_local.php /usr/share/squirrelmail/config/config_local.php --- squirrelmail-1.4.13/config/config_local.php 2007-07-10 10:52:53.000000000 -0400 +++ /usr/share/squirrelmail/config/config_local.php 2006-08-30 06:53:58.000000000 -0400 @@ -7,10 +7,11 @@ * Don't do it unless you know what you're doing. * Use standard PHP syntax, see config.php for examples. * - * @copyright © 2002-2007 The SquirrelMail Project Team + * @copyright © 2002-2006 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version $Id: config_local.php 12522 2007-07-10 14:52:53Z kink $ + * @version $Id: config_local.php,v 1.2.2.3 2006/04/14 22:27:07 jervfors Exp $ * @package squirrelmail * @subpackage config */ +?> \ No newline at end of file diff -Naur squirrelmail-1.4.13/config/config.php /usr/share/squirrelmail/config/config.php --- squirrelmail-1.4.13/config/config.php 1969-12-31 19:00:00.000000000 -0500 +++ /usr/share/squirrelmail/config/config.php 2006-08-30 06:53:58.000000000 -0400 @@ -0,0 +1,176 @@ + \ No newline at end of file diff -Naur squirrelmail-1.4.13/functions/global.php /usr/share/squirrelmail/functions/global.php --- squirrelmail-1.4.13/functions/global.php 2007-11-27 16:26:57.000000000 -0500 +++ /usr/share/squirrelmail/functions/global.php 2008-03-29 01:09:02.000000000 -0400 @@ -9,6 +9,23 @@ * @package squirrelmail */ + /* Ensim virtualization hack */ + if (($_GET['site_domain'] != '') || ($_POST['site_domain'] != '')){ + if ($_GET['site_domain'] != ''){ + $s_Domain = $_GET['site_domain']; + } else { + $s_Domain = $_POST['site_domain']; + } + $i_nPos = strpos($s_Domain,'/'); + if ($i_nPos > 0){ + $s_Domain = substr($s_Domain,0,$i_nPos); + } + if (preg_match('/^([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', trim(htmlspecialchars(str_replace('/','',$s_Domain))))) { + define('SITE_DOMAIN',$s_Domain); + + } + } + /** * Set constants */ @@ -120,6 +137,12 @@ sqstripslashes($_POST); } +/** Save the current domain (virtual) or load from session */ +/** Fix variables for virtualization hack */ + if (defined('SITE_DOMAIN')){ + sqsession_register(SITE_DOMAIN,'site_domain'); + } + /** * returns true if current php version is at mimimum a.b.c * diff -Naur squirrelmail-1.4.13/functions/prefs.php /usr/share/squirrelmail/functions/prefs.php --- squirrelmail-1.4.13/functions/prefs.php 2007-08-09 02:52:17.000000000 -0400 +++ /usr/share/squirrelmail/functions/prefs.php 2008-03-29 00:09:56.000000000 -0400 @@ -16,6 +16,16 @@ require_once(SM_PATH . 'functions/global.php'); require_once(SM_PATH . 'functions/plugin.php'); +/* virtualization patch */ + sqgetGlobalVar('site_domain', $domain ); +if ($domain != ""){ + $SITE_ROOT = "/home/virtual/$domain"; + $org_name = "$domain"; + $org_title = "E-Mail - $username"; + $data_dir = "/home/virtual/$domain/var/squirrelmail/data/"; + $attachment_dir = "/home/virtual/$domain/var/squirrelmail/attachments/"; +} + /** include this for error messages */ include_once(SM_PATH . 'functions/display_messages.php'); diff -Naur squirrelmail-1.4.13/src/login.php /usr/share/squirrelmail/src/login.php --- squirrelmail-1.4.13/src/login.php 2007-11-18 23:20:34.000000000 -0500 +++ /usr/share/squirrelmail/src/login.php 2008-03-29 00:37:06.000000000 -0400 @@ -161,6 +161,8 @@ $username_form_name = 'login_username'; $password_form_name = 'secretkey'; +/* Ensim virtualization hack */ +$domain_form_name = 'site_domain'; do_hook('login_top'); @@ -213,6 +215,8 @@ addInput($username_form_name, $loginname_value), 'left', '', 'width="70%"' ) ) . "\n" . +/* Ensim virtualization hack */ + getDomainTag(). html_tag( 'tr', html_tag( 'td', _("Password:") , @@ -240,5 +244,24 @@ echo '' . "\n"; do_hook('login_bottom'); + +/* Ensim virtualization hack */ + function getDomainTag() + { + global $domain_form_name; + + if (!defined('SITE_DOMAIN')){ + return html_tag( 'tr', + html_tag( 'td', + _("Domain:") , + 'right', '', 'width="30%"' ) . + html_tag( 'td',addInput($domain_form_name, ""), + 'left', '', 'width="*"' ) + ) . "\n"; + } else { + return '' . "\n"; + } + } + ?> diff -Naur squirrelmail-1.4.13/src/redirect.php /usr/share/squirrelmail/src/redirect.php --- squirrelmail-1.4.13/src/redirect.php 2007-08-29 03:25:36.000000000 -0400 +++ /usr/share/squirrelmail/src/redirect.php 2008-03-29 01:08:30.000000000 -0400 @@ -49,6 +49,11 @@ if(!sqGetGlobalVar('squirrelmail_language', $squirrelmail_language) || $squirrelmail_language == '') { $squirrelmail_language = $squirrelmail_default_language; } +/* Ensim virtualization patch */ +sqGetGlobalVar('site_domain',$site_domain); +if ($site_domain){ + sqsession_register ($site_domain,'site_domain'); +} if (!sqgetGlobalVar('mailtodata', $mailtodata)) { $mailtodata = ''; @@ -78,6 +83,11 @@ /* remove redundant spaces */ $login_username = trim($login_username); + /* Ensim virtual domain support */ + if (is_valid_email($login_username)==false) { + $login_username = $login_username.'@'.$domain; + } + /* Verify that username and password are correct. */ if ($force_username_lowercase) { $login_username = strtolower($login_username); @@ -165,7 +175,16 @@ $redirect_url .= urlencode($mailtodata); } +/* Ensim virtualization hack */ +function is_valid_email ($address) { + return (preg_match( + '/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+'. // the user name + '@'. // the ubiquitous at-sign + '([-0-9A-Z]+\.)+' . // host, sub-, and domain names + '([0-9A-Z]){2,4}$/i', // top-level domain (TLD) + trim($address))); +} /* Write session data and send them off to the appropriate page. */ session_write_close();