[tpop3d-discuss] a silly question

Chris Lightfoot chris at ex-parrot.com
Tue, 18 Feb 2003 14:19:35 +0000


On Tue, Feb 18, 2003 at 04:25:57PM +0300, Ivan Matveyev wrote:
> I am trying to get auth_other work. I've already made my php shell script
> get info from tpop3d, but I have no idea what is the problem with getting
> the result string from the script.

Hmm. That's a new one on me -- I'd welcome an example to
put in the distribution when you've got it working.

> I only get this message: "auth_other_recv_response: read: Bad file
> descriptor; killing child".
> 
> Here goes php function, which writes to stdout:
> 
> function stdout($what)
>     {
>     $fd=fopen("php://stdout","w");
>     fwrite($fd,$what);
>     logs($what);
>     fclose($fd);
>     }
> 
> That's the only output from the script.
> 
> sample function call:
> 
> stdout("result\0YES\0uid\0mail\0gid\0mail\0");
> 
> Any ideas?

Um. Firstly, the packet you send should end with two \0s,
so you should either append one in your function, or in
the data that you send.

Secondly, the `bad file descriptor' error probably
indicates that your program has closed its stdout so that
auth-other can't read from it any more. Could it be
exiting after processing a request? A quick test suggests
that your function stdout(...) doesn't, in fact, cause fd
1 to be closed, but your intention would probably be more
clear if you had stdout as a stream available globally.

-- 
The trouble with conspiracy theories is
that they assume the government is organised.