diff lib/sshv2.c @ 541:e46278e7ef1d

2004-8-21 Brian Masney <masneyb@gftp.org> * lib/rfc959.c lib/ftpcommon.h - added internal option to quote the filename in the SITE command. This is only enabled for servers that return UNIX in the SYST output. It is disabled if it is a BSD based FTP server * lib/sshv2.c (sshv2_start_login_sequence) - pass the search strings through gettext so that logins will work properly for non-english users * lib/pty.c (gftp_exec) - redirect STDERR of the child process to the opened pty so that stderr is shown properly in the log window
author masneyb
date Sat, 21 Aug 2004 14:40:41 +0000
parents ee182b8d1a54
children 5d13fa48c275
line wrap: on
line diff
--- a/lib/sshv2.c	Fri Aug 20 16:46:22 2004 +0000
+++ b/lib/sshv2.c	Sat Aug 21 14:40:41 2004 +0000
@@ -304,8 +304,13 @@
 static int
 sshv2_start_login_sequence (gftp_request * request, int fdm, int ptymfd)
 {
+  static char *pwstrs[] = {N_("Enter passphrase for RSA key"),
+                           N_("Enter passphrase for key '"),
+                           N_("Password"),
+                           N_("password"),
+                           NULL};
   char *tempstr, *temp1str, *pwstr, *yesstr = "yes\n", *securid_pass;
-  int wrotepw, ok, maxfd, ret, clear_tempstr;
+  int wrotepw, ok, maxfd, ret, clear_tempstr, pwidx;
   size_t rem, len, diff;
   fd_set rset, eset;
   ssize_t rd;
@@ -381,10 +386,15 @@
       rem -= rd;
       diff += rd;
 
-      if (strcmp (tempstr, "Password:") == 0 || 
-          (diff >= 10 && strcmp (tempstr + diff - 9, "assword: ") == 0) ||
-          strstr (tempstr, "Enter passphrase for RSA key") != NULL ||
-          strstr (tempstr, "Enter passphrase for key '") != NULL)
+      /* See if we are at the enter password prompt... */
+      for (pwidx = 0; pwstrs[pwidx] != NULL; pwidx++)
+        {
+          if (strstr (tempstr, pwstrs[pwidx]) != NULL ||
+              strstr (tempstr, _(pwstrs[pwidx])) != NULL)
+            break;
+        }
+
+      if (pwstrs[pwidx] != NULL)
         {
           clear_tempstr = 1;
           if (wrotepw)
@@ -400,7 +410,8 @@
               break;
             }
         }
-      else if (diff > 10 && strcmp (tempstr + diff - 10, "(yes/no)? ") == 0)
+      else if (strstr (tempstr, "(yes/no)?") != NULL ||
+               strstr (tempstr, _("(yes/no)?")) != NULL)
         {
           clear_tempstr = 1;
           if (!gftpui_protocol_ask_yes_no (request, request->hostname, tempstr))
@@ -417,7 +428,8 @@
                 }
             }
         }
-      else if (strstr (tempstr, "Enter PASSCODE:") != NULL)
+      else if (strstr (tempstr, "Enter PASSCODE:") != NULL ||
+               strstr (tempstr, _("Enter PASSCODE:")) != NULL)
         {
           clear_tempstr = 1;
           securid_pass = gftpui_protocol_ask_user_input (request,