]> git.pld-linux.org Git - packages/busybox.git/commitdiff
- patch correcting behaviour of ftpput command, may be buggy feel free to
authortommat <tommat@pld-linux.org>
Tue, 15 Feb 2005 13:57:59 +0000 (13:57 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  correct it.

Changed files:
    busybox-ftpput.patch -> 1.1

busybox-ftpput.patch [new file with mode: 0644]

diff --git a/busybox-ftpput.patch b/busybox-ftpput.patch
new file mode 100644 (file)
index 0000000..946e09c
--- /dev/null
@@ -0,0 +1,66 @@
+--- busybox-1.00/networking/ftpgetput.c.orig   2005-02-15 13:30:36.000000000 +0100
++++ busybox-1.00/networking/ftpgetput.c        2005-02-15 14:00:35.315575696 +0100
+@@ -227,15 +227,51 @@
+       int fd_local;
+       int response;
++      int server_sl = -1;
++      int local_sl = -1;
++      char local_fname[512];
++      char server_fname[512];
++      char server_fpath[1024];
++      char *temp;
++      int i;
++      
++      strcpy (server_fpath, server_path);
++      
++      for (i = 0; server_fpath[i] != '\0'; i++)
++              if (server_fpath[i] == '/') server_sl = i;
++      
++      if (server_sl == -1) {
++              strcpy(server_fname, server_fpath);
++              server_fpath[0] = '\0';
++      } else {
++              temp = server_fpath + server_sl;
++              strcpy(server_fname, temp);
++              server_fpath[server_sl+1] = '\0';
++      }
++      
++      for (i = 0; local_path[i] != '\0'; i++)
++              if (local_path[i] == '/') local_sl = i;
++      
++      if (local_sl == -1) {
++              strcpy(local_fname, local_path);
++      } else {
++              temp = local_path + local_sl;
++              strcpy(local_fname, temp);
++      }
++
++      if (server_fname[0] == '\0')
++              strcpy (server_fname, local_fname);
++              
+       /*  Connect to the data socket */
+       if (ftpcmd("PASV", NULL, control_stream, buf) != 227) {
+               bb_error_msg_and_die("PASV error: %s", buf + 4);
+       }
+       fd_data = xconnect_ftpdata(server, buf);
+-      if (ftpcmd("CWD ", server_path, control_stream, buf) != 250) {
+-              bb_error_msg_and_die("CWD error: %s", buf + 4);
+-      }
++      if (server_sl != -1)
++              if (ftpcmd("CWD ", server_fpath, control_stream, buf) != 250) {
++                      bb_error_msg_and_die("CWD error: %s", buf + 4);
++              }
+       /* get the local file */
+       if ((local_path[0] == '-') && (local_path[1] == '\0')) {
+@@ -260,7 +296,7 @@
+                       break;
+               }
+       }
+-      response = ftpcmd("STOR ", local_path, control_stream, buf);
++      response = ftpcmd("STOR ", server_fname, control_stream, buf);
+       switch (response) {
+       case 125:
+       case 150:
This page took 0.171038 seconds and 4 git commands to generate.