[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-plugins
Subject:    [SM-PLUGINS] Issue with vlogin + secure_login and
From:       Brett Johnson <brett () blzj ! com>
Date:       2009-09-24 13:08:52
Message-ID: 1253797732.28253.70.camel () homer
[Download RAW message or body]

Hello,

I am using SM 1.4.19 and I am having an issue with the vlogin 3.10.1
plugin in conjunction with the secure_login 1.4 plugin using the
allVirtualDomainsAreUnderOneHost setting. I'm not sure if the behavior I
am seeing is normal or not. My goal is when a user accesses a SM virtual
domain, they are redirected to a single SSL domain login page. The user
only enters their username (without @domain) to login. Vlogin should
append the virtual domain to the username. What I see is vlogin always
appends the SSL domain name to the username. 

Here are my configuration files:

secure_login/config.php
=======================
$change_back_to_http_after_login = 0;
$remain_in_https_if_logged_in_using_https = 0;
$allVirtualDomainsUnderOneSSLHost =
'https://secure.tld/###DOMAIN######PATH###';
$entryPointDomainPattern = '';
$entryPointPathPattern   = '';
$entryPointQueryPattern  = '';
$nonStandardHttpPort = '';
$sl_obey_x_forwarded_headers = 0;
$sl_debug = 0;

vlogin/data/config.php
======================
$useSessionBased = 0;
$virtualDomains = array(
'virt1' => array( 
'domain'     => 'virt1.tld',
'org_name'   => 'Virtual One',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt2' => array( 
'domain'     => 'virt2.tld',
'org_name'   => 'Virtual Two',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt3' => array( 
'domain'     => 'virt3.tld',
'org_name'   => 'Virtual Three',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt4' => array( 
'domain'     => 'virt4.tld',
'org_name'   => 'Virtual Four',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt5' => array( 
'domain'     => 'virt5.tld',
'org_name'   => 'Virtual Five',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
);
$useDomainFromVirtDomainsArray = 1;
$useDomainFromServerEnvironment = '';
$reverseDotSectionOrder = 0;
$numberOfDotSections = 2;
$removeFromFront = 1;
$checkByExcludeList = 1;
$notPartOfDomainName = array('www','mail','mail2','webmail');
$always_prepend = '';
$always_append = '';
$chopOffDotSectionsFromLeft = 0;
$chopOffDotSectionsFromRight = 0;
$at = '@';
$dot = '.';
$atConversion = array();
$forceLowercase = 0;
$replacements = array(
);
$alwaysAddHostName = 0;
$putHostNameOnFrontOfUsername = 0;
$dontUseHostName = 0;
$dontUseHostNameUserList = array(
);
$smHostIsDomainThatUserLoggedInWith = 1;
$removeDomainIfGiven = 0;
$usernameDomainIsHost = 0;
$rawLoginIsOutgoingEmailAddress = 0;
$appendDomainToOutgoingEmailAddress = 0;
$virtualDomainDataDir = '';
$allVirtualDomainsAreUnderOneHost = '/[\/]*(.*?)(\/|$)/';
$securePort = 443;
$stripDomainFromUserSubstitution = 0;
$usernameReplacements = array(
);
$sendmailVirtualUserTable = '';
$virtualUserTableDBFlavor = '';
$postProcessingPattern = '';
$postProcessingReplacement = '';
$translateHostnameTable = '';
$pathToQmail = '';
$default_org_logo = '';
$perUserSettingsFile = '';
$IMAPServerRules = array(
);
$SMTPServerRules = array(
);
$serviceLevelBackend = 0;
$internalServiceLevelFile =
'/path/to/squirrelmail/plugins/vlogin/data/service_levels.php';
$sqlServiceLevelQuery = 'SELECT service_level FROM users WHERE username
= "%1"';
$SQLDatabaseDomainLookup = '';
$SQLDatabaseUserLookup = '';
$SQLDatabaseServiceLevelLookup = '';
$vlogin_dsn = 'mysql://user:password@localhost/email_users';
$override_config_during_login = 1;
$vlogin_debug = 1;

Here is the vlogin debug output:

Your original username was:
test
> 
> ______________________________________________________________________
Your IMAP login was resolved to:
test@secure.tld
> 
> ______________________________________________________________________
$hostname is secure.tld

PHP_SELF is /webmail.virt1.tld/src/redirect.php

________________________________________________________________________
IMAP server: localhost


The PHP_SELF variable contains the correct virtual domain but the IMAP
login gets constructed with the SSL domain.

After playing around with the plugin a bit, I was able to get the plugin
to append the virtual domain by removing "$hostname ." from the
preg_match call in the determine_user_hostname function in
functions.php:

--- functions.orig      2009-09-24 08:46:22.000000000 -0400
+++ functions.php       2009-09-24 08:47:46.000000000 -0400
@@ -1025,7 +1025,7 @@
       // 
       // run pattern match against full URI starting after the protocol
(http(s)://)
       //
-      preg_match($allVirtualDomainsAreUnderOneHost, $hostname .
(strpos($_SERVER['PHP_SELF'], '/') === 0 ? '' : '/') .
$_SERVER['PHP_SELF'] . (empty($_SERVER['QUERY_STRING']) ? '' :
(strpos($_SERVER['QUERY_STRING'], '?') === 0 ? '' : '?') .
$_SERVER['QUERY_STRING']), $matches);
+      preg_match($allVirtualDomainsAreUnderOneHost,
(strpos($_SERVER['PHP_SELF'], '/') === 0 ? '' : '/') .
$_SERVER['PHP_SELF'] . (empty($_SERVER['QUERY_STRING']) ? '' :
(strpos($_SERVER['QUERY_STRING'], '?') === 0 ? '' : '?') .
$_SERVER['QUERY_STRING']), $matches);
       $hostname = $matches[1];
 
    }

Here is the debug output after making the change defined above:

Your original username was:
test

________________________________________________________________________
Your IMAP login was resolved to:
test@virt1.tld

________________________________________________________________________
$hostname is virt1.tld

PHP_SELF is /webmail.vitr1.tld/src/redirect.php

________________________________________________________________________
IMAP server: localhost

I am wondering if there is something wrong in my configuration or if
this behavior is a bug. If this behavior is incorrect, is the code
change I made above the correct solution, or is a better solution?

-- 
Regards,

Brett Johnson

CONFIDENTIAL NOTICE - The contents of this message, including any
attachments, are confidential and are intended solely for the use of the
person or entity to whom the message was addressed.  If you are not the
intended recipient of this message, please be advised that any
dissemination, distribution, or use of the contents of this message is
strictly prohibited. If you received this message in error, please
notify the sender. Please also permanently delete all copies of the
original message and any attached documentation. Thank you.




------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@lists.sourceforge.net
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): \
https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic