From cd4b3ab2cd2c41a231bed9142bb9740b377ab6df Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Mon, 1 Jul 2002 16:45:02 +0000 Subject: [PATCH] better handle continuation lines (from Aidan Cully) git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11045 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/ftp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/appl/ftp/ftp/ftp.c b/appl/ftp/ftp/ftp.c index 07494ab28..757d8a8d5 100644 --- a/appl/ftp/ftp/ftp.c +++ b/appl/ftp/ftp/ftp.c @@ -313,6 +313,7 @@ getreply (int expecteof) int c; struct sigaction sa, osa; char buf[8192]; + int reply_code; int long_warn = 0; sigemptyset (&sa.sa_mask); @@ -322,6 +323,7 @@ getreply (int expecteof) p = buf; + reply_code = 0; while (1) { c = getc (cin); switch (c) { @@ -351,14 +353,17 @@ getreply (int expecteof) if(isdigit(buf[0])){ sscanf(buf, "%d", &code); if(code == 631){ + code = 0; sec_read_msg(buf, prot_safe); sscanf(buf, "%d", &code); lead_string = "S:"; } else if(code == 632){ + code = 0; sec_read_msg(buf, prot_private); sscanf(buf, "%d", &code); lead_string = "P:"; }else if(code == 633){ + code = 0; sec_read_msg(buf, prot_confidential); sscanf(buf, "%d", &code); lead_string = "C:"; @@ -366,9 +371,11 @@ getreply (int expecteof) lead_string = "!!"; else lead_string = ""; + if(code != 0 && reply_code == 0) + reply_code = code; if (verbose > 0 || (verbose > -1 && code > 499)) fprintf (stdout, "%s%s\n", lead_string, buf); - if (buf[3] == ' ') { + if (code == reply_code && buf[3] == ' ') { strlcpy (reply_string, buf, sizeof(reply_string)); if (code >= 200) cpend = 0;