From: Robin L. P. <rlp...@di...> - 2010-07-21 18:02:03
|
I don't know cygwin at all, but on normal linux or whatever it matters very much *how* you open the terminal, because passwords are often read differently than other things. Can you show us where $self->{exp}; is defined? Basically, *any* Expect related calls that occur before the code below? -Robin On Wed, Jul 21, 2010 at 09:39:50AM -0400, Jonathan wrote: > I have an application, a client module that control a server module, > that my group is automating tests for. This may be a cygwin problem, > I will have to try on a cross platform system as the server/client > model runs on Windows/Linux/Mac. However, does anyone have any > insight into why I can't send a password to this application with > cygwin. > > Output: > VPN> connect as5505-1.testbed > >> contacting host as5505-1.testbed.cisco.com) for login information... > >> notice: Contactingas5505-1.testbed > VPN> > >> Please enter your username and password. > Group: SSLVPNClient > > Username: [userA] userA > Password: test123 ************************* this is the > password, it picked up the password prompt but never is accepted.... I > can enter keystroke right when displaying as test123 and it will > connect. > No prompt. > > > Code: > > sub connect { > > if ($VpnHelper::Debug){ > print "Entering VpnHelper::connect\n"; > } > > my ($self, $hostname, $username, $password, $group) = @_; > my $exp = $self->{exp}; > my $connected = 0; > > if ($VpnHelper::Debug){ > print "Username is $username\n"; > print "Password is $password\n"; > print "Group is $group\n"; > print "Hostname is $hostname\n"; > } > > > #Make sure VPN is not already up > if ($self->connected){ > return $connected; > } > > $exp->send("connect $hostname\r"); > $exp->expect(15, > [ > '-re','Username:\s*(.*)', > sub { > my $fh = shift; > $fh->send("$username\r"); > exp_continue; > } > ], > [ > '-re','Password:\s*', > sub { > my $fh = shift; > $fh ->send("$password\r"); > exp_continue; > } > ], > [ > '-re','state:\sConnected', > sub { > my $fh = shift; > $connected = 1; > exp_continue; > } > ], > [ > '-re','VPN>', > sub { > my $fh = shift; > exp_continue; > } > > ], > > [ > eof => > sub { > die "ERROR: premature EOF in vpn shell.\n"; > } > ], > [ > timeout => > sub { > die "No prompt.\n"; > } > ] > ); > > } > > Thank you in advance, > Jonathan > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss -- http://singinst.org/ : Our last, best hope for a fantastic future. Lojban (http://www.lojban.org/): The language in which "this parrot is dead" is "ti poi spitaki cu morsi", but "this sentence is false" is "na nei". My personal page: http://www.digitalkingdom.org/rlp/ |