[tpop3d-discuss] a silly question

Ivan Matveyev hobot at zebratelecom.ru
Tue, 18 Feb 2003 17:35:17 +0300 (MSK)


On Tue, 18 Feb 2003, Chris Lightfoot 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 could send it to you, but to get the thing working (I mean the ability
of php script to get info from tpop3d) I had to modify
auth_other_send_request function (had to change all '\0' to '=' and '\t'
for proper work of php).

> > 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.
This helped a bit. Now I get "auth_other_new_user_pass: missing key
`result' in response". ;-( The response is just as quoted above with an
extra '\0' at the end.

> 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.
It seems to be no problem. Stdout is closed after the query is processed.


-- 
Ivan Matveyev, Zebra Telecom
Tech Dept, +7(095)741-0001