[prev in list] [next in list] [prev in thread] [next in thread]
List: squirrelmail-cvs
Subject: [SM-CVS] SF.net SVN: squirrelmail:[14430] branches/SM-1_4-STABLE/squirrelmail
From: pdontthink () users ! sourceforge ! net
Date: 2014-01-21 3:19:35
Message-ID: E1W5RsJ-0003u5-NP () sfs-ml-2 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 14430
http://sourceforge.net/p/squirrelmail/code/14430
Author: pdontthink
Date: 2014-01-21 03:19:33 +0000 (Tue, 21 Jan 2014)
Log Message:
-----------
Add ability to show login error from the IMAP server instead of traditional "Unknown \
user or password incorrect" (thanks to Alain Williams)
Modified Paths:
--------------
branches/SM-1_4-STABLE/squirrelmail/config/conf.pl
branches/SM-1_4-STABLE/squirrelmail/config/config_default.php
branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog
branches/SM-1_4-STABLE/squirrelmail/functions/imap_general.php
branches/SM-1_4-STABLE/squirrelmail/plugins/administrator/defines.php
Modified: branches/SM-1_4-STABLE/squirrelmail/config/conf.pl
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/config/conf.pl 2014-01-21 01:46:14 UTC (rev \
14429)
+++ branches/SM-1_4-STABLE/squirrelmail/config/conf.pl 2014-01-21 03:19:33 UTC (rev \
14430) @@ -364,6 +364,7 @@
$browser_rendering_mode = 'quirks' if ( !$browser_rendering_mode );
$use_transparent_security_image = 'true' if ( !$use_transparent_security_image );
$check_mail_mechanism = 'meta' if ( !$check_mail_mechanism );
+$display_imap_login_error = 'false' if ( !$display_imap_login_error );
if ( $ARGV[0] eq '--install-plugin' ) {
print "Activating plugin " . $ARGV[1] . "\n";
@@ -564,6 +565,7 @@
print "19. Browser rendering mode : \
$WHT$browser_rendering_mode$NRM\n";
print "20. Security image : $WHT" . \
(lc($use_transparent_security_image) eq 'true' ? 'Transparent' : 'Textual') . \
"$NRM\n";
print "21. Auto check mail mechanism : $WHT$check_mail_mechanism$NRM\n";
+ print "22. Display login error from IMAP: \
$WHT$display_imap_login_error$NRM\n"; print "\n";
print "R Return to Main Menu\n";
} elsif ( $menu == 5 ) {
@@ -786,6 +788,7 @@
elsif ( $command == 19 ) { $browser_rendering_mode = command319(); }
elsif ( $command == 20 ) { $use_transparent_security_image = \
command320(); }
elsif ( $command == 21 ) { $check_mail_mechanism = command321(); }
+ elsif ( $command == 22 ) { $display_imap_login_error = command322(); }
} elsif ( $menu == 5 ) {
if ( $command == 1 ) { command41(); }
elsif ( $command == 2 ) { $theme_css = command42(); }
@@ -2645,6 +2648,35 @@
+# display_imap_login_error (since 1.4.23)
+sub command322 {
+ print "Some IMAP servers return detailed information about why a login is\n";
+ print "being refused (the username or password could be invalid or there\n";
+ print "might be an administrative lock on the account).\n";
+ print "\n";
+ print "Enabling this option will cause SquirrelMail to display login failure\n";
+ print "messages directly from the IMAP server. When it is disabled, login\n";
+ print "failures are always reported to the user with the traditional \
\"Unknown\n"; + print "user or password incorrect.\"\n";
+ print "\n";
+
+ if ( lc($display_imap_login_error) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Display login error messages directly from the IMAP server? (y/n) \
[$WHT$default_value$NRM]: $WHT"; + $display_imap_login_error = <STDIN>;
+ if ( ( $display_imap_login_error =~ /^y\n/i ) || ( ( $display_imap_login_error \
=~ /^\n/ ) && ( $default_value eq "y" ) ) ) { + $display_imap_login_error = \
'true'; + } else {
+ $display_imap_login_error = 'false';
+ }
+ return $display_imap_login_error;
+}
+
+
+
####################################################################################
#### THEMES ####
sub command41 {
@@ -3687,6 +3719,9 @@
print CF "\$use_imap_tls = $use_imap_tls;\n";
print CF "\$use_smtp_tls = $use_smtp_tls;\n";
+ # boolean
+ print CF "\$display_imap_login_error = $display_imap_login_error;\n";
+
print CF "\$session_name = '$session_name';\n";
# boolean
Modified: branches/SM-1_4-STABLE/squirrelmail/config/config_default.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/config/config_default.php 2014-01-21 01:46:14 \
UTC (rev 14429)
+++ branches/SM-1_4-STABLE/squirrelmail/config/config_default.php 2014-01-21 03:19:33 \
UTC (rev 14430) @@ -285,6 +285,15 @@
$imap_auth_mech = 'login';
/**
+ * Show login error from the IMAP server (true) or show
+ * the traditional/generic "Unknown user or password
+ * incorrect" (false)?
+ *
+ * @global boolean $display_imap_login_error
+ */
+$display_imap_login_error = false;
+
+/**
* IMAP folder delimiter
*
* This is the delimiter that your IMAP server uses to distinguish between
Modified: branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog 2014-01-21 01:46:14 UTC (rev \
14429)
+++ branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog 2014-01-21 03:19:33 UTC (rev \
14430) @@ -65,10 +65,15 @@
check_mail_mechanism in /path/to/squirrelmail/src/left_main.php on
line 322...")
- Added advanced control over the SSL context used when connecting
- to the SMTP and IMAP servers over SSL/TLS (Thanks to Emmanuel
+ to the SMTP and IMAP servers over SSL/TLS (thanks to Emmanuel
Dreyfus). You can take a look at $imapSslOptions and $smtpSslOptions
in config_local.example.php in SquirrelMail version 1.5.2 for more
information.
+ - Added ability to show login error from the IMAP server instead of
+ traditional "Unknown user or password incorrect" (thanks to Alain
+ Williams). See $display_imap_login_error in the configuration
+ file or "4. General Options ==> 22. Display login error from IMAP"
+ in the configuration tool.
Version 1.4.22 - 12 July 2011
-----------------------------
Modified: branches/SM-1_4-STABLE/squirrelmail/functions/imap_general.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/imap_general.php 2014-01-21 \
01:46:14 UTC (rev 14429)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/imap_general.php 2014-01-21 \
03:19:33 UTC (rev 14430) @@ -481,7 +481,7 @@
*/
function sqimap_login ($username, $password, $imap_server_address, $imap_port, \
$hide, $ssl_options=array()) {
global $color, $squirrelmail_language, $onetimepad, $use_imap_tls, \
$imap_auth_mech,
- $sqimap_capabilities;
+ $sqimap_capabilities, $display_imap_login_error;
// Note/TODO: This hack grabs the $authz argument from the session
$authz = '';
@@ -702,7 +702,29 @@
sqsession_destroy();
/* terminate the session nicely */
sqimap_logout($imap_stream);
- logout_error( _("Unknown user or password incorrect.") );
+
+ // determine what error message to show to the user
+ //
+ $fail_msg = _("Unknown user or password incorrect.");
+ if ($display_imap_login_error) {
+ // See if there is an error message from the server
+ // Skip any rfc5530 response code: '[something]' at the
+ // start of the message
+ if (!empty($message)
+ && $message{0} == '['
+ && ($end = strstr($message, ']'))
+ && $end != ']') {
+ $message = substr($end, 1);
+ }
+ // Remove surrounding spaces and if there
+ // is anything left, display that as the
+ // error message:
+ $message = trim($message);
+ if (strlen($message))
+ $fail_msg = _($message);
+ }
+
+ logout_error($fail_msg);
exit;
}
} else {
Modified: branches/SM-1_4-STABLE/squirrelmail/plugins/administrator/defines.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/plugins/administrator/defines.php 2014-01-21 \
01:46:14 UTC (rev 14429)
+++ branches/SM-1_4-STABLE/squirrelmail/plugins/administrator/defines.php 2014-01-21 \
03:19:33 UTC (rev 14430) @@ -268,6 +268,9 @@
'$use_transparent_security_image' => array( 'name' => _("Use \
transparent security image"), 'type' => SMOPT_TYPE_BOOLEAN,
'default' => true ),
+ '$display_imap_login_error' => array( 'name' => _("Show login error \
message directly from IMAP server instead of generic one"), + \
'type' => SMOPT_TYPE_BOOLEAN, + 'default' => \
false ),
/* --------------------------------------------------------*/
'Group5' => array( 'name' => _("Message of the Day"),
'type' => SMOPT_TYPE_TITLE ),
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic