changeset 529:c36a475ecf5a

2004-8-9 Brian Masney <masneyb@gftp.org> * lib/sshv2.c - fixes so that file permissions are preserved properly on file upload. Fixes so that the Utime and Chmod commands are shown in the log window
author masneyb
date Tue, 10 Aug 2004 02:55:35 +0000
parents d32b05e07284
children c39eb5731b32
files ChangeLog lib/sshv2.c
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 10 02:29:09 2004 +0000
+++ b/ChangeLog	Tue Aug 10 02:55:35 2004 +0000
@@ -1,4 +1,8 @@
 2004-8-9 Brian Masney <masneyb@gftp.org>
+	* lib/sshv2.c - fixes so that file permissions are preserved properly
+	on file upload. Fixes so that the Utime and Chmod commands are shown
+	in the log window
+
 	* lib/sshv2.c (sshv2_setup_file_offset) - added buf argument to this
 	function so that uploading files will work again
 
@@ -2722,7 +2726,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.303 2004/08/10 02:29:09 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.304 2004/08/10 02:55:35 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/sshv2.c	Tue Aug 10 02:29:09 2004 +0000
+++ b/lib/sshv2.c	Tue Aug 10 02:55:35 2004 +0000
@@ -561,13 +561,16 @@
       case SSH_FXP_SETSTAT:
         memcpy (&num, message + 4, 4);
         num = ntohl (num);
-        pos = message + 12 + num - 1;
-        oldchar = *pos;
-        *pos = '\0';
+
         memcpy (&stattype, message + 8 + num, 4);
         stattype = ntohl (stattype);
         memcpy (&attr, message + 12 + num, 4);
         attr = ntohl (attr);
+
+        pos = message + 8 + num;
+        oldchar = *pos;
+        *pos = '\0';
+
         switch (stattype)
           {
             case SSH_FILEXFER_ATTR_PERMISSIONS:
@@ -580,6 +583,7 @@
                                          _("%d: Utime %s %d\n"), id,
                                          message + 8, attr);
           }
+
         *pos = oldchar;
         break;
       case SSH_FXP_STATUS:
@@ -1493,7 +1497,7 @@
   num = htonl (SSH_FILEXFER_ATTR_PERMISSIONS);
   memcpy (endpos, &num, 4);
 
-  g_snprintf (buf, sizeof (buf), "%d", mode);
+  g_snprintf (buf, sizeof (buf), "%o", mode);
   num = htonl (strtol (buf, NULL, 8));
   memcpy (endpos + 4, &num, 4);