changeset 296:51725086634d

2003-10-26 Brian Masney <masneyb@gftp.org> * lib/misc.c (copy_request) - don't copy over the hostp pointer. This fixes a segfault in DnD * lib/sshv2.c - cleaned up the ssh2_params structure some * src/gtk/dnd.c - cleaned up the DND code some.
author masneyb
date Mon, 27 Oct 2003 00:54:25 +0000
parents ab4c90a561fc
children 6d088dfece0b
files ChangeLog lib/misc.c lib/sshv2.c src/gtk/dnd.c
diffstat 4 files changed, 39 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Oct 25 22:37:48 2003 +0000
+++ b/ChangeLog	Mon Oct 27 00:54:25 2003 +0000
@@ -1,3 +1,11 @@
+2003-10-26 Brian Masney <masneyb@gftp.org>
+	* lib/misc.c (copy_request) - don't copy over the hostp pointer. This
+	fixes a segfault in DnD
+
+	* lib/sshv2.c - cleaned up the ssh2_params structure some
+
+	* src/gtk/dnd.c - cleaned up the DND code some.
+
 2003-10-25 Brian Masney <masneyb@gftp.org>
 	* src/gtk/menu-items.c (dosave_directory_listing) - when saving the
 	directory listing, skip over the files that are not shown based on the
@@ -1618,7 +1626,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.157 2003/10/25 22:37:47 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.158 2003/10/27 00:54:24 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/misc.c	Sat Oct 25 22:37:48 2003 +0000
+++ b/lib/misc.c	Mon Oct 27 00:54:25 2003 +0000
@@ -665,7 +665,7 @@
   newreq->use_proxy = req->use_proxy;
   newreq->logging_function = req->logging_function;
   newreq->free_hostp = 0;
-  newreq->hostp = req->hostp;
+  newreq->hostp = NULL;
 
   if (copy_local_options)
     gftp_copy_local_options (&newreq->local_options_vars, 
--- a/lib/sshv2.c	Sat Oct 25 22:37:48 2003 +0000
+++ b/lib/sshv2.c	Mon Oct 27 00:54:25 2003 +0000
@@ -46,7 +46,7 @@
    gftp_option_type_checkbox, GINT_TO_POINTER(0), NULL, 
    GFTP_CVARS_FLAGS_SHOW_BOOKMARK,
    N_("Use the ssh-askpass utility to supply the remote password"), GFTP_PORT_GTK,
-   NULL},
+        NULL},
   {"sshv2_use_sftp_subsys", N_("Use SSH2 SFTP subsys"), 
    gftp_option_type_checkbox, GINT_TO_POINTER(0), NULL, 
    GFTP_CVARS_FLAGS_SHOW_BOOKMARK,
@@ -79,20 +79,22 @@
 
 typedef struct sshv2_params_tag
 {
-  char handle[SSH_MAX_HANDLE_SIZE + 4]; /* We'll encode the ID in here too */
-  int handle_len,
-      dont_log_status : 1;              /* For uploading files */
+  char handle[SSH_MAX_HANDLE_SIZE + 4], /* We'll encode the ID in here too */
+       *read_buffer;
+
+  gint32 handle_len,
+         id,
+         count;
   sshv2_message message;
 
-  gint32 id,				
-         count;
-  unsigned int initialized : 1;
+  unsigned int initialized : 1,
+               dont_log_status : 1;              /* For uploading files */
+
 #ifdef G_HAVE_GINT64
   gint64 offset;
 #else
   gint32 offset;
 #endif
-  char *read_buffer;
 } sshv2_params;
 
 
--- a/src/gtk/dnd.c	Sat Oct 25 22:37:48 2003 +0000
+++ b/src/gtk/dnd.c	Mon Oct 27 00:54:25 2003 +0000
@@ -214,9 +214,10 @@
 		       gint y, GtkSelectionData * selection_data, guint info,
 		       guint32 clk_time, gpointer data)
 {
-  char *newpos, *oldpos, tempchar;
+  char *newpos, *oldpos, *tempstr;
   gftp_window_data * wdata;
   int finish_drag;
+  size_t len;
 
   wdata = data;   
   if (!check_status (_("Drag-N-Drop"), wdata, 1, 0, 0, 1)) 
@@ -229,14 +230,26 @@
       while ((newpos = strchr (oldpos, '\n')) || 
              (newpos = strchr (oldpos, '\0'))) 
         {
-          tempchar = *newpos;
-          *newpos = '\0';
-          ftp_log (gftp_logging_misc, NULL, _("Received URL %s\n"), oldpos);
-          if (dnd_remote_file (oldpos, wdata))
+          len = newpos - oldpos;
+          if (oldpos[len - 1] == '\r')
+            len--;
+
+          if (len == 0)
+            break;
+
+          tempstr = g_malloc (len + 1);
+          memcpy (tempstr, oldpos, len);
+          tempstr[len] = '\0';
+
+          ftp_log (gftp_logging_misc, NULL, _("Received URL %s\n"), tempstr);
+
+          if (dnd_remote_file (tempstr, wdata))
             finish_drag = 1;
-         
+          g_free (tempstr);
+
           if (*newpos == '\0') 
             break;
+
           oldpos = newpos + 1;
         }
     }