Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package uftpd for openSUSE:Factory checked in at 2021-12-21 18:40:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/uftpd (Old) and /work/SRC/openSUSE:Factory/.uftpd.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "uftpd" Tue Dec 21 18:40:45 2021 rev:13 rq:941813 version:2.15 Changes: -------- --- /work/SRC/openSUSE:Factory/uftpd/uftpd.changes 2021-12-12 21:28:30.800373666 +0100 +++ /work/SRC/openSUSE:Factory/.uftpd.new.2520/uftpd.changes 2021-12-21 18:41:17.229909145 +0100 @@ -1,0 +2,19 @@ +Mon Dec 20 06:34:46 UTC 2021 - Martin Hauke <[email protected]> + +- Update to version 2.15 + Changes + * Silence some developer debug messages + * Always skip . and .. in FTP listings + * Internal refactoring and code cleanup + Fixes + * Fix regression introduced in v2.14, server directory name shown + in FTP + * listings instead of ., e.g. MLST . showed the directory name + * Fix #36: for real this time, now also with a test case to verify + * Fix #38: duplicate entries in FTP listings, regression in v2.14 + Caused by (initially unintentional) removal of sorted listings, + where directories prior to v2.14 were listed first. This change, + albeit an accident, actually helped clean up the code base and + speed up replies + +------------------------------------------------------------------- Old: ---- uftpd-2.14.tar.gz New: ---- uftpd-2.15.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ uftpd.spec ++++++ --- /var/tmp/diff_new_pack.WRRY8c/_old 2021-12-21 18:41:17.677909548 +0100 +++ /var/tmp/diff_new_pack.WRRY8c/_new 2021-12-21 18:41:17.681909551 +0100 @@ -18,7 +18,7 @@ Name: uftpd -Version: 2.14 +Version: 2.15 Release: 0 Summary: A combined TFTP/FTP server License: ISC ++++++ uftpd-2.14.tar.gz -> uftpd-2.15.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/.github/workflows/build.yml new/uftpd-2.15/.github/workflows/build.yml --- old/uftpd-2.14/.github/workflows/build.yml 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/.github/workflows/build.yml 2021-12-20 06:23:55.000000000 +0100 @@ -30,7 +30,7 @@ echo "deb [arch=amd64] https://deb.troglobit.com/debian stable main" \ | sudo tee /etc/apt/sources.list.d/troglobit.list sudo apt-get -y update - sudo apt-get -y install tree ftp tftp-hpa libuev-dev libite-dev + sudo apt-get -y install tree ftp tnftp tftp-hpa libuev-dev libite-dev - uses: actions/checkout@v2 - name: Configure run: | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/.github/workflows/release.yml new/uftpd-2.15/.github/workflows/release.yml --- old/uftpd-2.14/.github/workflows/release.yml 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/.github/workflows/release.yml 2021-12-20 06:23:55.000000000 +0100 @@ -45,7 +45,7 @@ echo "deb [arch=amd64] https://deb.troglobit.com/debian stable main" \ | sudo tee /etc/apt/sources.list.d/troglobit.list sudo apt-get -y update - sudo apt-get -y install pkg-config libuev-dev libite-dev + sudo apt-get -y install ftp tnftp tftp-hpa libuev-dev libite-dev - name: Creating Makefiles ... run: | ./autogen.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/ChangeLog.md new/uftpd-2.15/ChangeLog.md --- old/uftpd-2.14/ChangeLog.md 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/ChangeLog.md 2021-12-20 06:23:55.000000000 +0100 @@ -3,6 +3,27 @@ All notable changes to the project are documented in this file. + +[v2.15][] - 2021-12-20 +---------------------- + +### Changes +- CI status badge now to points to GitHub Actions, no more Travis-CI +- Silence some developer debug messages +- Always skip `.` and `..` in FTP listings +- Internal refactoring and code cleanup + +### Fixes +- Fix mdoc warning, found by lintian +- Fix regression introduced in v2.14, server directory name shown in FTP + listings instead of `.`, e.g. `MLST .` showed the directory name +- Fix #36: for real this time, now also with a test case to verify +- Fix #38: duplicate entries in FTP listings, regression in v2.14. + Caused by (initially unintentional) removal of sorted listings, where + directories prior to v2.14 were listed first. This change, albeit an + accident, actually helped clean up the code base and speed up replies + + [v2.14][] - 2021-12-11 ---------------------- @@ -498,7 +519,8 @@ Lines must end in the old `\r\n` format, rather than UNIX `\n`. -[UNRELEASED]: https://github.com/troglobit/uftpd/compare/v2.14...HEAD +[UNRELEASED]: https://github.com/troglobit/uftpd/compare/v2.15...HEAD +[v2.15]: https://github.com/troglobit/uftpd/compare/v2.14...v2.15 [v2.14]: https://github.com/troglobit/uftpd/compare/v2.13...v2.14 [v2.13]: https://github.com/troglobit/uftpd/compare/v2.12...v2.13 [v2.12]: https://github.com/troglobit/uftpd/compare/v2.11...v2.12 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/README.md new/uftpd-2.15/README.md --- old/uftpd-2.14/README.md 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/README.md 2021-12-20 06:23:55.000000000 +0100 @@ -1,6 +1,6 @@ No Nonsense FTP/TFTP Server =========================== -[![License Badge][]][License] [![Travis Status][]][Travis] [![Coverity Status][]][Coverity Scan] +[![License Badge][]][License] [![GitHub Status][]][GitHub] [![Coverity Status][]][Coverity Scan] uftpd is a UNIX daemon with sane built-in defaults. It just works. @@ -154,20 +154,20 @@ uftpd was originally based on [FtpServer][] by [Xu Wang][], but is now a complete rewrite with TFTP support by [Joachim Wiberg][], maintained at -[GitHub][]. +[GitHub][home]. [Joachim Wiberg]: http://troglobit.com [the FTP]: http://ftp.troglobit.com/uftpd/ [Xu Wang]: https://github.com/xu-wang11/ [FtpServer]: https://github.com/xu-wang11/FtpServer -[GitHub]: https://github.com/troglobit/uftpd +[home]: https://github.com/troglobit/uftpd [Finit]: https://github.com/troglobit/finit [lite]: https://github.com/troglobit/libite [libuEv]: https://github.com/troglobit/libuev [License]: https://en.wikipedia.org/wiki/ISC_license [License Badge]: https://img.shields.io/badge/License-ISC-blue.svg -[Travis]: https://travis-ci.org/troglobit/uftpd -[Travis Status]: https://travis-ci.org/troglobit/uftpd.png?branch=master +[GitHub]: https://github.com/troglobit/uftpd/actions/workflows/build.yml/ +[GitHub Status]: https://github.com/troglobit/uftpd/actions/workflows/build.yml/badge.svg [Coverity Scan]: https://scan.coverity.com/projects/2947 [Coverity Status]: https://scan.coverity.com/projects/2947/badge.svg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/configure.ac new/uftpd-2.15/configure.ac --- old/uftpd-2.14/configure.ac 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/configure.ac 2021-12-20 06:23:55.000000000 +0100 @@ -1,4 +1,4 @@ -AC_INIT([uftpd], [2.14], [https://github.com/troglobit/uftpd/issues], [], +AC_INIT([uftpd], [2.15], [https://github.com/troglobit/uftpd/issues], [], [https://troglobit.com/projects/uftpd/]) AC_CONFIG_AUX_DIR(aux) AM_INIT_AUTOMAKE([1.11 foreign dist-xz]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/debian/changelog new/uftpd-2.15/debian/changelog --- old/uftpd-2.14/debian/changelog 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/debian/changelog 2021-12-20 06:23:55.000000000 +0100 @@ -1,3 +1,18 @@ +uftpd (2.15) stable; urgency=medium + + * Silence some developer debug messages + * Always skip `.` and `..` in FTP listings + * Fix mdoc warning, found by lintian + * Fix regression introduced in v2.14, server directory name shown in FTP + listings instead of `.`, e.g. `MLST .` showed the directory name + * Fix #36: for real this time, now also with a test case to verify + * Fix #38: duplicate entries in FTP listings, regression in v2.14. + Caused by (initially unintentional) removal of sorted listings, where + directories prior to v2.14 were listed first. This change, albeit an + accident, actually helped clean up the code base and speed up replies + + -- Joachim Wiberg <[email protected]> Mon, 20 Dec 2021 06:15:08 +0100 + uftpd (2.14) stable; urgency=medium * Add support for `-o pasv_addr=ADDR` command line argument to override diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/man/uftpd.8 new/uftpd-2.15/man/uftpd.8 --- old/uftpd-2.14/man/uftpd.8 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/man/uftpd.8 2021-12-20 06:23:55.000000000 +0100 @@ -62,7 +62,7 @@ the log level, start .Nm with -.Cm Fl l Ar error . +.Fl l Ar error . .It Fl n Run in foreground, do not detach from controlling terminal .It Fl o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/src/common.c new/uftpd-2.15/src/common.c --- old/uftpd-2.14/src/common.c 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/src/common.c 2021-12-20 06:23:55.000000000 +0100 @@ -55,12 +55,12 @@ if (!chrooted) { size_t len = strlen(home); - DBG("Server path from CWD: %s", dir); +// DBG("Server path from CWD: %s", dir); if (len > 0 && home[len - 1] == '/') len--; memmove(dir + len, dir, strlen(dir) + 1); memcpy(dir, home, len); - DBG("Resulting non-chroot path: %s", dir); +// DBG("Resulting non-chroot path: %s", dir); } /* @@ -85,7 +85,7 @@ return NULL; } - DBG("realpath(%s) => %s", ptr, rpath); +// DBG("realpath(%s) => %s", ptr, rpath); if (rpath[1] != 0) strlcat(rpath, "/", sizeof(rpath)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/src/ftpcmd.c new/uftpd-2.15/src/ftpcmd.c --- old/uftpd-2.14/src/ftpcmd.c 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/src/ftpcmd.c 2021-12-20 06:23:55.000000000 +0100 @@ -22,6 +22,11 @@ # include <sys/time.h> #endif +#define LISTMODE_LIST 0 +#define LISTMODE_NLST 1 +#define LISTMODE_MLST 2 +#define LISTMODE_MLSD 3 + typedef struct { char *command; void (*cb)(ctrl_t *ctr, char *arg); @@ -29,7 +34,7 @@ static ftp_cmd_t supported[]; -static void do_PORT(ctrl_t *ctrl, int pending); +static void do_PORT(ctrl_t *ctrl, pend_t pending); static void do_LIST(uev_t *w, void *arg, int events); static void do_RETR(uev_t *w, void *arg, int events); static void do_STOR(uev_t *w, void *arg, int events); @@ -296,7 +301,7 @@ ctrl->fp = NULL; } - ctrl->pending = 0; + ctrl->pending = PENDING_NONE; ctrl->offset = 0; return close_data_connection(ctrl); @@ -476,16 +481,16 @@ static char str[11]; snprintf(str, sizeof(str), "%c%c%c%c%c%c%c%c%c%c", - S_ISDIR(m) ? 'd' : '-', - m & S_IRUSR ? 'r' : '-', - m & S_IWUSR ? 'w' : '-', - m & S_IXUSR ? 'x' : '-', - m & S_IRGRP ? 'r' : '-', - m & S_IWGRP ? 'w' : '-', - m & S_IXGRP ? 'x' : '-', - m & S_IROTH ? 'r' : '-', - m & S_IWOTH ? 'w' : '-', - m & S_IXOTH ? 'x' : '-'); + S_ISDIR(m) ? 'd' : '-', + (m & S_IRUSR) ? 'r' : '-', + (m & S_IWUSR) ? 'w' : '-', + (m & S_IXUSR) ? 'x' : '-', + (m & S_IRGRP) ? 'r' : '-', + (m & S_IWGRP) ? 'w' : '-', + (m & S_IXGRP) ? 'x' : '-', + (m & S_IROTH) ? 'r' : '-', + (m & S_IWOTH) ? 'w' : '-', + (m & S_IXOTH) ? 'x' : '-'); return str; } @@ -576,7 +581,7 @@ } memset(buf, 0, len); - if (ctrl->d_num == -1 && (ctrl->list_mode & 0x0F) == 2) + if (ctrl->d_num == -1 && ctrl->list_mode == LISTMODE_MLST) strlcat(buf, " ", len); for (int i = 0; ctrl->facts[i]; i++) @@ -594,18 +599,18 @@ if (stat(path, &st)) return -1; - switch (ctrl->list_mode & 0x0F) { - case 3: /* MLSD */ + switch (ctrl->list_mode) { + case LISTMODE_MLSD: /* fallthrough */ - case 2: /* MLST */ + case LISTMODE_MLST: mlsd_printf(ctrl, buf, len, path, name, &st); break; - case 1: /* NLST */ + case LISTMODE_NLST: snprintf(buf, len, "%s\r\n", name); break; - case 0: /* LIST */ + case LISTMODE_LIST: snprintf(buf, len, "%s 1 %5d %5d %12" PRIu64 " %s %s\r\n", mode_to_str(st.st_mode), 0, 0, (uint64_t)st.st_size, @@ -621,21 +626,22 @@ char buf[512] = { 0 }; char cwd[PATH_MAX]; int sd = ctrl->sd; - size_t len = 0; char *path; + int len; if (ctrl->data_sd != -1) sd = ctrl->data_sd; - snprintf(buf, sizeof(buf), "250- Listing %s\r\n", ctrl->file); - len = strlen(buf); + len = snprintf(buf, sizeof(buf), "250- Listing %s\r\n", ctrl->file); + if (len < 0 || len > (int)sizeof(buf)) + goto abort; strlcpy(cwd, ctrl->file, sizeof(cwd)); path = compose_path(ctrl, cwd); if (!path) goto abort; - if (list_printf(ctrl, &buf[len], sizeof(buf) - len, path, basename(path))) { + if (list_printf(ctrl, &buf[len], sizeof(buf) - len, path, basename(ctrl->file))) { abort: do_abort(ctrl); send_msg(ctrl->sd, "550 No such file or directory.\r\n"); @@ -643,8 +649,8 @@ } strlcat(buf, "250 End.\r\n", sizeof(buf)); - do_abort(ctrl); send_msg(sd, buf); + do_abort(ctrl); } static void do_MLSD(ctrl_t *ctrl) @@ -686,11 +692,10 @@ uev_timer_set(&ctrl->timeout_watcher, INACTIVITY_TIMER, 0); if (ctrl->d_num == -1) { - if (ctrl->list_mode == 3) - do_MLSD(ctrl); - else + if (ctrl->list_mode == LISTMODE_MLST) do_MLST(ctrl); - do_abort(ctrl); + else + do_MLSD(ctrl); return; } @@ -700,7 +705,6 @@ ctrl->tv.tv_sec = tv.tv_sec; } - ctrl->list_mode |= (ctrl->pending ? 0 : 0x80); while (ctrl->i < ctrl->d_num) { struct dirent *entry; char cwd[PATH_MAX]; @@ -711,7 +715,7 @@ name = entry->d_name; DBG("Found directory entry %s", name); - if ((!strcmp(name, ".") || !strcmp(name, "..")) && ctrl->list_mode < 2) + if (!strcmp(name, ".") || !strcmp(name, "..")) continue; len = strlen(ctrl->file); @@ -725,14 +729,8 @@ continue; } - switch (list_printf(ctrl, buf, sizeof(buf), path, name)) { - case -1: + if (list_printf(ctrl, buf, sizeof(buf), path, name)) goto fail; - case 1: - continue; - default: - break; - } DBG("LIST %s", buf); @@ -743,24 +741,12 @@ else ERR(errno, "Failed sending file %s to client", ctrl->file); - while (ctrl->i < ctrl->d_num) { - entry = ctrl->d[ctrl->i++]; - free(entry); - } do_abort(ctrl); send_msg(ctrl->sd, "426 TCP connection was established but then broken!\r\n"); } return; } - ctrl->list_mode &= 0x0F; - - /* Rewind and list files */ - if (ctrl->pending == 0) { - ctrl->pending++; - ctrl->i = 0; - return; - } do_abort(ctrl); send_msg(ctrl->sd, "226 Transfer complete.\r\n"); @@ -769,10 +755,10 @@ static const char *mode2op(int mode) { switch (mode) { - case 0: return "LIST"; - case 1: return "NLST"; - case 2: return "MLST"; - case 3: return "MLSD"; + case LISTMODE_LIST: return "LIST"; + case LISTMODE_NLST: return "NLST"; + case LISTMODE_MLST: return "MLST"; + case LISTMODE_MLSD: return "MLSD"; } return "LST?"; @@ -813,7 +799,7 @@ arg = ptr; } - if (mode >= 2) + if (mode >= LISTMODE_MLST) path = compose_abspath(ctrl, arg); else path = compose_path(ctrl, arg); @@ -828,9 +814,11 @@ ctrl->i = 0; ctrl->d_num = scandir(path, &ctrl->d, NULL, alphasort); if (ctrl->d_num == -1) { - send_msg(ctrl->sd, "550 No such file or directory.\r\n"); - DBG("Failed reading directory '%s': %s", path, strerror(errno)); - return; + if (access(path, R_OK)) { + send_msg(ctrl->sd, "550 No such file or directory.\r\n"); + DBG("Failed reading directory '%s': %s", path, strerror(errno)); + return; + } } DBG("Reading directory %s ... %d number of entries", path, ctrl->d_num); @@ -840,27 +828,27 @@ return; } - do_PORT(ctrl, 1); + do_PORT(ctrl, PENDING_LIST); } static void handle_LIST(ctrl_t *ctrl, char *arg) { - list(ctrl, arg, 0); + list(ctrl, arg, LISTMODE_LIST); } static void handle_NLST(ctrl_t *ctrl, char *arg) { - list(ctrl, arg, 1); + list(ctrl, arg, LISTMODE_NLST); } static void handle_MLST(ctrl_t *ctrl, char *arg) { - list(ctrl, arg, 2); + list(ctrl, arg, LISTMODE_MLST); } static void handle_MLSD(ctrl_t *ctrl, char *arg) { - list(ctrl, arg, 3); + list(ctrl, arg, LISTMODE_MLSD); } static void do_pasv_connection(uev_t *w, void *arg, int events) @@ -879,9 +867,9 @@ return; switch (ctrl->pending) { - case 3: - /* fall-through */ - case 2: + case PENDING_STOR: + /* fallthrough */ + case PENDING_RETR: if (ctrl->offset) rc = fseek(ctrl->fp, ctrl->offset, SEEK_SET); if (rc) { @@ -889,37 +877,41 @@ send_msg(ctrl->sd, "551 Failed seeking to that position in file.\r\n"); return; } - /* fall-through */ - case 1: + /* fallthrough */ + case PENDING_LIST: break; - default: + case PENDING_NONE: DBG("No pending command, waiting ..."); return; } switch (ctrl->pending) { - case 3: /* STOR */ + case PENDING_STOR: DBG("Pending STOR, starting ..."); uev_io_init(ctrl->ctx, &ctrl->data_watcher, do_STOR, ctrl, ctrl->data_sd, UEV_READ); break; - case 2: /* RETR */ + case PENDING_RETR: DBG("Pending RETR, starting ..."); uev_io_init(ctrl->ctx, &ctrl->data_watcher, do_RETR, ctrl, ctrl->data_sd, UEV_WRITE); break; - case 1: /* LIST */ + case PENDING_LIST: DBG("Pending LIST, starting ..."); uev_io_init(ctrl->ctx, &ctrl->data_watcher, do_LIST, ctrl, ctrl->data_sd, UEV_WRITE); break; + + case PENDING_NONE: + /* cannot get here */ + return; } - if (ctrl->pending == 1 && ctrl->list_mode == 2) + if (ctrl->pending == PENDING_LIST && ctrl->list_mode == LISTMODE_MLST) send_msg(ctrl->sd, "150 Opening ASCII mode data connection for MLSD.\r\n"); else send_msg(ctrl->sd, "150 Data connection accepted; transfer starting.\r\n"); - ctrl->pending = 0; + ctrl->pending = PENDING_NONE; } static int do_PASV(ctrl_t *ctrl, char *arg, struct sockaddr *data, socklen_t *len) @@ -1079,12 +1071,12 @@ * Check if previous command was PORT, then connect to client and * transfer file/listing similar to what's done for PASV conns. */ -static void do_PORT(ctrl_t *ctrl, int pending) +static void do_PORT(ctrl_t *ctrl, pend_t pending) { if (!ctrl->data_address[0]) { /* Check if previous command was PASV */ if (ctrl->data_sd == -1 && ctrl->data_listen_sd == -1) { - if (pending == 1 && ctrl->d_num != -1) + if (pending == 1) do_MLST(ctrl); return; } @@ -1099,24 +1091,28 @@ return; } - if (pending != 1 || ctrl->list_mode != 2) + if (pending != PENDING_LIST || ctrl->list_mode != LISTMODE_MLST) send_msg(ctrl->sd, "150 Data connection opened; transfer starting.\r\n"); switch (pending) { - case 3: + case PENDING_STOR: uev_io_init(ctrl->ctx, &ctrl->data_watcher, do_STOR, ctrl, ctrl->data_sd, UEV_READ); break; - case 2: + case PENDING_RETR: uev_io_init(ctrl->ctx, &ctrl->data_watcher, do_RETR, ctrl, ctrl->data_sd, UEV_WRITE); break; - case 1: + case PENDING_LIST: uev_io_init(ctrl->ctx, &ctrl->data_watcher, do_LIST, ctrl, ctrl->data_sd, UEV_WRITE); break; + + default: + ERR(0, "Unhandled pending command (%d) in %s()!", pending, __func__); + break; } - ctrl->pending = 0; + ctrl->pending = PENDING_NONE; } static void handle_RETR(ctrl_t *ctrl, char *file) @@ -1163,7 +1159,7 @@ return; } - do_PORT(ctrl, 2); + do_PORT(ctrl, PENDING_RETR); } /* Request to set mtime, ncftp does this */ @@ -1314,7 +1310,7 @@ return; } - do_PORT(ctrl, 3); + do_PORT(ctrl, PENDING_STOR); } static void handle_DELE(ctrl_t *ctrl, char *file) @@ -1494,9 +1490,9 @@ static void handle_HELP(ctrl_t *ctrl, char *arg) { - int i = 0; - char buf[80]; ftp_cmd_t *cmd; + char buf[80]; + int i = 0; if (string_valid(arg) && !string_compare(arg, "SITE")) { send_msg(ctrl->sd, "500 command HELP does not take any arguments on this server.\r\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/src/uftpd.h new/uftpd-2.15/src/uftpd.h --- old/uftpd-2.14/src/uftpd.h 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/src/uftpd.h 2021-12-20 06:23:55.000000000 +0100 @@ -107,6 +107,13 @@ typedef struct tftphdr tftp_t; +typedef enum { + PENDING_NONE=0, + PENDING_LIST, + PENDING_RETR, + PENDING_STOR +} pend_t; + typedef struct { int sd; int type; @@ -128,7 +135,7 @@ size_t bufsz; /* Size of buf */ char facts[10]; - char pending; /* Pending op: LIST, RETR, STOR */ + pend_t pending; /* Pending op: LIST, RETR, STOR */ char list_mode; /* Current LIST mode */ char *file; /* Current file name to fetch */ off_t offset; /* Offset/block in current file, for REST/WRQ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/test/Makefile.am new/uftpd-2.15/test/Makefile.am --- old/uftpd-2.14/test/Makefile.am 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/test/Makefile.am 2021-12-20 06:23:55.000000000 +0100 @@ -1,4 +1,4 @@ -EXTRA_DIST = lib.sh ftp.sh tftp.sh maxfiles.sh +EXTRA_DIST = lib.sh ftp.sh tftp.sh mlst.sh maxfiles.sh CLEANFILES = *~ *.trs *.log TEST_EXTENSIONS = .sh @@ -6,7 +6,5 @@ TESTS = ftp.sh TESTS += tftp.sh +TESTS += mlst.sh TESTS += maxfiles.sh - -.PRECIOUS: stop.log - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/test/lib.sh new/uftpd-2.15/test/lib.sh --- old/uftpd-2.14/test/lib.sh 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/test/lib.sh 2021-12-20 06:23:55.000000000 +0100 @@ -90,12 +90,27 @@ setup() { bindir=$(pwd)/../src - ls -l $bindir + ip link set lo up sleep 1 + + # https://datatracker.ietf.org/doc/html/rfc3092 + mkdir -p "${DIR}/foo/bar" + for file in baz qux quz xyzzy; do + touch "${DIR}/foo/$file" + done + for file in fred garply grault waldo; do + touch "${DIR}/foo/bar/$file" + done + cp /etc/passwd "${DIR}/testfile.txt" - "${bindir}/uftpd" -l debug "$DIR" -p "$DIR/pid" >"$DIR/log" + + "${bindir}/uftpd" "$DIR" -p "$DIR/pid" >"$DIR/log" cd "${CDIR}" || exit 1 + + sleep 1 + cat "$DIR/pid" >> "$DIR/PIDs" + return 0 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/test/maxfiles.sh new/uftpd-2.15/test/maxfiles.sh --- old/uftpd-2.14/test/maxfiles.sh 2021-12-11 12:03:14.000000000 +0100 +++ new/uftpd-2.15/test/maxfiles.sh 2021-12-20 06:23:55.000000000 +0100 @@ -1,5 +1,5 @@ #!/bin/sh -set -x +#set -x if [ x"${srcdir}" = x ]; then srcdir=. @@ -14,11 +14,11 @@ get() { - ftp -n 127.0.0.1 <<-END - user anonymous a@b - get testfile.txt - bye - END + ftp -n 127.0.0.1 <<-EOF + user anonymous a@b + get testfile.txt + bye + EOF } check_dep ftp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.14/test/mlst.sh new/uftpd-2.15/test/mlst.sh --- old/uftpd-2.14/test/mlst.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.15/test/mlst.sh 2021-12-20 06:23:55.000000000 +0100 @@ -0,0 +1,23 @@ +#!/bin/sh +#set -x + +if [ x"${srcdir}" = x ]; then + srcdir=. +fi +. ${srcdir}/lib.sh + +cmd() +{ + tnftp [email protected] <<-EOF + cd foo + ls + $* + EOF +} + +check_dep tnftp + +cmd mlst bar |grep -q "perm=lepc;type=dir; bar" || FAIL "missing bar" +cmd mlst baz |grep -q "perm=rw;size=0;type=file; baz" || FAIL "missing baz" + +OK
