[prev in list] [next in list] [prev in thread] [next in thread]
List: squirrelmail-cvs
Subject: [SM-CVS] SF.net SVN: squirrelmail:[14431] trunk/squirrelmail
From: pdontthink () users ! sourceforge ! net
Date: 2014-01-21 3:20:48
Message-ID: E1W5RtT-0002mM-EY () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 14431
http://sourceforge.net/p/squirrelmail/code/14431
Author: pdontthink
Date: 2014-01-21 03:20:48 +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:
--------------
trunk/squirrelmail/config/conf.pl
trunk/squirrelmail/config/config_default.php
trunk/squirrelmail/doc/ChangeLog
trunk/squirrelmail/functions/imap_general.php
trunk/squirrelmail/plugins/administrator/defines.php
Modified: trunk/squirrelmail/config/conf.pl
===================================================================
--- trunk/squirrelmail/config/conf.pl 2014-01-21 03:19:33 UTC (rev 14430)
+++ trunk/squirrelmail/config/conf.pl 2014-01-21 03:20:48 UTC (rev 14431)
@@ -495,6 +495,7 @@
$check_referrer = '' if ( !$check_referrer );
$ask_user_info = 'true' if ( !$ask_user_info );
$use_transparent_security_image = 'true' if ( !$use_transparent_security_image );
+$display_imap_login_error = 'false' if ( !$display_imap_login_error );
if ( $ARGV[0] eq '--install-plugin' ) {
print "Activating plugin " . $ARGV[1] . "\n";
@@ -727,6 +728,7 @@
print "18. Disable secure forms : \
$WHT$disable_security_tokens$NRM\n";
print "19. Page referal requirement : $WHT$check_referrer$NRM\n";
print "20. Security image : $WHT" . \
(lc($use_transparent_security_image) eq 'true' ? 'Transparent' : 'Textual') . \
"$NRM\n"; + print "21. Display login error from IMAP: \
$WHT$display_imap_login_error$NRM\n"; print "\n";
print "R Return to Main Menu\n";
} elsif ( $menu == 5 ) {
@@ -1004,6 +1006,7 @@
elsif ( $command == 18 ) { $disable_security_tokens = command320(); }
elsif ( $command == 19 ) { $check_referrer = command321(); }
elsif ( $command == 20 ) { $use_transparent_security_image = \
command322(); } + elsif ( $command == 21 ) { $display_imap_login_error = \
command323(); } } elsif ( $menu == 5 ) {
if ( $command == 1 ) { $use_icons = commandB3(); }
# elsif ( $command == 3 ) { $icon_theme_def = command53(); }
@@ -2879,6 +2882,35 @@
+# display_imap_login_error (since 1.5.2)
+sub command323 {
+ 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;
+}
+
+
+
sub command_userThemes {
print "\nDefine the user themes that you wish to use. If you have added\n";
print "a theme of your own, just follow the instructions (?) about\n";
@@ -5194,6 +5226,8 @@
print CF "\$use_imap_tls = $use_imap_tls;\n";
# boolean
print CF "\$use_smtp_tls = $use_smtp_tls;\n";
+ # boolean
+ print CF "\$display_imap_login_error = $display_imap_login_error;\n";
# string
print CF "\$session_name = '$session_name';\n";
# boolean
Modified: trunk/squirrelmail/config/config_default.php
===================================================================
--- trunk/squirrelmail/config/config_default.php 2014-01-21 03:19:33 UTC (rev 14430)
+++ trunk/squirrelmail/config/config_default.php 2014-01-21 03:20:48 UTC (rev 14431)
@@ -299,6 +299,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: trunk/squirrelmail/doc/ChangeLog
===================================================================
--- trunk/squirrelmail/doc/ChangeLog 2014-01-21 03:19:33 UTC (rev 14430)
+++ trunk/squirrelmail/doc/ChangeLog 2014-01-21 03:20:48 UTC (rev 14431)
@@ -354,9 +354,9 @@
attachment MIME type.
- Fixed sqauth_read_password() for plugins on the login_verified hook.
- Forced addition of a file suffix to attachments that lack a filename
- (helps forwarded messages avoid spam filters) (Thanks to Petr
+ (helps forwarded messages avoid spam filters) (thanks to Petr
Kletecka) (#3139004).
- - Added smtp_authenticate hook (Thanks to Emmanuel Dreyfus).
+ - Added smtp_authenticate hook (thanks to Emmanuel Dreyfus).
- Allow administrators to configure subfolders of user INBOXes to be
treated as special folders by adding $subfolders_of_inbox_are_special
to config_local.php.
@@ -384,9 +384,14 @@
- Full date and time is used as "title" (mouseover) text for dates
shown on the message list screen
- 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). See $imapSslOptions and $smtpSslOptions in
config_local.example.php 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 ==> 21. Display login error from IMAP"
+ in the configuration tool.
Version 1.5.1 (branched on 2006-02-12)
--------------------------------------
Modified: trunk/squirrelmail/functions/imap_general.php
===================================================================
--- trunk/squirrelmail/functions/imap_general.php 2014-01-21 03:19:33 UTC (rev 14430)
+++ trunk/squirrelmail/functions/imap_general.php 2014-01-21 03:20:48 UTC (rev 14431)
@@ -821,7 +821,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;
+ $imap_auth_mech, $sqimap_capabilities, $display_imap_login_error;
// Note/TODO: This hack grabs the $authz argument from the session. In the short \
future, // a new argument in function sqimap_login() will be used instead.
@@ -996,8 +996,30 @@
/* terminate the session nicely */
sqimap_logout($imap_stream);
- if ($hide == 3) return _("Unknown user or password incorrect.");
- logout_error( _("Unknown user or password incorrect.") );
+
+ // determine what error message to use
+ //
+ $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);
+ }
+
+ if ($hide == 3) return $fail_msg;
+ logout_error($fail_msg);
exit;
}
} else {
Modified: trunk/squirrelmail/plugins/administrator/defines.php
===================================================================
--- trunk/squirrelmail/plugins/administrator/defines.php 2014-01-21 03:19:33 UTC (rev \
14430)
+++ trunk/squirrelmail/plugins/administrator/defines.php 2014-01-21 03:20:48 UTC (rev \
14431) @@ -296,6 +296,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