Re: Calling Expect from PHP

From: Icarus Sparry (usenet_at_icarus.freeuk.com)
Date: 06/08/05


Date: Wed, 08 Jun 2005 19:13:08 GMT

On 2005-06-08, unidave@gmail.com <unidave@gmail.com> wrote:
> It does still work from the command line. Telnet's -d flag gives a
> premission denied message (look in the following debug output)
> -----------------------------------------------------
> spawn telnet -d mail.fccgi.com 110
> parent: waiting for sync byte
> parent: telling child to go ahead
> parent: now unsynchronized from child
> spawn: returns {1083}
>
> expect: does "" (spawn_id exp32) match glob pattern "+OK"? no
> Trying 192.168.24.3...
>
> expect: does "Trying 192.168.24.3...\r\r\n" (spawn_id exp32) match glob
> pattern "+OK"? no
> setsockopt (SO_DEBUG): Permission denied

[snip]

> spawn telnet -d mail.fccgi.com 110
> parent: waiting for sync byte
> parent: telling child to go ahead
> parent: now unsynchronized from child
> spawn: returns {1097}
>
> expect: does "" (spawn_id exp5) match glob pattern "+OK"? no
> Trying 192.168.24.3...
>
> expect: does "Trying 192.168.24.3...\r\r\n" (spawn_id exp5) match glob
> pattern "+OK"? no
> Connected to mail.fccgi.com (192.168.24.3).
>
> expect: does "Trying 192.168.24.3...\r\r\nConnected to mail.fccgi.com
> (192.168.24.3).\r\r\n" (spawn_id exp5) match glob pattern "+OK"? no
> Escape character is '^]'.
>
> expect: does "Trying 192.168.24.3...\r\r\nConnected to mail.fccgi.com
> (192.168.24.3).\r\r\nEscape character is '^]'.\r\r\n" (spawn_id exp5)
> match glob pattern "+OK"? no
> +OK Microsoft Exchange Server 2003 POP3 server version 6.5.7226.0
> (mail.fccgi.com

[snip]

> send: sending "pass b984\r" to { exp5 }

If that is your password, remember to change it!

> Pop is spawned by xinetd. I don't know how to determine how it may be
> affecting it's behavior.
I don't use xinetd myself, so we are in even deeper waters than my lack
of PHP knowledge.

How many different 'telnet' programs do you have on your system?
Note that when you use the '-d' from the command line it is happy, but
when you use it from the web page it complains.

If you are using 'bash', then 'type -a telnet' may point out more than
one version. Can you change the 'spawn telnet -d $host 110' to something
like 'spawn /usr/bin/telnet -d $host 110' in your script and see if that
helps.

If it doesn't then try

spawn -nottycopy telnet -d $host 110

to alter the way that the pty that is driving the telnet is set up.



Relevant Pages

  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)
  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)
  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)
  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)
  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)