fsockopen question
Nick Guenther
kousue at gmail.com
Fri Jun 20 10:38:46 PDT 2008
On Fri, Jun 20, 2008 at 1:28 PM, Peter Hessler <phessler at theapt.org> wrote:
> On 2008 Jun 20 (Fri) at 13:00:47 -0400 (-0400), Nick Guenther wrote:
> :On Fri, Jun 20, 2008 at 11:47 AM, <soc at visca.com> wrote:
> :> Greetings:
> :>
> :> Using OpenBSD 4.2, PHP 5.23.
> :>
> :> Yesterday I got a complaint from a user that she couldn't send email
> :> using the php mail program. I traced the problem down to a problem
> :> with PHP's fsockopen function. Here's the script I used to test it:
> :>
> :> http://visca.com/php/fsockopen.php
> :> <?php
> :> $fp = fsockopen("localhost", 25, $errno, $errstr);
> :> if (!$fp) {
> :> echo "ERROR: $errno - $errstr<br />\n";
> :> } else {
> :> $response = fgets($fp);
> :> echo "Response is \"$response\"";
> :> }
> :> ?>
> :>
> :> As you'll see if you follow the link, the script hangs for 60 seconds
> :> then prints ?Response is ""?. Port 25 is open and working.
> :>
> :> Can anyone suggest where I might go from here to debug this?
> :
> :Are you sure it's fsockopen? You have to do some configuration to make
> :PHP's mail() call work.
> :Anyway, your code makes perfect sense and is doing exactly what you
> :tell it to: you're connecting to sendmail, then waiting for a response
> :that's not going to come because you haven't said "HELO" to sendmail.
> :I think OpenBSD's sendmail is configured to not send a banner until
> :you do, to mitigate port scanning.
>
> MTAs are required to send a banner upon connections. Clients aren't
> allowed to send data until they see the full welcome banner. spamd(8)
> uses that fact as part of its technique.
Oh, I guess I got confused about that. I'm sorry.
Soc: have you tried poking around with netcat?
-Nick
More information about the Openbsd-newbies
mailing list