vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Dmitry Belyavskiy 9fd698
diff --color -rup a/scp.c b/scp.c
Dmitry Belyavskiy 9fd698
--- a/scp.c	2022-07-26 14:51:40.560120817 +0200
Dmitry Belyavskiy 9fd698
+++ b/scp.c	2022-07-26 14:52:37.118213004 +0200
Dmitry Belyavskiy 03150f
@@ -1324,11 +1324,11 @@ source_sftp(int argc, char *src, char *t
Dmitry Belyavskiy 03150f
Dmitry Belyavskiy 03150f
	if (src_is_dir && iamrecursive) {
Dmitry Belyavskiy 03150f
		if (upload_dir(conn, src, abs_dst, pflag,
Dmitry Belyavskiy 9fd698
-		    SFTP_PROGRESS_ONLY, 0, 0, 1, 1) != 0) {
Dmitry Belyavskiy 9fd698
+		    SFTP_PROGRESS_ONLY, 0, 0, 1, 1, 1) != 0) {
Dmitry Belyavskiy 03150f
			error("failed to upload directory %s to %s", src, targ);
Dmitry Belyavskiy 03150f
			errs = 1;
Dmitry Belyavskiy 03150f
		}
Dmitry Belyavskiy 9fd698
-	} else if (do_upload(conn, src, abs_dst, pflag, 0, 0) != 0) {
Dmitry Belyavskiy 9fd698
+	} else if (do_upload(conn, src, abs_dst, pflag, 0, 0, 1) != 0) {
Dmitry Belyavskiy 03150f
		error("failed to upload file %s to %s", src, targ);
Dmitry Belyavskiy 03150f
		errs = 1;
Dmitry Belyavskiy 03150f
	}
Dmitry Belyavskiy 9fd698
@@ -1566,11 +1566,11 @@ sink_sftp(int argc, char *dst, const cha
Dmitry Belyavskiy 9fd698
 		debug("Fetching %s to %s\n", g.gl_pathv[i], abs_dst);
Dmitry Belyavskiy 9fd698
 		if (globpath_is_dir(g.gl_pathv[i]) && iamrecursive) {
Dmitry Belyavskiy 9fd698
 			if (download_dir(conn, g.gl_pathv[i], abs_dst, NULL,
Dmitry Belyavskiy 9fd698
-			    pflag, SFTP_PROGRESS_ONLY, 0, 0, 1) == -1)
Dmitry Belyavskiy 9fd698
+			    pflag, SFTP_PROGRESS_ONLY, 0, 0, 1, 1) == -1)
Dmitry Belyavskiy 9fd698
 				err = -1;
Dmitry Belyavskiy 9fd698
 		} else {
Dmitry Belyavskiy 9fd698
 			if (do_download(conn, g.gl_pathv[i], abs_dst, NULL,
Dmitry Belyavskiy 9fd698
-			    pflag, 0, 0) == -1)
Dmitry Belyavskiy 9fd698
+			    pflag, 0, 0, 1) == -1)
Dmitry Belyavskiy 9fd698
 				err = -1;
Dmitry Belyavskiy 9fd698
 		}
Dmitry Belyavskiy 9fd698
 		free(abs_dst);
Dmitry Belyavskiy 9fd698
diff --color -rup a/sftp.c b/sftp.c
Dmitry Belyavskiy 9fd698
--- a/sftp.c	2022-07-26 14:51:40.561120836 +0200
Dmitry Belyavskiy 9fd698
+++ b/sftp.c	2022-07-26 14:52:37.119213023 +0200
Dmitry Belyavskiy 9fd698
@@ -666,12 +666,12 @@ process_get(struct sftp_conn *conn, cons
Dmitry Belyavskiy 9fd698
 		if (globpath_is_dir(g.gl_pathv[i]) && (rflag || global_rflag)) {
Dmitry Belyavskiy 9fd698
 			if (download_dir(conn, g.gl_pathv[i], abs_dst, NULL,
Dmitry Belyavskiy 9fd698
 			    pflag || global_pflag, 1, resume,
Dmitry Belyavskiy 9fd698
-			    fflag || global_fflag, 0) == -1)
Dmitry Belyavskiy 9fd698
+			    fflag || global_fflag, 0, 0) == -1)
Dmitry Belyavskiy 9fd698
 				err = -1;
Dmitry Belyavskiy 9fd698
 		} else {
Dmitry Belyavskiy 9fd698
 			if (do_download(conn, g.gl_pathv[i], abs_dst, NULL,
Dmitry Belyavskiy 9fd698
 			    pflag || global_pflag, resume,
Dmitry Belyavskiy 9fd698
-			    fflag || global_fflag) == -1)
Dmitry Belyavskiy 9fd698
+			    fflag || global_fflag, 0) == -1)
Dmitry Belyavskiy 9fd698
 				err = -1;
Dmitry Belyavskiy 9fd698
 		}
Dmitry Belyavskiy 9fd698
 		free(abs_dst);
Dmitry Belyavskiy 9fd698
@@ -760,12 +760,12 @@ process_put(struct sftp_conn *conn, cons
Dmitry Belyavskiy 9fd698
 		if (globpath_is_dir(g.gl_pathv[i]) && (rflag || global_rflag)) {
Dmitry Belyavskiy 9fd698
 			if (upload_dir(conn, g.gl_pathv[i], abs_dst,
Dmitry Belyavskiy 9fd698
 			    pflag || global_pflag, 1, resume,
Dmitry Belyavskiy 9fd698
-			    fflag || global_fflag, 0, 0) == -1)
Dmitry Belyavskiy 9fd698
+			    fflag || global_fflag, 0, 0, 0) == -1)
Dmitry Belyavskiy 9fd698
 				err = -1;
Dmitry Belyavskiy 9fd698
 		} else {
Dmitry Belyavskiy 9fd698
 			if (do_upload(conn, g.gl_pathv[i], abs_dst,
Dmitry Belyavskiy 9fd698
 			    pflag || global_pflag, resume,
Dmitry Belyavskiy 9fd698
-			    fflag || global_fflag) == -1)
Dmitry Belyavskiy 9fd698
+			    fflag || global_fflag, 0) == -1)
Dmitry Belyavskiy 9fd698
 				err = -1;
Dmitry Belyavskiy 9fd698
 		}
Dmitry Belyavskiy 9fd698
 	}
Dmitry Belyavskiy 9fd698
diff --color -rup a/sftp-client.c b/sftp-client.c
Dmitry Belyavskiy 9fd698
--- a/sftp-client.c	2022-07-26 14:51:40.561120836 +0200
Dmitry Belyavskiy 9fd698
+++ b/sftp-client.c	2022-07-26 15:09:54.825295533 +0200
Dmitry Belyavskiy 9fd698
@@ -1454,7 +1454,7 @@ progress_meter_path(const char *path)
Dmitry Belyavskiy 9fd698
 int
Dmitry Belyavskiy 9fd698
 do_download(struct sftp_conn *conn, const char *remote_path,
Dmitry Belyavskiy 9fd698
     const char *local_path, Attrib *a, int preserve_flag, int resume_flag,
Dmitry Belyavskiy 9fd698
-    int fsync_flag)
Dmitry Belyavskiy 9fd698
+    int fsync_flag, int inplace_flag)
Dmitry Belyavskiy 9fd698
 {
Dmitry Belyavskiy 9fd698
 	struct sshbuf *msg;
Dmitry Belyavskiy 9fd698
 	u_char *handle;
Dmitry Belyavskiy 9fd698
@@ -1498,8 +1498,8 @@ do_download(struct sftp_conn *conn, cons
Dmitry Belyavskiy 9fd698
 	    &handle, &handle_len) != 0)
Dmitry Belyavskiy 9fd698
 		return -1;
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
-	local_fd = open(local_path,
Dmitry Belyavskiy 9fd698
-	    O_WRONLY | O_CREAT | (resume_flag ? 0 : O_TRUNC), mode | S_IWUSR);
Dmitry Belyavskiy 9fd698
+	local_fd = open(local_path, O_WRONLY | O_CREAT |
Dmitry Belyavskiy 9fd698
+	((resume_flag || inplace_flag) ? 0 : O_TRUNC), mode | S_IWUSR);
Dmitry Belyavskiy 03150f
	if (local_fd == -1) {
Dmitry Belyavskiy 03150f
		error("open local \"%s\": %s", local_path, strerror(errno));
Dmitry Belyavskiy 03150f
		goto fail;
Dmitry Belyavskiy 9fd698
@@ -1661,8 +1661,11 @@ do_download(struct sftp_conn *conn, cons
Dmitry Belyavskiy 9fd698
 	/* Sanity check */
Dmitry Belyavskiy 9fd698
 	if (TAILQ_FIRST(&requests) != NULL)
Dmitry Belyavskiy 9fd698
 		fatal("Transfer complete, but requests still in queue");
Dmitry Belyavskiy 9fd698
-	/* Truncate at highest contiguous point to avoid holes on interrupt */
Dmitry Belyavskiy 9fd698
-	if (read_error || write_error || interrupted) {
Dmitry Belyavskiy 9fd698
+	/*
Dmitry Belyavskiy 9fd698
+	 * Truncate at highest contiguous point to avoid holes on interrupt,
Dmitry Belyavskiy 9fd698
+	 * or unconditionally if writing in place.
Dmitry Belyavskiy 9fd698
+	 */
Dmitry Belyavskiy 9fd698
+	if (inplace_flag || read_error || write_error || interrupted) {
Dmitry Belyavskiy 9fd698
 		if (reordered && resume_flag) {
Dmitry Belyavskiy 9fd698
 			error("Unable to resume download of \"%s\": "
Dmitry Belyavskiy 9fd698
 			    "server reordered requests", local_path);
Dmitry Belyavskiy 9fd698
@@ -1724,7 +1727,7 @@ do_download(struct sftp_conn *conn, cons
Dmitry Belyavskiy 9fd698
 static int
Dmitry Belyavskiy 9fd698
 download_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
Dmitry Belyavskiy 9fd698
     int depth, Attrib *dirattrib, int preserve_flag, int print_flag,
Dmitry Belyavskiy 9fd698
-    int resume_flag, int fsync_flag, int follow_link_flag)
Dmitry Belyavskiy 9fd698
+    int resume_flag, int fsync_flag, int follow_link_flag, int inplace_flag)
Dmitry Belyavskiy 9fd698
 {
Dmitry Belyavskiy 9fd698
 	int i, ret = 0;
Dmitry Belyavskiy 9fd698
 	SFTP_DIRENT **dir_entries;
Dmitry Belyavskiy 9fd698
@@ -1781,7 +1784,7 @@ download_dir_internal(struct sftp_conn *
Dmitry Belyavskiy 9fd698
 			if (download_dir_internal(conn, new_src, new_dst,
Dmitry Belyavskiy 9fd698
 			    depth + 1, &(dir_entries[i]->a), preserve_flag,
Dmitry Belyavskiy 9fd698
 			    print_flag, resume_flag,
Dmitry Belyavskiy 9fd698
-			    fsync_flag, follow_link_flag) == -1)
Dmitry Belyavskiy 9fd698
+			    fsync_flag, follow_link_flag, inplace_flag) == -1)
Dmitry Belyavskiy 9fd698
 				ret = -1;
Dmitry Belyavskiy 9fd698
 		} else if (S_ISREG(dir_entries[i]->a.perm) ||
Dmitry Belyavskiy 9fd698
 		    (follow_link_flag && S_ISLNK(dir_entries[i]->a.perm))) {
Dmitry Belyavskiy 9fd698
@@ -1793,7 +1796,8 @@ download_dir_internal(struct sftp_conn *
Dmitry Belyavskiy 9fd698
 			if (do_download(conn, new_src, new_dst,
Dmitry Belyavskiy 9fd698
 			    S_ISLNK(dir_entries[i]->a.perm) ? NULL :
Dmitry Belyavskiy 9fd698
 			    &(dir_entries[i]->a),
Dmitry Belyavskiy 9fd698
-			    preserve_flag, resume_flag, fsync_flag) == -1) {
Dmitry Belyavskiy 9fd698
+			    preserve_flag, resume_flag, fsync_flag,
Dmitry Belyavskiy 9fd698
+			    inplace_flag) == -1) {
Dmitry Belyavskiy 9fd698
 				error("Download of file %s to %s failed",
Dmitry Belyavskiy 9fd698
 				    new_src, new_dst);
Dmitry Belyavskiy 9fd698
 				ret = -1;
Dmitry Belyavskiy 9fd698
@@ -1831,7 +1835,7 @@ download_dir_internal(struct sftp_conn *
Dmitry Belyavskiy 9fd698
 int
Dmitry Belyavskiy 9fd698
 download_dir(struct sftp_conn *conn, const char *src, const char *dst,
Dmitry Belyavskiy 9fd698
     Attrib *dirattrib, int preserve_flag, int print_flag, int resume_flag,
Dmitry Belyavskiy 9fd698
-    int fsync_flag, int follow_link_flag)
Dmitry Belyavskiy 9fd698
+    int fsync_flag, int follow_link_flag, int inplace_flag)
Dmitry Belyavskiy 9fd698
 {
Dmitry Belyavskiy 9fd698
 	char *src_canon;
Dmitry Belyavskiy 9fd698
 	int ret;
Dmitry Belyavskiy 9fd698
@@ -1843,26 +1847,25 @@ download_dir(struct sftp_conn *conn, con
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 	ret = download_dir_internal(conn, src_canon, dst, 0,
Dmitry Belyavskiy 9fd698
 	    dirattrib, preserve_flag, print_flag, resume_flag, fsync_flag,
Dmitry Belyavskiy 9fd698
-	    follow_link_flag);
Dmitry Belyavskiy 9fd698
+	    follow_link_flag, inplace_flag);
Dmitry Belyavskiy 9fd698
 	free(src_canon);
Dmitry Belyavskiy 9fd698
 	return ret;
Dmitry Belyavskiy 9fd698
 }
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 int
Dmitry Belyavskiy 9fd698
 do_upload(struct sftp_conn *conn, const char *local_path,
Dmitry Belyavskiy 9fd698
-    const char *remote_path, int preserve_flag, int resume, int fsync_flag)
Dmitry Belyavskiy 9fd698
+    const char *remote_path, int preserve_flag, int resume,
Dmitry Belyavskiy 9fd698
+    int fsync_flag, int inplace_flag)
Dmitry Belyavskiy 9fd698
 {
Dmitry Belyavskiy 9fd698
 	int r, local_fd;
Dmitry Belyavskiy 9fd698
-	u_int status = SSH2_FX_OK;
Dmitry Belyavskiy 9fd698
-	u_int id;
Dmitry Belyavskiy 9fd698
-	u_char type;
Dmitry Belyavskiy 9fd698
+	u_int openmode, id, status = SSH2_FX_OK, reordered = 0;
Dmitry Belyavskiy 9fd698
 	off_t offset, progress_counter;
Dmitry Belyavskiy 9fd698
-	u_char *handle, *data;
Dmitry Belyavskiy 9fd698
+	u_char type, *handle, *data;
Dmitry Belyavskiy 9fd698
 	struct sshbuf *msg;
Dmitry Belyavskiy 9fd698
 	struct stat sb;
Dmitry Belyavskiy 9fd698
-	Attrib a, *c = NULL;
Dmitry Belyavskiy 9fd698
-	u_int32_t startid;
Dmitry Belyavskiy 9fd698
-	u_int32_t ackid;
Dmitry Belyavskiy 9fd698
+	Attrib a, t, *c = NULL;
Dmitry Belyavskiy 9fd698
+	u_int32_t startid, ackid;
Dmitry Belyavskiy 9fd698
+	u_int64_t highwater = 0;
Dmitry Belyavskiy 9fd698
 	struct request *ack = NULL;
Dmitry Belyavskiy 9fd698
 	struct requests acks;
Dmitry Belyavskiy 9fd698
 	size_t handle_len;
Dmitry Belyavskiy 9fd698
@@ -1913,10 +1916,15 @@ do_upload(struct sftp_conn *conn, const
Dmitry Belyavskiy 9fd698
 		}
Dmitry Belyavskiy 9fd698
 	}
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
+	openmode = SSH2_FXF_WRITE|SSH2_FXF_CREAT;
Dmitry Belyavskiy 9fd698
+	if (resume)
Dmitry Belyavskiy 9fd698
+		openmode |= SSH2_FXF_APPEND;
Dmitry Belyavskiy 9fd698
+	else if (!inplace_flag)
Dmitry Belyavskiy 9fd698
+		openmode |= SSH2_FXF_TRUNC;
Dmitry Belyavskiy 9fd698
+
Dmitry Belyavskiy 9fd698
 	/* Send open request */
Dmitry Belyavskiy 9fd698
-	if (send_open(conn, remote_path, "dest", SSH2_FXF_WRITE|SSH2_FXF_CREAT|
Dmitry Belyavskiy 9fd698
-	    (resume ? SSH2_FXF_APPEND : SSH2_FXF_TRUNC),
Dmitry Belyavskiy 9fd698
-	    &a, &handle, &handle_len) != 0) {
Dmitry Belyavskiy 9fd698
+	if (send_open(conn, remote_path, "dest", openmode, &a,
Dmitry Belyavskiy 9fd698
+	    &handle, &handle_len) != 0) {
Dmitry Belyavskiy 9fd698
 		close(local_fd);
Dmitry Belyavskiy 9fd698
 		return -1;
Dmitry Belyavskiy 9fd698
 	}
Dmitry Belyavskiy 9fd698
@@ -1999,6 +2007,12 @@ do_upload(struct sftp_conn *conn, const
Dmitry Belyavskiy 9fd698
 			    ack->id, ack->len, (unsigned long long)ack->offset);
Dmitry Belyavskiy 9fd698
 			++ackid;
Dmitry Belyavskiy 9fd698
 			progress_counter += ack->len;
Dmitry Belyavskiy 9fd698
+			if (!reordered && ack->offset <= highwater)
Dmitry Belyavskiy 9fd698
+				highwater = ack->offset + ack->len;
Dmitry Belyavskiy 9fd698
+			else if (!reordered && ack->offset > highwater) {
Dmitry Belyavskiy 9fd698
+				debug3_f("server reordered ACKs");
Dmitry Belyavskiy 9fd698
+				reordered = 1;
Dmitry Belyavskiy 9fd698
+			}
Dmitry Belyavskiy 9fd698
 			free(ack);
Dmitry Belyavskiy 9fd698
 		}
Dmitry Belyavskiy 9fd698
 		offset += len;
Dmitry Belyavskiy 9fd698
@@ -2017,6 +2031,14 @@ do_upload(struct sftp_conn *conn, const
Dmitry Belyavskiy 9fd698
 		status = SSH2_FX_FAILURE;
Dmitry Belyavskiy 9fd698
 	}
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
+	if (inplace_flag || (resume && (status != SSH2_FX_OK || interrupted))) {
Dmitry Belyavskiy 9fd698
+		debug("truncating at %llu", (unsigned long long)highwater);
Dmitry Belyavskiy 9fd698
+		attrib_clear(&t);
Dmitry Belyavskiy 9fd698
+		t.flags = SSH2_FILEXFER_ATTR_SIZE;
Dmitry Belyavskiy 9fd698
+		t.size = highwater;
Dmitry Belyavskiy 9fd698
+		do_fsetstat(conn, handle, handle_len, &t);
Dmitry Belyavskiy 9fd698
+	}
Dmitry Belyavskiy 9fd698
+
Dmitry Belyavskiy 9fd698
 	if (close(local_fd) == -1) {
Dmitry Belyavskiy 03150f
		error("close local \"%s\": %s", local_path, strerror(errno));
Dmitry Belyavskiy 03150f
		status = SSH2_FX_FAILURE;
Dmitry Belyavskiy 9fd698
@@ -2041,7 +2063,7 @@ do_upload(struct sftp_conn *conn, const
Dmitry Belyavskiy 9fd698
 static int
Dmitry Belyavskiy 9fd698
 upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
Dmitry Belyavskiy 9fd698
     int depth, int preserve_flag, int print_flag, int resume, int fsync_flag,
Dmitry Belyavskiy 9fd698
-    int follow_link_flag)
Dmitry Belyavskiy 9fd698
+    int follow_link_flag, int inplace_flag)
Dmitry Belyavskiy 9fd698
 {
Dmitry Belyavskiy 9fd698
 	int ret = 0;
Dmitry Belyavskiy 9fd698
 	DIR *dirp;
Dmitry Belyavskiy 9fd698
@@ -2119,12 +2141,13 @@ upload_dir_internal(struct sftp_conn *co
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 			if (upload_dir_internal(conn, new_src, new_dst,
Dmitry Belyavskiy 9fd698
 			    depth + 1, preserve_flag, print_flag, resume,
Dmitry Belyavskiy 9fd698
-			    fsync_flag, follow_link_flag) == -1)
Dmitry Belyavskiy 9fd698
+			    fsync_flag, follow_link_flag, inplace_flag) == -1)
Dmitry Belyavskiy 9fd698
 				ret = -1;
Dmitry Belyavskiy 9fd698
 		} else if (S_ISREG(sb.st_mode) ||
Dmitry Belyavskiy 9fd698
 		    (follow_link_flag && S_ISLNK(sb.st_mode))) {
Dmitry Belyavskiy 9fd698
 			if (do_upload(conn, new_src, new_dst,
Dmitry Belyavskiy 9fd698
-			    preserve_flag, resume, fsync_flag) == -1) {
Dmitry Belyavskiy 9fd698
+			    preserve_flag, resume, fsync_flag,
Dmitry Belyavskiy 9fd698
+			    inplace_flag) == -1) {
Dmitry Belyavskiy 03150f
				error("upload \"%s\" to \"%s\" failed",
Dmitry Belyavskiy 03150f
				    new_src, new_dst);
Dmitry Belyavskiy 03150f
				ret = -1;
Dmitry Belyavskiy 9fd698
@@ -2144,7 +2167,7 @@ upload_dir_internal(struct sftp_conn *co
Dmitry Belyavskiy 9fd698
 int
Dmitry Belyavskiy 9fd698
 upload_dir(struct sftp_conn *conn, const char *src, const char *dst,
Dmitry Belyavskiy 9fd698
     int preserve_flag, int print_flag, int resume, int fsync_flag,
Dmitry Belyavskiy 9fd698
-    int follow_link_flag, int create_dir)
Dmitry Belyavskiy 9fd698
+    int follow_link_flag, int create_dir, int inplace_flag)
Dmitry Belyavskiy 9fd698
 {
Dmitry Belyavskiy 9fd698
 	char *dst_canon;
Dmitry Belyavskiy 9fd698
 	int ret;
Dmitry Belyavskiy 9fd698
@@ -2155,7 +2178,7 @@ upload_dir(struct sftp_conn *conn, const
Dmitry Belyavskiy 9fd698
 	}
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 	ret = upload_dir_internal(conn, src, dst_canon, 0, preserve_flag,
Dmitry Belyavskiy 9fd698
-	    print_flag, resume, fsync_flag, follow_link_flag);
Dmitry Belyavskiy 9fd698
+	    print_flag, resume, fsync_flag, follow_link_flag, inplace_flag);
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 	free(dst_canon);
Dmitry Belyavskiy 9fd698
 	return ret;
Dmitry Belyavskiy 9fd698
diff --color -rup a/sftp-client.h b/sftp-client.h
Dmitry Belyavskiy 9fd698
--- a/sftp-client.h	2022-07-26 14:51:40.561120836 +0200
Dmitry Belyavskiy 9fd698
+++ b/sftp-client.h	2022-07-26 14:52:37.120213042 +0200
Dmitry Belyavskiy 9fd698
@@ -138,28 +138,29 @@ int do_fsync(struct sftp_conn *conn, u_c
Dmitry Belyavskiy 9fd698
  * Download 'remote_path' to 'local_path'. Preserve permissions and times
Dmitry Belyavskiy 9fd698
  * if 'pflag' is set
Dmitry Belyavskiy 9fd698
  */
Dmitry Belyavskiy 9fd698
-int do_download(struct sftp_conn *, const char *, const char *,
Dmitry Belyavskiy 9fd698
-    Attrib *, int, int, int);
Dmitry Belyavskiy 9fd698
+int do_download(struct sftp_conn *, const char *, const char *, Attrib *,
Dmitry Belyavskiy 9fd698
+    int, int, int, int);
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 /*
Dmitry Belyavskiy 9fd698
  * Recursively download 'remote_directory' to 'local_directory'. Preserve
Dmitry Belyavskiy 9fd698
  * times if 'pflag' is set
Dmitry Belyavskiy 9fd698
  */
Dmitry Belyavskiy 9fd698
-int download_dir(struct sftp_conn *, const char *, const char *,
Dmitry Belyavskiy 9fd698
-    Attrib *, int, int, int, int, int);
Dmitry Belyavskiy 9fd698
+int download_dir(struct sftp_conn *, const char *, const char *, Attrib *,
Dmitry Belyavskiy 9fd698
+    int, int, int, int, int, int);
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 /*
Dmitry Belyavskiy 9fd698
  * Upload 'local_path' to 'remote_path'. Preserve permissions and times
Dmitry Belyavskiy 9fd698
  * if 'pflag' is set
Dmitry Belyavskiy 9fd698
  */
Dmitry Belyavskiy 9fd698
-int do_upload(struct sftp_conn *, const char *, const char *, int, int, int);
Dmitry Belyavskiy 9fd698
+int do_upload(struct sftp_conn *, const char *, const char *,
Dmitry Belyavskiy 9fd698
+    int, int, int, int);
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 /*
Dmitry Belyavskiy 9fd698
  * Recursively upload 'local_directory' to 'remote_directory'. Preserve
Dmitry Belyavskiy 9fd698
  * times if 'pflag' is set
Dmitry Belyavskiy 9fd698
  */
Dmitry Belyavskiy 9fd698
-int upload_dir(struct sftp_conn *, const char *, const char *, int, int, int,
Dmitry Belyavskiy 9fd698
-    int, int, int);
Dmitry Belyavskiy 9fd698
+int upload_dir(struct sftp_conn *, const char *, const char *,
Dmitry Belyavskiy 9fd698
+    int, int, int, int, int, int, int);
Dmitry Belyavskiy 9fd698
 
Dmitry Belyavskiy 9fd698
 /*
Dmitry Belyavskiy 9fd698
  * Download a 'from_path' from the 'from' connection and upload it to