php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14931 Apache hangs when using imap with SSL
Submitted: 2002-01-08 12:54 UTC Modified: 2002-04-24 11:31 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: janek at tartu dot cv dot ee Assigned:
Status: Closed Package: IMAP related
PHP Version: 4.1.1 OS: Linux
Private report: No CVE-ID: None
 [2002-01-08 12:54 UTC] janek at tartu dot cv dot ee
'./configure' '--with-apache=../apache_1.3.22' '--with-mysql=/usr' '--enable-track-vars' '--disable-debug' '--with-openssl=/usr' '--with-zlib' '--enable-calendar' '--with-curl' '--with-dom' '--with-gd' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--enable-xslt' '--with-xslt-sablot' '--with-expat-dir=/usr'

RedHat 7.2
imap-2000c-15
openssl-0.9.6b-8

imap_open("{mail.server:993/imap/ssl/novalidate-cert}", "username", "passwd");
hangs the Apache instance. I can track that it connects to the right port but username is not sent. When trying to connect without ssl everything works. So is this PHP problem or ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-09 21:42 UTC] dwchin at umich dot edu
I've experienced exactly the same thing when compiling PHP 4.1.1 as an Apache dynamic module:

./configure  --prefix=/var/www --enable-xml --with-mcrypt=/var/www --with-gettext --with-imap=/usr/local/src/pine4.40/imap --with-imap-ssl --with-apxs --with-kerberos=/usr/kerberos

I don't think Apache "hangs": it seems like the authentication protocol times out.

This happens both with: "imap/ssl" and "imap/ssl/novalidate-cert".  Have not tried POP3/SSL.

I am certain the problem is not with the c-client code (from the Pine 4.40 distribution) because the pine executable that was compiled with the same c-client negotiates IMAP/ssl/novalidate-cert just fine.
 [2002-01-09 21:49 UTC] dwchin at umich dot edu
Oh, yes:  The IMAP server is Courier-IMAP.  Apache apache-1.3.22-1.7.1 on RedHat 7.1.

The maillog has no entries from the imapd-ssl server.

The bug was discovered when testing a Horde (2.0)/IMP (3.0) installation.
 [2002-01-10 22:54 UTC] dwchin at umich dot edu
Some more verbose log output (from using Horde):

Jan 10 22:48:23 HORDE [debug] [imp] $imp['stream'] = ; $connstr = {tenaya.physics.lsa.umich.edu:993/imap/ssl/novalidate-cert}; $imp['pass'] = xxxxxx [on line 329 of 
"/var/www/html/horde/imp/lib/IMP.php"]

Jan 10 22:48:23 HORDE [error] [imp] FAILED LOGIN 198.129.208.14 to tenaya.physics.lsa.umich.edu:993[imap/ssl/novalidate-cert] as gurney [on line 347 of "/var/www/html/horde/imp/lib/IMP.php"]

The code fragment that produces the appropriate variables above is:

$imp['stream'] = @imap_open($connstr, $imp['user'], Secret::read(Secret::getKey('imp'), $imp['pass']));
 [2002-01-10 22:55 UTC] dwchin at umich dot edu
So it looks like imap_open() doesn't return a "stream".
 [2002-01-10 23:00 UTC] dwchin at umich dot edu
Removing the "@" from imap_open() gives this warning message:

Warning: Couldn't open stream {tenaya.physics.lsa.umich.edu:993/imap/ssl/novalidate-cert} in /var/www/html/horde/imp/lib/IMP.php on
line 322
 [2002-04-24 06:59 UTC] juszkiew at kt dot agh dot edu dot pl
I think, I found the solution. I tested it on php 4.1.2.

File ext/imap/php_imap.c has got call to function
ssl_onceonlyinit (); 

It should be _after_ calls to 

mail_link(&imapdriver);         /* link in the imap driver */
        mail_link(&nntpdriver);         /* link in the nntp driver */
        mail_link(&pop3driver);         /* link in the pop3 driver */
        mail_link(&mbxdriver);          /* link in the mbx driver */
        mail_link(&tenexdriver);        /* link in the tenex driver */
        mail_link(&mtxdriver);          /* link in the mtx driver */
        mail_link(&dummydriver);        /* link in the dummy driver */

I think that call 
  auth_link (&auth_ssl);

also can help.
 [2002-04-24 11:31 UTC] sniper@php.net
Fixed in CVS. Fix will also be in PHP 4.2.1.

(I didn't notice any difference though, but that's what
the order is also in linkage.c created during the c-client
compile)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC