[rancid] Re: HP Procurve (hlogin): interaction in configure mode: possible?

john heasley heas at shrubbery.net
Fri Jan 18 00:14:59 UTC 2008


Tue, Jan 15, 2008 at 02:28:20PM +0100, Emmanuel Halbwachs:
> Hello,
> 
> First, thank you very much for your answer.
> 
> john heasley a ?crit (Sat, Jan 12, 2008 at 06:08:43PM +0000) :
> > you need
> > 	-c "conf t; foo; exit"
> 
> Yes, you're right, it was missing in my example.
> 
> > 2) it appears that hlogin has difficulty with the prompt changing.  A change
> > was applied to clogin to make this work, but apparently not applied
> > to hlogin.  you should be able to work-around it using the -x
> > method.

the attached patch should fix both issues; -c and -x.

> Well, I tried this as well (I forgot to tell it) and it hangs the same
> way:
> 
> root at sionet:~# cat ~eh/rancid/rancid-cmd
> conf t
> sh sys
> exit
> 
> root at sionet:~# /usr/lib/rancid/bin/hlogin -v foo -e bar -x ~eh/rancid/rancid-cmd switch
> switch
> spawn hpuifilter -- telnet switch
> Trying 145.238.x.y...
> Connected to switch.obspm.fr.
> Escape character is '^]'.
> HP J4899B ProCurve Switch 2650
> Firmware revision H.08.60
> 
> Copyright (C) 1991-2005 Hewlett-Packard Co.  All Rights Reserved.
> 
>                            RESTRICTED RIGHTS LEGEND
> 
>  Use, duplication, or disclosure by the Government is subject to restrictions
>  as set forth in subdivision (b) (3) (ii) of the Rights in Technical Data and
>  Computer Software clause at 52.227-7013.
> 
>          HEWLETT-PACKARD COMPANY, 3000 Hanover St., Palo Alto, CA 94303
> 
> Password:
> 
> switch> enable
> Password:
> switch#
> switch# no page
> switch#  conf t
> 
> -> hang
> 
> Error: TIMEOUT reached
> 
> I will try rancid 2.3.2a7 to see if it give some improvement on the
> subject.
> 
> Nevertheless, I am still open to any hint with HP and configure mode
> ;-)
> 
> 
> -- 
> Emmanuel Halbwachs
> Resp. R?seau/S?curit?                    Observatoire de Paris-Meudon
> tel      : (+33)1 45 07 75 54                   5 Place Jules Janssen
> fax      : (+33)1 45 07 76 13                    F 92195 MEUDON CEDEX
-------------- next part --------------
Index: hlogin.in
===================================================================
RCS file: /home/rancid/.CVS/rancid/bin/hlogin.in,v
retrieving revision 1.43
diff -d -u -r1.43 hlogin.in
--- hlogin.in	16 Nov 2007 02:22:53 -0000	1.43
+++ hlogin.in	18 Jan 2008 00:12:46 -0000
@@ -503,7 +503,8 @@
 
     # Turn off the pager and escape regex meta characters in the $prompt
     send "no page\r"
-    regsub -all "\[)(]" $prompt {\\&} reprompt
+    regsub -all {[)(]} $prompt {\\&} reprompt
+    regsub -all {^(.{1,11}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
     expect {
 	-re $reprompt	{}
 	-re "\[\n\r]+"	{ exp_continue }



More information about the Rancid-discuss mailing list