[rancid] Submission: Modification to MTLOGIN to allow port# selection and longer line width count (for system package detail print)
Ehud Gavron
Ehud.Gavron at Login.COM
Sat Jul 11 23:51:55 UTC 2015
The following patch allows
"add method ip.address.goes.here ssh:nnnn" for MikroTik routers.
It also extends the line width so that wide line (200 characters)
responses don't mess up rancid.
Ehud Gavron
--- /usr/libexec/rancid/mtlogin 2015-05-30 11:16:40.000000000 -0700
+++ /home/rancid2/bin/mtlogin 2015-05-15 15:14:01.923740909 -0700
@@ -309,9 +309,16 @@
send_user "\nError: telnet failed: $reason\n"
return 1
}
- } elseif ![string compare $prog "ssh"] {
- if [ catch {spawn $sshcmd -c $cyphertype -x -l $user+ct $router} reason ] {
- send_user "\nError: $sshcmd failed: $reason\n"
+ } elseif [string match "ssh*" $prog] {
+ regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
+ set cmd $sshcmd
+ if {"$port" != ""} {
+ set retval [ catch {spawn $sshcmd -p $port -c $cyphertype -x -l $user+ct200w $router} reason ]
+ } else {
+ set retval [ catch {spawn $sshcmd -c $cyphertype -x -l $user+ct200w $router} reason ]
+ }
+ if { $retval } {
+ send_user "\nError: $sshcmd failed: $reason\n"
return 1
}
} elseif ![string compare $prog "rsh"] {
@@ -382,7 +389,7 @@
return 1 }
-re "$u_prompt" {
- send -- "$user+ct\r"
+ send -- "$user+ct200w\r"
set uprompt_seen 1
exp_continue
}
More information about the Rancid-discuss
mailing list