[sork] passwd_expect patch

Jan Schneider jan at horde.org
Thu Nov 9 04:26:03 PST 2006


Zitat von Andrew Suffield <asuffield at suffields.me.uk>:

> The following patch was required for me to get passwd_expect to work
> correctly.
>
> --- passwd_expect	2006-11-09 10:58:53.000000000 +0000
> +++ passwd_expect	2006-11-09 10:59:33.000000000 +0000
> @@ -54,6 +53,8 @@
>
>  # read input from stdin
>
> +fconfigure stdin -blocking 1
> +
>  gets stdin user
>  gets stdin password(old)
>  gets stdin password(new)
> @@ -172,7 +168,8 @@
>  # log in
>  expect {
>    -re $fingerprint_string {sleep .5
> -                           send yes\r}
> +                           send yes\r
> +                           exp_continue}
>    -re $password_string    {sleep .5
>                             send $password(old)\r}
>    timeout                 {puts $err "Could not login to system (no  
> password prompt)\n"
>
> I cannot explain why stdin might be in non-blocking mode, but it was,
> and so sometimes expect would miss the username/password strings. I
> can only put this one down to deep crackfulness on the part of tcl,
> expect, apache, or php, and express my strong desire to never know
> what is going on there. Understanding this can only lead to
> pain. Forcing stdin into blocking mode ensures that it always works.
>
> The exp_continue is necessary because otherwise, if expect sees
> $fingerprint_string, it does not bother looking for $password_string
> or sending the old password. Obviously nobody ever tested this, it
> can't ever have worked.
> --
> Sork mailing list - Join the hunt: http://horde.org/bounties/#sork
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: sork-unsubscribe at lists.horde.org
>
>


Please create a ticket on http://bugs.horde.org/.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the sork mailing list