php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9461 imap_open crash when connecting to nntp with username and password
Submitted: 2001-02-26 08:36 UTC Modified: 2001-05-27 15:35 UTC
From: bo at erichsen dot com Assigned:
Status: Closed Package: IMAP related
PHP Version: 4.0 Latest CVS (26/02/2001) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bo at erichsen dot com
New email:
PHP Version: OS:

 

 [2001-02-26 08:36 UTC] bo at erichsen dot com
function that causes crash
<?php>
imap_open('{newsserver/nntp}'.'test.test','username','password') || die("can't connect: ".imap_last_error());
</php>


backtrace from gdb ( i know it says nothing but i did as described in the backtrace faq.)
#0  0x0 in ?? ()

I have a problem with imap_open:
I can do imap_open on nntp server that has no authentication. But when i try on
a nntpserver that requires a password.. php dumps core (signal 11 gdb backtrace
is #0 0x0 in ?? ()) ( i executed the cgi version of php to be sure that apache
has nothing to do with it.)
i tested c-client with the mtest program and it worked perfectly.
I've tried to compile php4 with -enable-debug but i'm not so experienced with
gdb so when i load the core-file i still get no symbols or references to the
instruction that causes the problem.
it should be simple to test:


try to connect to a nntp server without username and password
try to connect to a nntp server that requires username and password


i have looked through the c-client code and the php4 extension and i could
imagine the problem might be in mm_login but i'm not certain.


the server is running:
php4.0.5-dev latest cvs
linux 2.2.12-20smp
imap (imap-2001.BETA.SNAP-0102201858) also tried (imap-4.7c)
All help is appreciated and if anybody wants more information or maybe a test
nntp account i can provide that (just send me a mail bo@erichsen.com).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-02 16:49 UTC] chagenbu@php.net
From:  James Treleaven <jametrel@enoreo.on.ca> 

Like the author of bug #9461, I also tracked the problem down to mm_login() in ext/imap/php_imap.c [that is where my stack was getting stomped].  I replaced the later two calls to strncpy() in the function, with calls to strcpy(), and now I can use the function to login to news servers with no 
problem! 

The code in mm_login() looks correct to me - but I cannot believe that there is a bug in Linux's libc.a:strncpy(). I have a web based gateway up and running with hundreds of user's using my modified imap_open() to successfully connect to nntp with their usernames and passwords (we always require authentication).  My modification seems to be a good workaround - but I don't know why. 
 [2001-05-03 15:32 UTC] chagenbu@php.net
Can you try 4.0.6-cvs and see if Andi's strlcopy change had any affect on this?
 [2001-05-27 15:35 UTC] sniper@php.net
Should be fixed in CVS and soon to be released 4.0.6.

Try PHP 4.0.6RC1: 

http://www.php.net/~andi/php-4.0.6RC1.tar.gz

--Jani

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 17:02:17 2025 UTC