[Ssh-sftp-perl-users] Printing register_handler buffer contents...
Brought to you by:
dbrobins
|
From: Michael A. <dae...@ya...> - 2006-10-31 02:33:47
|
Hi,=0A=0A=0AI'm using FreeBSD6.x, when running passwd, the passwd prompts l=
ooks like:=0A=0AChanging local password for username=0AOld Password:=0ANew =
Password:=0ARetype New Password:=0A=0Aso I change this portion of remoteint=
eract2.pl:=0A=0A=0A$ssh->register_handler("stderr", sub {=0A my($channel=
, $buffer) =3D @_;=0A my $str =3D $buffer->bytes;=0A=0A if ($str eq "=
Changing local password for username\nOld Password:") {=0A $channel-=
>send_data($old_password);=0Aprint "str1: $str";=0A }=0A=0A elsif ($s=
tr =3D~ /^New/) {=0A $channel->send_data($new_password);=0Aprint "st=
r2: $str";=0A }=0A=0A elsif ($str =3D~ /^Retype/) {=0A $channe=
l->send_data($new_password);=0Aprint "str3: $str";=0A }=0Aprint "My stri=
ng is: $str";=0A});=0A=0A=0A=0AThe last debug looks like this: I inserted p=
rint statements hoping to capture the string being received but unfortunate=
ly, only the last print statement gets executed..=0A=0A=0A=0ALogin complete=
d, opening dummy shell channel.=0Achannel 0: new [client-session]=0ARequest=
ing channel_open for channel 0.=0Achannel 0: open confirm rwindow 0 rmax 32=
768=0AGot channel open confirmation, requesting shell.=0ARequesting service=
shell on channel 0.=0Achannel 1: new [client-session]=0ARequesting channel=
_open for channel 1.=0AEntering interactive session.=0ASending command: pas=
swd=0ARequesting service exec on channel 1.=0Achannel 1: open confirm rwind=
ow 0 rmax 32768=0Ainput_channel_request: rtype exit-status reply 0=0Achanne=
l 1: rcvd eof=0Achannel 1: output open -> drain=0Achannel 1: rcvd close=0Ac=
hannel 1: input open -> closed=0Achannel 1: close_read=0AMy string is: Chan=
ging local password for username=0Apasswd: pam_chauthtok(): conversation fa=
ilure=0Achannel 1: obuf empty=0Achannel 1: output drain -> closed=0Achannel=
1: close_write=0Achannel 1: send close=0Achannel 1: full closed=0A=0AThe p=
assword doesn't seem to change. Perhaps it has something to do with "passwd=
: pam_chauthok(): conversation failure"=0AAny idea what's wrong here?=0A=0A=
Thanks..=0A=0A=0A=0A=0A=0A |