This is a patch to publicfile-0.52 that replaces the EPLF ftpd LIST output with the vastly inferior but widely-supported "/bin/ls" style output. No additional system calls are made, so this should not affect security. The format is taken from the spec suggested at http://cr.yp.to/ftp/list/binls.html . This patch also adds a "conf-timeout" file to the source directory that can be used to adjust the idle timeout for the ftpd daemon. It changes the default to 300 seconds, rather than 60. to apply, cd to the publicfile source directory, then patch -p0 < publicfile_no_eplf.patch Dan Bernstein's publicfile and its associated tools are available from http://cr.yp.to/software.html 01 Sep 2000 Scott Woods --- fetch.c.orig Fri Sep 1 02:59:05 2000 +++ fetch.c Fri Sep 1 16:06:59 2000 @@ -40,24 +40,28 @@ static void printstat() { - substdio_puts(&ss,"+i"); - substdio_put(&ss,strnum,fmt_ulong(strnum,(unsigned long) st.st_dev)); - substdio_puts(&ss,"."); - substdio_put(&ss,strnum,fmt_ulong(strnum,(unsigned long) st.st_ino)); - - if (st.st_mtime > 0) - if (st.st_mtime < now - 60) { - substdio_puts(&ss,",m"); - substdio_put(&ss,strnum,fmt_ulong(strnum,(unsigned long) st.st_mtime)); + int i; + char *longstring = ctime(&st.st_mtime); + char buf[65]; + char datebuf[15]; + char *p = datebuf; + + for (i = 4; i < 11; ++i) + *p++ = longstring[i]; + if (st.st_mtime + ((365/2)*86400) > time(NULL)) + for (i = 11; i < 16; ++i) + *p++ = longstring[i]; + else { + *p++ = ' '; + for (i = 20; i < 24; ++i) + *p++ = longstring[i]; } - if ((st.st_mode & S_IFMT) == S_IFDIR) - substdio_puts(&ss,",/"); - if (((st.st_mode & S_IFMT) == S_IFREG) && ((st.st_mode & 0444) == 0444)) { - substdio_puts(&ss,",r,s"); - substdio_put(&ss,strnum,fmt_ulong(strnum,(unsigned long) st.st_size)); - } - substdio_puts(&ss,",\t"); + sprintf(buf, "%.10s 1 owner group %13g %.12s ", + (st.st_mode & S_IFMT) == S_IFDIR ? "drwxr-xr-x" : "-rw-r--r--", + (double)st.st_size, + datebuf); + substdio_put(&ss,buf,strlen(buf)); } static void list(char *fn,int flaglong) @@ -93,8 +97,8 @@ switch(how) { case FETCH_LISTONE: - if (fstat(fdfile,&st) == -1) break; printstat(&st); + if (fstat(fdfile,&st) == -1) break; for (i = 0;fn[i];++i) if (fn[i] == '\n') substdio_put(&ss,"",1); --- Makefile.orig Fri Sep 1 14:35:14 2000 +++ Makefile Fri Sep 1 14:51:36 2000 @@ -195,6 +195,8 @@ timeoutwrite.h substdio.h fetch.h pathdecode.h stralloc.h gen_alloc.h \ file.h tai.h uint64.h sig.h tai.h stralloc.h str.h error.h case.h \ byte.h env.h fmt.h scan.h ip.h + sed s/TIMEOUT_READ/`head -1 conf-timeout`/g ftpd.c > ftpd.tmp + mv ftpd.tmp ftpd.c ./compile ftpd.c getln.a: \ --- ftpd.c.orig Fri Sep 1 13:48:33 2000 +++ ftpd.c Fri Sep 1 14:51:38 2000 @@ -57,7 +57,7 @@ { int r; out_flush(); - r = timeoutread(60,fd,buf,len); + r = timeoutread(300,fd,buf,len); if (r <= 0) _exit(0); return r; } --- conf-timeout.orig Fri Sep 1 14:09:32 2000 +++ conf-timeout Fri Sep 1 14:04:49 2000 @@ -0,0 +1,3 @@ +300 + +this is the number of idle seconds before ftpd closes the connection.