changeset 65:4b5fec7711e9

2002-11-25 Brian Masney <masneyb@gftp.org> * lib/misc.c (ssh_start_login_sequence) - fixes for when the initial SSH banner is bigger than 200 characters * lib/local.c (local_connect) - set request->hostname to local filesystem * lib/protocols.c (gftp_parse_url) - don't include 2 slashes for the directory when parsing a local URL * src/gtk/chmod_dialog.c (chmod_dialog) - allow multiple files to be selected * src/gtk/dnd.c - small fixes
author masneyb
date Tue, 26 Nov 2002 14:58:13 +0000
parents 29128554eb86
children cd3e457cbc85
files ChangeLog lib/local.c lib/misc.c lib/protocols.c src/gtk/chmod_dialog.c src/gtk/dnd.c
diffstat 6 files changed, 47 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 23 14:34:25 2002 +0000
+++ b/ChangeLog	Tue Nov 26 14:58:13 2002 +0000
@@ -1,3 +1,18 @@
+2002-11-25 Brian Masney <masneyb@gftp.org>
+	* lib/misc.c (ssh_start_login_sequence) - fixes for when the initial
+	SSH banner is bigger than 200 characters
+
+	* lib/local.c (local_connect) - set request->hostname to local
+	filesystem
+
+	* lib/protocols.c (gftp_parse_url) - don't include 2 slashes for 
+	the directory when parsing a local URL
+
+	* src/gtk/chmod_dialog.c (chmod_dialog) - allow multiple files to be
+	selected
+
+	* src/gtk/dnd.c - small fixes
+
 2002-11-23 Brian Masney <masneyb@gftp.org>
 	* lib/sshv2.c - added more error checking so that the user won't get
 	disconnected if they enter files or directories that don't exist
@@ -292,7 +307,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.39 2002/11/23 14:34:24 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.40 2002/11/26 14:58:10 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/local.c	Sat Nov 23 14:34:25 2002 +0000
+++ b/lib/local.c	Tue Nov 26 14:58:13 2002 +0000
@@ -59,6 +59,9 @@
   g_return_val_if_fail (request != NULL, -2);
   g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, -2);
 
+  if (request->hostname == NULL)
+    request->hostname = g_strdup (_("local filesystem"));
+
   if (request->directory)
     {
       if (chdir (request->directory) != 0)
--- a/lib/misc.c	Sat Nov 23 14:34:25 2002 +0000
+++ b/lib/misc.c	Tue Nov 26 14:58:13 2002 +0000
@@ -857,14 +857,14 @@
 char *
 ssh_start_login_sequence (gftp_request * request, int fd)
 {
-  char *tempstr, *pwstr, *key_pos, *tmppos;
-  size_t rem, len, diff, lastdiff;
+  char *tempstr, *pwstr, *tmppos;
+  size_t rem, len, diff, lastdiff, key_pos;
   int wrotepw, ok;
   ssize_t rd;
 
   rem = len = SSH_LOGIN_BUFSIZE;
-  key_pos = tempstr = g_malloc0 (len + 1);
-  diff = lastdiff = 0;
+  tempstr = g_malloc0 (len + 1);
+  key_pos = diff = lastdiff = 0;
   wrotepw = 0;
   ok = 1;
 
@@ -881,20 +881,9 @@
           ok = 0;
           break;
         }
-
-      tempstr[diff + rd] = '\0';
       rem -= rd;
       diff += rd;
-      if (rem <= 1)
-        {
-          tempstr = g_realloc (tempstr, len + SSH_LOGIN_BUFSIZE);
-
-          request->logging_function (gftp_logging_recv, request->user_data,
-                                     "%s", tempstr + lastdiff);
-          lastdiff = diff;
-          len += SSH_LOGIN_BUFSIZE;
-          rem = SSH_LOGIN_BUFSIZE;
-        }
+      tempstr[diff] = '\0'; 
 
       if (diff > 11 && strcmp (tempstr + diff - 10, "password: ") == 0)
         {
@@ -911,10 +900,11 @@
               break;
             }
         }
-      else if ((tmppos = strstr (key_pos, "Enter passphrase for RSA key")) != NULL ||
-               ((tmppos = strstr (key_pos, "Enter passphrase for key '")) != NULL))
+      else if (diff > 2 && strcmp (tempstr + diff - 2, ": ") == 0 &&
+               ((tmppos = strstr (tempstr + key_pos, "Enter passphrase for RSA key")) != NULL ||
+                ((tmppos = strstr (tempstr + key_pos, "Enter passphrase for key '")) != NULL)))
         {
-          key_pos = tmppos + 1;
+          key_pos = diff;
           if (wrotepw)
             {
               ok = SSH_ERROR_BADPASS;
@@ -928,13 +918,23 @@
               break;
             }
         }
-      else if (diff >= 10 && strcmp (tempstr + diff - 10, "(yes/no)? ") == 0)
+      else if (diff > 10 && strcmp (tempstr + diff - 10, "(yes/no)? ") == 0)
         {
           ok = SSH_ERROR_QUESTION;
           break;
         }
       else if (diff >= 5 && strcmp (tempstr + diff - 5, "xsftp") == 0)
         break;
+      else if (rem <= 1)
+        {
+          request->logging_function (gftp_logging_recv, request->user_data,
+                                     "%s", tempstr + lastdiff);
+          len += SSH_LOGIN_BUFSIZE;
+          rem += SSH_LOGIN_BUFSIZE;
+          lastdiff = diff;
+          tempstr = g_realloc (tempstr, len);
+          continue;
+        }
     }
 
   g_free (pwstr);
--- a/lib/protocols.c	Sat Nov 23 14:34:25 2002 +0000
+++ b/lib/protocols.c	Tue Nov 26 14:58:13 2002 +0000
@@ -408,7 +408,7 @@
   if (i == GFTP_LOCAL_NUM)
     {
       request->directory = g_malloc (strlen (stpos + 6) + 1);
-      strcpy (request->directory, stpos + 6);
+      strcpy (request->directory, stpos + 7);
       return (0);
     }
 
--- a/src/gtk/chmod_dialog.c	Sat Nov 23 14:34:25 2002 +0000
+++ b/src/gtk/chmod_dialog.c	Tue Nov 26 14:58:13 2002 +0000
@@ -152,7 +152,7 @@
   int num;
 
   wdata = data;
-  if (!check_status (_("Chmod"), wdata, wdata->request->use_threads, 1, 1, 
+  if (!check_status (_("Chmod"), wdata, wdata->request->use_threads, 0, 1, 
                      wdata->request->chmod != NULL))
     return;
 
--- a/src/gtk/dnd.c	Sat Nov 23 14:34:25 2002 +0000
+++ b/src/gtk/dnd.c	Tue Nov 26 14:58:13 2002 +0000
@@ -69,7 +69,9 @@
   if (other_wdata != NULL && 
       compare_request (current_ftpdata, other_wdata->request, 1))
     {
-      gftp_set_password (current_ftpdata, other_wdata->request->password);
+      if (other_wdata->request->password != NULL)
+        gftp_set_password (current_ftpdata, other_wdata->request->password);
+
       fromwdata = other_wdata;
     }
   else
@@ -152,7 +154,8 @@
         continue;
 
       oldlen = totlen;
-      if (GFTP_GET_HOSTNAME (wdata->request) == NULL)
+      if (GFTP_GET_HOSTNAME (wdata->request) == NULL || 
+          wdata->request->protonum == GFTP_LOCAL_NUM)
         {
           tempstr = g_strdup_printf ("%s://%s/%s ", 
                                  GFTP_GET_URL_PREFIX (wdata->request),
@@ -181,7 +184,7 @@
         }
 
       if ((pos = strchr (tempstr, ':')) != NULL)
-        pos += 2;
+        pos += 3;
       else
         pos = tempstr;
       remove_double_slashes (pos);