IO::Socket was loaded without checking. Script failed with compilation
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 19 Jul 2006 07:56:48 +0000 (07:56 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 19 Jul 2006 07:56:48 +0000 (07:56 +0000)
errors, if IO::Socket was not available.

0x80-0xFF (no Unicode support) range is actually more accurate than
0x80-0xFFFF (with Unicode support)

fixed $use_imap_tls and $use_smtp_tls checks.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11412 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
config/conf.pl

index baa11fd7be50606caf13596fa7d647ab8f2dd1c1..9ac593a549f39dc15bfae65c5cf9f0e386c5d61f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -104,6 +104,9 @@ Version 1.5.2 - CVS
     config_base_location to config.php and a new option to conf.pl. This is
     to prevent problems in installs where our heuristic doesn't work
     correctly (#1521299, #1460675, #1110064, #1000850, #1113791).
+  - Removed conf.pl dependency on Perl IO::Socket module. Automatic detection
+    of supported authentication mechanisms is disabled, if IO::Socket is not
+    available.
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
index 05f51c3ba12816c1782c7ef12ecd7f8f6f5a485a..35c5eee7f51235f795ddc2566b323eb643b72740 100755 (executable)
@@ -1287,8 +1287,11 @@ sub command111 {
 # Now offers to detect supported mechs, assuming server & port are set correctly
 
 sub command112a {
-    if ($use_imap_tls =~ /^true\b/i) {
-        print "Auto-detection of login methods is unavailable when using TLS.\n";
+    if ($use_imap_tls ne "0") {
+        # 1. Script does not handle TLS.
+        # 2. Server does not have to declare all supported authentication mechs when 
+        #    STARTTLS is used. Supported mechs are declared only after STARTTLS.
+        print "Auto-detection of login methods is unavailable when using TLS or STARTTLS.\n";
     } else {
         print "If you have already set the hostname and port number, I can try to\n";
         print "detect the mechanisms your IMAP server supports.\n";
@@ -1350,9 +1353,10 @@ sub command112a {
 # SMTP authentication type
 # Possible choices: none, plain, cram-md5, digest-md5
 sub command112b {
-    if ($use_smtp_tls =~ /^true\b/i) {
-        print "Auto-detection of login methods is unavailable when using TLS.\n";
-    } else {
+    if ($use_smtp_tls ne "0") {
+        print "Auto-detection of login methods is unavailable when using TLS or STARTTLS.\n";
+    } elsif (eval ("use IO::Socket; 1")) {
+        # try loading IO::Socket module
         print "If you have already set the hostname and port number, I can try to\n";
         print "automatically detect some of the mechanisms your SMTP server supports.\n";
         print "Auto-detection is *optional* - you can safely say \"n\" here.\n";
@@ -1366,7 +1370,6 @@ sub command112b {
             # Special case!
             # Check none by trying to relay to junk@microsoft.com
             $host = $smtpServerAddress . ':' . $smtpPort;
-            use IO::Socket;
             my $sock = IO::Socket::INET->new($host);
             print "Testing none:\t\t$WHT";
             if (!defined($sock)) {
@@ -4501,13 +4504,16 @@ sub change_to_rel_path() {
     return $new_path;
 }
 
-sub detect_auth_support {
 # Attempts to auto-detect if a specific auth mechanism is supported.
 # Called by 'command112a' and 'command112b'
 # ARGS: service-name (IMAP or SMTP), host:port, mech-name (ie. CRAM-MD5)
-
+sub detect_auth_support {
+    # Try loading IO::Socket
+    unless (eval("use IO::Socket; 1")) {
+        print "Perl IO::Socket module is not available.";
+        return undef;
+    }
     # Misc setup
-    use IO::Socket;
     my $service = shift;
     my $host = shift;
     my $mech = shift;
@@ -4603,15 +4609,15 @@ sub clear_screen() {
 # checks IMAP mailbox name. Refuses to accept 8bit folders
 # returns 0 (folder name is not correct) or 1 (folder name is correct)
 sub check_imap_folder($) {
-    # Unicode support was added in Perl 5.6, use a less useful range in earlier versions
+    # Unicode support was added in Perl 5.6, use simple 8bit range in earlier versions
     if($] >= 5.6) {
+        # Using iso-10646 range, because x80-xFF range does not match unicode chars
         my $reg = '[\x{80}-\x{FFFF}]';
     } else {
         my $reg = '[\x80-\xFF]';
     }
     my $folder_name = shift(@_);
     if ($folder_name =~ /$reg/) {
-        # check for 8bit. Using iso-10646 range, because x80-xFF range does not match unicode chars
         print "Folder name contains 8bit characters. Configuration utility requires\n";
         print "UTF7-IMAP encoded folder names.\n";
         print "Press any key to continue...";