Discussion:
[rancid] Minor fix/update for hlogin ( and *login?).
Per-Olof Olsson
2013-02-27 07:47:30 UTC
Permalink
Hello


Testing some minor update for hlogin (rancid 2.3.8).

Sometimes I use hlogin to login to switches but get the session filtered by
hpuifilter. A bit hard to work with that output. I think this helps.


***@host bin]$ diff -c hlogin.in_ORG hlogin.in
*** hlogin.in_ORG 2013-01-21 07:05:47.357345221 +0100
--- hlogin.in 2013-02-27 07:56:51.332898135 +0100
***************
*** 328,336 ****
regexp {(telnet|ssh)(:([^[:space:]]+))*} $prog command suffix junk port
if [string match "telnet*" $prog] {
if {"$port" == ""} {
! set retval [ catch {spawn hpuifilter -- telnet $router} reason ]
} else {
! set retval [ catch {spawn hpuifilter -- telnet $router $port} reason ]
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
--- 328,344 ----
regexp {(telnet|ssh)(:([^[:space:]]+))*} $prog command suffix junk port
if [string match "telnet*" $prog] {
if {"$port" == ""} {
! if { $do_command || $do_script } {
! set retval [ catch {spawn hpuifilter -- telnet $router } reason ]
! } else {
! set retval [ catch {spawn telnet $router} reason ]
! }
} else {
! if { $do_command || $do_script } {
! set retval [ catch {spawn hpuifilter -- telnet -- $router $port}
reason ]
! } else {
! set retval [ catch {spawn telnet -- $router $port} reason ]
! }
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
***************
*** 346,352 ****
if {"$identfile" != ""} {
set cmd "$cmd -i $identfile"
}
! set retval [ catch {eval spawn hpuifilter -- [split "$cmd -c $cyphertype -x -l
$user $router" { }]} reason ]
if { $retval } {
send_user "\nError: $cmd failed: $reason\n"
return 1
--- 354,364 ----
if {"$identfile" != ""} {
set cmd "$cmd -i $identfile"
}
! if { $do_command || $do_script } {
! set retval [ catch {eval spawn hpuifilter -- [split "$cmd -c
$cyphertype -x -l $user $router" { }]} reason ]
! } else {
! set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user
$router" { }]} reason ]
! }
if { $retval } {
send_user "\nError: $cmd failed: $reason\n"
return 1



Testing to set negative port number to telnet shows that it don't work on RHlinux
(from "man cloginrc" " Example: add method * {ssh} {telnet:-3000} {rsh}").

Tested "add method <hostname> {telnet:-23}"

-----------------------
$ telnet <hostname> -23
telnet: invalid option -- '2'
Usage: telnet [-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]
[-n tracefile] [-b hostalias ] [-r]
[host-name [port]]
--------------------

I have to add "--" to telnet args in hlogin, "telnet -- $router $port"

or used positive port number and put
----------------------
DEFAULT
mode character
----------------------
or
----------------------
<hostname>
mode character
----------------------
in ~/.telnetrc


Is telnet special for RHlinux or update needed for telnet in all *login scripts
and/or add some notes in man page for cloginrc about ~/.telnetrc?


/Peo
----------------------------------------------------------
Per-Olof Olsson Email: ***@chalmers.se
Chalmers tekniska högskola IT-service
Hörsalsvägen 5 412 96 Göteborg
Tel: 031/772 6738 Fax: 031/772 8660
----------------------------------------------------------
heasley
2013-03-01 18:26:08 UTC
Permalink
Post by Per-Olof Olsson
Hello
Testing some minor update for hlogin (rancid 2.3.8).
Sometimes I use hlogin to login to switches but get the session filtered by
hpuifilter. A bit hard to work with that output. I think this helps.
I've always liked that it didnt mess with my terminal; ie: truncate it to
24 lines. but, ok; committed.
Post by Per-Olof Olsson
*** hlogin.in_ORG 2013-01-21 07:05:47.357345221 +0100
--- hlogin.in 2013-02-27 07:56:51.332898135 +0100
***************
*** 328,336 ****
...
Post by Per-Olof Olsson
Testing to set negative port number to telnet shows that it don't work on RHlinux
(from "man cloginrc" " Example: add method * {ssh} {telnet:-3000} {rsh}").
Tested "add method <hostname> {telnet:-23}"
-----------------------
$ telnet <hostname> -23
telnet: invalid option -- '2'
Usage: telnet [-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]
[-n tracefile] [-b hostalias ] [-r]
[host-name [port]]
--------------------
I have to add "--" to telnet args in hlogin, "telnet -- $router $port"
or used positive port number and put
----------------------
DEFAULT
mode character
----------------------
or
----------------------
<hostname>
mode character
----------------------
in ~/.telnetrc
Is telnet special for RHlinux or update needed for telnet in all *login scripts
and/or add some notes in man page for cloginrc about ~/.telnetrc?
I dont remember which client required the -; could have been BSD/OS. removed.

there is a note in the page referring to telnetrc; I dont want to duplicate the
manpage there, I would surely get it wrong or miss nuances of particular
implementations.
Per-Olof Olsson
2013-03-04 15:35:54 UTC
Permalink
Post by heasley
Post by Per-Olof Olsson
Hello
Testing some minor update for hlogin (rancid 2.3.8).
Sometimes I use hlogin to login to switches but get the session filtered by
hpuifilter. A bit hard to work with that output. I think this helps.
I've always liked that it didnt mess with my terminal; ie: truncate it to
24 lines. but, ok; committed.
Yes, good old HP2524 and HP41xx switches using 24 lines window.

New switches try to probe window size at login so it works well,
using proper window size.
Post by heasley
Post by Per-Olof Olsson
*** hlogin.in_ORG 2013-01-21 07:05:47.357345221 +0100
--- hlogin.in 2013-02-27 07:56:51.332898135 +0100
***************
*** 328,336 ****
...
Post by Per-Olof Olsson
Testing to set negative port number to telnet shows that it don't work on RHlinux
(from "man cloginrc" " Example: add method * {ssh} {telnet:-3000} {rsh}").
Tested "add method <hostname> {telnet:-23}"
-----------------------
$ telnet <hostname> -23
telnet: invalid option -- '2'
Usage: telnet [-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]
[-n tracefile] [-b hostalias ] [-r]
[host-name [port]]
--------------------
I have to add "--" to telnet args in hlogin, "telnet -- $router $port"
or used positive port number and put
----------------------
DEFAULT
mode character
----------------------
or
----------------------
<hostname>
mode character
----------------------
in ~/.telnetrc
Is telnet special for RHlinux or update needed for telnet in all *login scripts
and/or add some notes in man page for cloginrc about ~/.telnetrc?
I dont remember which client required the -; could have been BSD/OS. removed.
there is a note in the page referring to telnetrc; I dont want to duplicate the
manpage there, I would surely get it wrong or miss nuances of particular
implementations.
After I look in manuals ones more, I think all info needed is there.

It's best to restrict and not use options like "--" and negative port number to telnet
command, before tested it on all platforms.

Just recomend use of ~/.telnetrc to get "character mode", if port number is used.


/Peo

Loading...