bug in scp (OpenSSH)

Markus Friedl markus at openbsd.org
Fri Aug 31 21:18:46 EST 2001


On Fri, Aug 31, 2001 at 12:20:23PM +0200, Roman Drahtmueller wrote:
> Are you serious that you want to keep a bug because "this is how the rcp
> protocol works"? It is clearly flawed.

should we really change the semantics of a 17 year old protocol,
if you can use sftp, rsync or tar instead?

however, you can try to modify sink() to truncate the ofd if
response() returns an error. so the data will be sent but
discarded. i'm not sure whether i like the idea. it might
break other things.

> Is it necessary to make full quotes for a single sentence?

depends.

-m

Index: scp.c
===================================================================
RCS file: /home/markus/cvs/ssh/scp.c,v
retrieving revision 1.81
diff -u -r1.81 scp.c
--- scp.c	2001/08/29 20:44:03	1.81
+++ scp.c	2001/08/31 11:17:53
@@ -853,11 +853,15 @@
 					run_err("%s: set mode: %s",
 					    np, strerror(errno));
 		}
+		if (response() < 0) {
+			ftruncate(ofd, 0);
+			wrerr = YES;
+			wrerrno = EIO;
+		}
 		if (close(ofd) == -1) {
 			wrerr = YES;
 			wrerrno = errno;
 		}
-		(void) response();
 		if (setimes && wrerr == NO) {
 			setimes = 0;
 			if (utimes(np, tv) < 0) {



More information about the openssh-unix-dev mailing list