changeset 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 5dc503f04424
children fd9ce7797984
files ChangeLog lib/ftpcommon.h lib/pty.c lib/rfc959.c lib/sshv2.c
diffstat 5 files changed, 61 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Aug 20 16:46:22 2004 +0000
+++ b/ChangeLog	Sat Aug 21 14:40:41 2004 +0000
@@ -1,3 +1,16 @@
+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
+
 2004-8-17 Brian Masney <masneyb@gftp.org>
 	* lib/sshv2.c - renamed read_buffer in sshv2_params to
 	transfer_buffer. In sshv2_put_next_file_chunk(), dynamically allocate
@@ -2761,7 +2774,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.312 2004/08/18 04:11:26 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.313 2004/08/21 14:40:41 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/ftpcommon.h	Fri Aug 20 16:46:22 2004 +0000
+++ b/lib/ftpcommon.h	Sat Aug 21 14:40:41 2004 +0000
@@ -27,7 +27,8 @@
                       * dataconn_rbuf;
   int data_connection;
   unsigned int is_ascii_transfer : 1,
-               is_fxp_transfer : 1;
+               is_fxp_transfer : 1,
+               quote_filename : 1;
   int (*auth_tls_start) (gftp_request * request);
   ssize_t (*data_conn_read) (gftp_request * request, void *ptr, size_t size,
                              int fd);
--- a/lib/pty.c	Fri Aug 20 16:46:22 2004 +0000
+++ b/lib/pty.c	Sat Aug 21 14:40:41 2004 +0000
@@ -324,7 +324,7 @@
 
       dup2 (s[1], 0);
       dup2 (s[1], 1);
-      dup2 (s[1], 2);
+      dup2 (ptysfd, 2);
       _gftp_close_all_fds (ptysfd);
 
       execvp (args[0], args);
--- a/lib/rfc959.c	Fri Aug 20 16:46:22 2004 +0000
+++ b/lib/rfc959.c	Sat Aug 21 14:40:41 2004 +0000
@@ -386,12 +386,14 @@
 static int
 rfc959_syst (gftp_request * request)
 {
+  rfc959_parms * parms;
   char *stpos, *endpos;
   int ret;
 
   g_return_val_if_fail (request != NULL, GFTP_EFATAL);
   g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL);
 
+  parms = request->protocol_data;
   ret = rfc959_send_command (request, "SYST\r\n", 1);
 
   if (ret < 0)
@@ -408,8 +410,14 @@
     return (GFTP_ERETRYABLE);
 
   *endpos = '\0';
+  parms->quote_filename = 0;
+
   if (strcmp (stpos, "UNIX") == 0)
-    request->server_type = GFTP_DIRTYPE_UNIX;
+    {
+      request->server_type = GFTP_DIRTYPE_UNIX;
+      if (strstr (endpos + 1, "BSD") == NULL)
+        parms->quote_filename = 1;
+    }
   else if (strcmp (stpos, "VMS") == 0)
     request->server_type = GFTP_DIRTYPE_VMS;
   else if (strcmp (stpos, "MVS") == 0 ||
@@ -1656,6 +1664,7 @@
 static int
 rfc959_chmod (gftp_request * request, const char *file, mode_t mode)
 {
+  rfc959_parms * parms;
   char *tempstr;
   int ret;
 
@@ -1663,7 +1672,12 @@
   g_return_val_if_fail (file != NULL, GFTP_EFATAL);
   g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL);
 
-  tempstr = g_strdup_printf ("SITE CHMOD %o \"%s\"\r\n", mode, file);
+  parms = request->protocol_data;
+  if (parms->quote_filename)
+    tempstr = g_strdup_printf ("SITE CHMOD %o \"%s\"\r\n", mode, file);
+  else
+    tempstr = g_strdup_printf ("SITE CHMOD %o %s\r\n", mode, file);
+
   ret = rfc959_send_command (request, tempstr, 1);
   g_free (tempstr);
 
@@ -1730,17 +1744,24 @@
 rfc959_set_file_time (gftp_request * request, const char *file, time_t datetime)
 {
   char *tempstr, *datestr;
+  rfc959_parms * parms;
   int ret;
 
   g_return_val_if_fail (request != NULL, GFTP_EFATAL);
   g_return_val_if_fail (file != NULL, GFTP_EFATAL);
   g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL);
 
+  parms = request->protocol_data;
+
   datestr = rfc959_time_t_to_mdtm (request, datetime);
   if (datestr == NULL)
     return (GFTP_EFATAL);
 
-  tempstr = g_strconcat ("SITE UTIME ", datestr, " \"", file, "\"\r\n", NULL);
+  if (parms->quote_filename)
+    tempstr = g_strconcat ("SITE UTIME ", datestr, " \"", file, "\"\r\n", NULL);
+  else
+    tempstr = g_strconcat ("SITE UTIME ", datestr, " ", file, "\r\n", NULL);
+
   g_free (datestr);
 
   ret = rfc959_send_command (request, tempstr, 1);
@@ -1806,6 +1827,7 @@
   sparms = src_request->protocol_data;
 
   dparms->data_connection = -1;
+  dparms->quote_filename = sparms->quote_filename;
   dparms->is_ascii_transfer = sparms->is_ascii_transfer;
   dparms->is_fxp_transfer = sparms->is_fxp_transfer;
   dparms->auth_tls_start = sparms->auth_tls_start;
--- 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,