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-12 21:27:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/uftpd (Old) and /work/SRC/openSUSE:Factory/.uftpd.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "uftpd" Sun Dec 12 21:27:45 2021 rev:12 rq:940016 version:2.14 Changes: -------- --- /work/SRC/openSUSE:Factory/uftpd/uftpd.changes 2021-10-08 00:06:58.737847760 +0200 +++ /work/SRC/openSUSE:Factory/.uftpd.new.2520/uftpd.changes 2021-12-12 21:28:30.800373666 +0100 @@ -1,0 +2,10 @@ +Sat Dec 11 11:16:51 UTC 2021 - Martin Hauke <[email protected]> + +- Update to version 2.14 + * Add support for -o pasv_addr=ADDR command line argument to + override + * Add support for -p PIDFILE command line argument + * the address passed to the client in passive mode, useful for + some types of NAT setup + +------------------------------------------------------------------- Old: ---- uftpd-2.13.tar.gz New: ---- uftpd-2.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ uftpd.spec ++++++ --- /var/tmp/diff_new_pack.JIdCW5/_old 2021-12-12 21:28:31.212373910 +0100 +++ /var/tmp/diff_new_pack.JIdCW5/_new 2021-12-12 21:28:31.216373912 +0100 @@ -2,7 +2,7 @@ # spec file for package uftpd # # Copyright (c) 2021 SUSE LLC -# Copyright (c) 2018-2020, Martin Hauke <[email protected]> +# Copyright (c) 2018-2021, Martin Hauke <[email protected]> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: uftpd -Version: 2.13 +Version: 2.14 Release: 0 Summary: A combined TFTP/FTP server License: ISC ++++++ uftpd-2.13.tar.gz -> uftpd-2.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/.github/workflows/build.yml new/uftpd-2.14/.github/workflows/build.yml --- old/uftpd-2.13/.github/workflows/build.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/.github/workflows/build.yml 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,53 @@ +name: Bob the Builder + +# Run on all branches, including all pull requests, except the 'dev' +# branch since that's where we run Coverity Scan (limited tokens/day) +on: + push: + branches: + - '**' + - '!dev' + pull_request: + branches: + - '**' + +jobs: + build: + # Verify we can build on latest Ubuntu with both gcc and clang + name: ${{ matrix.compiler }} + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [gcc, clang] + fail-fast: false + env: + MAKEFLAGS: -j3 + CC: ${{ matrix.compiler }} + steps: + - name: Install dependencies + run: | + curl -sS https://deb.troglobit.com/pubkey.gpg | sudo apt-key add - + 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 + - uses: actions/checkout@v2 + - name: Configure + run: | + ./autogen.sh + ./configure --prefix= + - name: Build + run: | + make V=1 + - name: Install + run: | + DESTDIR=~/tmp make install-strip + tree ~/tmp + ldd ~/tmp/sbin/uftpd + size ~/tmp/sbin/uftpd + ~/tmp/sbin/uftpd -h + - name: Test + run: | + ulimit -n 1024 + # Tests must currently not run in parallel + LD_LIBRARY_PATH=/tmp/lib make -j1 check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/.github/workflows/c-cpp.yml new/uftpd-2.14/.github/workflows/c-cpp.yml --- old/uftpd-2.13/.github/workflows/c-cpp.yml 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/.github/workflows/c-cpp.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -name: C/C++ CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Install tools for unit tests - run: sudo apt-get -y install tree ftp tftp-hpa - - name: Install libuEv - run: | - wget https://github.com/troglobit/libuev/releases/download/v2.3.1/libuev-2.3.1.tar.xz - tar xf libuev-2.3.1.tar.xz - (cd libuev-2.3.1 && ./configure --prefix=/tmp && make && make install-strip) - - name: Install libite (-lite) - run: | - wget https://github.com/troglobit/libite/releases/download/v2.2.0/libite-2.2.0.tar.xz - tar xf libite-2.2.0.tar.xz - (cd libite-2.2.0 && ./configure --prefix=/tmp && make && make install-strip) - - name: configure - run: | - ./autogen.sh - PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./configure --disable-silent-rules --prefix= - - name: build - run: make -j5 - - name: run unit tests - run: | - ulimit -n 1024 - LD_LIBRARY_PATH=/tmp/lib make check - - name: install - run: | - DESTDIR=~/tmp make install-strip - tree ~/tmp - ldd ~/tmp/sbin/uftpd - LD_LIBRARY_PATH=/tmp/lib ~/tmp/sbin/uftpd -h - - name: distcheck - run: PKG_CONFIG_PATH=/tmp/lib/pkgconfig LD_LIBRARY_PATH=/tmp/lib make distcheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/.github/workflows/coverity.yml new/uftpd-2.14/.github/workflows/coverity.yml --- old/uftpd-2.13/.github/workflows/coverity.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/.github/workflows/coverity.yml 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,87 @@ +name: Coverity Scan + +on: + push: + branches: + - 'dev' + +env: + PROJECT_NAME: uftpd + CONTACT_EMAIL: [email protected] + COVERITY_NAME: troglobit-uftpd + COVERITY_PROJ: troglobit%2Fuftpd + +jobs: + coverity: + runs-on: ubuntu-latest + env: + MAKEFLAGS: -j3 + steps: + - name: Fetch latest Coverity Scan MD5 + id: var + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + run: | + wget -q https://scan.coverity.com/download/cxx/linux64 \ + --post-data "token=$TOKEN&project=${COVERITY_PROJ}&md5=1" \ + -O coverity-latest.tar.gz.md5 + export MD5=$(cat coverity-latest.tar.gz.md5) + echo "Got MD5 $MD5" + echo ::set-output name=md5::${MD5} + - uses: actions/cache@v2 + id: cache + with: + path: coverity-latest.tar.gz + key: ${{ runner.os }}-coverity-${{ steps.var.outputs.md5 }} + restore-keys: | + ${{ runner.os }}-coverity-${{ steps.var.outputs.md5 }} + ${{ runner.os }}-coverity- + ${{ runner.os }}-coverity + - name: Download Coverity Scan + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + run: | + if [ ! -f coverity-latest.tar.gz ]; then + wget -q https://scan.coverity.com/download/cxx/linux64 \ + --post-data "token=$TOKEN&project=${COVERITY_PROJ}" \ + -O coverity-latest.tar.gz + else + echo "Latest Coverity Scan available from cache :-)" + md5sum coverity-latest.tar.gz + fi + mkdir coverity + tar xzf coverity-latest.tar.gz --strip 1 -C coverity + - name: Install dependencies + run: | + curl -sS https://deb.troglobit.com/pubkey.gpg | sudo apt-key add - + 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 + - uses: actions/checkout@v2 + - name: Configure + run: | + ./autogen.sh + ./configure + - name: Build + run: | + export PATH=`pwd`/coverity/bin:$PATH + cov-build --dir cov-int make + - name: Submit results to Coverity Scan + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + run: | + tar czvf ${PROJECT_NAME}.tgz cov-int + curl \ + --form project=${COVERITY_NAME} \ + --form token=$TOKEN \ + --form email=${CONTACT_EMAIL} \ + --form file=@${PROJECT_NAME}.tgz \ + --form version=trunk \ + --form description="${PROJECT_NAME} $(git rev-parse HEAD)" \ + https://scan.coverity.com/builds?project=${COVERITY_PROJ} + - name: Upload build.log + uses: actions/upload-artifact@v2 + with: + name: coverity-build.log + path: cov-int/build-log.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/.github/workflows/release.yml new/uftpd-2.14/.github/workflows/release.yml --- old/uftpd-2.13/.github/workflows/release.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/.github/workflows/release.yml 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,65 @@ +name: Release General + +on: + push: + tags: + - 'v[0-9]+.[0-9]+*' + +jobs: + release: + name: Create GitHub release + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + release_id: ${{ steps.create_release.outputs.id }} + steps: + - uses: actions/checkout@v2 + - name: Extract ChangeLog entry ... + # Hack to extract latest entry for body_path below + run: | + awk '/-----*/{if (x == 1) exit; x=1;next}x' ChangeLog.md \ + |head -n -1 > release.md + cat release.md + - name: Create release ... + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: uftpd ${{ github.ref }} + body_path: release.md + draft: false + prerelease: false + tarball: + name: Build and upload release tarball + needs: release + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Installing dependencies ... + run: | + curl -sS https://deb.troglobit.com/pubkey.gpg | sudo apt-key add - + 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 + - name: Creating Makefiles ... + run: | + ./autogen.sh + ./configure + - name: Build release ... + run: | + make release + ls -lF ../ + mkdir -p artifacts/ + mv ../*.tar.* artifacts/ + - name: Upload release artifacts ... + uses: skx/[email protected] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + releaseId: ${{ needs.release.outputs.release_id }} + args: artifacts/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/.gitignore new/uftpd-2.14/.gitignore --- old/uftpd-2.13/.gitignore 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/.gitignore 2021-12-11 12:03:14.000000000 +0100 @@ -3,6 +3,7 @@ *.d *.map .deps +.gdb_history .libs .stamp .unpacked @@ -22,6 +23,7 @@ missing stamp-h1 TAGS +ID GPATH GRTAGS GSYMS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/.travis.yml new/uftpd-2.14/.travis.yml --- old/uftpd-2.13/.travis.yml 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,52 +0,0 @@ -# Travis CI integration -# Defaults to GNU GCC and autotools: ./configure && make && make test -language: c - -# Use docker for quicker builds, it now allows https://docs.travis-ci.com/user/apt/ -sudo: false - -# Test build with both GCC and Clang (LLVM) -compiler: - - gcc - - clang - -env: - global: - # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created - # via the "travis encrypt" command using the project repo's public key - - secure: "PQuj5u9r9J22UAgjeu0unfZewE48Y1PFmzD+o3QHpc/lPqFoDKvUY+pjAOsCXuV4DBORLGLKs+oZBFmb1yliBZBm6nO1Yj2JutlwyFRKUBTJkEi5Xn12adAYRI0THaQ5/b0kKPonxOuA/4ksoC2myqX7izz+Z6qKgSwJanKHrvA=" - -addons: - apt: - packages: - - tree - - ftp - - tftp-hpa - coverity_scan: - project: - name: "troglobit/uftpd" - description: "uftpd -- the no nonsense (T)FTP server" - notification_email: [email protected] - build_command_prepend: "./autogen.sh && PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./configure --disable-silent-rules --prefix=" - build_command: "make -j5 clean all" - branch_pattern: dev - -install: - - wget https://github.com/troglobit/libuev/releases/download/v2.3.1/libuev-2.3.1.tar.xz - - wget https://github.com/troglobit/libite/releases/download/v2.2.0/libite-2.2.0.tar.xz - - tar xf libuev-2.3.1.tar.xz - - tar xf libite-2.2.0.tar.xz - - (cd libuev-2.3.1 && ./configure --prefix=/tmp && make && make install-strip) - - (cd libite-2.2.0 && ./configure --prefix=/tmp && make && make install-strip) - -script: - - ./autogen.sh - - PKG_CONFIG_PATH=/tmp/lib/pkgconfig ./configure --disable-silent-rules --prefix= - - make clean - - make -j5 - - ulimit -n 1024 - - LD_LIBRARY_PATH=/tmp/lib make check - - DESTDIR=~/tmp make install-strip - - tree ~/tmp - - ldd ~/tmp/sbin/uftpd - - LD_LIBRARY_PATH=/tmp/lib ~/tmp/sbin/uftpd -h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/ChangeLog.md new/uftpd-2.14/ChangeLog.md --- old/uftpd-2.13/ChangeLog.md 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/ChangeLog.md 2021-12-11 12:03:14.000000000 +0100 @@ -3,6 +3,24 @@ All notable changes to the project are documented in this file. +[v2.14][] - 2021-12-11 +---------------------- + +### Changes +- Add support for `-o pasv_addr=ADDR` command line argument to override +- Add support for `-p PIDFILE` command line argument + the address passed to the client in passive mode, useful for some + types of NAT setup +- Add support for new libite (-lite) library header namespace +- Restored .tar.gz release archives +- Replaced Travis-CI with GitHub Actions + +### Fixes +- Issue #36: MLST command without any argument blocks +- Fix memory leak in MLST/MLSD, only affects no-MMU systems where the + kernel cannot free memory of processes on exit + + [v2.13][] - 2020-06-30 ---------------------- @@ -480,7 +498,8 @@ Lines must end in the old `\r\n` format, rather than UNIX `\n`. -[UNRELEASED]: https://github.com/troglobit/uftpd/compare/v2.13...HEAD +[UNRELEASED]: https://github.com/troglobit/uftpd/compare/v2.14...HEAD +[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 [v2.11]: https://github.com/troglobit/uftpd/compare/v2.10...v2.11 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/LICENSE new/uftpd-2.14/LICENSE --- old/uftpd-2.13/LICENSE 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/LICENSE 2021-12-11 12:03:14.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (C) 2014-2020 Joachim Nilsson <[email protected]> +Copyright (C) 2014-2021 Joachim Wiberg <[email protected]> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/Makefile.am new/uftpd-2.14/Makefile.am --- old/uftpd-2.13/Makefile.am 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/Makefile.am 2021-12-11 12:03:14.000000000 +0100 @@ -1,21 +1,10 @@ -SUBDIRS = src man tests +SUBDIRS = src man test doc_DATA = README.md LICENSE ChangeLog.md EXTRA_DIST = README.md LICENSE ChangeLog.md -## Generate .deb package -package build-deb: - @dpkg-buildpackage -uc -us -B - -## Generate MD5 checksum file -MD5 = md5sum -md5-dist: - @for file in $(DIST_ARCHIVES); do \ - $(MD5) $$file > $$file.md5; \ - done - ## Check if tagged in git release-hook: - if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \ + if [ ! `git tag -l v$(PACKAGE_VERSION) | grep $(PACKAGE_VERSION)` ]; then \ echo; \ printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ @@ -31,16 +20,22 @@ echo; \ fi +## Generate .deb package +package build-deb: + @debuild -uc -us -B --lintian-opts --profile debian -i -I --show-overrides + ## Target to run when building a release -release: distcheck release-hook md5-dist package +release: release-hook distcheck + @for file in $(DIST_ARCHIVES); do \ + md5sum $$file > ../$$file.md5; \ + sha256sum $$file > ../$$file.sha256; \ + done + @mv $(DIST_ARCHIVES) ../ @echo @echo "Resulting release files:" @echo "=================================================================" @for file in $(DIST_ARCHIVES); do \ - printf "%-30s Distribution tarball\n" $$file; \ - printf "%-30s " $$file.md5; cat $$file.md5 | cut -f1 -d' '; \ - mv $$file* ../; \ - done - @for file in `(cd ..; ls $(PACKAGE)_$(VERSION)*)`; do \ - printf "%-30s Debian/Ubuntu file\n" $$file; \ + printf "%-32s Distribution tarball\n" $$file; \ + printf "%-32s " $$file.md5; cat ../$$file.md5 | cut -f1 -d' '; \ + printf "%-32s " $$file.sha256; cat ../$$file.sha256 | cut -f1 -d' '; \ done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/README.md new/uftpd-2.14/README.md --- old/uftpd-2.13/README.md 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/README.md 2021-12-11 12:03:14.000000000 +0100 @@ -22,7 +22,7 @@ ----- ``` -uftpd [-hnsv] [-l LEVEL] [-o ftp=PORT,tftp=PORT,writable] [PATH] +uftpd [-hnsv] [-l LEVEL] [-o OPTS] [PATH] -h Show this help text -l LEVEL Set log level: none, err, notice (default), info, debug @@ -30,6 +30,7 @@ -o OPT Options: ftp=PORT tftp=PORT + pasv_addr=ADDR writable -s Use syslog, even if running in foreground, default w/o -n -v Show program version @@ -67,6 +68,7 @@ > your syslogd to redirect `LOG_FTP` to a separate log file, or reduce > the log level of uftpd using `-l error` to only log errors and higher. + Running from inetd ------------------ @@ -151,11 +153,11 @@ ------------------- uftpd was originally based on [FtpServer][] by [Xu Wang][], but is now a -complete rewrite with TFTP support by [Joachim Nilsson][], maintained at +complete rewrite with TFTP support by [Joachim Wiberg][], maintained at [GitHub][]. -[Joachim Nilsson]: http://troglobit.com +[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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/configure.ac new/uftpd-2.14/configure.ac --- old/uftpd-2.13/configure.ac 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/configure.ac 2021-12-11 12:03:14.000000000 +0100 @@ -1,12 +1,12 @@ -AC_INIT([uftpd], [2.13], [https://github.com/troglobit/uftpd/issues],, +AC_INIT([uftpd], [2.14], [https://github.com/troglobit/uftpd/issues], [], [https://troglobit.com/projects/uftpd/]) AC_CONFIG_AUX_DIR(aux) -AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) +AM_INIT_AUTOMAKE([1.11 foreign dist-xz]) AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([src/uftpd.c]) -AC_CONFIG_HEADER([config.h]) -AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile src/Makefile man/Makefile test/Makefile]) AC_PROG_CC AC_PROG_LN_S diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/debian/README.Debian new/uftpd-2.14/debian/README.Debian --- old/uftpd-2.13/debian/README.Debian 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/debian/README.Debian 2021-12-11 12:03:14.000000000 +0100 @@ -5,4 +5,4 @@ It runs from inetd on ports specified in /etc/services, serving files from the ftp user's $HOME, /src/ftp -- it just works. - -- Joachim Nilsson <[email protected]>, Sun, 2 Feb 2015 06:43:37 +0100 + -- Joachim Wiberg <[email protected]>, Sat, 11 Dec 2021 08:46:52 +0100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/debian/changelog new/uftpd-2.14/debian/changelog --- old/uftpd-2.13/debian/changelog 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/debian/changelog 2021-12-11 12:03:14.000000000 +0100 @@ -1,3 +1,15 @@ +uftpd (2.14) stable; urgency=medium + + * Add support for `-o pasv_addr=ADDR` command line argument to override + * Add support for `-p PIDFILE` command line argument + the address passed to the client in passive mode, useful for some + types of NAT setup + * Fix issue #36: MLST command without any argument blocks + * Fix memory leak in MLST/MLSD, only affects no-MMU systems where the + kernel cannot free memory of processes on exit + + -- Joachim Wiberg <[email protected]> Sat, 11 Dec 2021 11:27:57 +0100 + uftpd (2.13) unstable; urgency=medium * Fix issue #31: Socket leak in daemon accept(), causing denial of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/debian/control new/uftpd-2.14/debian/control --- old/uftpd-2.13/debian/control 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/debian/control 2021-12-11 12:03:14.000000000 +0100 @@ -1,7 +1,7 @@ Source: uftpd Section: net Priority: optional -Maintainer: Joachim Nilsson <[email protected]> +Maintainer: Joachim Wiberg <[email protected]> Build-Depends: debhelper (>= 10) Standards-Version: 4.3.0 Homepage: https://troglobit.com/projects/uftpd/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/debian/copyright new/uftpd-2.14/debian/copyright --- old/uftpd-2.13/debian/copyright 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/debian/copyright 2021-12-11 12:03:14.000000000 +0100 @@ -1,5 +1,5 @@ -Copyright: (c) 2014-2020 Joachim Nilsson <[email protected]> +Copyright: (c) 2014-2021 Joachim Wiberg <[email protected]> License: ISC Permission to use, copy, modify, and/or distribute this software for any diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/man/uftpd.8 new/uftpd-2.14/man/uftpd.8 --- old/uftpd-2.13/man/uftpd.8 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/man/uftpd.8 2021-12-11 12:03:14.000000000 +0100 @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2014-2020 Joachim Nilsson <[email protected]> +.\" Copyright (c) 2014-2021 Joachim Wiberg <[email protected]> .\" .\" Permission to use, copy, modify, and/or distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -13,9 +13,9 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd June 30, 2020 +.Dd December 6, 2021 .Dt UFTPD 8 -.Os "uftpd (2.10)" +.Os "uftpd (2.14)" .Sh NAME .Nm uftpd .Nd @@ -25,6 +25,7 @@ .Op Fl hnsv .Op Fl l Ar LOG .Op Fl o Ar ftp=PORT,tftp=PORT,writable +.Op Fl p Ar FILE .Op Ar PATH .Sh DESCRIPTION .Nm @@ -72,6 +73,7 @@ .It Ar ftp=PORT .It Ar tftp=PORT .It Ar writable +.It Ar pasv_addr=ADDR .El .Pp Override Internet ports otherwise derived from @@ -87,6 +89,20 @@ sub-directory, like .Ar upload/ , or similar. +.Pp +An address passed to the client in passive mode can be overridden with +the +.Ar pasv_addr +option (real data socket address remains unchanged). This may be useful +for passing through some types of NAT. +.It Fl p Ar FILE +File to store process ID for signaling +.Nm . +The default depends on how +.Nm +was configured at build time, and also the UNIX system it runs on, +but often it is found in +.Pa /var/run/uftpd.pid . .It Fl s Use syslog, even if running in foreground, default when running in the background @@ -204,6 +220,12 @@ .It Pa /etc/nologin Displayed to user attempting to connect. Access is refused if this file exists. +.It Pa /var/run/uftpd.pid +Program default PID file, created only when +.Nm +is ready with its internal setup and able to service signals. Note, +.Nm +exits on most signals. So no special processing is done atm. .El .Sh SEE ALSO .Xr ftp 1 , @@ -211,7 +233,7 @@ .Xr syslogd 8 .Sh AUTHORS .Nm -was written by Joachim Nilsson +was written by Joachim Wiberg .Aq mailto:[email protected] and is maintained at .Aq https://github.com/troglobit/uftpd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/src/common.c new/uftpd-2.14/src/common.c --- old/uftpd-2.13/src/common.c 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/src/common.c 2021-12-11 12:03:14.000000000 +0100 @@ -1,6 +1,6 @@ /* Common methods shared between FTP and TFTP engines * - * Copyright (c) 2014-2020 Joachim Nilsson <[email protected]> + * Copyright (c) 2014-2021 Joachim Wiberg <[email protected]> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -32,23 +32,21 @@ */ char *compose_path(ctrl_t *ctrl, char *path) { - struct stat st; static char rpath[PATH_MAX]; - char *name, *ptr; char dir[PATH_MAX] = { 0 }; + char *name, *ptr; + struct stat st; strlcpy(dir, ctrl->cwd, sizeof(dir)); DBG("Compose path from cwd: %s, arg: %s", ctrl->cwd, path ?: ""); if (!path || !strlen(path)) goto check; - if (path) { - if (path[0] != '/') { - if (dir[strlen(dir) - 1] != '/') - strlcat(dir, "/", sizeof(dir)); - } - strlcat(dir, path, sizeof(dir)); + if (path[0] != '/') { + if (dir[strlen(dir) - 1] != '/') + strlcat(dir, "/", sizeof(dir)); } + strlcat(dir, path, sizeof(dir)); check: while ((ptr = strstr(dir, "//"))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/src/ftpcmd.c new/uftpd-2.14/src/ftpcmd.c --- old/uftpd-2.13/src/ftpcmd.c 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/src/ftpcmd.c 2021-12-11 12:03:14.000000000 +0100 @@ -1,6 +1,6 @@ /* FTP engine * - * Copyright (c) 2014-2020 Joachim Nilsson <[email protected]> + * Copyright (c) 2014-2021 Joachim Wiberg <[email protected]> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -161,7 +161,7 @@ static int open_data_connection(ctrl_t *ctrl) { socklen_t len = sizeof(struct sockaddr); - struct sockaddr_in sin; + struct sockaddr_in sin = { 0 }; /* Previous PORT command from client */ if (ctrl->data_address[0]) { @@ -195,8 +195,8 @@ /* Previous PASV command, accept connect from client */ if (ctrl->data_listen_sd > 0) { const int const_int_1 = 1; - int retries = 3; char client_ip[100]; + int retries = 3; retry: ctrl->data_sd = accept(ctrl->data_listen_sd, (struct sockaddr *)&sin, &len); @@ -269,8 +269,13 @@ { if (ctrl->d || ctrl->d_num) { uev_io_stop(&ctrl->data_watcher); - if (ctrl->d_num > 0) + if (ctrl->d_num > 0) { + int i; + + for (i = 0; i < ctrl->d_num; i++) + free(ctrl->d[i]); free(ctrl->d); + } ctrl->d_num = 0; ctrl->d = NULL; ctrl->i = 0; @@ -584,22 +589,12 @@ static int list_printf(ctrl_t *ctrl, char *buf, size_t len, char *path, char *name) { - int dirs; - int mode = ctrl->list_mode; struct stat st; if (stat(path, &st)) return -1; - dirs = mode & 0xF0; - mode = mode & 0x0F; - - if (dirs && !S_ISDIR(st.st_mode)) - return 1; - if (!dirs && S_ISDIR(st.st_mode)) - return 1; - - switch (mode) { + switch (ctrl->list_mode & 0x0F) { case 3: /* MLSD */ /* fallthrough */ case 2: /* MLST */ @@ -623,9 +618,11 @@ static void do_MLST(ctrl_t *ctrl) { - size_t len = 0; char buf[512] = { 0 }; + char cwd[PATH_MAX]; int sd = ctrl->sd; + size_t len = 0; + char *path; if (ctrl->data_sd != -1) sd = ctrl->data_sd; @@ -633,27 +630,43 @@ snprintf(buf, sizeof(buf), "250- Listing %s\r\n", ctrl->file); len = strlen(buf); - if (list_printf(ctrl, &buf[len], sizeof(buf) - len, ctrl->file, basename(ctrl->file))) { + 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))) { + abort: do_abort(ctrl); send_msg(ctrl->sd, "550 No such file or directory.\r\n"); return; } strlcat(buf, "250 End.\r\n", sizeof(buf)); + do_abort(ctrl); send_msg(sd, buf); } static void do_MLSD(ctrl_t *ctrl) { char buf[512] = { 0 }; + char cwd[PATH_MAX]; + char *path; + + strlcpy(cwd, ctrl->file, sizeof(cwd)); + path = compose_path(ctrl, cwd); + if (!path) + goto abort; - if (list_printf(ctrl, buf, sizeof(buf), ctrl->file, basename(ctrl->file))) { + if (list_printf(ctrl, buf, sizeof(buf), path, basename(path))) { + abort: do_abort(ctrl); send_msg(ctrl->sd, "550 No such file or directory.\r\n"); return; } send_msg(ctrl->data_sd, buf); + do_abort(ctrl); send_msg(ctrl->sd, "226 Transfer complete.\r\n"); } @@ -690,8 +703,9 @@ ctrl->list_mode |= (ctrl->pending ? 0 : 0x80); while (ctrl->i < ctrl->d_num) { struct dirent *entry; - char *name, *path; char cwd[PATH_MAX]; + char *name, *path; + size_t len; entry = ctrl->d[ctrl->i++]; name = entry->d_name; @@ -700,8 +714,10 @@ if ((!strcmp(name, ".") || !strcmp(name, "..")) && ctrl->list_mode < 2) continue; + len = strlen(ctrl->file); snprintf(cwd, sizeof(cwd), "%s%s%s", ctrl->file, - ctrl->file[strlen(ctrl->file) - 1] == '/' ? "" : "/", name); + ctrl->file[len > 0 ? len - 1 : len] == '/' ? "" : "/", name); + path = compose_path(ctrl, cwd); if (!path) { fail: @@ -719,7 +735,6 @@ } DBG("LIST %s", buf); - free(entry); bytes = send(ctrl->data_sd, buf, strlen(buf), 0); if (-1 == bytes) { @@ -971,7 +986,10 @@ return; /* Convert server IP address and port to comma separated list */ - msg = strdup(ctrl->serveraddr); + if (pasv_addr) + msg = strdup(pasv_addr); + else + msg = strdup(ctrl->serveraddr); if (!msg) { send_msg(ctrl->sd, "426 Internal server error.\r\n"); exit(1); @@ -1066,7 +1084,7 @@ 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 && ctrl->d_num != -1) do_MLST(ctrl); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/src/log.c new/uftpd-2.14/src/log.c --- old/uftpd-2.13/src/log.c 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/src/log.c 2021-12-11 12:03:14.000000000 +0100 @@ -1,6 +1,6 @@ /* uftpd -- the no nonsense (T)FTP server * - * Copyright (c) 2014-2020 Joachim Nilsson <[email protected]> + * Copyright (c) 2014-2021 Joachim Wiberg <[email protected]> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/src/tftpcmd.c new/uftpd-2.14/src/tftpcmd.c --- old/uftpd-2.13/src/tftpcmd.c 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/src/tftpcmd.c 2021-12-11 12:03:14.000000000 +0100 @@ -1,6 +1,6 @@ /* TFTP Engine * - * Copyright (c) 2014-2020 Joachim Nilsson <[email protected]> + * Copyright (c) 2014-2021 Joachim Wiberg <[email protected]> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/src/uftpd.c new/uftpd-2.14/src/uftpd.c --- old/uftpd-2.13/src/uftpd.c 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/src/uftpd.c 2021-12-11 12:03:14.000000000 +0100 @@ -1,6 +1,6 @@ /* uftpd -- the no nonsense (T)FTP server * - * Copyright (c) 2014-2020 Joachim Nilsson <[email protected]> + * Copyright (c) 2014-2021 Joachim Wiberg <[email protected]> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -19,12 +19,14 @@ /* Global daemon settings */ char *prognm = PACKAGE_NAME; +char *pidfn = NULL; char *home = NULL; int inetd = 0; int background = 1; int do_syslog = 1; int do_ftp = FTP_DEFAULT_PORT; int do_tftp = TFTP_DEFAULT_PORT; +char *pasv_addr = NULL; int do_insecure = 0; pid_t tftp_pid = 0; struct passwd *pw = NULL; @@ -42,6 +44,10 @@ static int version(void) { printf("%s\n", PACKAGE_VERSION); + printf("\nBug report address: %s\n", PACKAGE_BUGREPORT); +#ifdef PACKAGE_URL + printf("Project homepage: %s\n", PACKAGE_URL); +#endif return 0; } @@ -52,7 +58,7 @@ if (is_inetd) printf("\nUsage: %s [-hv] [-l LEVEL] [PATH]\n\n", prognm); else - printf("\nUsage: %s [-hnsv] [-l LEVEL] [-o ftp=PORT,tftp=PORT,writable] [PATH]\n\n", prognm); + printf("\nUsage: %s [-hnsv] [-l LEVEL] [-o OPTS] [-p FILE] [PATH]\n\n", prognm); printf(" -h Show this help text\n" " -l LEVEL Set log level: none, err, notice (default), info, debug\n"); @@ -61,15 +67,14 @@ " -o OPT Options:\n" " ftp=PORT\n" " tftp=PORT\n" + " pasv_addr=ADDR\n" " writable\n" - " -s Use syslog, even if running in foreground, default w/o -n\n"); + " -p FILE File to store process ID for signaling %s\n" + " -s Use syslog, even if running in foreground, default w/o -n\n", + prognm); printf(" -v Show program version\n\n"); - printf("The optional 'PATH' defaults to the $HOME of the /etc/passwd user 'ftp'\n" - "Bug report address: %-40s\n", PACKAGE_BUGREPORT); -#ifdef PACKAGE_URL - printf("Project homepage: %s\n", PACKAGE_URL); -#endif + printf("The optional 'PATH' defaults to the $HOME of the /etc/passwd user 'ftp'\n"); return code; } @@ -243,7 +248,7 @@ sig_init(ctx); /* We're now up and running, save pid file. */ - pidfile(NULL); + pidfile(pidfn); INFO("Serving files from %s ...", home); @@ -270,18 +275,21 @@ FTP_OPT = 0, TFTP_OPT, SEC_OPT, + PASV_OPT }; char *subopts; char *const token[] = { [FTP_OPT] = "ftp", [TFTP_OPT] = "tftp", [SEC_OPT] = "writable", + [PASV_OPT] = "pasv_addr", NULL }; uev_ctx_t ctx; + struct in_addr in_pasv_addr; - prognm = progname(argv[0]); - while ((c = getopt(argc, argv, "hl:no:sv")) != EOF) { + pidfn = prognm = progname(argv[0]); + while ((c = getopt(argc, argv, "hl:no:p:sv")) != EOF) { switch (c) { case 'h': return usage(0); @@ -318,7 +326,17 @@ } do_tftp = atoi(value); break; - + case PASV_OPT: + if (!value) { + fprintf(stderr, "Missing PASV address argument to -o pasv_addr=ADDR"); + return usage(1); + } + if (!inet_aton(value,&in_pasv_addr)) { + fprintf(stderr, "Value specified to pasv_addr is not a valid IPv4 address"); + return usage(1); + } + pasv_addr = strdup(value); + break; case SEC_OPT: do_insecure = 1; break; @@ -330,6 +348,10 @@ } break; + case 'p': + pidfn = optarg; + break; + case 's': do_syslog++; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/src/uftpd.h new/uftpd-2.14/src/uftpd.h --- old/uftpd-2.13/src/uftpd.h 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/src/uftpd.h 2021-12-11 12:03:14.000000000 +0100 @@ -1,6 +1,6 @@ /* uftpd -- the no nonsense (T)FTP server * - * Copyright (c) 2014-2020 Joachim Nilsson <[email protected]> + * Copyright (c) 2014-2021 Joachim Wiberg <[email protected]> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -48,7 +48,11 @@ #include <unistd.h> #include <uev/uev.h> -#include <lite/lite.h> +#ifdef _LIBITE_LITE +# include <libite/lite.h> +#else +# include <lite/lite.h> +#endif #define FTP_DEFAULT_PORT 21 #define FTP_SERVICE_NAME "ftp" @@ -97,6 +101,7 @@ extern int do_syslog; /* Bool: False at daemon start */ extern int do_ftp; /* Port: FTP port, or disabled */ extern int do_tftp; /* Port: TFTP port, or disabled */ +extern char *pasv_addr; /* Address passed to client in pasv mode */ extern int do_insecure; /* Bool: Allow writable root or not */ extern struct passwd *pw; /* FTP user's passwd entry */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/test/.gitignore new/uftpd-2.14/test/.gitignore --- old/uftpd-2.13/test/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/test/.gitignore 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,2 @@ +*.trs +*.log diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/test/Makefile.am new/uftpd-2.14/test/Makefile.am --- old/uftpd-2.13/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/test/Makefile.am 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,12 @@ +EXTRA_DIST = lib.sh ftp.sh tftp.sh maxfiles.sh +CLEANFILES = *~ *.trs *.log + +TEST_EXTENSIONS = .sh +TESTS_ENVIRONMENT = unshare -mrun + +TESTS = ftp.sh +TESTS += tftp.sh +TESTS += maxfiles.sh + +.PRECIOUS: stop.log + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/test/ftp.sh new/uftpd-2.14/test/ftp.sh --- old/uftpd-2.13/test/ftp.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/test/ftp.sh 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,27 @@ +#!/bin/sh +#set -x + +if [ x"${srcdir}" = x ]; then + srcdir=. +fi +. ${srcdir}/lib.sh + +get() +{ + ftp -n 127.0.0.1 <<-END + verbose on + user anonymous a@b + bin + get $1 + bye + END + sleep 1 +} + +check_dep ftp +get testfile.txt + +ls -la +[ -s testfile.txt ] && OK +FAIL + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/test/lib.sh new/uftpd-2.14/test/lib.sh --- old/uftpd-2.13/test/lib.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/test/lib.sh 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,111 @@ +#!/bin/sh + +# Test name, used everywhere as /tmp/uftpd/$NM/foo +NM=$(basename "$0" .sh) +DIR=/tmp/uftpd/$NM +CDIR=/tmp/uftpd/${NM}-client + +# Print heading for test phases +print() +{ + printf "\e[7m>> %-76s\e[0m\n" "$1" +} + +dprint() +{ + printf "\e[2m%-76s\e[0m\n" "$1" +} + +SKIP() +{ + print "TEST: SKIP" + [ $# -gt 0 ] && echo "$*" + exit 77 +} + +FAIL() +{ + print "TEST: FAIL" + [ $# -gt 0 ] && echo "$*" + exit 99 +} + +OK() +{ + print "TEST: OK" + [ $# -gt 0 ] && echo "$*" + exit 0 +} + +# shellcheck disable=SC2068 +check_dep() +{ + if [ -n "$2" ]; then + if ! $@; then + SKIP "$* is not supported on this system." + fi + elif ! command -v "$1" >/dev/null; then + SKIP "Cannot find $1, skipping test." + fi +} + +# Stop all lingering collectors and other tools +kill_pids() +{ + # shellcheck disable=SC2162 + if [ -f "$DIR/PIDs" ]; then + while read ln; do kill "$ln" 2>/dev/null; done < "$DIR/PIDs" + rm "$DIR/PIDs" + fi +} + +teardown() +{ + kill_pids + sleep 1 + + [ -d "${DIR}" ] && rm -rf "${DIR}" + [ -d "${CDIR}" ] && rm -rf "${CDIR}" +} + +signal() +{ + echo + if [ "$1" != "EXIT" ]; then + print "Got signal, cleaning up" + fi + teardown +} + +# props to https://stackoverflow.com/a/2183063/1708249 +# shellcheck disable=SC2064 +trapit() +{ + func="$1" ; shift + for sig ; do + trap "$func $sig" "$sig" + done +} + +setup() +{ + bindir=$(pwd)/../src + ls -l $bindir + ip link set lo up + sleep 1 + cp /etc/passwd "${DIR}/testfile.txt" + "${bindir}/uftpd" -l debug "$DIR" -p "$DIR/pid" >"$DIR/log" + cd "${CDIR}" || exit 1 + return 0 +} + +# Runs once when including lib.sh +mkdir -p "${DIR}" +mkdir -p "${CDIR}" +touch "$DIR/PIDs" + +# Call signal() on signals or on exit +trapit signal INT TERM QUIT EXIT + +# Basic setup for all tests +setup diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/test/maxfiles.sh new/uftpd-2.14/test/maxfiles.sh --- old/uftpd-2.13/test/maxfiles.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/test/maxfiles.sh 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,31 @@ +#!/bin/sh +set -x + +if [ x"${srcdir}" = x ]; then + srcdir=. +fi +. ${srcdir}/lib.sh + +#max=`ulimit -n` +max=1040 + +# check beyond max to verify uftpd doesn't leak descriptors +max=$((max + 20)) + +get() +{ + ftp -n 127.0.0.1 <<-END + user anonymous a@b + get testfile.txt + bye + END +} + +check_dep ftp + +i=1 +while [ $i -lt $max ]; do + get + rm testfile.txt + i=$((i + 1)) +done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/test/tftp.sh new/uftpd-2.14/test/tftp.sh --- old/uftpd-2.13/test/tftp.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/uftpd-2.14/test/tftp.sh 2021-12-11 12:03:14.000000000 +0100 @@ -0,0 +1,22 @@ +#!/bin/sh +#set -x + +if [ x"${srcdir}" = x ]; then + srcdir=. +fi +. ${srcdir}/lib.sh + +get() +{ + tftp 127.0.0.1 -c get "$1" + sleep 1 +} + +check_dep tftp +netstat -atnup + +get testfile.txt +ls -la +[ -s testfile.txt ] && OK +FAIL + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/tests/.gitignore new/uftpd-2.14/tests/.gitignore --- old/uftpd-2.13/tests/.gitignore 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/tests/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -*.trs -*.log diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/tests/Makefile.am new/uftpd-2.14/tests/Makefile.am --- old/uftpd-2.13/tests/Makefile.am 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/tests/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -EXTRA_DIST = start.sh stop.sh -EXTRA_DIST += ftp.sh tftp.sh maxfiles.sh -CLEANFILES = *~ *.trs *.log -TEST_EXTENSIONS = .sh - -TESTS = start.sh -TESTS += ftp.sh -TESTS += tftp.sh -TESTS += maxfiles.sh -TESTS += stop.sh - -.PRECIOUS: stop.log - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/tests/ftp.sh new/uftpd-2.14/tests/ftp.sh --- old/uftpd-2.13/tests/ftp.sh 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/tests/ftp.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -#!/bin/sh -cd /tmp -ftp -n 127.0.0.1 9013 <<-END - verbose on - user anonymous a@b - bin - get testfile.txt - bye -END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/tests/maxfiles.sh new/uftpd-2.14/tests/maxfiles.sh --- old/uftpd-2.13/tests/maxfiles.sh 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/tests/maxfiles.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -#!/bin/sh -set -e -cd /tmp - -#max=`ulimit -n` -max=1040 - -# check beyond max to verify uftpd doesn't leak descriptors -max=$(($max + 20)) - -get() -{ - ftp -n 127.0.0.1 9013 <<-END - user anonymous a@b - get testfile.txt - bye -END -} - -i=1 -while [ $i -lt $max ]; do - get - rm testfile.txt - i=$(($i + 1)) -done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/tests/start.sh new/uftpd-2.14/tests/start.sh --- old/uftpd-2.13/tests/start.sh 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/tests/start.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -#!/bin/bash -cd ../tests -cp /etc/passwd testfile.txt - -../src/uftpd -n -o ftp=9013,tftp=6969 -l none . & -echo $! >/tmp/uftpd.pid - -sleep 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/tests/stop.sh new/uftpd-2.14/tests/stop.sh --- old/uftpd-2.13/tests/stop.sh 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/tests/stop.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,12 +0,0 @@ -#!/bin/bash -cd ../tests -rm -f testfile.txt - -if [ -e /tmp/uftpd.pid ]; then - PID=`cat /tmp/uftpd.pid` - echo "Stopping uftpd PID $PID" - kill -9 $PID -fi - -rm -f /tmp/uftpd.pid -rm -f /tmp/testfile.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/uftpd-2.13/tests/tftp.sh new/uftpd-2.14/tests/tftp.sh --- old/uftpd-2.13/tests/tftp.sh 2020-06-30 23:45:05.000000000 +0200 +++ new/uftpd-2.14/tests/tftp.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -#!/bin/sh -set -x -cd /tmp -tftp -4 127.0.0.1 6969 -m binary -c get testfile.txt
