[rancid] Submission: Modification to MTLOGIN to allow port# selection and longer line width count (for system package detail print)

Ehud Gavron gavron at wetwork.net
Mon Jul 13 22:06:57 UTC 2015


Thanks!  Sadly our RHEL6 and other servers are running 3.1...

Next time I'll check your source tree before duplicating effort on a feature
you've already added :)

Thank you for the work!

E

On 07/13/2015 03:01 PM, heasley wrote:
> Sat, Jul 11, 2015 at 04:51:55PM -0700, Ehud Gavron:
>> 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"] {
> we already have this for 3.2.  copy attached.
>
>> @@ -382,7 +389,7 @@
>>          return 1 }
>>  
>>      -re "$u_prompt"            {
>> -                      send -- "$user+ct\r"
>> +                      send -- "$user+ct200w\r"
>>                        set uprompt_seen 1
>>                        exp_continue
>>                      }
> that is a bizarre platform.  is it wrapping long lines, truncating or
> discarding?  Is there any reason that this username feature may not be
> supported?  eg: a minimum version, etc.
>
>
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20150713/3c78fdf8/attachment.html>


More information about the Rancid-discuss mailing list