From f1845ab4cb03b0ef1803c8a2e0933b446d99fc76 Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Wed, 10 Oct 2001 15:32:40 +0000 Subject: fix multi-line contunuations - ok deraadt@ --- libexec/ftp-proxy/ftp-proxy.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libexec/ftp-proxy/ftp-proxy.c b/libexec/ftp-proxy/ftp-proxy.c index 320c7704670..b603163016d 100644 --- a/libexec/ftp-proxy/ftp-proxy.c +++ b/libexec/ftp-proxy/ftp-proxy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp-proxy.c,v 1.16 2001/09/21 18:06:25 beck Exp $ */ +/* $OpenBSD: ftp-proxy.c,v 1.17 2001/10/10 15:32:39 beck Exp $ */ /* * Copyright (c) 1996-2001 @@ -844,6 +844,7 @@ do_server_reply(struct csiob *server, struct csiob *client) { int code, i, j, rv; struct in_addr *iap; + static int continuing = 0; char tbuf[100], *sendbuf, *p; log_control_command((char *)server->line_buffer, 0); @@ -863,13 +864,21 @@ do_server_reply(struct csiob *server, struct csiob *client) */ code = strtol((char *)server->line_buffer, &p, 10); if (!*(server->line_buffer) || (*p != ' ' && *p != '-')) { + if (continuing) + goto sendit; syslog(LOG_INFO, "malformed control reply"); exit(EX_DATAERR); } if (code <= 0 || code > 999) { + if (continuing) + goto sendit; syslog(LOG_INFO, "invalid server reply code %d", code); exit(EX_DATAERR); } + if (*p == '-') + continuing = 1; + else + continuing = 0; if (code == 227 && !NatMode) { unsigned int values[6]; u_char *tailptr; @@ -928,8 +937,10 @@ do_server_reply(struct csiob *server, struct csiob *client) ((u_char *)&client_listen_sa.sin_port)[1]); debuglog(1, "to client(modified): %s\n", tbuf); sendbuf = tbuf; - } else + } else { + sendit: sendbuf = server->line_buffer; + } /* * send our (possibly modified) control command in sendbuf -- cgit v1.2.3