summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-04-06 04:16:45 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-04-06 04:16:45 +0000
commit06e9515eb898a335be246759b3059f2e7a4da698 (patch)
tree6e3a2f3822c9bfd589762678c0176e9cf172152b
parentdc0594cc54960a78c64e34c8ebb82f2ce52b687a (diff)
- djm@cvs.openbsd.org 2002/04/06 00:30:08
[sftp-client.c] Fix occasional corruption on upload due to bad reuse of request id, spotted by chombier@mac.com; ok markus@
-rw-r--r--ChangeLog8
-rw-r--r--sftp-client.c10
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 67433b8aa..ad22e4485 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
2 - (djm) Typo in Suse SPEC file. Fix from Carsten Grohmann 2 - (djm) Typo in Suse SPEC file. Fix from Carsten Grohmann
3 <carsten.grohmann@dr-baldeweg.de> 3 <carsten.grohmann@dr-baldeweg.de>
4 - (bal) Added MAP_FAILED to allow AIX and Trusted HP to compile. 4 - (bal) Added MAP_FAILED to allow AIX and Trusted HP to compile.
5 - (bal) OpenBSD CVS Sync
6 - djm@cvs.openbsd.org 2002/04/06 00:30:08
7 [sftp-client.c]
8 Fix occasional corruption on upload due to bad reuse of request id, spotted
9 by chombier@mac.com; ok markus@
10
5 11
620020405 1220020405
7 - (bal) Patch for OpenSC SmartCard library; ok markus@; patch by 13 - (bal) Patch for OpenSC SmartCard library; ok markus@; patch by
@@ -8172,4 +8178,4 @@
8172 - Wrote replacements for strlcpy and mkdtemp 8178 - Wrote replacements for strlcpy and mkdtemp
8173 - Released 1.0pre1 8179 - Released 1.0pre1
8174 8180
8175$Id: ChangeLog,v 1.2027 2002/04/06 04:11:28 mouring Exp $ 8181$Id: ChangeLog,v 1.2028 2002/04/06 04:16:45 mouring Exp $
diff --git a/sftp-client.c b/sftp-client.c
index 9fa8376e6..0d42696ae 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -28,7 +28,7 @@
28/* XXX: copy between two remote sites */ 28/* XXX: copy between two remote sites */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: sftp-client.c,v 1.30 2002/04/01 22:07:17 markus Exp $"); 31RCSID("$OpenBSD: sftp-client.c,v 1.31 2002/04/06 00:30:08 djm Exp $");
32 32
33#include "openbsd-compat/fake-queue.h" 33#include "openbsd-compat/fake-queue.h"
34 34
@@ -1061,10 +1061,12 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1061 1061
1062 if (id == startid || len == 0 || 1062 if (id == startid || len == 0 ||
1063 id - ackid >= conn->num_requests) { 1063 id - ackid >= conn->num_requests) {
1064 u_int r_id;
1065
1064 buffer_clear(&msg); 1066 buffer_clear(&msg);
1065 get_msg(conn->fd_in, &msg); 1067 get_msg(conn->fd_in, &msg);
1066 type = buffer_get_char(&msg); 1068 type = buffer_get_char(&msg);
1067 id = buffer_get_int(&msg); 1069 r_id = buffer_get_int(&msg);
1068 1070
1069 if (type != SSH2_FXP_STATUS) 1071 if (type != SSH2_FXP_STATUS)
1070 fatal("Expected SSH2_FXP_STATUS(%d) packet, " 1072 fatal("Expected SSH2_FXP_STATUS(%d) packet, "
@@ -1075,11 +1077,11 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1075 1077
1076 /* Find the request in our queue */ 1078 /* Find the request in our queue */
1077 for(ack = TAILQ_FIRST(&acks); 1079 for(ack = TAILQ_FIRST(&acks);
1078 ack != NULL && ack->id != id; 1080 ack != NULL && ack->id != r_id;
1079 ack = TAILQ_NEXT(ack, tq)) 1081 ack = TAILQ_NEXT(ack, tq))
1080 ; 1082 ;
1081 if (ack == NULL) 1083 if (ack == NULL)
1082 fatal("Can't find request for ID %d", id); 1084 fatal("Can't find request for ID %d", r_id);
1083 TAILQ_REMOVE(&acks, ack, tq); 1085 TAILQ_REMOVE(&acks, ack, tq);
1084 1086
1085 if (status != SSH2_FX_OK) { 1087 if (status != SSH2_FX_OK) {