ipv6 address must be in []
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 29 Jan 2006 11:18:22 +0000 (11:18 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 29 Jan 2006 11:18:22 +0000 (11:18 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10607 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_general.php

index 4a85407bf06672520fac95fa17ad98ec727ad9ff..714946a2bee6d0a919764788cd51e557a0e834bf 100755 (executable)
@@ -636,7 +636,10 @@ function sqimap_read_data ($imap_stream, $tag_uid, $handle_errors,
 function sqimap_create_stream($server,$port,$tls=0) {
     global $squirrelmail_language;
 
-    // FIXME: ipv6 address support
+    if (strstr($server,':') && ! preg_match("/^\[.*\]$/",$server)) {
+        // numerical IPv6 address must be enclosed in square brackets
+        $server = '['.$server.']';
+    }
 
     if ($tls == 1) {
         if ((check_php_version(4,3)) and (extension_loaded('openssl'))) {
@@ -649,7 +652,7 @@ function sqimap_create_stream($server,$port,$tls=0) {
                 _("TLS is enabled, but this version of PHP does not support TLS sockets, or is missing the openssl extension.").
                 '<br /><br />'.
                 _("Please contact your system administrator and report this error."),
-               sprintf(_("Error connecting to IMAP server: %s."), $server));
+                          sprintf(_("Error connecting to IMAP server: %s."), $server));
         }
     }
 
@@ -661,7 +664,7 @@ function sqimap_create_stream($server,$port,$tls=0) {
         require_once(SM_PATH . 'functions/display_messages.php');
         logout_error( sprintf(_("Error connecting to IMAP server: %s."), $server).
             "<br />\r\n$error_number : $error_string<br />\r\n",
-           sprintf(_("Error connecting to IMAP server: %s."), $server) );
+                      sprintf(_("Error connecting to IMAP server: %s."), $server) );
         exit;
     }
     $server_info = fgets ($imap_stream, 1024);