Bug 63809

Summary: imap support non-functional in latest php
Product: [Retired] Red Hat Linux Reporter: David Lawrence <dkl>
Component: phpAssignee: Phil Copeland <copeland>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-04-18 22:25:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Lawrence 2002-04-18 22:25:38 UTC
Description of Problem:  
imap support not behaving properly in latest php-imap package. If I downgrade 
to php that shipped with 7.2 I can get this to work. Here is the sample script 
I am using to test. 
 
<html> 
<head><title> PHP IMAP Test Page </title></head> 
<body bgcolor="#ffffff"> 
 
<?php 
 
$username = "test"; 
$password = "password"; 
$mailserver = "127.0.0.1:143"; 
 
$mbox = imap_open ("\{$mailserver}INBOX", $username, $password); 
 
echo "<p><h1>Mailboxes</h1>\n"; 
$folders = imap_listmailbox ($mbox, "{localhost}", "*"); 
 
if ($folders == false) { 
        echo "Call failed<br>\n"; 
} else { 
        while (list ($key, $val) = each ($folders)) { 
                echo $val."<br>\n"; 
        } 
} 
 
echo "<p><h1>Headers in INBOX</h1>\n"; 
$headers = imap_headers ($mbox); 
 
if ($headers == false) { 
        echo "Call failed<br>\n"; 
} else { 
        while (list ($key,$val) = each ($headers)) { 
                echo $val."<br>\n"; 
        } 
} 
imap_close($mbox); 
 
?> 
 
</body> 
</html> 
 
Here is the output I get in the browser. 
 
Warning: Couldn't open stream {localhost:143}INBOX in 
/var/www/html/test_imap.php on line 11 
  
Mailboxes 
Warning: Supplied argument is not a valid imap resource in 
/var/www/html/test_imap.php on line 14 
 Call failed 
  
Headers in INBOX 
Warning: Supplied argument is not a valid imap resource in 
/var/www/html/test_imap.php on line 25 
 Call failed 
  
Warning: Supplied argument is not a valid imap resource in 
/var/www/html/test_imap.php on line 34 
   
 
Version-Release number of selected component (if applicable):  
php-4.1.2-7 
php-imap-4.1.2-7 
  
Additional Information:  
I have properly enable IMAP support in xinet.d and I can successfully connect 
as the test user when doing the following line from the console 
 
[test@dhcp59-206 test]$ mutt -f '{localhost:143}INBOX'

Comment 1 Phil Copeland 2002-04-19 07:42:02 UTC
This is caused by a change of behaviour.

Even if you don't ASK for ssl negotiation, the connection will always try and
negotiate ssl and when the client tries to validate the server's certificate, it
fails.

The script is *almost* correct.
The problem is that the imap/ssl interaction uses a self signed certificate that
we supply that instead of being signed by a cert authority,  ergo the ssl
connection will fail because it's not signed by a trusted authority.

You need to change
  $mailserver = "127.0.0.1:143"; 
to
  $mailserver = "127.0.0.1:143/novalidate-cert"; 

and suddenly everything will be fine again.. or you could go pay lots of money
to a key certificate authority (CA) and get yourself a certificate that will
pass the validation checks.

Phil
=--=