[rancid] Re: Any idea on why ssh would resolve hostnames differently from an interactive shell?

Janet Plato techgrrl2003 at yahoo.com
Wed Nov 28 20:14:34 UTC 2007


Hi John,

Thanks for replying.  So I figured this out yesterday.  One of the
variable $sshver is occasionally empty.  When spawn creates the ARGV
array it creates it with an empty item, ssh tries to resolve the empty
item thinking it is a hostname and fails.  When it closes, clogin sees
an EOF.  

If spawn sends it to bash -c "ssh $sshver etc" the empty $sshver simply
becomes a blank spot in the string, and ssh has to build the argv array
before exec'ing ssh, and so it works.

I replaced this:
       } elseif ![string compare $prog "ssh"] {
           if [ catch {spawn ssh $sshver -c $cyphertype -x -l $user
$router} reason ] {

with this:

         } elseif ![string compare $prog "ssh"] {
             set mycommand [concat ssh -c $cyphertype $sshver -x
$user@$router]
             if [ catch "spawn $mycommand" reason ] {
                 send_user "\nError: ssh failed: $reason\n"
                 exit 1
             }


and all is well.

Cheers,

Janet


--- john heasley <heas at shrubbery.net> wrote:

> Sun, Nov 25, 2007 at 06:07:02PM -0800, Janet Plato:
> >   I find myself extending the types of service to include ssh v2
> and I
> > am having some trouble, when I have expect "spawn ssh -x
> user at device"
> 
> my guess is the @ is buggering it.  try -l.
> 
> >   [pid 27642] recvfrom(4,
> > "\205\r\201\200\0\1\0\0\0\1\0\0\0\0\1\0\1\0\0\6\0\1\0\0" ..., 1024,
> 0,
> > {sa_family=AF_INET, sin_port=htons(53),
> > sin_addr=inet_addr("128.104.254.254")}, [16]) = 92
> >   [pid 27642] close(4)                    = 0
> >   [pid 27642] write(2, "ssh: : Name or service not known"..., 34) =
> 34
> >   [pid 27642] exit_group(255) 
> > 
> >   The strace manpage says the \### stuff is supposed to be in a
> format
> > a c programmer would understand, but I do not understand it.  Is it
> a
> > mix of octal and the \t, \r, \n we all know and love?  In some
> cases I
> > have seen \Dg which kind of throws the octal and normal escape
> sequence
> > theory out the window.  Knowing what strace is telling me would be
> a
> > fine start for me.
> 
> my guess would be those are decimal.  I'd expect octals to be \0xxx.
> 
> 



      ____________________________________________________________________________________
Be a better pen pal. 
Text or chat with friends inside Yahoo! Mail. See how.  http://overview.mail.yahoo.com/


More information about the Rancid-discuss mailing list