diff options
author | hrs <hrs@FreeBSD.org> | 2004-07-25 23:14:47 +0800 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2004-07-25 23:14:47 +0800 |
commit | 15326047fc297593a19c9ce1e392ae92b76ee055 (patch) | |
tree | 1e58e7f6ba3e040b26973df83d6337ff5b4e3ae0 /ftp/spegla | |
parent | fac70de59f81e181c5fce24a60d5fbb45f4ef1ad (diff) | |
download | freebsd-ports-gnome-15326047fc297593a19c9ce1e392ae92b76ee055.tar.gz freebsd-ports-gnome-15326047fc297593a19c9ce1e392ae92b76ee055.tar.zst freebsd-ports-gnome-15326047fc297593a19c9ce1e392ae92b76ee055.zip |
Add a patch to fix a serious bug which can break a ftp
connection under some circumstances.
Approved by: maintainer timeout (2 months)
Approved by: linimon (mentor)
Diffstat (limited to 'ftp/spegla')
-rw-r--r-- | ftp/spegla/Makefile | 2 | ||||
-rw-r--r-- | ftp/spegla/files/patch-ba | 11 | ||||
-rw-r--r-- | ftp/spegla/files/patch-jftp.c | 61 |
3 files changed, 62 insertions, 12 deletions
diff --git a/ftp/spegla/Makefile b/ftp/spegla/Makefile index 2ff6478e4a05..368a3f7ccf33 100644 --- a/ftp/spegla/Makefile +++ b/ftp/spegla/Makefile @@ -8,7 +8,7 @@ PORTNAME= spegla PORTVERSION= 1.1p4 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= ftp ipv6 MASTER_SITES= ftp://subzero.campus.luth.se/pub/spegla/ # ftp://ftp.luth.se/pub/unix/mirror/ diff --git a/ftp/spegla/files/patch-ba b/ftp/spegla/files/patch-ba deleted file mode 100644 index b5ea070a5e82..000000000000 --- a/ftp/spegla/files/patch-ba +++ /dev/null @@ -1,11 +0,0 @@ ---- jftp.c.orig Fri Sep 27 12:46:43 2002 -+++ jftp.c Fri Sep 27 12:47:55 2002 -@@ -980,7 +980,7 @@ - /* Late versions of wu-ftpd does some kind of recursive - * listing if only a '.' is given as directory. - */ -- if (strcmp(dir, ".") == 0) -+ if ((strcmp(dir, ".") == 0) || !*dir) - res = ftp_req(c, "list %s", flags); - else - res = ftp_req(c, "list %s %s", flags, dir); diff --git a/ftp/spegla/files/patch-jftp.c b/ftp/spegla/files/patch-jftp.c new file mode 100644 index 000000000000..7add9fc77920 --- /dev/null +++ b/ftp/spegla/files/patch-jftp.c @@ -0,0 +1,61 @@ +--- jftp.c.orig Fri Mar 19 03:47:12 2004 ++++ jftp.c Fri Mar 19 03:47:57 2004 +@@ -40,6 +40,7 @@ + #include <netinet/in.h> + #include <arpa/inet.h> + ++#include <ctype.h> + #include <setjmp.h> + #include <signal.h> + #include <stdio.h> +@@ -246,6 +247,7 @@ + int ftp_status, eol, i, islongtext; + ssize_t done, res, size, pos; + char *nfmt; ++ char rescode[5]; + + if (*fmt != ' ') { + if ((nfmt = alloca(strlen(fmt) + 3)) == NULL) { +@@ -293,12 +295,28 @@ + pos += done; + if(eol) { + ftp_status=0; +- res = sscanf(c->ftp_buf, "%3d", &ftp_status); +- if ((res == 1) && (ftp_status >= 100) && (ftp_status <= 999)) { +- /* We have a line that contains a valid reply code */ + +- /* This may be the start of a multi line reply */ +- islongtext = (c->ftp_buf[3] == '-'); ++ /* We are interested in the first 4 bytes */ ++ (void)memset(rescode, '\0', sizeof(rescode)); ++ (void)memcpy(rescode, c->ftp_buf, sizeof(rescode) - 1); ++ ++ if (isdigit(rescode[0]) ++ && isdigit(rescode[1]) ++ && isdigit(rescode[2])) { ++ res = sscanf(rescode, "%3d", &ftp_status); ++ ++ E_LOGX_1(3, "ftp_status: %d", ftp_status); ++ E_LOGX_1(3, "c->ftp_buf: %s", c->ftp_buf); ++ ++ if ((rescode[3] == '-' || rescode[3] == ' ') ++ && (res == 1)) { ++ islongtext = (rescode[3] == '-'); ++ if (ftp_status < 100) { ++ E_LOGX_1(1, "%s", c->ftp_buf); ++ c->ftp_resp = JFTP_ERR; ++ return -1; ++ } ++ } + } + if(islongtext) { + size = sizeof(c->ftp_buf); +@@ -980,7 +998,7 @@ + /* Late versions of wu-ftpd does some kind of recursive + * listing if only a '.' is given as directory. + */ +- if (strcmp(dir, ".") == 0) ++ if ((strcmp(dir, ".") == 0) || !*dir) + res = ftp_req(c, "list %s", flags); + else + res = ftp_req(c, "list %s %s", flags, dir); |