]> thyrsus.com Git - ssh-installkeys.git/commitdiff
Hang fix from Josh Glover.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 8 Jan 2004 05:47:07 +0000 (05:47 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 8 Jan 2004 05:47:07 +0000 (05:47 +0000)
ssh-installkeys

index 4052940c644b00c341ed0b42e54b65e3c9c0cfe7..df832702f70ae7f507f02183d280fb819a223418 100755 (executable)
@@ -14,7 +14,7 @@ Options:
 
 Author: Eric S. Raymond <esr@thyrsus.com>"""
 
-# $Id: ssh-installkeys,v 1.14 2003/12/04 01:26:59 esr Exp esr $
+# $Id: ssh-installkeys,v 1.15 2003/12/30 17:15:58 esr Exp esr $
 
 import os, sys, getopt, string, getpass, tempfile
 
@@ -63,7 +63,7 @@ A critical module was not found. Probably this OS does not support it.
 Currently pexpect is intended for UNIX operating systems (including OS-X)."""
 
 __version__ = '0.94'
-__revision__ = '$Revision: 1.14 $'
+__revision__ = '$Revision: 1.15 $'
 __all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn',
     '__version__', '__revision__']
 
@@ -575,14 +575,19 @@ class ssh_session:
         child = spawn(command)
         if self.verbose:
             sys.stderr.write("-> " + command + "\n")
-        seen = child.expect(['assword:', EOF])
-        if seen == 0:
-            if not self.password:
-                self.password = getpass.getpass('Remote password: ')
-            child.sendline(self.password)
-            seen = child.expect(EOF)
-        if self.verbose:
-            sys.stderr.write("<- " + child.before + "\n")
+        while True:
+            seen=child.expect([EOF,'assword:','continue connecting (yes/no)?'])
+            if seen == 0:
+                break
+            elif seen == 1:
+                if not self.password:
+                    self.password = getpass.getpass('Remote password: ')
+                child.sendline(self.password)
+                seen = child.expect(EOF)
+            elif seen == 2:
+                child.sendline("yes")
+            if self.verbose:
+                sys.stderr.write("<- " + child.before + "\n")
         return child.before
     def ssh(self, command):
         return self.__exec("ssh -l %s %s \"%s\""%(self.user,self.host,command))