twoftpd-1.42/0000775000076400007640000000000011732365413012501 5ustar bruceguentertwoftpd-1.42/FILES0000664000076400007640000000121011732365413013260 0ustar bruceguenterANNOUNCEMENT AUTOFILES COPYING ChangeLog FILES INSTHIER Makefile NEWS README SRCFILES TARGETS TODO VERSION backend.c backend.h banner.c conf-bgincs conf-bglibs conf-bin conf-cc conf-ld conf-man conf.c conf.h copy.c list.c log.c log.h main.c messagefile.c path.c respond.c responses.c retr.c socket.c stat.c state.c statmod.c store.c strtou.c tests.sh twoftpd-1.42.spec twoftpd-anon-conf.c twoftpd-anon.c twoftpd-auth.1 twoftpd-auth.1.html twoftpd-auth.c twoftpd-bind-port.c twoftpd-conf.c twoftpd-drop.c twoftpd-log.run twoftpd-switch.1 twoftpd-switch.1.html twoftpd-switch.c twoftpd-xfer.1 twoftpd-xfer.1.html twoftpd-xfer.c twoftpd.h twoftpd.run twoftpd-1.42/log.h0000664000076400007640000000050711732365413013435 0ustar bruceguenter#ifndef TWOFTPD__LOG__H__ #define TWOFTPD__LOG__H__ extern const char program[]; extern void log_start(void); #define log_str(S) obuf_puts(&errbuf, S) #define log_uint(U) obuf_putu(&errbuf, U) #define log_end() obuf_putsflush(&errbuf, "\n") extern void log1(const char*); extern void log2(const char*, const char*); #endif twoftpd-1.42/NEWS0000664000076400007640000003715711732365413013215 0ustar bruceguenter------------------------------------------------------------------------------- Changes in version 1.42 - Fixed bug in reporting an error in closing the sending socket. - Fixed bug in reporting an error to list a single entry. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.41 - Fix a one-off buffer overrun in ASCII conversion in the STOR command. - Fix resetting the output buffer between listings. - Added a $CONNECT_TIMEOUT setting to set timeouts on data connections. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.40 - File transfer handling has been completely rewritten to handle interrupts on the command channel. Closing the command channel or sending another command will interrupt any data transfer in progress. - Fixed a longstanding bug in the handling of $MESSAGEFILE Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.30 - Switched to the CVM v2 client library. - Added a $AUTH_ATTEMPTS control to twoftpd-auth to limit the number of authentication attempts per session. - Rewrote the directory listing code to fix listing files with special characters in their names. - Added a transfer rate (bytes/sec) indicator to transfer logs. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.21 - Added a fake listing routine to twoftpd-drop, to avoid errors on GUI clients that require LIST or NLST. - Fixed a compile failure on FreeBSD in the newer MDTM command. Thanks Sergei Kolobov. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.20 - Modified the backends (twoftpd-auth and twoftpd-xfer) to show a 220 banner if the front end authenticated, and 230 if not. This fixes problems some FTP clients have when running twoftpd-anon after authentication. - Added twoftpd-drop, a write-only FTP server. - Added twoftpd-switch, a tool to choose between twoftpd-anon, twoftpd-drop, and twoftpd-xfer based on the value of $SHELL, $SHELL_READONLY, and $SHELL_WRITEONLY. - Make sure to open only regular files. - Added a MDTM command to the xfer backend that can set timestamps (instead of just retrieving them). - Fixed bug exposed by Mozilla which tries to retrieve directories before listing them. - Eliminated the bogus APPE-after-REST test. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.17 - Fixed a bug where paths starting with "/." would not be omitted when nodotfiles was set. - Check the return value from *buf_close functions. - Fixed a minor (but annoying) typo in listing permissions of sticky files. - Path permission failures (no dot files / lock home) now produce a sensible system error. - Fixed a bug where listing "/foo/*" would not include the "/foo/" prefix in the resulting names. - Updated for bglibs version 1.006 Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.16 - Added a port-20 socket hack, based partly on code contributed by Wejn. - Fixed problems with handling interrupted system calls (strace would kill twoftpd). - Converted to use bglibs. - Added support for restarting uploads with REST. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.15 - Remember to uncork the socket before closing it. - Fixed a bug in twoftpd-anon-conf -- getpwnam returns the same static struct each time it's called, but I used it in two different ways. - Fixed a minor bug in CWD command to make it possible to cd into execute-only directories. - Fixed handling when doing NLST against non-existant files. - When making/accepting connections, abort if stdin becomes readable (because of additional command or hangup). - Added support for handling supplemental group IDs. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.14 - Fixed a bug in the string sort implementation that caused listings to leak memory. - Fixed up PASV connection mode to only show the 150 response if the connection does not fail. - Some other minor fixes to socket handling and response messages. - Added a work around for broken firewalls that rewrite certain commands (specifically PORT) with two CR characters before the final LF. - Fixed missing socket library for SysV (ie Solaris) systems. - Strip trailing slashes, which confuse at least the "lock $HOME" mode, from the home path. - Use corked (Linux) or no-push (BSD) writes to improve transfer efficiency. - Set SO_LINGER on outbound sockets (LIST/RETR) to prevent the success message from being sent on the network before the data is completely sent. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.13 - Bugfix: listing "." when CWD is "/" would fail. - Include system error message in STAT and MDTM. - Print out an error message when the session or command times out, instead of just silently dropping the connection. - Modified the PASV response to work around yet more broken clients. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.12 - Now uses the CVM 0.10 (protocol 1) API for authentication. This means you MUST use modules from CVM 0.10 or later with this version. - Many error messages now include the system error message (like "File or path not found") that caused the error. - Added a simple, limited LIST/NLST option parser, to provide compatibility with broken clients that like to send commands like "NLST -alL". - Added authentication and session timeout limits. - SITE commands are no longer output twice in the logs. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.11 - Fixed a nasty bug (guaranteed corruption) with retrieving files larger than 4KB in ASCII mode. - Fixed up the response code for MKD from 250 to 257. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.10 - Fixed a bug in outbound (PORT mode) connection -- it wasn't binding to the local IP, causing problems between servers with multiple IPs and firewalls. - Modified the PASV response to work around FTP client bugs. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.09 - Fixed yet another listing bug -- group names that were not exactly 8 characters long were either truncated to 8 characters or padded with garbage. Thanks Dan Peterson. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.08 - Fixed yet another one-off bug in listed filenames that resulted in the leading character being chopped off when CWD is "/". - Previous versions of twoftpd would drop all dotfiles from listings. This version makes that behavior optional, as well as also disallowing all file access to dotfiles when they are hidden. - Modified how emulated or "soft" chroot mode is enabled. Previously it was enabled by setting the first character of $CHROOT to "e". Now it is enabled by setting $SOFTCHROOT and not setting $CHROOT. - Added a "lock HOME" backend setting that works similar to the soft chroot above. The CWD will still include $HOME, but all accesses to files and paths outside of $HOME will be forbidden. - Added support for the SITE CHMOD command in the twoftpd-xfer backend, as well as a framework for adding other SITE commands. - Added code to show the true mode of files in long listings rather than just "-rw-r--r--" for files and "drwxr-xr-x" for directories. - Long listings now also show the true group name reported by the CVM when the group number on the file is the same as $GID. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.07 - Fixed a bug in handling listing unreadable directory entries that would cause listings to be prematurely terminated immediately before such an entry. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.06 - Fixed a one-off bug in doing pattern listings that caused all the resulting filenames to be prefixed with a '/'. - Fixed some portability problems. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.05 - Rewrote all file handling operations to enable "emulated" chroot behavior. There are now three modes of operation: 1. Normal: CWD appears as $HOME at login. 2. Hard chroot: CWD appears as / at login, and is enforced with a chroot. 3. Emulated chroot: CWD appears as / at login, with no chroot. In all of the cases, there is no chdir done after the server starts. This change was done to permit symlinks outside of $HOME. - Improved the run files and the conf tools to run envdir on each connection rather than before tcpserver starts. This allows the configuration variables to be modified without restarting the service. - Added configuration for logging of responses, and made logging of requests optional. You must now set $LOGREQUESTS if you want to log requests and $LOGRESPONSES if you want to log responses. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.02 - Fixed a couple of bugs in twoftpd-anon-conf. - Dotfiles should be skipped when listing directories. - Made the numeric values of some success responses fall in line with the specifics of the FTP RFC. This should hopefully fix many of the client failures. - Added logging code to log requests and responses. - The backend modules (twoftpd-anon and twoftpd-xfer) will optionally print out a banner on startup, and a message file on entering a directory. As well, twoftpd-auth will optionally print out a banner before login. ------------------------------------------------------------------------------- Changes in version 1.01 - Fixed a critical bug in parsing and printing IPs. - Fixed a bug in handling listing single items. - Fixed a minor usage documentation bug in the conf programs. ------------------------------------------------------------------------------- Changes in version 1.00 - Added twoftpd-conf and twoftpd-anon-conf programs. - Minor internal socket and directory handling changes. ------------------------------------------------------------------------------- Changes in version 0.92 - Removed the code to handle anonymous logins from the authentication front end, in favour of recommending running a seperate anonymous server. - Proper telnet escape translation is now done on output. - Added some compatibility fixes, especially for glob. NOTE: there will be no more features added, except for critical omissions, before the 1.0 release, just bug fixes. ------------------------------------------------------------------------------- Changes in version 0.91 - Fixed a bug in socket handling that caused timeouts to be set too low. - Fixed some minor bugs in command-line and environment handling. - Fixed an iobuf bug that caused opened output files to not be closed on errors. - Added support for the REST command, to speed up resumed transfers. ------------------------------------------------------------------------------- Changes in version 0.9 - Fixed bug in EOF handling when storing files. - IP addresses in PORT commands that do not match the remote IP address are now rejected. ------------------------------------------------------------------------------- Changes in version 0.8 - Use glob library to handle wildcard handling. This means twoftpd can now handle listing patterns like "test*/*". - Apply timeouts on all socket handling routines. - Dropped use of sendfile on Linux, since it's incompatible with handling timeouts on sending or receiving data. ------------------------------------------------------------------------------- Changes in version 0.7 - Fixed a bug that caused PORT-style connections to fail. ------------------------------------------------------------------------------- Changes in version 0.6 - Can now handle LIST and NLST on non-directories. - Should now automatically use sendfile on Linux systems. - Can now handle ASCII mode file transfers. - Can now handle RNFR/RNTO file renaming commands. - Can now handle newlines (octal 012) in paths. ------------------------------------------------------------------------------- Changes in version 0.5 - TwoFTPd now uses CVM (http://em.ca/~bruceg/cvm/) for authentication. - twoftpd-auth needs to have the anonymous configuration parameters set by environment variables instead of reading them through getpwnam. ------------------------------------------------------------------------------- Changes in version 0.4 - Now handles timout when making PORT connections. - Simplified the directory listing format. - Configured and packaged with SPAC. ------------------------------------------------------------------------------- Changes in version 0.3 - Now supports anonymous logins with reduced priviledges. - Now handles both PASV and PORT mode connections. - Now handles STOR and APPE file upload commands. - Handles additional verbs: MDTM, RMD, MKD, DELE. - Times out on PASV connections and receiving commands, as specified by $TIMEOUT (defaults to 900 seconds). - If $CHROOT is set, twoftpd-xfer will chroot on entry. ------------------------------------------------------------------------------- twoftpd-1.42/messagefile.c0000664000076400007640000000260711732365413015136 0ustar bruceguenter/* messagefile.c - Show a message file to the client. * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "twoftpd.h" #include "backend.h" const char* message_file; void show_message_file(unsigned code) { int fd; ibuf in; char buf[1024]; if (message_file) { if ((fd = open_fd(message_file, O_RDONLY, 0)) != -1) { if (ibuf_init(&in, fd, 0, 0, 0)) { while (ibuf_gets(&in, buf, sizeof buf, '\n')) { if (in.count > 1) { if (buf[in.count-1] == '\n') buf[in.count-1] = 0; respond(code, 0, buf); } } } ibuf_close(&in); } close(fd); } } twoftpd-1.42/responses.c0000664000076400007640000000202511732365413014665 0ustar bruceguenter/* responses.c - A set of pre-canned responses. * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "twoftpd.h" #define R(NAME,CODE,TEXT) int respond_##NAME(void){return respond(CODE, 1, TEXT);} R(internal_error, 451, "Internal error."); R(ok, 200, "OK."); R(permission_denied, 550, "Permission denied."); twoftpd-1.42/tests.sh0000664000076400007640000036264411732365413014216 0ustar bruceguenter#!/bin/sh src=`pwd` tmp=$src/tests-tmp rm -rf $tmp mkdir -p $tmp PATH="$src:/bin:/usr/bin:/usr/local/bin" tests_failed=0 tests_count=0 _UID=`id -u` _GID=`id -g` usage() { echo "usage: sh $0 [-v]" } vecho() { :; } while getopts v flag do case $flag in v) vecho() { echo "$*"; } ;; *) usage; exit 1 ;; esac done xw=$src/xfer-watch uid=`id -u` gid=`id -g` home=$tmp/home mkdir -p $home cvm=$tmp/cvm TCPLOCALIP=127.0.0.1 TCPLOCALHOST=localhost TCPREMOTEIP=127.0.0.1 LOGREQUESTS=1 CVM_RANDOM_BYTES=0 TIMEOUT=5 export CVM_RANDOM_BYTES LOGREQUESTS TCPLOCALIP TCPLOCALHOST TCPREMOTEIP TIMEOUT env="env UID=$uid GID=$gid USER=ftp GROUP=ftp HOME=$home TZ=Canada/Saskatchewan" # Support functions strippid() { sed -e 's/\[[0123456789]*\]/[PID]/'; } echolines() { for line in "$@" do printf "$line\r\n" 2>/dev/null done } authcmd() { $src/twoftpd-auth "$@" 2>&1 &1 | strippid } makecvm() { ( echo '#!/bin/sh' for line in "$@"; do echo "$line"; done ) >$cvm chmod 755 $cvm } fixdir() { sed -e 's/^\(d.*\) [123456789][0123456789] /\1 4096 /'; } fixbytes() { sed -e 's/[0123456789]* bytes /### bytes /'; } anon() { echolines "$@" | $env $src/twoftpd-anon 2>/dev/null | fixdir | tail -n +2; } drop() { echolines "$@" | $env $src/twoftpd-drop 2>/dev/null | fixdir | tail -n +2; } xfer() { echolines "$@" | $env $src/twoftpd-xfer 2>/dev/null | fixdir | tail -n +2; } testparams() { local backend=$1 local command=$2 shift 2 local param for param in "$@"; do $backend "$command $param" done } xfertest() { local backend=$1 local mode=$2 local io=$3 local conv=$4 shift 4 $env $src/xfer-test $src/twoftpd-$backend $mode $io $conv "$@" | fixdir | tail -n +2 } run_compare_test() { local name=$1 shift sed -e "s:@SOURCE@:$src:g" -e "s:@TMPDIR@:$tmp:g" -e "s:@UID@:$_UID:" -e "s:@GID@:$_GID:" >$tmp/expected ( runtest "$@" 2>&1 ) 2>&1 >$tmp/actual-raw cat -v $tmp/actual-raw >$tmp/actual if ! cmp $tmp/expected $tmp/actual >/dev/null 2>&1 then echo "Test $name $* failed:" ( cd $tmp; diff -U 9999 expected actual | tail -n +3; echo; ) tests_failed=$(($tests_failed+1)) fi rm -f $tmp/expected $tmp/actual tests_count=$(($tests_count+1)) } ##### Test tests/auth-output ##### runtest() { ( echolines QUIT | $src/twoftpd-auth 1 2 >/dev/null; ) 2>&1 | strippid echolines QUIT | $src/twoftpd-auth 1 2 2>/dev/null } vecho "Running test tests/auth-output " run_compare_test tests/auth-output </dev/null $env BANNER='foo bar' $src/twoftpd-$backend 2>/dev/null $env AUTHENTICATED=1 $src/twoftpd-$backend 2>/dev/null } vecho "Running test tests/backend-greeting 'anon'" run_compare_test tests/backend-greeting 'anon' </dev/null' \ 'printf "\\0\\0\\001\\010username\\002\\003102\\003\\003103\\004\\011Real Name\\005\\011/home/dir\\006\\012/bin/false\\007\\007grpname\\000" 2>/dev/null' \ 'exit 0' } vecho "Running test tests/make-good-cvm " run_compare_test tests/make-good-cvm <$tmp/env chmod 755 $tmp/env auth $cvm $tmp/env 'USER username' 'PASS password' rm -f $tmp/env } vecho "Running test tests/auth-cvm-good-data " run_compare_test tests/auth-cvm-good-data <$home/subdir/date for i in `seq 60`; do echo 01234567890123456789012345678901234567890123456789012345678901234567890 done >$home/large TZ=GMT touch -t 200001020304.05 $home/empty TZ=GMT touch -t 200102030405.06 $home/subdir TZ=GMT touch -t 200301180607.08 $home/large chmod 664 $home/empty chmod 644 $home/large chmod 775 $home/subdir } vecho "Running test tests/make-home " run_compare_test tests/make-home <$home/tmp xfertest $backend port store bin 'APPE tmp' <$home/large cksum <$home/tmp xfertest $backend port store bin 'APPE tmpx' <$home/large test -e $home/tmpx || echo tmpx was not created rm -f $home/tmp $home/tmpx } vecho "Running test tests/backend-appe 'anon'" run_compare_test tests/backend-appe 'anon' <$home/README echo top line2 >>$home/README echo subdir >$home/subdir/README echo CWD subdir \ | $env MESSAGEFILE=README \ $src/twoftpd-$backend 2>/dev/null rm -f $home/README $home/subdir/README } vecho "Running test tests/backend-messagefile 'anon'" run_compare_test tests/backend-messagefile 'anon' <$tmp/large xfertest $backend $mode store $conv 'STOR tmp' <$tmp/large xfertest $backend $mode store $conv 'STOR tmp' <$tmp/large if [ -e $home/tmp ]; then cksum <$home/tmp rm -f $home/tmp else echo tmp was not created fi rm -f $tmp/large } vecho "Running test tests/backend-store 'anon' 'pasv' 'bin'" run_compare_test tests/backend-store 'anon' 'pasv' 'bin' <$home/testfile xfertest xfer $mode retr bin 64:$method 'RETR testfile' | fixbytes rm $home/testfile } vecho "Running test tests/backend-interrupt 'pasv' 'close'" run_compare_test tests/backend-interrupt 'pasv' 'close' </dev/null 2>&1 echo $? rm -f $home/newfile } vecho "Running test tests/backend-list-times " run_compare_test tests/backend-list-times <&2' 'exit 111' } vecho "Running test tests/make-error-cvm " run_compare_test tests/make-error-cvm < extern obuf conf_out; extern void start_file(const char* filename, int mode); extern void end_file(void); extern void make_file(const char* filename, int mode, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5, const char* s6, const char* s7); extern void make_fileu(const char* filename, unsigned val); #endif twoftpd-1.42/twoftpd-auth.10000664000076400007640000000212411732365413015210 0ustar bruceguenter.TH twoftpd-auth 1 .SH NAME twoftpd-auth \- TwoFTPD authentication front-end .SH SYNOPSIS .B twoftpd-auth .B cvmodule .B twoftpd-xfer .SH DESCRIPTION .B twoftpd-auth reads a username and password from the network and authenticates them using the CVM module .BR cvmodule . If the authentication succeeds, it sets the environment variables .BR UID , .BR GID , .BR HOME , and .B USER to the user's UID, GID, home directory, and login name respectively, and then executes .BR twoftpd-xfer . It also sets .B GROUP if the CVM reports a group name, and .B AUTHENTICATED to .B 1 .RB ( twoftpd-auth and .B twoftpd-xfer look for this variable to determine what startup banner code to use). .SH ENVIRONMENT .TP .B AUTH_ATTEMPTS The maximum number of authentication attempts to allow before dropping the connection. .TP .B AUTH_TIMEOUT The maximum number of seconds to wait for successful authentication. .TP .B LOGINBANNER If set, the contents of this variable will be sent as extra responses before the user logs in. .TP .B TIMEOUT The maximum number of seconds to wait for command input. .SH SEE ALSO twoftpd-xfer(1) twoftpd-1.42/twoftpd.run0000664000076400007640000000027111732365413014716 0ustar bruceguenter#!/bin/sh exec 2>&1 umask 022 exec \ tcpserver -DRHv -llocalhost 0 ftp \ envdir /etc/twoftpd \ softlimit -m 2000000 \ /usr/bin/twoftpd-auth \ /usr/bin/cvm-unix \ /usr/bin/twoftpd-xfer twoftpd-1.42/conf-ld0000664000076400007640000000012411732365413013743 0ustar bruceguentergcc -L/usr/local/lib This will be used to link .o and .a files into an executable. twoftpd-1.42/conf-bgincs0000664000076400007640000000003211732365413014607 0ustar bruceguenter/usr/local/bglibs/include twoftpd-1.42/twoftpd-auth.1.html0000664000076400007640000000410011732365413016147 0ustar bruceguenterContent-type: text/html Manpage of twoftpd-auth

twoftpd-auth

Section: User Commands (1)
Index Return to Main Contents
 

NAME

twoftpd-auth - TwoFTPD authentication front-end  

SYNOPSIS

twoftpd-auth cvmodule twoftpd-xfer  

DESCRIPTION

twoftpd-auth reads a username and password from the network and authenticates them using the CVM module cvmodule. If the authentication succeeds, it sets the environment variables UID, GID, HOME, and USER to the user's UID, GID, home directory, and login name respectively, and then executes twoftpd-xfer. It also sets GROUP if the CVM reports a group name, and AUTHENTICATED to 1 (twoftpd-auth and twoftpd-xfer look for this variable to determine what startup banner code to use).  

ENVIRONMENT

AUTH_ATTEMPTS
The maximum number of authentication attempts to allow before dropping the connection.
AUTH_TIMEOUT
The maximum number of seconds to wait for successful authentication.
LOGINBANNER
If set, the contents of this variable will be sent as extra responses before the user logs in.
TIMEOUT
The maximum number of seconds to wait for command input.
 

SEE ALSO

twoftpd-xfer(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 22:19:53 GMT, April 04, 2011 twoftpd-1.42/twoftpd-xfer.10000664000076400007640000000643211732365413015221 0ustar bruceguenter.TH twoftpd-xfer 1 .SH NAME twoftpd-xfer \- TwoFTPD file transfer back-end. .SH SYNOPSIS .B twoftpd-xfer .SH DESCRIPTION .B twoftpd-xfer reads FTP request from the network and executes file transfers based on those requests. Before doing anything, .B twoftpd-xfer changes directory to the authenticated user's home directory, changes the root directory to that directory, and drops all root priviledges. .SH ENVIRONMENT .TP .B AUTHENTICATED If set (typically by .B twoftpd-auth after successfully completing authentication), the startup banner will use code .IR 230 , indicating that authentication was successful. Otherwise, the startup banner will use code .IR 220 , which is the normal initial connection banner. .TP .B BANNER If set, the contents of this variable will be sent as extra responses when the server starts. .TP .B CHROOT If set, change the root directory to the user's home directory through the OS chroot syscall. .TP .B CONNECT_TIMEOUT The maximum number of seconds to wait for a data channel connection to complete. If not set, it defaults to the value of .BR $TIMEOUT . .TP .B GID Numerical group ID number to change to at program startup. .TP .B GIDS Optional comma-seperated list of numerical group IDs to set up as the supplementary group IDs. .TP .B GROUP Group name to use in long listings for files owned by .BR $GID . If not set, defaults to .IR mygroup . .TP .B HOME Directory to switch to on program startup. .TP .B LOCKHOME If set (and neither .B CHROOT nor .B SOFTCHROOT are set), all accesses to files and paths outside of .B HOME will be forbidden. .TP .B LOGREQUESTS If set, all requests from the client will be logged. .TP .B LOGRESPONSES If set, all responses to the client (after login) will be logged. .TP .B MESSAGEFILE If set, the contents this file will be automatically sent as extra responses to the client whenever the server enters a directory (including at startup). .TP .B NODOTFILES If set, all listings will exclude all files starting with a period, and it will not be possible to do any file access (including storing or retrieving) to any file starting with a period. This may be useful for anonymous FTP servers. .TP .B SESSION_TIMEOUT The maximum number of seconds to allow a single session to last. .TP .B SOFTCHROOT If set, and .B CHROOT is not set, the server emulates the effect of a chroot without actually effecting a chroot. This eliminates the system-enforced barrier provided by the chroot, but allows for things like symlinks outside of the home directory. .TP .B TCPLOCALIP The IP to use when creating PASV connections. Normally, this is set by .BR tcpserver . .TP .B TCPREMOTEIP The source IP to use when creating PORT connections. Normally, this is set by .BR tcpserver . .TP .B TIMEOUT The maximum number of seconds to wait for command input or connections. .TP .B UID Numerical user ID number to change to at program startup. .TP .B USER Owner name to use in long listings for files owned by .BR $UID . .SH NOTES You will need to set the umask to an appropriate value before running this program. .P The .B twoftpd-anon program functions identically to this program, with the exception of having no file modification capabilities. The .B twoftpd-drop program is a similarly restricted program, that can only create new files (no overwriting, modifying, or listing existing files). twoftpd-1.42/store.c0000664000076400007640000001026411732365413014004 0ustar bruceguenter/* store.c - twoftpd routines for handling storage-modifying commands * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include "twoftpd.h" #include "backend.h" static str rnfr_filename; static unsigned long xlate_ascii(char* out, const char* in, unsigned long inlen) { unsigned long outlen; for (outlen = 0; inlen > 0; --inlen, ++in) { if (*in != CR) { *out = *in; ++outlen; ++out; } } return outlen; } static int open_copy_close(int append) { int in; int out; unsigned long ss; unsigned long bytes_in; unsigned long bytes_out; int result; ss = startpos; startpos = 0; if ((out = open_fd(req_param, append ? O_WRONLY | O_APPEND : store_exclusive ? O_WRONLY | O_CREAT | O_EXCL : ss ? O_WRONLY : O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) return respond_syserr(550, "Could not open output file"); if (ss && lseek(out, ss, SEEK_SET) != ss) { close(out); return respond(550, 1, "Could not seek to start position in output file."); } if ((in = make_in_connection()) == -1) { close(out); if (store_exclusive) unlink(req_param); return 1; } result = copy_xlate_close(in, out, timeout * 1000, binary_flag ? 0 : xlate_ascii, &bytes_in, &bytes_out); return respond_xferresult(result, bytes_in, 0); } int handle_stor(void) { return open_copy_close(0); } int handle_appe(void) { return open_copy_close(1); } int handle_mkd(void) { if (!qualify_validate(req_param)) return 1; if (mkdir(fullpath.s+1, 0777)) return respond_syserr(550, "Could not create directory"); return respond(257, 1, "Directory created successfully."); } int handle_rmd(void) { if (!qualify_validate(req_param)) return 1; if (rmdir(fullpath.s+1)) return respond_syserr(550, "Could not remove directory"); return respond(250, 1, "Directory removed successfully."); } int handle_dele(void) { if (!qualify_validate(req_param)) return 1; if (unlink(fullpath.s+1)) return respond_syserr(550, "Could not remove file"); return respond(250, 1, "File removed successfully."); } int handle_rnfr(void) { struct stat st; if (!qualify_validate(req_param)) return 1; if (stat(fullpath.s+1, &st) == -1) { if (errno == EEXIST) return respond(550, 1, "File does not exist."); else return respond(450, 1, "Could not locate file."); } if (!str_copy(&rnfr_filename, &fullpath)) return respond_internal_error(); return respond(350, 1, "OK, file exists."); } int handle_rnto(void) { int r; if (!qualify_validate(req_param)) return 1; if (!rnfr_filename.len) return respond(425, 1, "Send RNFR first."); r = rename(rnfr_filename.s+1, fullpath.s+1); str_truncate(&rnfr_filename, 0); if (r == -1) return respond_syserr(550, "Could not rename file"); return respond(250, 1, "File renamed."); } int handle_site_chmod(void) { unsigned mode; const char* ptr; for (ptr = req_param, mode = 0; *ptr >= '0' && *ptr <= '7'; ++ptr) mode = (mode * 8) | (*ptr - '0'); if (ptr == req_param || *ptr != SPACE || mode > 0777) return respond(501, 1, "Invalid mode specification."); while (*ptr == SPACE) ++ptr; if (!qualify_validate(ptr)) return 1; if (chmod(fullpath.s+1, mode) != 0) return respond_syserr(550, "Could not change modes on file"); return respond(250, 1, "File modes changed."); } twoftpd-1.42/twoftpd-anon-conf.c0000664000076400007640000000671311732365413016217 0ustar bruceguenter/* twoftpd-conf.c - Configure a new instance of twoftpd auth/xfer * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include "conf.h" #include "conf_bin.c" #include #include const char program[] = "twoftpd-anon-conf"; static const char usage_str[] = "usage: twoftpd-anon-conf ftpacct logacct /twoftpd /var/log/twoftpd /ftp [ip]\n"; void usage(const char* msg) { if (msg) obuf_put4s(&outbuf, program, ": ", msg, ".\n"); obuf_puts(&outbuf, usage_str); obuf_flush(&outbuf); exit(1); } static long ftpuid; static long ftpgid; static long loguid; static long loggid; static const char* logname; static const char* maindir; static const char* logdir; static const char* ftpdir; static const char* ip = "0.0.0.0"; int main(int argc, char* argv[]) { struct passwd* pw; if (argc < 6) usage("Too few parameters"); if (argc > 7) usage("Too many parameters"); if ((pw = getpwnam(argv[1])) == 0) die1(1, "Unknown ftpacct user name"); ftpuid = pw->pw_uid; ftpgid = pw->pw_gid; if ((pw = getpwnam(argv[2])) == 0) die1(1, "Unknown logacct user name"); loguid = pw->pw_uid; loggid = pw->pw_gid; logname = pw->pw_name; maindir = argv[3]; logdir = argv[4]; ftpdir = argv[5]; if (maindir[0] != '/' || logdir[0] != '/' || ftpdir[0] != '/') die1(1, "Directory names must start with /."); if (argc > 6) { ip = argv[6]; } umask(0); if (mkdir(maindir, 0755) == -1) die1sys(1, "Error creating main directory"); if (chmod(maindir, 01755) == -1) die1sys(1, "Error setting permissions on main directory"); if (mkdir(logdir, 0700) == -1) die1sys(1, "Error creating log directory"); if (chown(logdir, loguid, loggid) == -1) die1sys(1, "Error setting owner on log directory"); if (chdir(maindir) == -1) die1sys(1, "Error changing to main directory"); if (mkdir("log", 0755) == -1) die1sys(1, "Error creating log service directory"); if (mkdir("env", 0755) == -1) die1sys(1, "Error creating env directory"); make_file("run", 0755, "#!/bin/sh\n" "exec 2>&1\n" "umask 022\n" "exec \\\n" "tcpserver -DRHv -llocalhost ", ip, " 21 \\\n" "softlimit -m 2000000 \\\n" "envdir ", maindir, "/env \\\n", conf_bin, "/twoftpd-anon"); make_file("log/run", 0755, "#!/bin/sh\n" "exec \\\n" "setuidgid ", logname, " \\\n" "multilog t ", logdir, 0, 0, 0); make_fileu("env/CHROOT", 1); make_fileu("env/GID", ftpgid); make_file("env/HOME", 0644, ftpdir, 0, 0, 0, 0, 0, 0); make_fileu("env/UID", ftpuid); make_file("env/USER", 0644, "ftp", 0, 0, 0, 0, 0, 0); make_file("env/GROUP", 0644, "ftp", 0, 0, 0, 0, 0, 0); return 0; } twoftpd-1.42/strtou.c0000664000076400007640000000202211732365413014201 0ustar bruceguenter/* strtou.c - Translate decimal string to unsigned long * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "twoftpd.h" unsigned long strtou(const char* str, const char** end) { unsigned long i; for (i = 0; *str >= '0' && *str <= '9'; ++str) i = i * 10 + *str - '0'; *end = str; return i; } twoftpd-1.42/twoftpd-xfer.c0000664000076400007640000000452611732365413015305 0ustar bruceguenter/* twoftpd-xfer.c - Main dispatch table for twoftpd-xfer * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "twoftpd.h" #include "backend.h" const char program[] = "twoftpd-xfer"; int store_exclusive = 0; const command verbs[] = { { "TYPE", 0, 0, handle_type }, { "STRU", 0, 0, handle_stru }, { "MODE", 0, 0, handle_mode }, { "CWD", 0, 0, handle_cwd }, { "PWD", 0, handle_pwd, 0 }, { "CDUP", 0, handle_cdup, 0 }, { "PASV", 0, handle_pasv, 0 }, { "PORT", 0, 0, handle_port }, { "LIST", 0, handle_list, handle_list }, { "NLST", 0, handle_nlst, handle_nlst }, { "SIZE", 0, 0, handle_size }, { "MDTM", 0, 0, handle_mdtm2 }, { "REST", 0, 0, handle_rest }, { "RETR", 0, 0, handle_retr }, { "STOR", 0, 0, handle_stor }, { "APPE", 0, 0, handle_appe }, { "MKD", 0, 0, handle_mkd }, { "RMD", 0, 0, handle_rmd }, { "DELE", 0, 0, handle_dele }, { "RNFR", 0, 0, handle_rnfr }, { "RNTO", 0, 0, handle_rnto }, /* Compatibility verbs as defined by RFC1123 */ { "XCWD", 0, 0, handle_cwd }, { "XPWD", 0, handle_pwd, 0 }, { "XCUP", 0, handle_cdup, 0 }, { "XMKD", 0, 0, handle_mkd }, { "XRMD", 0, 0, handle_rmd }, /* Handle stray login commands */ { "USER", 1, 0, handle_pass }, { "PASS", 1, 0, handle_pass }, { "ACCT", 0, 0, handle_pass }, { 0, 0, 0, 0 } }; const command site_commands[] = { { "CHMOD", 0, 0, handle_site_chmod }, { 0, 0, 0, 0 } }; twoftpd-1.42/ChangeLog0000664000076400007640000046542111732365413014267 0ustar bruceguentercommit 1d3e83ba4c4988bb7291057afb759d5642381044 Author: Bruce Guenter Date: Fri Aug 8 15:52:24 2008 -0600 Fix a one-off buffer overrun in ASCII conversion in the STOR command. NEWS | 2 ++ store.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) commit e8d52cec57b961fd1c25cfea3ebf5828ebe22518 Author: Bruce Guenter Date: Thu Aug 7 12:19:28 2008 -0600 Added a $CONNECT_TIMEOUT setting to set timeouts on data connections. NEWS | 2 ++ backend.c | 4 ++++ backend.h | 1 + socket.c | 4 ++-- twoftpd-xfer.1 | 5 +++++ 5 files changed, 14 insertions(+), 2 deletions(-) commit 702acc92372e33d6c6916a67cd4a57105ba00423 Author: Bruce Guenter Date: Tue Aug 5 16:59:58 2008 -0600 Fix resetting the output buffer between listings. NEWS | 1 + list.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) commit bde1bf60f2dec27c0d974781d86e297eca9a56af Author: Bruce Guenter Date: Tue Aug 5 16:57:06 2008 -0600 Bumped version to 1.41 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) commit b8cf68e2c46259308a2ef54f8b0556c4bd7f109b Author: Bruce Guenter Date: Mon Aug 4 12:51:31 2008 -0600 Updated the TODO file. TODO | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) commit 3e256450ab0ba4a7f1d8ad9858082e25fd98e219 Author: Bruce Guenter Date: Mon Aug 4 12:39:20 2008 -0600 Bumped version to 1.40, rewriting the biggest NEWS entry. NEWS | 10 +++++----- VERSION | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) commit ebd5f78fca40cdf8494924494340eaf3b9c6c5e3 Author: Bruce Guenter Date: Sun Aug 3 20:25:56 2008 -0600 Dropped use of iobuf in make_{in,out}_connection in favor of bare FDs. TODO | 2 -- backend.h | 6 +++--- list.c | 32 +++++++++++++++++--------------- retr.c | 6 +++--- socket.c | 35 ++++++++++++++--------------------- store.c | 6 +++--- tests/backend-list-modes | 16 ++++++++-------- tests/backend-list-params | 30 +++++++++++++++--------------- twoftpd-drop.c | 9 ++++----- 9 files changed, 67 insertions(+), 75 deletions(-) commit b4355c852690c020b7820bd2467e6f474fef03f1 Author: Bruce Guenter Date: Fri Aug 1 18:38:57 2008 -0600 Moved all callers of respond_bytes into a simpler respond_xferresult routine TODO | 2 - list.c | 25 +++---------- respond.c | 18 ++++++++- retr.c | 17 +++------ store.c | 17 +++------ tests/backend-appe | 2 +- tests/backend-interrupt | 12 +++--- tests/backend-list-modes | 48 ++++++++++++------------ tests/backend-list-params | 82 +++++++++++++++++++++--------------------- tests/backend-list-specials | 4 +- tests/backend-lockhome | 4 +- tests/backend-rest | 4 +- tests/backend-retr | 16 ++++---- tests/backend-softchroot | 6 ++-- tests/backend-store | 24 ++++++------ twoftpd-drop.c | 4 +- twoftpd.h | 3 +- 17 files changed, 135 insertions(+), 153 deletions(-) commit 8a2f447903b3e0e4e3823c638da5cb587cbabc28 Author: Bruce Guenter Date: Fri Aug 1 18:05:35 2008 -0600 Modified listing to handle interruptions as well. NEWS | 6 +++--- TODO | 10 ++-------- list.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 13 deletions(-) commit 60f47e3bdc4125c464bd7544bbcd9815fb8c93ed Author: Bruce Guenter Date: Fri Aug 1 16:59:14 2008 -0600 Expose the network writing function from copy_xlate. backend.h | 2 ++ copy.c | 40 +++++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) commit d5cbbfe319ed3fb917f80c6e04a550fd0dfcd7f5 Author: Bruce Guenter Date: Fri Aug 1 16:37:19 2008 -0600 Modified listing to create a full line before outputting it. This change consolidates the output handling to a single call, so as to simplify handling timeouts and interruptions in that single call. list.c | 89 ++++++++++++++++++++++++++++++++++----------------------------- 1 files changed, 48 insertions(+), 41 deletions(-) commit 8cd52aff13ed2ddeca54adc61dc6d85756ac40c2 Author: Bruce Guenter Date: Fri Aug 1 13:23:29 2008 -0600 Dropped use of open_in in show_message_file, fixing a longstanding bug. NEWS | 2 ++ backend.h | 1 - messagefile.c | 23 ++++++++++++++++------- path.c | 9 --------- tests/backend-messagefile | 31 +++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 17 deletions(-) create mode 100644 tests/backend-messagefile commit dad89ebe0babdbe0f5483516537a5a7b0ea6b992 Author: Bruce Guenter Date: Fri Aug 1 12:54:45 2008 -0600 Dropped the use of open_in/ibuf in handle_retr retr.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) commit 1f94ef50b157885bd2bcbf8af0980e1760499cf4 Author: Bruce Guenter Date: Thu Jul 31 17:59:51 2008 -0600 Moved open_out into store.c, dropping the use of obuf to hold the file. backend.h | 2 +- path.c | 11 +---------- store.c | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 21 deletions(-) commit 8201610d35478268843bb131d957efcbe786b8cb Author: Bruce Guenter Date: Thu Jul 31 17:28:07 2008 -0600 Drop the use of iobuf parameters from copy_xlate_close backend.h | 2 +- copy.c | 17 +++++++++-------- retr.c | 2 +- store.c | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) commit e8d2d4c4a76f53efb79605233267b876670dc1e1 Author: Bruce Guenter Date: Thu Jul 31 16:30:28 2008 -0600 Any errors from closing the input file can be ignored in copy_xlate_close. copy.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) commit de8abe9da24e657fab2c2333fa929f7f879a336b Author: Bruce Guenter Date: Thu Jul 31 16:19:14 2008 -0600 Use read/write directly in copy_xlate to avoid EAGAIN issues. copy.c | 58 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 33 insertions(+), 25 deletions(-) commit 11c84cdcfb20aaee49ccea4a3aa52c95552db53a Author: Bruce Guenter Date: Thu Jul 31 14:04:14 2008 -0600 Simplify a set of conditional expressions in the listing code. list.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) commit c5473eb88b589cd565b3f396b319fe372b6faf0c Author: Bruce Guenter Date: Wed Jul 30 16:27:56 2008 -0600 Eliminate two unused variables. retr.c | 1 - store.c | 1 - 2 files changed, 0 insertions(+), 2 deletions(-) commit d8325280cfacd3c1c132fc58982e1332ed58f4e3 Author: Bruce Guenter Date: Wed Jul 30 16:27:32 2008 -0600 Use ipv4_scan instead of the deprecated ipv4_parse in -bind-port. twoftpd-bind-port.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 225180aaa2b145e84cc6781912a5b38f76d9b4d3 Author: Bruce Guenter Date: Wed Jul 30 16:21:32 2008 -0600 Pushed the timeout value into callers of copy_xlate, and out of socket.c. TODO | 2 +- backend.h | 2 +- copy.c | 10 +++++----- list.c | 1 + retr.c | 3 ++- socket.c | 2 -- store.c | 3 ++- 7 files changed, 12 insertions(+), 11 deletions(-) commit cfcd12e29ecb0acc550e60c2cce89209f8e11755 Author: Bruce Guenter Date: Wed Jul 30 16:13:50 2008 -0600 Push the poll timeout value into copy_xlate. copy.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) commit e0ead7f42efe3c052eb026785251415fdd9acc0b Author: Bruce Guenter Date: Wed Jul 30 15:55:23 2008 -0600 Handle interruptions to data transfers on the command channel. NEWS | 4 +++- TODO | 2 ++ copy.c | 39 ++++++++++++++++++++++++++++++++++++++- retr.c | 13 ++++++++----- store.c | 13 ++++++++----- tests.inc | 3 ++- tests/backend-interrupt | 32 +++++++++++++++++++++++++++++--- xfer-test | 26 ++++++++++++++++++++------ 8 files changed, 110 insertions(+), 22 deletions(-) commit f7d17d757ee2c36091b248e350b568ff85c77673 Author: Bruce Guenter Date: Wed Jul 23 22:59:02 2008 -0600 Improved reporting of interrupted transfers. NEWS | 2 ++ copy.c | 13 +++++++++++-- retr.c | 4 +++- store.c | 2 ++ tests.inc | 1 + tests/backend-interrupt | 20 ++++++++++++++++++++ xfer-test | 47 +++++++++++++++++++++++++++++++---------------- 7 files changed, 70 insertions(+), 19 deletions(-) create mode 100644 tests/backend-interrupt commit edbe94eb4963dca39142ccd0ee4d19ff25f1988f Author: Bruce Guenter Date: Wed Jul 23 16:37:41 2008 -0600 Set default values in xfer-test for env vars used by the backends. xfer-test | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) commit 3ff550dacd094d3c7c116d267ac2fcea62990b8f Author: Bruce Guenter Date: Wed Jul 23 16:12:31 2008 -0600 Moved a snippet of common code out of the IO functions in xfer-test. xfer-test | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) commit ba3a97865b2441bed85644d6e56454b20300ddf8 Author: Bruce Guenter Date: Tue Jul 22 23:12:19 2008 -0600 Fixed the error code in handle_pasv when creating the socket failed. socket.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 7998de08888916a5a67abd90084ddf1fad02e24f Author: Bruce Guenter Date: Tue Jul 22 23:00:36 2008 -0600 Moved the close function calls into copy_xlate, rename to copy_xlate_close backend.h | 12 ++++++------ copy.c | 28 ++++++++++++++++++++++++---- retr.c | 6 ++---- store.c | 6 ++---- 4 files changed, 34 insertions(+), 18 deletions(-) commit 49a5997d8ce313e8a3e3256a71c9f0d2dae2a244 Author: Bruce Guenter Date: Tue Jul 22 18:16:47 2008 -0600 Changed the return value convention for copy_xlate. System errors are now cause a -1 return, and success returns 0. This will be extended to have interruptions return 1. copy.c | 13 +++++++++---- retr.c | 6 +++--- store.c | 6 +++--- 3 files changed, 15 insertions(+), 10 deletions(-) commit 2652f3bd42dbb19bed6e218c0c8cd7804e2bd539 Author: Bruce Guenter Date: Tue Jul 22 17:57:47 2008 -0600 Merged the two network copy routines into one, copy_xlate. backend.h | 8 ++++++ backend=l | 1 + messagefile.c => copy.c | 50 ++++++++++++++++++++++++------------- retr.c | 63 ++++++++++++++-------------------------------- store.c | 48 ++++++++++++----------------------- 5 files changed, 77 insertions(+), 93 deletions(-) copy messagefile.c => copy.c (50%) commit 11118e343297426ec95fe30ad383113fc07edee8 Author: Bruce Guenter Date: Tue Jul 22 17:54:40 2008 -0600 Bumped version to 1.31 NEWS | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) commit 0ae358db32af67d29a2cd0bb2d0579e6f3dfb861 Author: Bruce Guenter Date: Tue Jul 22 15:19:35 2008 -0600 Fixed up some problems in the README README.in | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) commit 1ff33fa5176897a79209d18727cdb7042c16248e Author: Bruce Guenter Date: Thu Jul 10 16:00:20 2008 -0600 Tweaked some printfs in tests to fix a problem with ksh. tests.inc | 2 +- tests/make-good-cvm | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) commit 3991d72f9b27899f70eb5cde451af1ee4a33ca25 Author: Bruce Guenter Date: Thu Jul 10 15:56:03 2008 -0600 Expanded some notes in the README. README.in | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) commit d1850e31ae37dd4bb483470ea375b34b31976669 Author: Bruce Guenter Date: Thu Jul 10 15:55:40 2008 -0600 Added -D_FILE_OFFSET_BITS=64 to the compile flags in the spec. spec | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit ce68b0674746f145fe2517065adedb4bc7e4ec33 Author: Bruce Guenter Date: Thu Jul 10 12:46:22 2008 -0600 Added tests for LOCKHOME and SOFTCHROOT behavior. TODO | 3 ++- tests/backend-lockhome | 29 +++++++++++++++++++++++++++++ tests/backend-softchroot | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletions(-) create mode 100644 tests/backend-lockhome create mode 100644 tests/backend-softchroot commit eeeb21f125b7e755e4500d8d870af4579b316aad Author: Bruce Guenter Date: Thu Jul 10 12:15:44 2008 -0600 Added test to ensure -drop doesn't overwrite existing files. tests/backend-store | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) commit c1c535c0be9e9447ede374bd5a65a324c397420c Author: Bruce Guenter Date: Thu Jul 10 11:39:26 2008 -0600 Added self tests for the -drop backend. tests.inc | 2 +- tests/backend-appe | 12 ++++++- tests/backend-cdup-pwd | 10 +++++- tests/backend-chmod | 6 +++- tests/backend-commands | 74 ++++++++++++++++++++++++++++++++++++++++++- tests/backend-cwd-pwd | 10 +++++- tests/backend-dele | 6 +++- tests/backend-greeting | 8 ++++- tests/backend-list-modes | 42 ++++++++++++++++++++++++- tests/backend-list-params | 77 ++++++++++++++++++++++++++++++++++++++++++++- tests/backend-mdtm | 5 ++- tests/backend-mdtm2 | 6 +++- tests/backend-mkd-rmd | 9 +++++- tests/backend-mode | 7 +++- tests/backend-rest | 5 ++- tests/backend-retr | 22 ++++++++++++- tests/backend-rnfrto | 15 ++++++++- tests/backend-size | 5 ++- tests/backend-store | 30 +++++++++++++++++- tests/backend-stru | 7 +++- tests/backend-type | 13 +++++++- 21 files changed, 350 insertions(+), 21 deletions(-) commit b8fcb2158900c9b08d2ae3ce87e268daf5bc3bba Author: Bruce Guenter Date: Thu Jul 10 10:57:56 2008 -0600 Dropped the use of SOFTCHROOT in preparation for testing CHROOT modes. tests.inc | 3 +-- tests/backend-cdup-pwd | 16 ++++++++-------- tests/backend-commands | 8 ++++---- tests/backend-cwd-pwd | 16 ++++++++-------- 4 files changed, 21 insertions(+), 22 deletions(-) commit cb77897b029f0fdacd0194a7af313e80856039df Author: Bruce Guenter Date: Thu Jul 10 10:42:22 2008 -0600 Bumped version to 1.30 due to significant changes in this release. NEWS | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit bccb4607464036f9e8d2b192b7fa7fd15e06df49 Author: Bruce Guenter Date: Wed Jul 9 20:30:19 2008 -0600 Scale down the transfer rate to kB, MB, etc when it gets large. respond.c | 8 ++++++++ xfer-test | 2 +- 2 files changed, 9 insertions(+), 1 deletions(-) commit 04d2f565050eb13ebea83440db16286de3106f9c Author: Bruce Guenter Date: Wed Jul 9 20:19:51 2008 -0600 Added a transfer rate indicator to responses. NEWS | 2 ++ respond.c | 17 ++++++++++++++++- socket.c | 1 + twoftpd.h | 1 + xfer-test | 1 + 5 files changed, 21 insertions(+), 1 deletions(-) mode change 100644 => 100755 xfer-test commit 6d09b9262a72bb24133a49ec0bb775169599296b Author: Bruce Guenter Date: Wed Jul 9 16:21:15 2008 -0600 Updated the copyright year and email address. README.in | 2 +- backend.c | 2 +- banner.c | 2 +- conf.c | 2 +- list.c | 2 +- log.c | 2 +- main.c | 2 +- messagefile.c | 2 +- path.c | 2 +- respond.c | 2 +- responses.c | 2 +- retr.c | 2 +- socket.c | 2 +- spec | 2 +- stat.c | 2 +- state.c | 2 +- statmod.c | 2 +- store.c | 2 +- strtou.c | 2 +- twoftpd-anon-conf.c | 2 +- twoftpd-anon.c | 2 +- twoftpd-auth.c | 2 +- twoftpd-bind-port.c | 2 +- twoftpd-conf.c | 2 +- twoftpd-drop.c | 2 +- twoftpd-switch.c | 2 +- twoftpd-xfer.c | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) commit 2be0a6f81f64c3326c137d246433407d4e3f5f00 Author: Bruce Guenter Date: Wed Jul 9 12:00:36 2008 -0600 Rewrote the directory listing code. NEWS | 3 +- list.c | 62 +++++++++++++++++++++++++++++--------------- tests/backend-list-params | 11 +++++++- 3 files changed, 53 insertions(+), 23 deletions(-) commit c7ed4b8d253ec3c9e36f419d3f08e9d65e904e3c Author: Bruce Guenter Date: Tue Jul 8 12:36:34 2008 -0600 Added a $AUTH_ATTEMPTS control to twoftpd-auth. NEWS | 3 +++ tests/auth-attempts | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ twoftpd-auth.1 | 4 ++++ twoftpd-auth.c | 13 ++++++++++++- 4 files changed, 67 insertions(+), 1 deletions(-) create mode 100644 tests/auth-attempts commit 10b5afa4b918c85dd96feb58a5be0ca561a3eb90 Author: Bruce Guenter Date: Tue Jul 8 12:22:48 2008 -0600 Switched to the CVM v2 client library. NEWS | 2 ++ spec | 2 +- tests.inc | 4 +++- tests/make-good-cvm | 16 ++++++++-------- twoftpd-auth.c | 10 ++++------ twoftpd-auth=x | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) commit 97143d8b8261989f07587409617cd7c9b2d57675 Author: Bruce Guenter Date: Fri Jun 27 16:29:01 2008 -0600 Use fmt_ulldec instead of snprintf in stat.c to allow for large sizes. stat.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) commit 4e0e992b277e73caba7b1199d86160f45541ca85 Author: Bruce Guenter Date: Fri Jun 27 15:52:55 2008 -0600 Use a ull format in list.c to properly output large file sizes. list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit cf520f94549e469a29a0bdfa355c4c9606c0900e Author: Bruce Guenter Date: Fri Jun 27 15:52:21 2008 -0600 Use fmt_multi instead of snprintf in socket.c socket.c | 11 +++++------ spec | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) commit 16f7738a0ec4d8cfe7b34699ffbf0f4829767774 Author: Bruce Guenter Date: Mon Jun 11 23:19:41 2007 +0000 Use the @YEAR@ macro for the copyright year in the README. README.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit d15cb3f205764a47f9731b724fd82843241eebfa Author: Bruce Guenter Date: Fri May 18 23:29:52 2007 +0000 Fixed listing files with special characters in their names. NEWS | 1 + list.c | 13 ++++++++++--- tests/backend-list-specials | 23 +++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 tests/backend-list-specials commit 2c91e83603b918642481e2e95efb323307d6f1b7 Author: Bruce Guenter Date: Fri May 12 23:58:56 2006 +0000 Bumped version to 1.22 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) commit feae98140f7ae7609d9b8532e64368886fd61c8f Author: Bruce Guenter Date: Thu Apr 20 18:20:26 2006 +0000 Fixed missing BuildRequires: cvm-devel in the spec. Thanks Charlie Brady spec | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) commit 8b5d2e66673be97a5bf8ffa3948ac649deffb097 Author: Bruce Guenter Date: Tue Apr 18 23:46:56 2006 +0000 Added this year to the README file. README.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 8ee6c6f2ad7c1ff77c68aa36f39a0eba98d6b196 Author: Bruce Guenter Date: Tue Apr 18 23:44:51 2006 +0000 Fixed some portability issues in the test cases. tests/auth-cvm-bad-data | 2 +- tests/auth-timeout | 11 ++++++++--- tests/make-home | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) commit b74c633c6008ec39796a5d0f02a603420aa73aed Author: Bruce Guenter Date: Tue Apr 18 19:27:47 2006 +0000 Apparently the shell printf command's handling of octal sequences has changed to be C compatible. tests/make-good-cvm | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) commit a9bc8adfda604efbc500d8621e25d6ea0a45050e Author: Bruce Guenter Date: Mon Apr 17 21:59:19 2006 +0000 Adjusted the spec to use the new install target. spec | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) commit 6583df913e957351cd47c55e3c96cc000d48cc20 Author: Bruce Guenter Date: Tue Apr 11 23:12:58 2006 +0000 Switched installer to use bg-installer. INSTHIER | 15 +++++++++++++++ insthier.c | 23 ----------------------- spec | 2 +- 3 files changed, 16 insertions(+), 24 deletions(-) create mode 100644 INSTHIER delete mode 100644 insthier.c commit 0b17e2b33900e2105049da79bd9efb3d732348c5 Author: Bruce Guenter Date: Tue Apr 11 22:59:48 2006 +0000 Renamed Copyright: to License: in spec. spec | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit d9baa942af336a35afb13b8ca8703022b390cc4d Author: Bruce Guenter Date: Tue Apr 11 22:59:35 2006 +0000 Added the ChangeLog to the list of distributed files. makedist.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit f1de9ad433916dd1b9a81d5c7f5afce4a193ae10 Author: Bruce Guenter Date: Thu Feb 24 01:14:31 2005 +0000 Fixed a compile failure on FreeBSD in the newer MDTM command. Thanks Sergei Kolobov NEWS | 3 +++ statmod.c | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-) commit 7a080dbf40a46004bef421fb824f4e38c0c7aba9 Author: Bruce Guenter Date: Fri Jan 21 18:20:22 2005 +0000 Use -lbg instead of individual -lbg-* libraries. twoftpd-anon-conf=x | 3 +-- twoftpd-anon=x | 6 +----- twoftpd-auth=x | 4 +--- twoftpd-bind-port=x | 5 +---- twoftpd-conf=x | 3 +-- twoftpd-drop=x | 6 +----- twoftpd-xfer=x | 6 +----- 7 files changed, 7 insertions(+), 26 deletions(-) commit 6c68beadde4feec26f41fec3fd6e04f441be029c Author: Bruce Guenter Date: Fri Jan 21 18:09:26 2005 +0000 Added a fake (empty) listing routine to twoftpd-drop. NEWS | 3 +++ twoftpd-drop.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) commit c54940cb70e7d0e5965c657a4d5191cb59b0eb5f Author: Bruce Guenter Date: Fri Jan 21 18:07:46 2005 +0000 Bumped version to 1.21 NEWS | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) commit bb63f6b33df79c7800b52d61271c789734a1d5ef Author: Bruce Guenter Date: Fri Jan 21 16:20:03 2005 +0000 Updated the required versions and web site URLs. spec | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) commit adf9027a162e3f3233d69435c8bb3304b34e1ade Author: Bruce Guenter Date: Thu Jan 20 23:37:22 2005 +0000 Bumped version to 1.20. NEWS | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 19c0a4c69fe9a8356e475c4e8805c2676fdeda1e Author: Bruce Guenter Date: Thu Jan 20 23:36:32 2005 +0000 Added some notes about ABOR. TODO | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) commit 9499abeb70fd1f102fd89170329abb406aa661cb Author: Bruce Guenter Date: Thu Jan 20 23:36:19 2005 +0000 Somehow this got missed in the last commit of twoftpd-switch.c. twoftpd-switch.1 | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) commit 3eb133230d938b9a1e911cd58ef4cb9c2ed3bf7d Author: Bruce Guenter Date: Thu Jan 20 23:29:50 2005 +0000 Rewrote twoftpd-switch to rely on environment variables exclusively to determine which back-end to use. NEWS | 5 +++-- twoftpd-switch.c | 51 +++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 16 deletions(-) commit f68d6fc94b5429a6bfc9f521120ee7a29994d9f6 Author: Bruce Guenter Date: Thu Jan 20 22:54:56 2005 +0000 Added twoftpd-drop, a write-only FTP server. NEWS | 2 ++ backend.h | 1 + insthier.c | 1 + store.c | 7 ++++++- twoftpd-anon.c => twoftpd-drop.c | 15 ++++++--------- twoftpd-anon=x => twoftpd-drop=x | 0 twoftpd-xfer.1 | 4 ++++ twoftpd-xfer.c | 2 ++ 8 files changed, 22 insertions(+), 10 deletions(-) copy twoftpd-anon.c => twoftpd-drop.c (80%) copy twoftpd-anon=x => twoftpd-drop=x (100%) commit 7097a3baf8b9482cb31de22ea4afb788426ef39f Author: Bruce Guenter Date: Thu Jan 20 16:49:02 2005 +0000 Modify small directory sizes to make ReiserFS directories look like normal (ext[23] etc) ones with 4kB block size. tests.inc | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) commit 6cb70c4550ae543bb83acd1c66e455efdcf3279f Author: Bruce Guenter Date: Thu Jan 20 16:48:26 2005 +0000 Use `ls` to compress spaces, to avoid differences in ls formatting. tests/backend-mdtm2 | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) commit 8677a414c7bd01a39ef17c8a8a164dfb45156cb7 Author: Bruce Guenter Date: Tue Jan 18 03:58:50 2005 +0000 I had it right the first time -- 230 means authenticated, 220 means ready for new user. backend.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 88da4b5674d0867c4560bd7aa9ccc41351230d5c Author: Bruce Guenter Date: Tue Jan 18 00:06:28 2005 +0000 Eliminated the bogus APPE-after-REST test. NEWS | 2 ++ store.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) commit 2826a3f8c8979abe367dff2d9cd067979bb4d6ac Author: Bruce Guenter Date: Sat Jan 15 00:14:42 2005 +0000 The startup code check was backwards -- authenticated should show 230. backend.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 8f5e13c01650c9c511303d34de99a023148ada1c Author: Bruce Guenter Date: Sat Jan 15 00:08:28 2005 +0000 Added note about svn access. README.in | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) commit 98a25cddff2ffdedb6e22b08b156980b673075d2 Author: Bruce Guenter Date: Fri Jan 14 23:50:55 2005 +0000 Modified the backends (twoftpd-auth and twoftpd-xfer) to show a 220 banner if the front end authenticated, and 230 if not. This fixes problems some FTP clients have when running twoftpd-anon after authentication. The codes had previously been hard-coded into the respective programs. NEWS | 5 +++++ backend.c | 6 ++++-- backend.h | 2 -- tests/auth-cvm-good-data | 4 ++-- tests/backend-greeting | 9 ++++++--- twoftpd-anon.c | 3 +-- twoftpd-auth.1 | 9 ++++++++- twoftpd-auth.c | 5 +++-- twoftpd-xfer.1 | 11 +++++++++++ twoftpd-xfer.c | 3 +-- 10 files changed, 41 insertions(+), 16 deletions(-) commit 2a416b825f4d757aad8cd909ddc083beae78a109 Author: Bruce Guenter Date: Fri Jan 14 05:29:17 2005 +0000 Clarified error message on aborted connections. socket.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit c8f108618ac96482895a71923218fcef73ed6116 Author: Bruce Guenter Date: Fri Jan 7 19:08:24 2005 +0000 Switched from wc to cksum when verifying that files arrived correctly to avoid issues with variable spaces with wc. tests/backend-appe | 6 +++--- tests/backend-store | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) commit 33fce590fa69223b3d26264eafae3ad2cd886f21 Author: Bruce Guenter Date: Fri Jan 7 19:07:25 2005 +0000 Fixed usage of "tail +#" to "tail -n +#" tests.inc | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) commit 8cd092bd3625a7681ea58e3499c35691f9509ae7 Author: Bruce Guenter Date: Fri Jan 7 18:00:41 2005 +0000 Fixed bug exposed by Mozilla which tries to retrieve directories before listing them without re-issuing a connection command. This is valid usage but would previously cause failures. NEWS | 3 +++ retr.c | 9 +++++++++ 2 files changed, 12 insertions(+), 0 deletions(-) commit 75264c1bfeb718b3ca21eaca85f8212b723c7683 Author: Bruce Guenter Date: Fri Jan 7 17:53:54 2005 +0000 Make sure to close the output buffer on all errors. store.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) commit d3be1e195db48ba3fe23a40c8fa3cef54337f12c Author: Bruce Guenter Date: Fri Jan 7 17:48:39 2005 +0000 Make sure to close the input ibuf on all errors. retr.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) commit 47a6e095383318cfa1f960ad12c4b78a8ea9805a Author: Bruce Guenter Date: Fri Jan 7 17:40:55 2005 +0000 Whoops, twoftpd-switch has a man page to install as well. insthier.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 05541636d6d741d2918c1a043e6be02dbcfe8d50 Author: Bruce Guenter Date: Fri Jan 7 17:39:19 2005 +0000 Added twoftpd-switch program. NEWS | 3 +++ insthier.c | 1 + twoftpd-switch.1 | 19 +++++++++++++++++++ twoftpd-switch.c | 31 +++++++++++++++++++++++++++++++ twoftpd-switch=x | 3 +++ 5 files changed, 57 insertions(+), 0 deletions(-) create mode 100644 twoftpd-switch.1 create mode 100644 twoftpd-switch.c create mode 100644 twoftpd-switch=x commit 057d2f21dca03a05bc14fe84bc5712adee9df897 Author: Bruce Guenter Date: Wed Nov 26 04:40:55 2003 +0000 Remove the extraneous trailing blank line. tests/backend-list-times | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) commit 80d233304caf4dc70634916ecc0f3207301d2f6b Author: Bruce Guenter Date: Wed Nov 26 00:01:56 2003 +0000 Added a test to check that time stamps are properly displayed. tests/backend-list-times | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) create mode 100644 tests/backend-list-times commit c97128ec6eb9d2aba89cebe8ca5a114eee647c70 Author: Bruce Guenter Date: Tue Nov 25 23:24:43 2003 +0000 Cut off the timestamps from long listings so that differences in times won't affect the test results. tests/backend-list-modes | 50 ++++++++++++++++++++++---------------------- tests/backend-list-params | 26 +++++++++++----------- 2 files changed, 38 insertions(+), 38 deletions(-) commit 4f41c90530dcd96efaaaf32896d5c9207861582f Author: Bruce Guenter Date: Tue Nov 25 22:37:39 2003 +0000 I see no need to handle SITE UTIME anymore, since MDTM works and is far easier to parse. TODO | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) commit 1db32eec57ead9534112df75cbf0f0323f306534 Author: Bruce Guenter Date: Tue Nov 25 22:37:12 2003 +0000 Added tests for the new MDTM modification command. tests/backend-mdtm2 | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) create mode 100644 tests/backend-mdtm2 commit 870e8ed41679555d0c8b378da220057220f56cc0 Author: Bruce Guenter Date: Tue Nov 25 21:55:58 2003 +0000 Fix up the API for gettime to handle returning zero etc. statmod.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) commit 090d7090c4b06f89deac5d4cc464b5157d6f3cd6 Author: Bruce Guenter Date: Tue Nov 25 21:53:51 2003 +0000 Correct the returned timestamp to adjust for the current time zone. statmod.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 6c85628ffb7dbfb78a70c4fbdebedcfd607f4f98 Author: Bruce Guenter Date: Tue Nov 25 18:06:33 2003 +0000 Split the date parsing code off from the MDTM command handler. statmod.c | 25 ++++++++++++++++++------- 1 files changed, 18 insertions(+), 7 deletions(-) commit f05449e7565e3487e9d1be3ca8c2d191f5d3c666 Author: Bruce Guenter Date: Mon Nov 24 23:39:39 2003 +0000 Added dual-mode MDTM command for setting file timestamps. NEWS | 3 ++ TODO | 2 - backend.h | 3 ++ backend=l | 1 + statmod.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ twoftpd-xfer.c | 2 +- 6 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 statmod.c commit 964f42c09905fbb8243cf32e9099f2fcc7ced243 Author: Bruce Guenter Date: Mon Nov 24 22:16:09 2003 +0000 Make sure to open only regular files for reading/writing. NEWS | 1 + path.c | 34 ++++++++++++++++++++++++++++------ store.c | 5 +++-- 3 files changed, 32 insertions(+), 8 deletions(-) commit dc733fba7188927fdae5a5dbed3dab8b6d1a8a16 Author: Bruce Guenter Date: Mon Nov 24 21:12:44 2003 +0000 Switched list host to lists.untroubled.org README.in | 4 ++-- makedist.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) commit 0a1a3ac3191360eef3ec1829de613d7fb0795d60 Author: Bruce Guenter Date: Wed Mar 26 17:48:28 2003 +0000 Clarified note about multiple anonymous servers. README.in | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) commit d1f639f0efdc83d513b748326212ff938482d740 Author: Bruce Guenter Date: Fri Mar 21 14:18:50 2003 +0000 Bumped up version number. NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) commit c06786c904bfe29f9e010215ea225984dc1d13b7 Author: Bruce Guenter Date: Fri Mar 21 14:18:10 2003 +0000 Print out error messages when the socket functions fail. twoftpd-bind-port.c | 30 ++++++++++++++++++++---------- twoftpd-bind-port=x | 1 + 2 files changed, 21 insertions(+), 10 deletions(-) commit 002b23d002a840955be181c00789fb25481f81c5 Author: Bruce Guenter Date: Wed Mar 5 23:34:33 2003 +0000 Bump up the version number. VERSION | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit c5b7cab22ced82ed59f3413c639b5434b56b704c Author: Bruce Guenter Date: Wed Mar 5 23:33:05 2003 +0000 To avoid timing glitches, make sure to remove files before remaking. spec | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit d78a4730eed96538fe3977032e386caca58e9a4e Author: Bruce Guenter Date: Wed Mar 5 22:53:25 2003 +0000 Fixed several shadowed global variable names. backend.c | 6 ++++-- list.c | 6 +++--- main.c | 20 ++++++++++---------- retr.c | 14 +++++++------- socket.c | 22 +++++++++++----------- twoftpd-auth.c | 6 ++++-- twoftpd.h | 2 +- 7 files changed, 40 insertions(+), 36 deletions(-) commit 71c792d885733a898f7951b97474b4fb4209170a Author: Bruce Guenter Date: Wed Mar 5 22:42:18 2003 +0000 Change (again) to new bglibs library setup. spec | 6 +++--- twoftpd-anon-conf=x | 4 ++-- twoftpd-anon=x | 10 +++++----- twoftpd-auth=x | 8 ++++---- twoftpd-bind-port=x | 6 +++--- twoftpd-conf=x | 4 ++-- twoftpd-xfer=x | 10 +++++----- 7 files changed, 24 insertions(+), 24 deletions(-) commit f355475d5c4b56dcb66661f2793ee07ce2fa37e1 Author: Bruce Guenter Date: Fri Feb 14 20:03:16 2003 +0000 Treat a missing parameter to LIST/NLST as a request to list ".". This ensures that all list requests pass through path validation. list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 80e169a44f3c63a60eecee6caf1ebcf11d7eb9be Author: Bruce Guenter Date: Wed Feb 12 07:07:23 2003 +0000 Updated tests. tests/backend-list-modes | 16 ++++++++-------- tests/backend-list-params | 23 ++++++++++++++++++----- tests/backend-mdtm | 4 ++-- tests/make-home | 2 +- 4 files changed, 29 insertions(+), 16 deletions(-) commit 1b5bbded4da0af0afe95e00b4687a43f52158744 Author: Bruce Guenter Date: Wed Feb 12 07:07:12 2003 +0000 Fixed yet another bug in path prefix stripping. list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 26dc4214ffc010dc100a475fe061b27a2d6e4c96 Author: Bruce Guenter Date: Tue Feb 11 00:48:51 2003 +0000 Remember that ipv4addr's have to be passed by reference, not value now. socket.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) commit 894a9420356acad9bd588ce41b636830e0e29690 Author: Bruce Guenter Date: Mon Feb 10 21:25:36 2003 +0000 Updated link scripts for bglibs 1.006 twoftpd-anon-conf=x | 4 ++-- twoftpd-anon=x | 12 +++++------- twoftpd-auth=x | 8 ++++---- twoftpd-bind-port=x | 7 +++---- twoftpd-conf=x | 4 ++-- twoftpd-xfer=x | 12 +++++------- 6 files changed, 21 insertions(+), 26 deletions(-) commit a6f35256c0b13f46151ef2ea1d294128eb5d2f4f Author: Bruce Guenter Date: Mon Feb 10 16:58:11 2003 +0000 Updated the README file to make it templated. README => README.in | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) rename README => README.in (90%) commit 0fe7d0088488592d76e9fe9c43b8c16d8b4c0a61 Author: Bruce Guenter Date: Mon Feb 10 16:57:21 2003 +0000 Updated for bglibs version 1.006 NEWS | 1 + socket.c | 23 ++++++++++++----------- twoftpd-bind-port.c | 4 ++-- 3 files changed, 15 insertions(+), 13 deletions(-) commit 89f62dd423a7c773e86a714a59056a5ca88467a2 Author: Bruce Guenter Date: Wed Nov 20 05:00:11 2002 +0000 Fixed copyright date. list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 2398c9dea3f7f0bcf5668f5b64115402253109fd Author: Bruce Guenter Date: Tue Aug 27 09:36:12 2002 +0000 Fixed bug in output when listing patterns like /foo/* NEWS | 2 ++ list.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) commit feb51fb3c9d58baeb95948b63ecac3b5d9d52e6b Author: Bruce Guenter Date: Mon Jul 22 07:05:10 2002 +0000 Set errno to EPERM on path validation failures. NEWS | 2 ++ path.c | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) commit 536feb334546ca2099d2ffefe03fedcff3375af7 Author: Bruce Guenter Date: Sat Jul 20 05:15:43 2002 +0000 Block paths starting with "/.". NEWS | 2 ++ path.c | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) commit 68c1c86e9b1aa6a65161b04b1e8b2633410ee6d4 Author: Bruce Guenter Date: Fri Jul 19 19:59:07 2002 +0000 Check close return code. NEWS | 1 + retr.c | 2 +- store.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) commit 3a6a8ae4c11aec23fb9d2a8608fe5a37e85edaa3 Author: Bruce Guenter Date: Wed Jul 17 07:25:37 2002 +0000 Fixed a typo in listing permissions of sticky files. NEWS | 8 ++++++++ TODO | 1 + list.c | 2 +- 3 files changed, 10 insertions(+), 1 deletions(-) commit 4c630c1091cf53c41b815d1a6183581e1312fb09 Author: Bruce Guenter Date: Mon Jun 3 04:45:56 2002 +0000 Added bglibs -I/-L flags. spec | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 8939d5bff47d851d9be81888d1ab8ed286cad568 Author: Bruce Guenter Date: Mon Jun 3 04:42:59 2002 +0000 Bumped up date. README | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 9aa3a5edfbfc25cd2929ad110e5ee55c1b40729e Author: Bruce Guenter Date: Mon Jun 3 03:14:50 2002 +0000 Always reset startpos after the RETR command. retr.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) commit 2a98f814434c55c6685e99be83655bef6d92edbd Author: Bruce Guenter Date: Mon Jun 3 03:13:57 2002 +0000 Added support for resuming uploads. NEWS | 1 + backend.h | 1 + retr.c | 2 +- store.c | 16 ++++++++++++---- 4 files changed, 15 insertions(+), 5 deletions(-) commit 39cf94e23a60bd7a83241bf1da66e084ba02f6d1 Author: Bruce Guenter Date: Sat Jun 1 02:31:33 2002 +0000 Switched to using bglibs NEWS | 1 + README.CVS | 10 ---------- backend.c | 6 +++--- backend.h | 4 ++-- backend=l | 1 - conf.c | 6 ++++-- conf.h | 2 +- insthier.c | 2 +- list.c | 8 ++++---- log.c | 2 +- main.c | 4 ++-- messagefile.c | 2 +- path.c | 2 +- respond.c | 2 +- socket.c | 6 +++--- spec | 1 + stat.c | 2 +- state.c | 2 +- twoftpd-anon-conf.c | 4 ++-- twoftpd-anon-conf=x | 5 ++--- twoftpd-anon=x | 14 +++++++------- twoftpd-auth.c | 4 ++-- twoftpd-auth=x | 10 ++++------ twoftpd-bind-port.c | 8 +++----- twoftpd-bind-port=x | 10 ++++------ twoftpd-conf.c | 4 ++-- twoftpd-conf=x | 5 ++--- twoftpd-xfer=x | 14 +++++++------- 28 files changed, 63 insertions(+), 78 deletions(-) delete mode 100644 README.CVS commit e8f8c53f099bb31051336660c47be41fad856b06 Author: Bruce Guenter Date: Thu May 30 03:38:32 2002 +0000 Fixed incorrect UID number in results. tests/auth-cvm-good-data | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit aec44d8cd5eff2ebd57aa2b9cc3bd628ab34dcde Author: Bruce Guenter Date: Thu May 30 03:33:47 2002 +0000 Added missing "fork.h" include. twoftpd-bind-port.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit d5980bfba1a9dc0ce32c488e90aa33db4078913a Author: Bruce Guenter Date: Thu May 30 03:33:39 2002 +0000 *** empty log message *** NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 711ff2fc5ef48131a94bc33b14a90a938a095b0c Author: Bruce Guenter Date: Wed May 29 22:48:44 2002 +0000 Removed extraneous iopoll.o object. twoftpd-anon=x | 1 - twoftpd-xfer=x | 1 - 2 files changed, 0 insertions(+), 2 deletions(-) commit cdf51fb7a8ef746c2723b00b23670dc714bf4b3b Author: Bruce Guenter Date: Wed May 29 22:44:13 2002 +0000 Bumped up version. README | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 0acd8ba439938ba6867e697e0be8fc26aa41e668 Author: Bruce Guenter Date: Wed May 29 22:35:44 2002 +0000 *** empty log message *** NEWS | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) commit d6168deafea47e9052cf4a43301e38b17be75b53 Author: Bruce Guenter Date: Wed May 29 22:35:23 2002 +0000 Converted to using new iopoll_restart routine. socket.c | 4 ++-- twoftpd-anon=x | 1 + twoftpd-bind-port.c | 7 +++---- twoftpd-bind-port=x | 1 + twoftpd-xfer=x | 1 + 5 files changed, 8 insertions(+), 6 deletions(-) commit 7247651b77ea8ffad874a8d73ec14f9e80f97263 Author: Bruce Guenter Date: Wed May 29 12:20:07 2002 +0000 Replaced the numerical constants with named constants in the telnet control code parser. main.c | 17 +++++++++-------- twoftpd.h | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 9 deletions(-) commit 7bd25b685e46ce94c0f6aecd9db749040f59429f Author: Bruce Guenter Date: Wed May 29 12:18:01 2002 +0000 *** empty log message *** TODO | 8 -------- VERSION | 2 +- 2 files changed, 1 insertions(+), 9 deletions(-) commit ed11e8f8df4d5fe7bd981753b7afb34cd6bc6bd6 Author: Bruce Guenter Date: Wed May 29 12:17:37 2002 +0000 Added back-end code for the socket binding hack. backend.c | 8 ++++++++ backend.h | 1 + socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 9 deletions(-) commit da23b2e81bcaadc2099eb27485b7891a8cf18820 Author: Bruce Guenter Date: Wed May 29 12:15:04 2002 +0000 Fixed a typo (write 1 byte, not 0) and change from a stream to a datagram socket pair. twoftpd-bind-port.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit ac279cc207389c5e30cead22365e82eb139a13c3 Author: Bruce Guenter Date: Wed May 29 00:38:11 2002 +0000 Added implementation of bound socket generator daemon. insthier.c | 15 +++--- twoftpd-bind-port.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++ twoftpd-bind-port=x | 7 +++ 3 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 twoftpd-bind-port.c create mode 100644 twoftpd-bind-port=x commit a94d48376745c092579f3529d180a52c7e6d397d Author: Bruce Guenter Date: Fri Apr 19 03:09:18 2002 +0000 Added missing include. backend.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit d48590691caf96c89a95b3b29b9bff3b18b4f7e9 Author: Bruce Guenter Date: Fri Apr 19 03:08:50 2002 +0000 *** empty log message *** README | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 3f61fd444be579c3a1900098f8ecfd44301bbac6 Author: Bruce Guenter Date: Fri Apr 19 03:07:12 2002 +0000 Fixed some minor typos. tests/auth-commands | 32 ++++++++++++++++---------------- tests/auth-cvm-bad-data | 2 +- tests/auth-cvm-good-data | 2 +- tests/auth-cvm-invocation | 2 +- tests/auth-cvm-service | 2 +- tests/auth-invocation | 4 ++-- tests/auth-output | 2 +- tests/auth-timeout | 2 +- tests/backend-list-modes | 16 ++++++++-------- tests/backend-list-params | 8 ++++---- tests/backend-mdtm | 4 ++-- tests/make-home | 2 +- 12 files changed, 39 insertions(+), 39 deletions(-) commit ae7c2b5d20ac8f0865829e2e49cbf3e4f20a2402 Author: Bruce Guenter Date: Fri Apr 19 01:58:06 2002 +0000 *** empty log message *** TODO | 20 +++++++------------- 1 files changed, 7 insertions(+), 13 deletions(-) commit e3bac7e1fe5d5452ecc8e1362c0cbb4b4308136e Author: Bruce Guenter Date: Fri Apr 19 01:58:01 2002 +0000 Add missing man pages to files. spec | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit bbd16ab93fd0b566d3e348fcd74447d6305227f5 Author: Bruce Guenter Date: Thu Apr 18 04:44:45 2002 +0000 Fixed up this file to use cvm_setenv instead of doing it all manually. twoftpd-auth.c | 25 +------------------------ 1 files changed, 1 insertions(+), 24 deletions(-) commit 7345fa04a17596bfc17e7dbc6f401606c90dfd62 Author: Bruce Guenter Date: Thu Apr 18 04:20:15 2002 +0000 Added support for handling supplemental group IDs. NEWS | 2 ++ backend.c | 22 ++++++++++++++++++++++ twoftpd-xfer.1 | 4 ++++ 3 files changed, 28 insertions(+), 0 deletions(-) commit 9d3ab22fb9d14cf53a552494ca1b94c81ffc4248 Author: Bruce Guenter Date: Thu Apr 18 03:09:32 2002 +0000 Truncate user/group names to 8 characters once at startup, instead of each time a long item is listed. backend.c | 10 ++++++++-- backend.h | 2 ++ list.c | 30 ++++++++++++++++-------------- 3 files changed, 26 insertions(+), 16 deletions(-) commit 563b5951e0f5fdd7944f8ec33373db04fd971f35 Author: Bruce Guenter Date: Wed Apr 17 09:47:17 2002 +0000 *** empty log message *** TODO | 30 ++++++++++++++---------------- 1 files changed, 14 insertions(+), 16 deletions(-) commit 0b5403ba65efd2fbd4f63a0911bffac8016c8bb0 Author: Bruce Guenter Date: Wed Apr 17 09:44:23 2002 +0000 Abort connections if stdin becomes readable. NEWS | 3 +++ TODO | 2 -- socket.c | 39 ++++++++++++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 11 deletions(-) commit d642dbadb6d060dc55d0c3d504499950ab29c9d7 Author: Bruce Guenter Date: Wed Apr 17 00:08:42 2002 +0000 *** empty log message *** TODO | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) commit a7384344bbf245323028cf662597665ea33a0c58 Author: Bruce Guenter Date: Wed Apr 17 00:02:53 2002 +0000 Fixed handling of '*' indicator on executable files. Added support for '-p' flag. list.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) commit 73613db6b3c0a1e3bc80efd7c4e000d17cdbb7ee Author: Bruce Guenter Date: Tue Apr 16 23:42:18 2002 +0000 Rewrote list handling to add support for the "-F" flag. list.c | 90 +++++++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 52 insertions(+), 38 deletions(-) commit 5773bf5e6a85350c41301a5138f26dab12954ef9 Author: Bruce Guenter Date: Tue Apr 16 22:45:43 2002 +0000 *** empty log message *** NEWS | 2 ++ README | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) commit 96f0dd4d08ac1d6b9c47a23721f13a5c91b08f56 Author: Bruce Guenter Date: Tue Apr 16 22:45:29 2002 +0000 Fixed missing include and a warning. backend.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) commit 2f0d0864031ccf1000c6aa130e50fada3353ead3 Author: Bruce Guenter Date: Tue Apr 16 22:42:34 2002 +0000 When doing NLST, and the named file is not found, produce a 550 error. list.c | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) commit 2a2235572a6e180ac6ea98fabf09d0e7531f7089 Author: Bruce Guenter Date: Tue Apr 16 22:39:49 2002 +0000 Move setting list_options out of list.c and into backend.c. backend.c | 1 + backend.h | 1 + list.c | 13 ++++--------- 3 files changed, 6 insertions(+), 9 deletions(-) commit ce4ac5c29169f7705a725c50249942cd5a10ade6 Author: Bruce Guenter Date: Tue Apr 16 04:54:03 2002 +0000 *** empty log message *** TODO | 14 ++++++++++++++ VERSION | 2 +- 2 files changed, 15 insertions(+), 1 deletions(-) commit 41203ae0811b0d3fb08c44fc8afa7e4174de1dab Author: Bruce Guenter Date: Tue Feb 26 11:49:41 2002 +0000 Touched up documentation on $USER and $GROUP. twoftpd-xfer.1 | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) commit 264e4dd63089d511d67d1bb8f2ad33609339073a Author: Bruce Guenter Date: Tue Feb 19 23:45:48 2002 +0000 *** empty log message *** TODO | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) commit 1a2aaebe753aaf63ee0c552bee4f951152e47d66 Author: Bruce Guenter Date: Tue Feb 19 23:44:48 2002 +0000 Use the unix/sig library instead of direct signal calls. main.c | 4 ++-- twoftpd-anon=x | 1 + twoftpd-auth=x | 1 + twoftpd-xfer=x | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) commit 27739e2e6a1ee7420d869672b87a70de7696d8cf Author: Bruce Guenter Date: Tue Feb 19 03:20:14 2002 +0000 Use new net library instead of old socket one. README.CVS | 2 +- socket.c | 2 +- twoftpd-anon=x | 2 +- twoftpd-auth=x | 2 +- twoftpd-xfer=x | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) commit a87f1c3a78af308b4a63fcf8df3b455e384397a8 Author: Bruce Guenter Date: Tue Feb 19 03:19:34 2002 +0000 *** empty log message *** NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) commit c8eef5cb3ab0dffcb68ae4d4c63c5ea2e12cde0c Author: Bruce Guenter Date: Tue Feb 19 03:19:25 2002 +0000 Fixed capitalization on banner string. twoftpd-auth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 8d43866d3bc7d781f6e2f91ff8e591812248895f Author: Bruce Guenter Date: Tue Feb 19 03:19:03 2002 +0000 It's OK to CWD to non-readable directories, as long as they're executable. state.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 216f8a6de78cccb14689cb989017b7b82ebf805e Author: Bruce Guenter Date: Tue Nov 27 06:13:40 2001 +0000 Fixed a bug with the usage of getpwnam NEWS | 3 +++ twoftpd-anon-conf.c | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) commit ca63be7f626a70fdc9c75f100301fd6be458637e Author: Bruce Guenter Date: Fri Nov 9 10:10:10 2001 +0000 Remember to uncork the socket before closing it. NEWS | 7 +++++++ backend.h | 1 + list.c | 7 ++----- retr.c | 2 +- socket.c | 10 ++++++++++ 5 files changed, 21 insertions(+), 6 deletions(-) commit e19b994c2fccda5bb9290721e7975a4a067809be Author: Bruce Guenter Date: Sun Nov 4 03:55:19 2001 +0000 Fixed up the "Opened connection" message. tests/backend-appe | 2 +- tests/backend-list-modes | 32 +++++++++++++++--------------- tests/backend-list-params | 48 ++++++++++++++++++++++---------------------- tests/backend-rest | 4 +- tests/backend-retr | 16 +++++++------- tests/backend-store | 8 +++--- 6 files changed, 55 insertions(+), 55 deletions(-) commit 73889de486a49bd60db5911623a9735f5127ad6a Author: Bruce Guenter Date: Sun Nov 4 03:51:57 2001 +0000 Turn on SO_LINGER for outbound sockets, and SO_REUSE for all sockets. NEWS | 4 ++++ socket.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) commit ced980d1cbc5c0194c085fe482b7f63aafaf30a6 Author: Bruce Guenter Date: Sun Nov 4 03:50:43 2001 +0000 Bumped up version number. README | 4 ++-- VERSION | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) commit 16f9fe6ad9b519e5821c02898ca15dc757346694 Author: Bruce Guenter Date: Sat Oct 20 00:12:53 2001 +0000 Set the "cork" option on output sockets. NEWS | 3 +++ socket.c | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) commit cd4ee86551e22e05fde42fe6473cbcf43218d76d Author: Bruce Guenter Date: Fri Oct 19 04:52:49 2001 +0000 Yet another revision, this time to remove the old bogus parts that got left behind. backend.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) commit efc5a89fa28761039404a7473afc8d6d14acd97e Author: Bruce Guenter Date: Fri Oct 19 04:42:40 2001 +0000 Uh, yeah, really fix the strip slashes stuff... backend.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) commit 943d3d78a45804300a68d3a79844a102fc613577 Author: Bruce Guenter Date: Fri Oct 19 04:38:07 2001 +0000 Droped the release number back down to 1. spec | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit d9a611a291e5bb71932c286c289c405f02b894e7 Author: Bruce Guenter Date: Fri Oct 19 04:37:53 2001 +0000 Fixed the previous "trailing slash" patch to fixup $HOME instead of cwd. NEWS | 21 +++++++++++++++++++++ backend.c | 3 ++- 2 files changed, 23 insertions(+), 1 deletions(-) commit 086cb5d225e190c4cbbdf0b3460fbd5ec1987f14 Author: Bruce Guenter Date: Fri Oct 19 04:33:20 2001 +0000 Added the required "socket.lib" target. twoftpd-auth=x | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 3f1970b6cadba12946044d890e69b43530b070a1 Author: Bruce Guenter Date: Fri Oct 19 04:30:01 2001 +0000 Strip trailing slashes from the path, as they cause confusion. backend.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 66c2128b64dae357d05f2aef0d1de185561cd179 Author: Bruce Guenter Date: Thu Oct 18 03:04:30 2001 +0000 Updated for new iobuf setup functions. socket.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 4f4abb1e35522749e7a7971374f4f6eb496adf22 Author: Bruce Guenter Date: Tue Sep 25 02:40:37 2001 +0000 Report opening socket only after the socket is opened. Fix some other potential glitches. socket.c | 43 ++++++++++++++++++++++++++++++------------- 1 files changed, 30 insertions(+), 13 deletions(-) commit c4ad13412e436ab09237f614cd753311c5866eb1 Author: Bruce Guenter Date: Fri Sep 21 00:03:16 2001 +0000 Added workaround for broken firewalls that add extra CRs. main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) commit 88fc3300af803bbd3465839dd239d391d9231062 Author: Bruce Guenter Date: Fri Sep 14 04:12:39 2001 +0000 Fixed up PASV response text. tests/backend-list-modes | 16 ++++++++-------- tests/backend-retr | 8 ++++---- tests/backend-store | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) commit 1c7c5b605066a2b686957c6b241a8e65a9b45626 Author: Bruce Guenter Date: Fri Sep 14 04:12:26 2001 +0000 Don't print an error message for EOF on stdin. main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 4106b56bf02889d172d1238bc3b488ed39cda742 Author: Bruce Guenter Date: Fri Sep 14 03:29:50 2001 +0000 Added note about twoftpd-anon. twoftpd-xfer.1 | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) commit 5b04e2d7edf03e7c596831adb96dbd64aa924407 Author: Bruce Guenter Date: Fri Sep 14 03:01:22 2001 +0000 Removed (now) duplicate definition of CR and LF. twoftpd.h | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) commit 7a67bbf00a8a09e92f4ea0aaab24c666ce593778 Author: Bruce Guenter Date: Fri Sep 14 02:33:25 2001 +0000 Removed rts.* files. EXTRADIST | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) commit 17af2b85338635b29f965cc394ccc3983588d0b1 Author: Bruce Guenter Date: Fri Sep 14 02:31:38 2001 +0000 PASV response workaround for more broken FTP clients. NEWS | 6 ++++-- socket.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) commit 1b05848dc7f57d6660499d265a18c545c4ffd8d3 Author: Bruce Guenter Date: Fri Sep 14 02:27:29 2001 +0000 *** empty log message *** NEWS | 3 +++ README | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) commit 7fdf57360b8fec20b88eaf53a084ca624a7cc218 Author: Bruce Guenter Date: Fri Sep 14 02:23:54 2001 +0000 Install a standard handler for SIGALRM to indicate that the session timed out and is being dropped. main.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) commit 3f9864c9b652da07739de65af1cbf80fbce18c29 Author: Bruce Guenter Date: Tue Sep 4 23:57:12 2001 +0000 Provide proper connection timeout and system error messages. socket.c | 37 +++++++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 12 deletions(-) commit fd1339e4d8266db4d4558a370c09ef7dd42a1be5 Author: Bruce Guenter Date: Tue Sep 4 23:56:33 2001 +0000 Add the result code to the respond_syserr parameters. respond.c | 4 ++-- retr.c | 2 +- stat.c | 4 ++-- store.c | 12 ++++++------ twoftpd.h | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) commit e1c0231e95d68bb546b978055990056decf33d25 Author: Bruce Guenter Date: Tue Sep 4 23:55:16 2001 +0000 Provide error messages on command timeout and I/O errors. main.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) commit 00c61a43d1aa04cd6dd9a123406c23cf72bb19b1 Author: Bruce Guenter Date: Thu Aug 30 05:33:52 2001 +0000 Added more tests. TODO | 5 +--- tests.inc | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/backend-appe | 29 +++++++++++++++++++++ tests/backend-chmod | 16 ++++++++++++ tests/backend-dele | 15 +++++++++++ tests/backend-greeting | 14 ++++++++++ tests/backend-store | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 tests.inc create mode 100644 tests/backend-appe create mode 100644 tests/backend-chmod create mode 100644 tests/backend-dele create mode 100644 tests/backend-greeting create mode 100644 tests/backend-store commit 40d9927ba8c713e7c9c6ce6733dfed7b0779f0d1 Author: Bruce Guenter Date: Thu Aug 30 02:41:19 2001 +0000 Converted tests to new test framework. tests/auth-commands | 88 ++++++++ tests/auth-cvm-bad-data | 9 + tests/auth-cvm-good-data | 15 ++ tests/auth-cvm-invocation | 10 + tests/auth-cvm-service | 13 + tests/auth-invocation | 11 + tests/auth-output | 7 + tests/auth-timeout | 8 + tests/backend-cdup-pwd | 19 ++ tests/backend-commands | 173 +++++++++++++++ tests/backend-cwd-pwd | 19 ++ tests/backend-list-modes | 143 ++++++++++++ tests/backend-list-params | 197 +++++++++++++++++ tests/backend-mdtm | 9 + tests/backend-mkd-rmd | 23 ++ tests/backend-mode | 13 + tests/backend-rest | 25 ++ tests/backend-retr | 533 +++++++++++++++++++++++++++++++++++++++++++++ tests/backend-rnfrto | 33 +++ tests/backend-size | 9 + tests/backend-stru | 13 + tests/backend-type | 25 ++ tests/delete-bad-cvm | 3 + tests/delete-error-cvm | 3 + tests/delete-good-cvm | 3 + tests/delete-home | 3 + tests/make-bad-cvm | 3 + tests/make-error-cvm | 3 + tests/make-good-cvm | 13 + tests/make-home | 13 + 30 files changed, 1439 insertions(+), 0 deletions(-) create mode 100644 tests/auth-commands create mode 100644 tests/auth-cvm-bad-data create mode 100644 tests/auth-cvm-good-data create mode 100644 tests/auth-cvm-invocation create mode 100644 tests/auth-cvm-service create mode 100644 tests/auth-invocation create mode 100644 tests/auth-output create mode 100644 tests/auth-timeout create mode 100644 tests/backend-cdup-pwd create mode 100644 tests/backend-commands create mode 100644 tests/backend-cwd-pwd create mode 100644 tests/backend-list-modes create mode 100644 tests/backend-list-params create mode 100644 tests/backend-mdtm create mode 100644 tests/backend-mkd-rmd create mode 100644 tests/backend-mode create mode 100644 tests/backend-rest create mode 100644 tests/backend-retr create mode 100644 tests/backend-rnfrto create mode 100644 tests/backend-size create mode 100644 tests/backend-stru create mode 100644 tests/backend-type create mode 100644 tests/delete-bad-cvm create mode 100644 tests/delete-error-cvm create mode 100644 tests/delete-good-cvm create mode 100644 tests/delete-home create mode 100644 tests/make-bad-cvm create mode 100644 tests/make-error-cvm create mode 100644 tests/make-good-cvm create mode 100644 tests/make-home commit 7cc5ebb6b72d4003d6e05a29243391a4ce4fe3da Author: Bruce Guenter Date: Thu Aug 30 02:41:12 2001 +0000 Moved to new test framework. rts.exp | 1887 ------------------------------------------------------------- rts.sh | 1 - rts.tests | 197 ------- 3 files changed, 0 insertions(+), 2085 deletions(-) delete mode 100644 rts.exp delete mode 100644 rts.sh delete mode 100644 rts.tests commit 9820d5011001a91668e2c0094a953008586a1d36 Author: Bruce Guenter Date: Thu Aug 30 02:41:03 2001 +0000 *** empty log message *** TODO | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) commit 7bd31fcaa79296520f135d002825c0a259f4f1c7 Author: Bruce Guenter Date: Thu Aug 30 02:40:54 2001 +0000 Bumped up version README | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 6bc3a9df7f2918db4d26d17dd14376cc3e28295c Author: Bruce Guenter Date: Thu Aug 30 02:40:24 2001 +0000 Include system error message in STAT and MDTM. NEWS | 9 +++++++++ stat.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) commit 85b22ee2ea6d273ec9ee44086695f3e96900173d Author: Bruce Guenter Date: Thu Aug 30 02:39:03 2001 +0000 Fixed bug: doing lists of "." when CWD is "/" would fail. list.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 5780703b9c1cac2b93e453fdeca3c819e442f0ee Author: Bruce Guenter Date: Sat Aug 25 00:29:07 2001 +0000 Fixed dependancy on CVM 0.10 spec | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 9ef78dafebf51787733ebeb1b8c53f62e60ca897 Author: Bruce Guenter Date: Sat Aug 25 00:14:48 2001 +0000 *** empty log message *** README | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 7e85e99833b9468f07f8a492a3d8d3fb4366f30e Author: Bruce Guenter Date: Sat Aug 25 00:05:08 2001 +0000 Fix double-output of SITE commands in the logs. NEWS | 2 ++ TODO | 2 -- main.c | 20 +++++++++----------- twoftpd.h | 1 - 4 files changed, 11 insertions(+), 14 deletions(-) commit 1436efed8dbfdfdcee9fb8ca25aa5282ea242bea Author: Bruce Guenter Date: Sat Aug 25 00:04:31 2001 +0000 Added code to handle running setup commands before the transfer. xfer-test | 43 +++++++++++++++++++++++++++---------------- 1 files changed, 27 insertions(+), 16 deletions(-) commit 09e9c5bb3b5c3bb99bee738f526c48a15751703f Author: Bruce Guenter Date: Sat Aug 25 00:04:12 2001 +0000 Added tests for NLST options, NLST .., and REST TODO | 8 ++- rts.exp | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------- rts.tests | 25 ++----- 3 files changed, 210 insertions(+), 51 deletions(-) commit 6873443252a40180ea7e48930be4d452d7ea9d86 Author: Bruce Guenter Date: Fri Aug 24 09:50:47 2001 +0000 Fixed missing respond_end in respond_bytes. respond.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) commit ea4b3869ad81e7ebee0bea6138e5500c28d5562a Author: Bruce Guenter Date: Fri Aug 24 05:43:23 2001 +0000 Use "ftp" instead of "21" as the FTP port number. README | 6 +++--- twoftpd.run | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) commit 3f16a375e1ef65ceb9d87279dc04869e058ff14a Author: Bruce Guenter Date: Fri Aug 24 05:41:26 2001 +0000 Added authentication and session timeout limits. NEWS | 2 ++ backend.c | 6 ++++++ main.c | 2 -- twoftpd-auth.1 | 7 +++++-- twoftpd-auth.c | 8 +++++++- twoftpd-xfer.1 | 3 +++ 6 files changed, 23 insertions(+), 5 deletions(-) commit 37f1d0c46ac8092455fb3c700a9237dae6a08a64 Author: Bruce Guenter Date: Fri Aug 24 05:40:09 2001 +0000 Added some limited but extendable LIST/NLST option parsing. NEWS | 4 +++ list.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 17 deletions(-) commit ecbcf5bff8e272e6cc4f03abff913d70f5c11d4d Author: Bruce Guenter Date: Fri Aug 24 05:31:13 2001 +0000 *** empty log message *** NEWS | 17 +++++++++++++++++ README | 4 ++-- TODO | 4 ++++ VERSION | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) commit f7751fec063aec6f8ca11d54d072a46f4ad1cb5b Author: Bruce Guenter Date: Fri Aug 24 05:28:41 2001 +0000 Added output of system error messages to responses. respond.c | 11 +++++++++++ retr.c | 2 +- store.c | 12 ++++++------ twoftpd.h | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) commit 86a3fa5f8c91bc0b1218bb688333b81d77844021 Author: Bruce Guenter Date: Fri Aug 24 05:22:30 2001 +0000 Added tests for RNFR/RNTO. rts.exp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ rts.tests | 7 +++++-- 2 files changed, 56 insertions(+), 2 deletions(-) commit 087266eb5ccfb641c0ca6c8426195d55e8555511 Author: Bruce Guenter Date: Fri Aug 24 05:22:04 2001 +0000 Added respond_bytes response generator. list.c | 6 +++--- respond.c | 10 ++++++++++ retr.c | 15 ++++----------- store.c | 15 ++++----------- twoftpd.h | 2 ++ 5 files changed, 23 insertions(+), 25 deletions(-) commit fb63dde4e704f0992abbf0a7e68365fc392acc03 Author: Bruce Guenter Date: Fri Aug 24 05:21:22 2001 +0000 Adjusted for new CVM interface. twoftpd-auth.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) commit 0d22db39185b83be343a064b6c77f601de11c7a4 Author: Bruce Guenter Date: Thu Aug 16 06:17:31 2001 +0000 Added more list parameter tests. rts.exp | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rts.tests | 20 +++++++++-- 2 files changed, 125 insertions(+), 3 deletions(-) commit 4bfba5e901a64fe8a3b6742f59f9407aeddf6919 Author: Bruce Guenter Date: Thu Aug 16 03:21:21 2001 +0000 Adjusted to new insthier prototype. insthier.c | 23 ++++++++++------------- 1 files changed, 10 insertions(+), 13 deletions(-) commit 2d2dbe24e4680c7b76d76bbdb19b0fa94de3b822 Author: Bruce Guenter Date: Thu Aug 16 03:19:29 2001 +0000 *** empty log message *** README.CVS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit a83f7b4f57bb7951165b8d5bde56fe221b82a4cc Author: Bruce Guenter Date: Thu Aug 16 03:19:09 2001 +0000 Wrote this transfer test tool. xfer-test | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 91 insertions(+), 0 deletions(-) create mode 100644 xfer-test commit d05f5e7e1d9bd9a8b0ac993171d33d924465f7a0 Author: Bruce Guenter Date: Thu Aug 16 03:18:53 2001 +0000 Added several transfer tests. rts.exp | 830 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- rts.tests | 53 +++-- 2 files changed, 818 insertions(+), 65 deletions(-) commit ea7217361a1eda9ca3fde0c085a068f8f1c6d6c8 Author: Bruce Guenter Date: Thu Aug 16 00:19:30 2001 +0000 *** empty log message *** NEWS | 7 +++++++ README | 4 ++-- VERSION | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) commit f8597aac250f0cec296762ec5c7e846a7b8e4678 Author: Bruce Guenter Date: Wed Aug 15 19:21:35 2001 +0000 Fixed a nasty bug in (not) dealing with the portion of a block following the last LF in ASCII mode. retr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 09f40e495e711e0dcbea8eca702bb34b1391131e Author: Bruce Guenter Date: Wed Aug 15 10:15:27 2001 +0000 Fixed up the response code for MKD from 250 to 257. store.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit ce5e66c2278406cfa66d0cbebfc801a78e2944f2 Author: Bruce Guenter Date: Tue Aug 7 04:36:56 2001 +0000 *** empty log message *** README | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 8d2ff714cdb80f6438316613a2324f93e3649d8e Author: Bruce Guenter Date: Tue Aug 7 00:19:56 2001 +0000 Fixed outbound connection binding to IP. Worked around FTP clients failing to parse the PASV response. NEWS | 4 ++++ socket.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) commit 1fda539d2391e5fc23e73286631c44a869f51e87 Author: Bruce Guenter Date: Mon Aug 6 03:49:01 2001 +0000 Bumped the version to 1.10 NEWS | 3 +++ README | 2 +- VERSION | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) commit b3727bf5cdf300fc67403939e5678947eb94677d Author: Bruce Guenter Date: Sat Aug 4 01:13:49 2001 +0000 *** empty log message *** NEWS | 3 +++ README | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) commit b6411f74e4bf5fe83f7b1343492534d5d21f1783 Author: Bruce Guenter Date: Thu Aug 2 23:30:17 2001 +0000 Fixed a bug in outputting the group name in listings. NEWS | 3 +++ backend.c | 4 +++- backend.h | 5 +++-- list.c | 10 +++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) commit 4fbfc47317c3621c7ec5c89b21f6c1b2bb8cfb17 Author: Bruce Guenter Date: Thu Aug 2 23:25:39 2001 +0000 *** empty log message *** TODO | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) commit 1324ed858a28e9b29fa6dca151b5d0c8bd55ba42 Author: Bruce Guenter Date: Thu Aug 2 23:25:31 2001 +0000 Bumped up version number. NEWS | 3 +++ README | 4 ++-- VERSION | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) commit d057c6a3b1ff1f7039c0ca53af71a4d96ab25614 Author: Bruce Guenter Date: Thu Aug 2 10:06:58 2001 +0000 Write out a GROUP file here. twoftpd-anon-conf.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 731eff109467d809bf6d2282e4ee11719d1fef86 Author: Bruce Guenter Date: Thu Aug 2 09:53:23 2001 +0000 *** empty log message *** README | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) commit e9b59b25712c967d51d2e2c47abecb3c74b9a584 Author: Bruce Guenter Date: Thu Aug 2 09:51:58 2001 +0000 Report the true group name in long listings. NEWS | 3 +++ backend.c | 2 ++ backend.h | 1 + list.c | 4 ++-- twoftpd-xfer.1 | 4 ++++ 5 files changed, 12 insertions(+), 2 deletions(-) commit 9829c8d0a5ee7b6946ed25382c18d11b51bd7781 Author: Bruce Guenter Date: Thu Aug 2 09:46:05 2001 +0000 Set $GROUP if the CVM reports a group name. twoftpd-auth.1 | 6 +++++- twoftpd-auth.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) commit 26b73055905a0fba105983e48d03586703000d79 Author: Bruce Guenter Date: Thu Aug 2 09:42:32 2001 +0000 Added support for printing out the real file mode instead of a fabrication in long listings. NEWS | 3 +++ list.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) commit 85d75844a0ecfbf05015f14ae33fc67f730d18f6 Author: Bruce Guenter Date: Thu Aug 2 09:28:28 2001 +0000 Renamed the "verb" struct to "command" as it now fulfulls a dual purpose. main.c | 10 +++++----- twoftpd-anon.c | 4 ++-- twoftpd-auth.c | 4 ++-- twoftpd-xfer.c | 4 ++-- twoftpd.h | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) commit 2a2eeda3a392809d01e567c6efb50b34a8c2d114 Author: Bruce Guenter Date: Thu Aug 2 09:25:37 2001 +0000 Added support for SITE commands. Added the SITE CHMOD command to twoftpd-xfer. NEWS | 3 ++ backend.h | 1 + main.c | 57 +++++++++++++++++++++++++++++++++++++------------------ store.c | 15 ++++++++++++++ twoftpd-anon.c | 6 ++++- twoftpd-auth.c | 6 ++++- twoftpd-xfer.c | 7 +++++- twoftpd.h | 3 +- 8 files changed, 75 insertions(+), 23 deletions(-) commit b5f944bd3a71fee4fd7a6b599d5052942d51fdb2 Author: Bruce Guenter Date: Thu Aug 2 05:09:17 2001 +0000 *** empty log message *** NEWS | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) commit c72e5af9fe4b5fc088c0a8c16728fbe62590dd0e Author: Bruce Guenter Date: Thu Aug 2 04:56:49 2001 +0000 Added the "lock HOME" backend option. NEWS | 4 ++++ backend.c | 2 ++ backend.h | 1 + path.c | 6 ++++++ twoftpd-xfer.1 | 9 +++++++++ 5 files changed, 22 insertions(+), 0 deletions(-) commit bb17d530f0975fd2292cb395ff26f6ed97621dde Author: Bruce Guenter Date: Thu Aug 2 04:32:18 2001 +0000 Bumped up version number. NEWS | 13 +++++++++++++ README | 2 +- VERSION | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) commit ffaf6142dce720243832f5d00d18878836a8000a Author: Bruce Guenter Date: Thu Aug 2 04:31:19 2001 +0000 Changed how emulated or "soft" chroot is enabled. backend.c | 7 +++++-- twoftpd-xfer.1 | 17 ++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) commit 59ce5326c1a56978e783f37432a39bf244e7a967 Author: Bruce Guenter Date: Thu Aug 2 04:30:55 2001 +0000 Fixed yet another one-off strip length bug. list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 0acd891aa57fc293d538c7510ba61edecc0fca18 Author: Bruce Guenter Date: Tue Jul 31 13:21:15 2001 +0000 Actually use permission denied instead of internal error when the path fails validation. path.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit c542e574fb2b2d2a8318502f5b268900a4230e20 Author: Bruce Guenter Date: Tue Jul 31 13:19:38 2001 +0000 Marked the internal qualification routines as static. path.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit cd80619695ddcfe47351441c72dfad8af7545048 Author: Bruce Guenter Date: Tue Jul 31 13:17:27 2001 +0000 Rewrote the path qualification and validation code to use a central routine. backend.h | 4 ++-- list.c | 22 +++++++++------------- path.c | 41 ++++++++++++++++++++++++++++------------- stat.c | 12 +++++------- state.c | 15 ++++++--------- store.c | 27 +++++++++++---------------- 6 files changed, 61 insertions(+), 60 deletions(-) commit a1c40e3cd7e1f12f4e11834921e918966481d376 Author: Bruce Guenter Date: Tue Jul 31 13:15:56 2001 +0000 Added a new "permission denied" response. responses.c | 1 + twoftpd.h | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) commit 901e1b7bb0dcc47e353f0a5c938a977138d1e787 Author: Bruce Guenter Date: Tue Jul 31 11:24:21 2001 +0000 Document the new NODOTFILES option. twoftpd-xfer.1 | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) commit 9ae332b19afd281e77ea2794fbf568b05420e0a9 Author: Bruce Guenter Date: Tue Jul 31 11:24:08 2001 +0000 Check for dotfiles when listing directories. list.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 0c5a9c513efba9eb5316c334268aae0edc7e14f5 Author: Bruce Guenter Date: Tue Jul 31 11:23:49 2001 +0000 Added a new routine to check a path for dotfiles in any element. Also fail to qualify any path containing dotfiles if nodotfiles is set. backend.h | 1 + path.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) commit 71f798c39c849a8996852d63229888983beb9c22 Author: Bruce Guenter Date: Tue Jul 31 10:51:24 2001 +0000 Pass the "nodotfiles" options to path_match. list.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) commit 687b3212915b4945c63cd8354c5e6975ec48f785 Author: Bruce Guenter Date: Tue Jul 31 10:50:32 2001 +0000 Track the NODOTFILES environment variable. backend.c | 3 +++ backend.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) commit 115e8583d63e8c6910ffde832f16d95486deafa3 Author: Bruce Guenter Date: Thu Jul 26 05:23:55 2001 +0000 Bumped version. NEWS | 6 ++++++ README | 4 ++-- VERSION | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) commit aea31c61942cda74111e60070844e683ae4b7481 Author: Bruce Guenter Date: Thu Jul 26 05:23:50 2001 +0000 *** empty log message *** TODO | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) commit ed49b7a3d66171e20634ab3a649d494c08fb1f77 Author: Bruce Guenter Date: Thu Jul 26 05:22:29 2001 +0000 Fixed the dummy stat string to make it match the normal stat output. list.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) commit f38ecacfc28327715d7a29a8caa9d1ec6f954357 Author: Bruce Guenter Date: Thu Jul 26 05:06:59 2001 +0000 If the stat fails, output a "dummy" stat line. list.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) commit 2674c4c6fd0efe4fbd33513ebfaaf1d783849925 Author: Bruce Guenter Date: Thu Jul 26 05:00:30 2001 +0000 Bytes counted in this module are "received", not "sent". store.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit bbd9bc91bfc3b7dc92d473eccd20b1054d1423c4 Author: Bruce Guenter Date: Wed Jul 18 06:32:47 2001 +0000 Added code to count and report the number of bytes sent over the network when retrieving and storing files. retr.c | 19 +++++++++++++++---- store.c | 18 ++++++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) commit ff312da2a90241ce2fee66958ea853e018b44eba Author: Bruce Guenter Date: Wed Jul 18 06:31:25 2001 +0000 Added respond_uint, to provide integer parts in responses. respond.c | 6 ++++++ twoftpd.h | 1 + 2 files changed, 7 insertions(+), 0 deletions(-) commit 93b15d0716a4123a0035eb112cd15e389e8a49ef Author: Bruce Guenter Date: Sat Jul 14 01:27:27 2001 +0000 Removed the obsolete configuration of anonymous mode. spec | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) commit 1fcc72edc06852d89687b0183d978106f4cce461 Author: Bruce Guenter Date: Sat Jul 7 03:53:46 2001 +0000 Suppress the unused parameter warnings for argc and argv. backend.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 858867f877cf4f87d2a20c833127fb4d8f1b7e80 Author: Bruce Guenter Date: Fri Jul 6 01:41:50 2001 +0000 Use IOPOLL_* instead of POLL*. socket.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) commit b306aec2681c1341c680924259ea147b4c842b27 Author: Bruce Guenter Date: Fri Jul 6 01:41:34 2001 +0000 *** empty log message *** NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 86369621e64df9c661edc0cc05d6f3b50baf08c7 Author: Bruce Guenter Date: Thu Jul 5 21:57:59 2001 +0000 Bumped up version number. README | 4 ++-- VERSION | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) commit f44ebe6c694c0b6ed315e60a06aa03d6f687af83 Author: Bruce Guenter Date: Thu Jul 5 21:57:54 2001 +0000 Fixed a one-off bug in pattern listings. NEWS | 5 +++++ list.c | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) commit b7eb8fe9b4ebdf7e3bed537db9e6885d0a8588d4 Author: Bruce Guenter Date: Sat Jun 30 03:35:06 2001 +0000 Updated the FutureQuest notices. NEWS | 2 +- README | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit e893351083a01d9d6458754bfc66559f75c472fd Author: Bruce Guenter Date: Sat Jun 30 03:34:57 2001 +0000 Updated the list of required pieces needed from the CVS. README.CVS | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) commit dfc3d8719dada41ca098fa501b971b64fca6be05 Author: Bruce Guenter Date: Sat Jun 30 00:40:40 2001 +0000 Fixed up the tests. rts.exp | 638 ++++++++++++++++++++++++++++++------------------------------ rts.tests | 23 ++- 2 files changed, 333 insertions(+), 328 deletions(-) commit 9b1ddc3155a5af6cf9c4a77d53083d8a66dfdbe5 Author: Bruce Guenter Date: Sat Jun 30 00:40:30 2001 +0000 *** empty log message *** NEWS | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) commit 010423aa0d2001e3c036e03c7ee85990d1958dc7 Author: Bruce Guenter Date: Sat Jun 30 00:40:19 2001 +0000 Since qualify returns a relative path, make sure to prefix it with a "/" when setting cwd in handle_cwd. state.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) commit aec9b19a89fd8e34973a9a89c92369834b40f09e Author: Bruce Guenter Date: Sat Jun 30 00:36:10 2001 +0000 Fixed a one-off big in changing directories. state.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) commit a4d6772bba59ae0080ecb490dab65ef3b900e89c Author: Bruce Guenter Date: Sat Jun 30 00:31:48 2001 +0000 Moved the request and response tests into main.c so that both the front-ends and back-ends will run the test. backend.c | 3 --- main.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) commit 42a3b5a58854551b35b7075a61b6464fa55a73e3 Author: Bruce Guenter Date: Fri Jun 29 23:27:20 2001 +0000 Modified the startup scripts to run envdir after tcpserver. NEWS | 13 ++++++++++--- twoftpd-anon-conf.c | 4 ++-- twoftpd-conf.c | 4 ++-- twoftpd.run | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) commit bf3912bffc051fb13fef5a528ad682994e31379f Author: Bruce Guenter Date: Fri Jun 29 23:27:08 2001 +0000 Bumped up the version to 1.05. README | 5 ++++- VERSION | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) commit 835ee590d2fd6840310681fd37ffe795b43136b6 Author: Bruce Guenter Date: Fri Jun 29 21:15:52 2001 +0000 Make sure that qualify always returns a relative path. path.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) commit 65854e25f11cbc83b949d8c6e51019bf8d8a33e8 Author: Bruce Guenter Date: Fri Jun 29 12:09:02 2001 +0000 First check-in of changes required for emulated chroot operation. backend.c | 13 +++- backend.h | 7 ++ backend=l | 5 +- list.c | 206 +++++++++++++---------------------------------- main=l | 5 +- messagefile.c | 2 +- messagefile.c => path.c | 36 +++++---- retr.c | 2 +- stat.c | 12 ++- state.c | 40 +++++----- store.c | 32 +++++--- twoftpd-anon=x | 3 + twoftpd-xfer.1 | 17 +++- twoftpd-xfer=x | 3 + 14 files changed, 168 insertions(+), 215 deletions(-) copy messagefile.c => path.c (59%) commit 8e1df3563846370643dbe23b1acd1be3ca3fd30c Author: Bruce Guenter Date: Fri Jun 29 12:01:59 2001 +0000 Used canned response. socket.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 70665044296af38b20416d41a8b9b93fdf55d333 Author: Bruce Guenter Date: Fri Jun 29 11:58:15 2001 +0000 *** empty log message *** NEWS | 9 +++++++++ README | 4 ++-- TODO | 4 +--- VERSION | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) commit aff1daa0f1e597d2a22da4e1ed197733ebc321fe Author: Bruce Guenter Date: Fri Jun 29 11:56:55 2001 +0000 Added some common canned responses. strtou.c => responses.c | 13 ++++--------- twoftpd.h | 4 ++++ 2 files changed, 8 insertions(+), 9 deletions(-) copy strtou.c => responses.c (76%) commit 6bea62969cbba64ad08d9c157756a854604cb06d Author: Bruce Guenter Date: Sat Jun 23 02:35:40 2001 +0000 *** empty log message *** NEWS | 3 ++- README | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) commit 867d2f5ffa008d239b98eb77dddae23ced1cda1e Author: Bruce Guenter Date: Sat Jun 23 02:16:32 2001 +0000 Added full support for banners and message files. backend.c | 5 ++++- backend.h | 5 +++++ backend=l | 1 + strtou.c => banner.c | 24 ++++++++++++++++-------- main=l | 1 + log.c => messagefile.c | 44 +++++++++++++++++--------------------------- state.c | 1 + twoftpd-auth.1 | 4 ++++ twoftpd-auth.c | 4 ++++ twoftpd-xfer.1 | 9 +++++++++ twoftpd.h | 3 +++ 11 files changed, 65 insertions(+), 36 deletions(-) copy strtou.c => banner.c (66%) copy log.c => messagefile.c (62%) commit 48fc2afa0aa68f2dc081d9d68488c410376ff3e3 Author: Bruce Guenter Date: Sat Jun 23 02:15:46 2001 +0000 *** empty log message *** NEWS | 5 +++++ TODO | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) commit 2a343fc3c9fe854aba1ae1a65c164dfa6c033320 Author: Bruce Guenter Date: Fri Jun 22 03:44:52 2001 +0000 Explicitly turn logging of responses and requests on. spec | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit efcab6c3c772812efbf067e9bccf7ef64cb1574a Author: Bruce Guenter Date: Fri Jun 22 03:38:25 2001 +0000 I was already logging requests, make it optional now. main.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) commit 081d3811d6af730cf0c374109f1a6efd26ac829d Author: Bruce Guenter Date: Fri Jun 22 01:12:30 2001 +0000 Modified for new spac makedist tools. makedist.in | 42 ------------------------------------------ makedist.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 42 deletions(-) delete mode 100644 makedist.in create mode 100644 makedist.py commit cc0cf7056d6ef3871bb05c30aa3dd6f79a8cbb2d Author: Bruce Guenter Date: Fri Jun 22 01:08:21 2001 +0000 Added support for logging requests and responses. backend.c | 6 +++++- strtou.c => log.c | 37 +++++++++++++++++++++++++++++-------- log.h | 14 ++++++++++++++ main.c | 29 +++++++---------------------- main=l | 1 + respond.c | 15 +++++++++++++-- twoftpd-anon.c | 1 + twoftpd-auth.c | 2 ++ twoftpd-xfer.1 | 6 ++++++ twoftpd-xfer.c | 1 + twoftpd.h | 2 ++ 11 files changed, 81 insertions(+), 33 deletions(-) copy strtou.c => log.c (59%) create mode 100644 log.h commit b64d484ac6a7d2174383846fc3fe3962a6473858 Author: Bruce Guenter Date: Fri Jun 22 01:07:06 2001 +0000 Updated the spec file. spec | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) commit d999099b5a82528c4622f6e12d6c01b2e06320af Author: Bruce Guenter Date: Fri Jun 22 01:04:10 2001 +0000 *** empty log message *** NEWS | 11 +++++++++++ README | 4 ++-- TODO | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) commit 26ae5e6e6f4bd5b56d8ff1d1f377163527b03d2a Author: Bruce Guenter Date: Fri Jun 22 00:34:35 2001 +0000 Added cvm_ prefix to calls to the CVM code. twoftpd-auth.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) commit 10d610a4422541322a4087d31982e9b406d9acf3 Author: Bruce Guenter Date: Fri Jun 22 00:34:05 2001 +0000 Added missing string.h includes. twoftpd-anon-conf.c | 1 + twoftpd-conf.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) commit 6a19f0f2763cb37a3c72d3129b4245afd5c049c0 Author: Bruce Guenter Date: Tue Jun 19 03:42:54 2001 +0000 Added startup code number constant. backend.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 6a6673710a9c44c8ae074bb20d73ed8aff7876f3 Author: Bruce Guenter Date: Tue Jun 19 03:41:10 2001 +0000 Fixed missing string.h include. list.c | 1 + socket.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) commit cdc997da0e902963bd407739911e66c9cf04d3b5 Author: Bruce Guenter Date: Tue Jun 19 03:40:49 2001 +0000 Fixed the server startup response number. backend.c | 5 +++-- twoftpd-anon.c | 2 ++ twoftpd-xfer.c | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) commit 525f4f30f8e5ce1cc99a7b71c7718124acbc3fb9 Author: Bruce Guenter Date: Mon Jun 18 22:22:59 2001 +0000 *** empty log message *** TODO | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) commit 921999d70aedaa5a29a9f92df655b2ec8b835153 Author: Bruce Guenter Date: Sat May 19 10:25:18 2001 +0000 Skip files starting with a period. list.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 20be9236c3ae8278f7e1ef532da68c72f4d3a867 Author: Bruce Guenter Date: Fri May 11 10:08:59 2001 +0000 Added setenv.h compatibility header. twoftpd-auth.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit dfcccb8e94f1f3122b8c5c3482f942d5998bf72a Author: Bruce Guenter Date: Fri May 11 10:08:39 2001 +0000 Fixed two bugs. twoftpd-anon-conf.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) commit d780a8bda73a1d9648641bf7eef75185c04cc07f Author: Bruce Guenter Date: Fri May 11 10:08:19 2001 +0000 Added some missing compatibility object files. twoftpd-anon-conf=x | 1 + twoftpd-auth=x | 2 ++ twoftpd-conf=x | 1 + 3 files changed, 4 insertions(+), 0 deletions(-) commit 6b2fe7fd2ba6e311b1bca78d3e5ad3fe65405e13 Author: Bruce Guenter Date: Sat Apr 7 00:18:29 2001 +0000 *** empty log message *** README | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit a5183ff4191f3c9fc520e7e042267c882a6ed407 Author: Bruce Guenter Date: Sat Apr 7 00:18:05 2001 +0000 Fixed handling of GLOB_NOMATCH result from glob. list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 3e143eb1f4d8cb8f1ae7c13a60b07dfcc86d619b Author: Bruce Guenter Date: Thu Apr 5 22:29:43 2001 +0000 Fixed some bugs in handling of single items listings. list.c | 54 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 32 insertions(+), 22 deletions(-) commit 627174c467a39d30abdb8355f88b022406d9aba8 Author: Bruce Guenter Date: Thu Apr 5 22:29:30 2001 +0000 *** empty log message *** NEWS | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) commit d6e2a9055a7cbe81f0f97cf6532c8fe7787302ca Author: Bruce Guenter Date: Thu Apr 5 22:27:24 2001 +0000 Fixed a bug in IP parsing and printing. socket.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) commit 25fd8745fd287eb2eaf9b97e39b171954bc957fc Author: Bruce Guenter Date: Thu Apr 5 21:37:26 2001 +0000 Bumped up version number. NEWS | 4 ++++ README | 4 ++-- VERSION | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) commit 08b94fd94330c04488347c3613423f66adba657e Author: Bruce Guenter Date: Thu Apr 5 21:36:30 2001 +0000 Fixed the usage notes. twoftpd-anon-conf.c | 2 +- twoftpd-conf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 7bb7026d45dd01dfa6c130e680fb170ad97785a3 Author: Bruce Guenter Date: Thu Apr 5 11:25:24 2001 +0000 *** empty log message *** TODO | 2 -- conf.h | 18 ++++++++++++++++++ twoftpd-conf=x | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 conf.h commit bebe60be025d8e8ba95c832c9f8f5921e59870a9 Author: Bruce Guenter Date: Thu Apr 5 11:25:14 2001 +0000 Bumped up version number. NEWS | 10 ++++++---- README | 6 +++--- TODO | 6 ------ VERSION | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) commit 0c74042ed93c24da95b11d0e054968f7fa577698 Author: Bruce Guenter Date: Thu Apr 5 11:22:11 2001 +0000 Include new conf.h header file. conf.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 1b1d6ebf4abddc1bc6a7240d0bf0614dc1d9f6dd Author: Bruce Guenter Date: Thu Apr 5 11:21:57 2001 +0000 Added new executables. insthier.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) commit 6c7f1a52b5fba619ff8d6fa29d17cda7e4dfce15 Author: Bruce Guenter Date: Thu Apr 5 11:21:45 2001 +0000 Use the new conf.h header file. twoftpd-anon-conf.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) commit c6f2659890314d255aead167ebcfbea6b048fef9 Author: Bruce Guenter Date: Thu Apr 5 11:21:29 2001 +0000 Use the routines from conf.c twoftpd-conf.c | 52 ++++++++++++++++++++++------------------------------ 1 files changed, 22 insertions(+), 30 deletions(-) commit afaeb8b44a9ae7d85ea76e589f3e303eb6df63c8 Author: Bruce Guenter Date: Thu Apr 5 11:18:03 2001 +0000 Added config program for twoftpd-anon. twoftpd-conf.c => twoftpd-anon-conf.c | 89 ++++++++++++++++----------------- twoftpd-conf=x => twoftpd-anon-conf=x | 1 + 2 files changed, 45 insertions(+), 45 deletions(-) copy twoftpd-conf.c => twoftpd-anon-conf.c (58%) copy twoftpd-conf=x => twoftpd-anon-conf=x (77%) commit 234e1ac50c3e1b796e0c05f839f33aa90483b97f Author: Bruce Guenter Date: Thu Apr 5 11:17:33 2001 +0000 Added some generic configuration building routines. conf.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) create mode 100644 conf.c commit 3062f8ae4385b65f45afaf49dad4e381b9a387a1 Author: Bruce Guenter Date: Tue Apr 3 03:40:27 2001 +0000 Added a twoftpd-conf program. twoftpd-conf.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ twoftpd-conf=x | 2 + 2 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 twoftpd-conf.c create mode 100644 twoftpd-conf=x commit 70da2fe9614e8b3396a1bb03d9d964f97c1141b7 Author: Bruce Guenter Date: Tue Apr 3 02:55:16 2001 +0000 Noted umask requirement. twoftpd-xfer.1 | 3 +++ twoftpd.run | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) commit 1cd58c74d83382370a9eab36ec060e51572e29e5 Author: Bruce Guenter Date: Tue Apr 3 02:54:43 2001 +0000 *** empty log message *** TODO | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) commit 6d185399d2fb20f66a9f6310c2b538bfc26df6a7 Author: Bruce Guenter Date: Thu Mar 29 04:39:21 2001 +0000 Minor documentation touch-ups. README | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) commit 91352896bc8489a97cb3826460c2f8e909ecb801 Author: Bruce Guenter Date: Thu Mar 29 04:38:50 2001 +0000 *** empty log message *** NEWS | 1 + TODO | 2 -- 2 files changed, 1 insertions(+), 2 deletions(-) commit 89379553a55e6eb0d5d88aaefc90c03d3b9eec4e Author: Bruce Guenter Date: Thu Mar 29 04:24:06 2001 +0000 *** empty log message *** backend.h | 2 +- twoftpd-anon=x | 1 + twoftpd-xfer=x | 1 + 3 files changed, 3 insertions(+), 1 deletions(-) commit 3ed9d71d75785dbe18cb984f2991ab24927535d2 Author: Bruce Guenter Date: Thu Mar 29 04:24:03 2001 +0000 Call parse_localip on TCPLOCALIP. backend.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit d58e61e608f54f179bd4619430bf7b65ca26e369 Author: Bruce Guenter Date: Thu Mar 29 04:23:43 2001 +0000 Modified to use socket lib functions instead of the low-level function. socket.c | 101 ++++++++++++++++++++++++++++--------------------------------- 1 files changed, 46 insertions(+), 55 deletions(-) commit d71b6ef67cbba8a786030ffca6c4a861181bb8e6 Author: Bruce Guenter Date: Wed Mar 28 05:10:27 2001 +0000 *** empty log message *** TODO | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) commit 207e053a7e60b05fed85294d447e5c0f771aea2d Author: Bruce Guenter Date: Wed Mar 28 05:08:37 2001 +0000 Renamed a function for clarity. list.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 38ae899bfb8cc403f4de98a9667bf72d4c6e7bc3 Author: Bruce Guenter Date: Wed Mar 28 04:40:52 2001 +0000 Bumped up version number. NEWS | 9 ++++++--- README | 4 ++-- VERSION | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) commit 2e55c2c149182d9f0f0a2dd6b36aa8a8e09dde07 Author: Bruce Guenter Date: Wed Mar 28 04:40:45 2001 +0000 Removed unused file. listdir.c | 81 ------------------------------------------------------------- 1 files changed, 0 insertions(+), 81 deletions(-) delete mode 100644 listdir.c commit 0215ee850606bb79263b91ae72dd48e67f35f9df Author: Bruce Guenter Date: Wed Mar 28 04:40:19 2001 +0000 Merged listdir.c into list.c, which is the only code that uses listdir. backend.h | 3 -- backend=l | 1 - list.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 5 deletions(-) commit 264025232c720b35912bdab514d9d6f1150eeaea Author: Bruce Guenter Date: Thu Mar 22 09:59:16 2001 +0000 Added the iopoll.o compatibility library. backend=l | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit a7a57f0cea22ba4c1f212ee8610cc1cf23cbec5c Author: Bruce Guenter Date: Thu Mar 22 09:58:37 2001 +0000 *** empty log message *** TODO | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit d4fa76413337699cacfaf605e0f71af15fd169f8 Author: Bruce Guenter Date: Thu Mar 22 09:56:00 2001 +0000 Use iopoll instead of poll directly. socket.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) commit 01853e7ba7edf3fdb5963d80bbba5c27736d81f8 Author: Bruce Guenter Date: Thu Mar 22 09:46:57 2001 +0000 *** empty log message *** NEWS | 6 +++--- README | 2 +- twoftpd.run | 14 ++++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) commit f3254694d9d94200ffd2127853ec470d25174e4e Author: Bruce Guenter Date: Thu Mar 22 09:45:05 2001 +0000 Removed the anonymous-mode tests. rts.exp | 49 +++---------------------------------------------- 1 files changed, 3 insertions(+), 46 deletions(-) commit 449663e33505740241a3ac6229c1362ca45302a0 Author: Bruce Guenter Date: Thu Mar 22 09:44:51 2001 +0000 Removed the anonymous login tests. rts.tests | 33 +++------------------------------ 1 files changed, 3 insertions(+), 30 deletions(-) commit 902e98ce994b6dc29b208ee288cefe71c4d2facb Author: Bruce Guenter Date: Thu Mar 22 09:44:32 2001 +0000 Simplified the code by eliminating extraneous parameters. twoftpd-auth.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-) commit a48f8932bdf4a5ddef5d215a4ba54a6e5c65b160 Author: Bruce Guenter Date: Tue Mar 20 22:25:27 2001 +0000 *** empty log message *** NEWS | 6 ++++++ TODO | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) commit f305c3fcf2bb9972bc875434bfc30282f2e09728 Author: Bruce Guenter Date: Tue Mar 20 22:23:12 2001 +0000 Added note about resource limits. README | 38 ++++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 10 deletions(-) commit 2e9f165346d06d53a4fa1684bedc28733572400a Author: Bruce Guenter Date: Tue Mar 20 22:22:51 2001 +0000 Removed the "anonymous" mode from the run file. twoftpd.run | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) commit d6d2bf21b3036b7a8644e8aabf5e2e9b89203cc8 Author: Bruce Guenter Date: Tue Mar 20 22:22:29 2001 +0000 Call respond_str instead of obuf routines directly. state.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) commit cb511654c7632dacce53fd4bc6b9460ca4ca7f8f Author: Bruce Guenter Date: Tue Mar 20 22:22:12 2001 +0000 Added routine to provide output translation. respond.c | 19 ++++++++++++++++++- twoftpd.h | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) commit 2297b72d00c0f805af009ec314237be1e3703b3a Author: Bruce Guenter Date: Tue Mar 20 05:44:33 2001 +0000 *** empty log message *** makedist.in | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-) commit 166dc3eb3afed7e4caa34da7e7151cba81767c5e Author: Bruce Guenter Date: Tue Mar 20 05:38:30 2001 +0000 Added required socket library. twoftpd-auth=x | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit da8a49f56966835ac1f750670ed71daf7c50d933 Author: Bruce Guenter Date: Sat Mar 17 03:02:54 2001 +0000 Note the use of $USER. twoftpd-xfer.1 | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) commit 3be7e68075acef204a326b3dd25e8d0621435ed3 Author: Bruce Guenter Date: Sat Mar 17 03:01:51 2001 +0000 *** empty log message *** TODO | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) commit 6cba0358a8c2886f0a63587cd61ec4d0a92622d5 Author: Bruce Guenter Date: Sat Mar 17 03:01:26 2001 +0000 Stripped out the anonymous login component for simplicity -- if you need both, run both seperately. twoftpd-auth.1 | 31 ------------------------------- twoftpd-auth.c | 38 -------------------------------------- 2 files changed, 0 insertions(+), 69 deletions(-) commit 67343376bdba61bf5885aad171cb2ecf397edf68 Author: Bruce Guenter Date: Sat Mar 10 06:06:37 2001 +0000 *** empty log message *** TODO | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) commit 906a02c4611f5e68bf590ff72e6cb0e36830a68b Author: Bruce Guenter Date: Sat Mar 10 04:45:18 2001 +0000 Bumped version number. NEWS | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) commit 59ca00535d44d95fefeb7fef180f0626b321d95a Author: Bruce Guenter Date: Sat Mar 10 02:25:01 2001 +0000 *** empty log message *** TODO | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit d14165d6d88d83f3112e43688d72027a2c8162f6 Author: Bruce Guenter Date: Sat Mar 10 02:24:53 2001 +0000 Fixed some portability problems to FreeBSD (and possibly others). list.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) commit dcd8a48590da7bc6518ce3828bd03e816eaf066c Author: Bruce Guenter Date: Sat Mar 10 02:23:59 2001 +0000 Use new "systime.h" magic include. backend.c | 2 +- stat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 631b4cec0b8ad243f3d0a4816cc2c9d72333bd29 Author: Bruce Guenter Date: Thu Mar 8 21:10:09 2001 +0000 Final release. NEWS | 7 +++++-- README | 2 +- TODO | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) commit 6448247aab8f0e17f938abce85e7c3ab3f703beb Author: Bruce Guenter Date: Wed Mar 7 23:26:35 2001 +0000 Require CVM 0.3, just to ensure the bugs in 0.2 are not present. spec | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 5e65d145ce1856daef273e88082013105df65d06 Author: Bruce Guenter Date: Wed Mar 7 23:24:13 2001 +0000 *** empty log message *** TODO | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) commit bd5550c0649b80c174a3e004d18db93ec2913763 Author: Bruce Guenter Date: Wed Mar 7 22:32:26 2001 +0000 *** empty log message *** rts.tests | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 991602bc840c8a96dc8e4b038a7b8f8b2bbb9e68 Author: Bruce Guenter Date: Wed Mar 7 22:31:43 2001 +0000 Added the REST command. NEWS | 2 ++ TODO | 4 +--- backend.h | 1 + retr.c | 18 ++++++++++++++++++ twoftpd-anon.c | 1 + twoftpd-xfer.c | 1 + 6 files changed, 24 insertions(+), 3 deletions(-) commit 2154d1277252ad47ed3b331240e2bf90b21bee29 Author: Bruce Guenter Date: Wed Mar 7 22:20:59 2001 +0000 Added notes for those checking out the sources from CVS. README.CVS | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 README.CVS commit 9770fef94272f75cfd001dd55f8c1e2a656a2fd7 Author: Bruce Guenter Date: Wed Mar 7 22:20:34 2001 +0000 Dropped version number from 0.99 to 0.91. NEWS | 2 +- README | 4 ++-- VERSION | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) commit bd0907440ec33fabc6042cfdbc66afafd8cddf32 Author: Bruce Guenter Date: Wed Mar 7 22:06:37 2001 +0000 Updated news. NEWS | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) commit 98e04d9bd045254389dfdb8584888a3aeb1a69f1 Author: Bruce Guenter Date: Wed Mar 7 22:02:31 2001 +0000 Added some testing data. EXTRADIST | 3 + rts.exp | 865 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ rts.sh | 1 + rts.tests | 202 ++++++++++++++ 4 files changed, 1071 insertions(+), 0 deletions(-) create mode 100644 rts.exp create mode 100644 rts.sh create mode 100644 rts.tests commit 8ea2ac526a9d38871f2c578d9ce4d6fe1f2a9f7e Author: Bruce Guenter Date: Wed Mar 7 20:45:03 2001 +0000 Timeouts for new sockets need to be set to "timeout*1000", not just "timeout". socket.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 82fb0293ff87920c34b6bd902b888a3a57dc7317 Author: Bruce Guenter Date: Wed Mar 7 05:42:20 2001 +0000 Check if $SERVICE is set, and if not, set it to "ftp". twoftpd-auth.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) commit 08d9f718a3cb8e0d67db2148f6dc909d08f357ed Author: Bruce Guenter Date: Wed Mar 7 04:18:14 2001 +0000 Fixed data type in strtou from unsigned to unsigned long. strtou.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 986ad5c8212919182011e8fa83adb9959a2fadf3 Author: Bruce Guenter Date: Wed Mar 7 04:17:32 2001 +0000 Fixed number handling to use strtou everywhere. backend.c | 9 +++++---- main.c | 11 +++++++++-- main=l | 1 + respond.c => strtou.c | 23 +++++++---------------- twoftpd-auth.c | 7 ++++--- twoftpd.h | 3 +++ 6 files changed, 29 insertions(+), 25 deletions(-) copy respond.c => strtou.c (65%) commit 5f2f719a3d80556aaadfdb95e54d25eb7a64c94c Author: Bruce Guenter Date: Wed Mar 7 04:00:50 2001 +0000 Added checks to make sure a correct number of command-line parameters are used. twoftpd-auth.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) commit dcc8bf2eddcba132d0ea68ca83ee8604b977d0a3 Author: Bruce Guenter Date: Wed Mar 7 00:18:58 2001 +0000 Expanded on usage documentation. README | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) commit 76d0c25512f2f38873856aa46fd2cb4b87d50bfe Author: Bruce Guenter Date: Wed Mar 7 00:18:37 2001 +0000 Bumped up version number. NEWS | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) commit 18c5406c9ce0710ef04d87ced8591fb9fd11b35e Author: Bruce Guenter Date: Tue Mar 6 23:53:21 2001 +0000 Documentation touchups. NEWS | 3 +++ README | 2 +- TODO | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) commit 8e511cbf9e1fac3bffb8246311a832b56a34a9b7 Author: Bruce Guenter Date: Tue Mar 6 23:53:07 2001 +0000 Removed unneeded include file. store.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) commit ee2d750c452de9cf01a3d3dd434b680eb026fe6b Author: Bruce Guenter Date: Tue Mar 6 23:51:44 2001 +0000 Parse TCPREMOTEIP and validate PORT commands against it. backend.c | 2 ++ backend.h | 1 + socket.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 0 deletions(-) commit 23916d08a6f6ddf14f66e127c3ff5701e4d44003 Author: Bruce Guenter Date: Mon Mar 5 21:33:07 2001 +0000 Bumped up version number. NEWS | 4 ++++ README | 2 +- VERSION | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) commit 34e6ff3f99589c5de61909905d2470d7a86d14ab Author: Bruce Guenter Date: Mon Mar 5 21:32:40 2001 +0000 Fixed a bug in EOF handling when storing files. store.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit f95fe4b5138739214ac74df679f72e18a824ea07 Author: Bruce Guenter Date: Mon Mar 5 05:27:57 2001 +0000 Updated usage documentation. README | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) commit 58df13779563362903ca010a26e60b107e2b8f8c Author: Bruce Guenter Date: Mon Mar 5 05:22:16 2001 +0000 Bumped up version, updated documentation. NEWS | 10 ++++++++++ README | 8 ++------ TODO | 18 +----------------- VERSION | 2 +- 4 files changed, 14 insertions(+), 24 deletions(-) commit a1b010d5256973fe3aff5092cd41742408bf3ba6 Author: Bruce Guenter Date: Mon Mar 5 05:21:30 2001 +0000 Modified to use glob for listing patterns. list.c | 72 ++++++++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 48 insertions(+), 24 deletions(-) commit 908ff7362166314405117cbad436ee386fd1057a Author: Bruce Guenter Date: Mon Mar 5 05:20:00 2001 +0000 Modified the interface to listdir to return the count of entries. backend.h | 2 +- listdir.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) commit 664bec613354d689fdf66107df524a7ace1d6281 Author: Bruce Guenter Date: Mon Mar 5 05:18:02 2001 +0000 Added socket.lib to dependancies. twoftpd-anon=x | 1 + twoftpd-xfer=x | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) commit 464a654731b57df7e8125519a2f49cf743411823 Author: Bruce Guenter Date: Mon Mar 5 04:46:06 2001 +0000 Set timeouts on stdin/stdout (in addition to the alarm handling). main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) commit f86ccd54e4e12f295e0e5adaf075b49574535030 Author: Bruce Guenter Date: Mon Mar 5 04:44:24 2001 +0000 Fixed one-off bug in output of PWD information. state.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit b1843d6d5ca72223af71514ca267059b067fd303 Author: Bruce Guenter Date: Sun Mar 4 02:21:52 2001 +0000 Restore the socket routines using iobuf since it now has timeout handling. backend.h | 9 ++------- retr.c | 18 ++++++++++-------- socket.c | 12 +++++++----- store.c | 17 ++++++++++------- 4 files changed, 29 insertions(+), 27 deletions(-) commit ef4194155549e9a6c46ddd928faef28cbb1dd995 Author: Bruce Guenter Date: Sun Mar 4 02:20:54 2001 +0000 iobuf library now has timeout handling, so remove it from here. timeout_read.c | 35 ----------------------------------- timeout_write.c | 39 --------------------------------------- 2 files changed, 0 insertions(+), 74 deletions(-) delete mode 100644 timeout_read.c delete mode 100644 timeout_write.c commit ca77f9b3c6ca60a8a79d783d6824b9148ecfb7fd Author: Bruce Guenter Date: Sat Mar 3 20:35:59 2001 +0000 Fixed a typo -- need to poll for POLLOUT, not POLLIN. timeout_write.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit d5eb74441ec0828c603b39fbd8d9727d04eed5d0 Author: Bruce Guenter Date: Sat Mar 3 01:30:45 2001 +0000 Added this routine to write to the network with a timeout. timeout_read.c => timeout_write.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) copy timeout_read.c => timeout_write.c (73%) commit 9ba3b32fed9a318c6467ac440d791373a0fd3354 Author: Bruce Guenter Date: Sat Mar 3 01:30:30 2001 +0000 Modified to use timeout_write. retr.c | 40 +++++++++++++++++++++++++--------------- 1 files changed, 25 insertions(+), 15 deletions(-) commit c61298866689d034349c7995525f5e8ace714885 Author: Bruce Guenter Date: Sat Mar 3 01:29:52 2001 +0000 Added timeout_* function prototypes. Removed make_{in,out}_connection. backend.h | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) commit e2f38af9e43e6313aaf0b1b6e5e43bb37bfb2288 Author: Bruce Guenter Date: Sat Mar 3 01:29:22 2001 +0000 Added support for timeouts on reading data from the network. store.c | 29 ++++++++++++++--------------- respond.c => timeout_read.c | 32 +++++++++++++++----------------- 2 files changed, 29 insertions(+), 32 deletions(-) copy respond.c => timeout_read.c (65%) commit 7431d19f52ad128869a55e54b2f3bb51800b755c Author: Bruce Guenter Date: Fri Mar 2 23:25:56 2001 +0000 Modified the data type of "timeout" from "struct timeval" to just "unsigned". main.c | 10 ++++------ socket.c | 27 ++++++++++----------------- twoftpd.h | 2 +- 3 files changed, 15 insertions(+), 24 deletions(-) commit 727d82e457b7c400d4674e7d663310e61d4ada89 Author: Bruce Guenter Date: Fri Mar 2 23:13:28 2001 +0000 Dropped use of sendfile. Merged the binary and ASCII file copy cases. retr.c | 46 ++++++++++------------------------------------ 1 files changed, 10 insertions(+), 36 deletions(-) commit 202c20d6c89f80cc921f1b43ec8b9ef61fa2ccac Author: Bruce Guenter Date: Fri Mar 2 23:09:58 2001 +0000 Merged the binary and ASCII file copy cases. store.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) commit c9bb37ae3f6977e6e390b27337987ebf65cb882c Author: Bruce Guenter Date: Fri Mar 2 23:08:05 2001 +0000 Use unix/nonblock routines instead of calling fcntl directly. socket.c | 8 +++----- twoftpd-anon=x | 1 + twoftpd-xfer=x | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) commit 5a1e4b9d5fab149add3ba9e1d0867edbd9da6c35 Author: Bruce Guenter Date: Fri Mar 2 23:00:22 2001 +0000 *** empty log message *** README | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit f185da3041931a3527993a7735066f9dd242d60e Author: Bruce Guenter Date: Fri Mar 2 03:22:32 2001 +0000 *** empty log message *** NEWS | 1 + TODO | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) commit 8c32d0399aeaf2fb092804e2a45845280047f0cb Author: Bruce Guenter Date: Fri Mar 2 03:22:27 2001 +0000 Fixed usage of obuf_putuw. list.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 422763f3360d46037d9fb2194e7d56bed12ff639 Author: Bruce Guenter Date: Fri Mar 2 02:54:59 2001 +0000 Modified some obuf_puts calls to be more efficient. list.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) commit 8279c23e8aa8a2d93bf0f87135b6b07527849d77 Author: Bruce Guenter Date: Fri Mar 2 02:54:34 2001 +0000 Turn off non-blocking mode after connecting to a remote. socket.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) commit 8ae620c336076a170e8841600de1e0df102fa60f Author: Bruce Guenter Date: Wed Feb 28 21:40:35 2001 +0000 Merged some duplicated code in preparation for glob changes. list.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) commit d6e7e49f1fc9bb3787f54321f6e77d187aae99e1 Author: Bruce Guenter Date: Wed Feb 28 21:39:24 2001 +0000 listdir is always called with "." as it's parameter, so drop the parameter. backend.h | 2 +- listdir.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) commit c87eaa45099cfbe63049b2af4c5b793aaf170e64 Author: Bruce Guenter Date: Wed Feb 28 21:38:42 2001 +0000 Require cvm >= 0.2 due to file name changes in CVM. spec | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 573b24dedbe76e99777ea8289a3c2307be8c6a66 Author: Bruce Guenter Date: Tue Feb 27 23:20:56 2001 +0000 Account for changes to cvm naming. twoftpd.run | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 5238621dceb037357f3034a75ffcc7ac90521d98 Author: Bruce Guenter Date: Tue Feb 27 23:20:34 2001 +0000 *** empty log message *** README | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit ef3d2665f572e2e862e11070e48fb62b77732fe1 Author: Bruce Guenter Date: Tue Feb 27 21:47:39 2001 +0000 Bumped up version number. NEWS | 3 +++ README | 2 +- VERSION | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) commit 26e97195ab3a6ff3cab90b749e1ef6d8481b3f2c Author: Bruce Guenter Date: Tue Feb 27 21:47:12 2001 +0000 Added GPL notice to all the sources. backend.c | 17 +++++++++++++++++ list.c | 17 +++++++++++++++++ listdir.c | 17 +++++++++++++++++ main.c | 17 +++++++++++++++++ respond.c | 17 +++++++++++++++++ retr.c | 17 +++++++++++++++++ socket.c | 17 +++++++++++++++++ stat.c | 17 +++++++++++++++++ state.c | 17 +++++++++++++++++ store.c | 17 +++++++++++++++++ twoftpd-anon.c | 17 +++++++++++++++++ twoftpd-auth.c | 17 +++++++++++++++++ twoftpd-xfer.c | 17 +++++++++++++++++ 13 files changed, 221 insertions(+), 0 deletions(-) commit 52f7747d53193781dc9a4e5bb96f3b40023d46d3 Author: Bruce Guenter Date: Tue Feb 27 11:12:37 2001 +0000 *** empty log message *** NEWS | 2 ++ README | 15 +++------------ TODO | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) commit 444a4a9d1332bf84769199ee997d97bdfdef24df Author: Bruce Guenter Date: Tue Feb 27 11:05:08 2001 +0000 Handle translating NUL in the parameter to LF. main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 2bcb3d997924e470b7cbbe75067debf19e286414 Author: Bruce Guenter Date: Tue Feb 27 11:04:46 2001 +0000 Fixed name typo in respond_start. respond.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit 68e2dba95d971aa39691663becf50e6910d961f9 Author: Bruce Guenter Date: Tue Feb 27 11:04:28 2001 +0000 Handle translating LF in paths to NUL. state.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) commit 34f93a5342a8efefbe966eeafbe8c17b8136a5ba Author: Bruce Guenter Date: Tue Feb 27 11:03:34 2001 +0000 Added entry points for starting and stopping a response message. respond.c | 16 +++++++++++++--- twoftpd.h | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) commit fef3c7a57831876933d3334a77c793701f6f949c Author: Bruce Guenter Date: Tue Feb 27 10:52:27 2001 +0000 *** empty log message *** NEWS | 3 +-- TODO | 6 ------ 2 files changed, 1 insertions(+), 8 deletions(-) commit 9116d70ab6f15922f4d92dfdf5c83d9da07f6de7 Author: Bruce Guenter Date: Tue Feb 27 10:52:02 2001 +0000 Optimized the loop somewhat in retr_asc, added missing flush. retr.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) commit 1b6d915176b74d2eb0c386c66931e0f92a3e6a76 Author: Bruce Guenter Date: Tue Feb 27 10:51:32 2001 +0000 Added support for ASCII mode transfers. store.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) commit 4daa2b943423e2c3a985b711d3f2c77faf2ee54c Author: Bruce Guenter Date: Tue Feb 27 10:41:30 2001 +0000 Fixed a manual use of write to use outbuf. main.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) commit a3508f6b1384a0c1891e598973f57eb802648402 Author: Bruce Guenter Date: Tue Feb 27 09:23:47 2001 +0000 Added declarations for rnfr/rnto functions. backend.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit b5605ac96d30da4e9038b6d5fc08fad84383cd7e Author: Bruce Guenter Date: Tue Feb 27 09:23:33 2001 +0000 Trimed out some duplicated code. store.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) commit c89e5195351b4ddf49e79eb2372d8c9bd9f0c5db Author: Bruce Guenter Date: Tue Feb 27 09:11:57 2001 +0000 Use iobuf library for input. main.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) commit a0ee7da9db9d98cdea52c214af6935f0054d7128 Author: Bruce Guenter Date: Tue Feb 27 08:58:17 2001 +0000 *** empty log message *** NEWS | 5 +++++ TODO | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) commit 3cabd0f12b9c2ab2045bb3023f2d2f3f854ff96d Author: Bruce Guenter Date: Tue Feb 27 08:58:11 2001 +0000 Modified to use iobuf library backend.h | 4 +- list.c | 146 +++++++++++++++++++------------------------------------ respond.c | 9 ++-- socket.c | 18 +++++++- twoftpd-anon=x | 1 + twoftpd-auth=x | 1 + twoftpd-xfer=x | 1 + 7 files changed, 79 insertions(+), 101 deletions(-) commit 2f884aab21bcf3814bd471a1eed424beb7021f95 Author: Bruce Guenter Date: Tue Feb 27 08:57:18 2001 +0000 Modified to use iobuf library. Added support for binary_flag. retr.c | 78 +++++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 46 insertions(+), 32 deletions(-) commit a9f0d62f47758820f9cf38857b3b6910d67a3489 Author: Bruce Guenter Date: Tue Feb 27 08:56:03 2001 +0000 Fixed some typos from previous check-in. store.c | 24 +++++++++++------------- 1 files changed, 11 insertions(+), 13 deletions(-) commit c7111fc33e6fd65d53bc8db25620c9e5ef769234 Author: Bruce Guenter Date: Tue Feb 27 08:52:43 2001 +0000 Added support for RNFR/RNTO verbs. store.c | 26 ++++++++++++++++++++++++++ twoftpd-xfer.c | 2 ++ 2 files changed, 28 insertions(+), 0 deletions(-) commit adf4bc4baa1f4b6d1bb9df7e1fef0961bd8a6dbb Author: Bruce Guenter Date: Tue Feb 27 08:52:17 2001 +0000 Rewrote to use iobuf library for I/O. store.c | 62 +++++++++++++++++++++----------------------------------------- 1 files changed, 21 insertions(+), 41 deletions(-) commit f4d303960e40e0d2740663cc75cd840f8610fbfb Author: Bruce Guenter Date: Sat Feb 24 01:49:22 2001 +0000 Updated documentation. NEWS | 6 ++++++ README | 2 -- VERSION | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) commit ffd83768e584d15dff223901bfe49f9ccde14f82 Author: Bruce Guenter Date: Sat Feb 24 01:44:11 2001 +0000 Add the proper include files for Linux sendfile. retr.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) commit 572c8533211e99754201ccfd9b3a64cd59dae0bc Author: Bruce Guenter Date: Sat Feb 24 01:43:57 2001 +0000 Removed nlst.c backend.h | 2 -- backend=l | 1 - 2 files changed, 0 insertions(+), 3 deletions(-) commit 45837f9c01aea6c132e777cc0fef9896cfff194a Author: Bruce Guenter Date: Sat Feb 24 01:43:37 2001 +0000 Merged list and nlst into one module, and added support for listing single files. list.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++------------- nlst.c | 22 ------------ 2 files changed, 96 insertions(+), 46 deletions(-) delete mode 100644 nlst.c commit fd3e9d716c6dcedf9f9cdb12b5034ce95004398a Author: Bruce Guenter Date: Fri Feb 23 22:47:29 2001 +0000 Modified to use the new automatic Linux sendfile test. retr.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) commit 9785d96fc654f75b3de53aa1099318f31a4cb84a Author: Bruce Guenter Date: Fri Feb 23 22:23:16 2001 +0000 *** empty log message *** README | 2 +- spec | 5 +++++ twoftpd.run | 7 +------ 3 files changed, 7 insertions(+), 7 deletions(-) commit dbf972cbd499422df9a3c917ac2e8bb1990c175b Author: Bruce Guenter Date: Fri Feb 23 09:43:49 2001 +0000 Fixed typo in calling authenticate. twoftpd-auth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 9c20abdeb221afd2dee3f917f7e65ef0a8d21665 Author: Bruce Guenter Date: Fri Feb 23 06:41:50 2001 +0000 *** empty log message *** README | 6 +++--- spec | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) commit 8179cc00da854e01de6d789854e384458d971824 Author: Bruce Guenter Date: Fri Feb 23 06:40:02 2001 +0000 Set up anonymous mode properly. twoftpd.run | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) commit b45bec8d13d10f7ae8a88ef264c060639dd498c5 Author: Bruce Guenter Date: Fri Feb 23 06:39:41 2001 +0000 Modified to take the CVM interface into account. twoftpd-auth.1 | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) commit 61afc958cc51e6d35723f127684b81ce2c53757a Author: Bruce Guenter Date: Fri Feb 23 06:05:54 2001 +0000 *** empty log message *** NEWS | 7 +++++++ TODO | 56 ++------------------------------------------------------ 2 files changed, 9 insertions(+), 54 deletions(-) commit 05f53f5e144628b592bb66db6acf4ecd7daa14bf Author: Bruce Guenter Date: Fri Feb 23 06:05:47 2001 +0000 Removed the extraneous frontend library source. frontend.c | 100 ------------------------------------------------------------ frontend.h | 20 ------------ frontend=l | 1 - 3 files changed, 0 insertions(+), 121 deletions(-) delete mode 100644 frontend.c delete mode 100644 frontend.h delete mode 100644 frontend=l commit 5786bbdb7f9ebe37f3ebd837e98f8e35a19fec6c Author: Bruce Guenter Date: Fri Feb 23 05:10:57 2001 +0000 Rewrote the auth front end to use CVM authentication. twoftpd-auth.c | 132 +++++++++++++++++++++++++++++++++++++++++--------------- twoftpd-auth=x | 4 +- 2 files changed, 98 insertions(+), 38 deletions(-) commit 9d141792086c0828af1273f8e2af659a0beb22cb Author: Bruce Guenter Date: Fri Feb 23 05:10:32 2001 +0000 Added a stub for the "USER" verb as well. twoftpd-anon.c | 6 ++++-- twoftpd-xfer.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) commit a67ee66e48fac05d65d808b2f179eb6f7c00601b Author: Bruce Guenter Date: Fri Feb 23 04:15:39 2001 +0000 Use new installer framework. insthier.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) commit 47903f90175550dd780d1a1d8d4e3db777ed6669 Author: Bruce Guenter Date: Fri Feb 23 04:15:28 2001 +0000 Bumped up version. VERSION | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 87ed8287b5b59baec129bbe63328ccc397983b87 Author: Bruce Guenter Date: Fri Feb 23 04:15:19 2001 +0000 Modified the authentication front-end to take its anonymous configuration from environment variables instead of from password table lookup. frontend.c | 18 ++++++++++-------- frontend.h | 1 - twoftpd-auth.1 | 20 +++++++++++++------- twoftpd-auth.c | 5 ----- 4 files changed, 23 insertions(+), 21 deletions(-) commit 9844438e4d555ee1a0fc7b6290eefbcff6b21562 Author: Bruce Guenter Date: Wed Feb 21 21:52:25 2001 +0000 Added this extra distribution file list. EXTRADIST | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) create mode 100644 EXTRADIST commit d3f125222e328699d3e1a98bdcb4623e8d390dae Author: Bruce Guenter Date: Wed Feb 21 04:42:51 2001 +0000 *** empty log message *** listdir.c | 5 ++--- makedist.in | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) commit 3d99ac172dff8fb6341d46a1344c52a62c9f7d16 Author: Bruce Guenter Date: Wed Feb 21 04:42:14 2001 +0000 Adapted for systems without shadow passwords. twoftpd-auth.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) commit 6de8186a67a0a826868040e12d87240e87d32e21 Author: Bruce Guenter Date: Wed Feb 21 04:02:46 2001 +0000 Dropped version number down from 0.5 to 0.4. NEWS | 2 +- README | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) commit 2c633b2ce155461ef50c218b7cc9a84e017c6af1 Author: Bruce Guenter Date: Wed Feb 21 03:54:38 2001 +0000 *** empty log message *** NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 22daf9b47cf48bb91ea5c4ca793c08ab3a5f623f Author: Bruce Guenter Date: Wed Feb 21 03:54:30 2001 +0000 Make with optimization flags. spec | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 2f927964ce26e99b1b69e1bcaa0e8da2c706fb58 Author: Bruce Guenter Date: Wed Feb 21 03:47:24 2001 +0000 Need to create directories before installing. spec | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) commit cec026af02cb7f202a218506d42f2b5264fe3a33 Author: Bruce Guenter Date: Wed Feb 21 03:46:14 2001 +0000 Added files necessary for SPAC. VERSION | 1 + backend=l | 9 +++++++++ frontend=l | 1 + insthier.c | 12 ++++++++++++ main=l | 2 ++ twoftpd-anon=x | 2 ++ twoftpd-auth=x | 4 ++++ twoftpd-xfer=x | 2 ++ 8 files changed, 33 insertions(+), 0 deletions(-) create mode 100644 VERSION create mode 100644 backend=l create mode 100644 frontend=l create mode 100644 insthier.c create mode 100644 main=l create mode 100644 twoftpd-anon=x create mode 100644 twoftpd-auth=x create mode 100644 twoftpd-xfer=x commit 37d1fccbc75a73ce17b25128d5ac68597441fa50 Author: Bruce Guenter Date: Wed Feb 21 03:46:00 2001 +0000 Makefile is no longer necessary. Makefile | 65 -------------------------------------------------------------- 1 files changed, 0 insertions(+), 65 deletions(-) delete mode 100644 Makefile commit f7ed0e90d65250d8bc323e512cdaa914e9fabe9f Author: Bruce Guenter Date: Wed Feb 21 03:45:41 2001 +0000 Renamed source files to match the executables. anon.c => twoftpd-anon.c | 0 auth.c => twoftpd-auth.c | 0 xfer.c => twoftpd-xfer.c | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename anon.c => twoftpd-anon.c (100%) rename auth.c => twoftpd-auth.c (100%) rename xfer.c => twoftpd-xfer.c (100%) commit 12216a096e8aad60113a84eb5afafbaebaf49212 Author: Bruce Guenter Date: Wed Feb 21 03:44:52 2001 +0000 Modified for use with SPAC. makedist.in | 4 ---- spec | 9 +++++++-- 2 files changed, 7 insertions(+), 6 deletions(-) commit 72d1dfccc24ebf37cd9ef779755c77ebe03aedcd Author: Bruce Guenter Date: Wed Feb 21 03:44:39 2001 +0000 *** empty log message *** NEWS | 4 ++++ README | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) commit 0db66d03db27b624648d85a8cdbc139d5321c0cd Author: Bruce Guenter Date: Sat Feb 10 05:09:10 2001 +0000 *** empty log message *** NEWS | 2 +- TODO | 2 -- 2 files changed, 1 insertions(+), 3 deletions(-) commit b387e2608e26edefe08989220faed1156d012a7e Author: Bruce Guenter Date: Sat Feb 10 05:07:27 2001 +0000 Fixed a typo. list.c | 2 +- socket.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 3b1d08f06ca5476dfa57de4881fe461022227104 Author: Bruce Guenter Date: Sat Feb 10 05:06:00 2001 +0000 Handle timeout in start_connection. socket.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) commit e93b5430d9b44cb770988523f1cc5eb6655f3a4b Author: Bruce Guenter Date: Sat Feb 10 04:53:53 2001 +0000 Log the request even if it isn't known. main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) commit a26c92d0fe624dfabec00b7e30037b5d5753bfdb Author: Bruce Guenter Date: Sat Feb 10 04:43:08 2001 +0000 Corrected some inappropriate uses of fixed-size buffers. TODO | 2 -- list.c | 5 ++--- main.c | 2 +- socket.c | 21 ++++++++------------- stat.c | 8 +++++--- 5 files changed, 16 insertions(+), 22 deletions(-) commit a6a21708155dfb92be997c2aef8a4737057845ce Author: Bruce Guenter Date: Sat Feb 10 04:30:22 2001 +0000 Added the "home" global, currently unused. backend.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit a4cf10c56f07ed032ea60ef3218d121c98beec88 Author: Bruce Guenter Date: Sat Feb 10 04:29:48 2001 +0000 Fixed a bug in formatting the owner string. list.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) commit 664f2b7f7db5191cf72b464c2ca6dd0feb5f35a6 Author: Bruce Guenter Date: Sat Feb 10 04:28:19 2001 +0000 Tweaked the algorithm used by utoa. frontend.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) commit 2f4311e308ee916e697ffa230f976d988468057e Author: Bruce Guenter Date: Sat Feb 10 04:27:46 2001 +0000 Removed the unused "do_chroot" global. backend.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) commit 73700804f9d7a8c8e57caff8dc928740cfa87e88 Author: Bruce Guenter Date: Sat Feb 10 03:58:19 2001 +0000 Export the login user name through $USER. auth.c | 1 + frontend.c | 3 ++- frontend.h | 1 + 3 files changed, 4 insertions(+), 1 deletions(-) commit ffed52a9b63dec27037cf3dca5cf3e0c66d70ff0 Author: Bruce Guenter Date: Sat Feb 10 03:45:33 2001 +0000 *** empty log message *** Makefile | 33 ++++++++++++++++----------------- TODO | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 18 deletions(-) commit 35e3e8b3ca1fbaa8d97fad0fd242ffd12bdb0373 Author: Bruce Guenter Date: Sat Feb 10 03:45:20 2001 +0000 Header reorganizations. anon.c | 3 +-- auth.c | 1 + frontend.c | 1 + listdir.c | 1 + main.c | 1 - nlst.c | 1 + retr.c | 1 + socket.c | 1 + stat.c | 1 + state.c | 1 + store.c | 1 + xfer.c | 3 +-- 12 files changed, 11 insertions(+), 5 deletions(-) commit 3a1e745b09a76728cd52a8c7f492e80baa80f4b8 Author: Bruce Guenter Date: Sat Feb 10 03:41:23 2001 +0000 Export the uid, gid, and user values as globals. backend.c | 12 +++++++++--- backend.h | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) commit b0b93b8d066b64edd6a6b89e784a657f44c367c6 Author: Bruce Guenter Date: Sat Feb 10 03:40:29 2001 +0000 Modified to use stdio, to avoid the fixed-size buffer. respond.c | 21 +++------------------ 1 files changed, 3 insertions(+), 18 deletions(-) commit 150c45421c404f4be70473fa4d0b294256872699 Author: Bruce Guenter Date: Sat Feb 10 03:38:57 2001 +0000 Simplified the output list format. list.c | 98 ++++++++++++++++++--------------------------------------------- 1 files changed, 28 insertions(+), 70 deletions(-) commit d085ab8b97c9ee907f5d1e4696db839217e8d22b Author: Bruce Guenter Date: Sat Feb 10 03:20:06 2001 +0000 Reorganized the header file into three parts. backend.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ frontend.h | 20 ++++++++++++++++++++ twoftpd.h | 54 ------------------------------------------------------ 3 files changed, 70 insertions(+), 54 deletions(-) create mode 100644 backend.h create mode 100644 frontend.h commit 6118724a765828ab1a0278a76a4f603f4f2bf2c7 Author: Bruce Guenter Date: Fri Feb 9 22:36:29 2001 +0000 Documentation touch ups. README | 8 ++++++-- TODO | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) commit c137413f9c27d72bd4c43b1ebb4f10a873a5905a Author: Bruce Guenter Date: Fri Feb 9 22:20:05 2001 +0000 Broke the authentication portion of the front end into a seperate module. Makefile | 15 ++++---- NEWS | 4 ++ anon.c | 2 + auth.c | 96 +++++++++----------------------------------------- auth.c => frontend.c | 45 +++++++++-------------- twoftpd.h | 16 +++++++- xfer.c | 2 + 7 files changed, 64 insertions(+), 116 deletions(-) copy auth.c => frontend.c (62%) commit 2721bf7633e995303e05bf07976294741babd22b Author: Bruce Guenter Date: Fri Feb 9 11:23:42 2001 +0000 *** empty log message *** TODO | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 89dc3fdee908e4d84383894e6372ccaef5c26de2 Author: Bruce Guenter Date: Fri Feb 9 10:41:29 2001 +0000 Some more file reorganizations. Makefile | 18 ++++++++------ format.c => list.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++- nlst.c | 21 +++++++++++++++++ retr.c | 63 ---------------------------------------------------- twoftpd.h | 9 ++++--- 5 files changed, 92 insertions(+), 77 deletions(-) rename format.c => list.c (72%) create mode 100644 nlst.c commit 06bf1d7c46f2babd58f17bd30ed1f2b94777e26d Author: Bruce Guenter Date: Fri Feb 9 06:15:59 2001 +0000 Fixed documentation bug. NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 30f2dd31506a684ee41e83696dbe9a3fb0cd73f9 Author: Bruce Guenter Date: Fri Feb 9 05:39:01 2001 +0000 *** empty log message *** spec | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 0f95a74c916512fa11d21adb09df4809af16a58a Author: Bruce Guenter Date: Fri Feb 9 05:33:50 2001 +0000 *** empty log message *** NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 670a9498459ce81995917b90b65ae69c817a5d49 Author: Bruce Guenter Date: Fri Feb 9 05:32:58 2001 +0000 Fixed a couple of socket-related bugs. backend.c | 4 +++- socket.c | 4 ++-- twoftpd.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) commit 41dbf65bd78f9475d2809e130df148d4cd97497a Author: Bruce Guenter Date: Fri Feb 9 05:21:43 2001 +0000 Added anonymous FTP capability to the front end. auth.c | 51 +++++++++++++++++++-------------------------------- spec | 7 +++++-- 2 files changed, 24 insertions(+), 34 deletions(-) commit 76301d042c32efa637749071ac312187f750ed44 Author: Bruce Guenter Date: Fri Feb 9 05:08:30 2001 +0000 Added anonymous FTP capability. NEWS | 2 + README | 13 +++++---- TODO | 3 -- auth.c | 76 +++++++++++++++++++++++++++++++++++++++++-------------- twoftpd-auth.1 | 30 +++++++++++++++++++--- twoftpd.run | 4 ++- 6 files changed, 94 insertions(+), 34 deletions(-) commit f75034cbdb7d535fe909eb364fe824d862392aba Author: Bruce Guenter Date: Fri Feb 9 04:31:11 2001 +0000 Flipped from a NOCHROOT flag to a CHROOT flag, so that the auth front end can unconditionally set it for anonymous users. backend.c | 2 +- spec | 1 + twoftpd-xfer.1 | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) commit e5894529d8171f7dc670a9a6f52a8001cef94b62 Author: Bruce Guenter Date: Fri Feb 9 04:25:36 2001 +0000 Split xfer.c into multiple modules, added anon.c for anonymous back-end. Makefile | 20 +++- TODO | 4 + anon.c | 24 ++++ backend.c | 45 ++++++ retr.c | 120 +++++++++++++++++ socket.c | 143 ++++++++++++++++++++ stat.c | 24 ++++ state.c | 59 ++++++++ store.c | 85 ++++++++++++ twoftpd.h | 42 ++++++- xfer.c | 443 ------------------------------------------------------------- 11 files changed, 562 insertions(+), 447 deletions(-) create mode 100644 anon.c create mode 100644 backend.c create mode 100644 retr.c create mode 100644 socket.c create mode 100644 stat.c create mode 100644 state.c create mode 100644 store.c commit ae16efec6ab19c9badf77fcd7a4e9b5a74f4aa64 Author: Bruce Guenter Date: Fri Feb 9 03:15:09 2001 +0000 Added in the twoftpd-xfer command-line argument. twoftpd.run | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) commit 21e800c63890f81d4d50e687c5c4b6db0ab811e1 Author: Bruce Guenter Date: Fri Feb 9 03:12:53 2001 +0000 *** empty log message *** TODO | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) commit 2fc5b8c9d773668be142d5004b3508408f4258ef Author: Bruce Guenter Date: Fri Feb 9 03:12:48 2001 +0000 Bumped version from 0.2 to 0.3 for internal release. Makefile | 5 ++--- NEWS | 2 +- README | 13 +++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) commit 259f0dcdf62ca1aaa94744f70f53f0359a47f7b8 Author: Bruce Guenter Date: Fri Feb 9 03:11:04 2001 +0000 twoftpd-auth now execs its command-line, like it did before, instead of using a hard-coded path. auth.c | 9 ++++++++- twoftpd-auth.1 | 1 + twoftpd.h | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) commit 80e3590776888ddab6088173afe047654b86e652 Author: Bruce Guenter Date: Fri Feb 9 01:38:31 2001 +0000 *** empty log message *** Makefile | 2 +- spec | 5 +++++ 2 files changed, 6 insertions(+), 1 deletions(-) commit 02f2e162faf51c1bc1606101088e8bec611c6b1b Author: Bruce Guenter Date: Fri Feb 9 01:35:46 2001 +0000 Added supervise run scripts. Added man pages. README | 15 +++++++++++++-- TODO | 4 ++-- spec | 18 +++++++++++++++++- twoftpd-auth.1 | 25 +++++++++++++++++++++++++ twoftpd-log.run | 2 ++ twoftpd-xfer.1 | 35 +++++++++++++++++++++++++++++++++++ twoftpd.run | 3 +++ 7 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 twoftpd-auth.1 create mode 100644 twoftpd-log.run create mode 100644 twoftpd-xfer.1 create mode 100644 twoftpd.run commit 041b51852fc59713b45f7502c49dd83014273234 Author: Bruce Guenter Date: Fri Feb 9 00:33:12 2001 +0000 Added support for using sendfile on Linux when retrieving files. xfer.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) commit a33856e576280b545fe94322854e9f2c418e81fe Author: Bruce Guenter Date: Thu Feb 8 23:37:19 2001 +0000 Now logs all commands to stderr. Makefile | 5 +++-- auth.c | 8 ++++---- main.c | 28 +++++++++++++++++++++++----- twoftpd.h | 1 + xfer.c | 52 ++++++++++++++++++++++++++-------------------------- 5 files changed, 57 insertions(+), 37 deletions(-) commit 965184b712e581eb8f8d50649f31a2cdcd7e3a13 Author: Bruce Guenter Date: Thu Feb 8 23:19:09 2001 +0000 Changed method of executing twoftpd-xfer to use a hard-coded path. Makefile | 2 +- README | 2 +- TODO | 5 +++++ auth.c | 5 +---- twoftpd.h | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) commit aaf9cc8030e245a1e3262d9f2b7df98466851d9b Author: Bruce Guenter Date: Thu Feb 8 22:37:37 2001 +0000 Added support for both PASV and PORT connections. Added support for STOR and APPE file upload commands. Added MDTM, RMD, MKD, and DELE verbs. NEWS | 11 ++- TODO | 14 ++- xfer.c | 350 ++++++++++++++++++++++++++++++++++++++++++++++------------------ 3 files changed, 276 insertions(+), 99 deletions(-) commit 1f56e4049d658a0ca51cccc740bbe587a6a39347 Author: Bruce Guenter Date: Thu Feb 8 12:52:41 2001 +0000 Fixed some bugs in the timeout handling. TODO | 2 -- main.c | 13 +++++++------ xfer.c | 4 +++- 3 files changed, 10 insertions(+), 9 deletions(-) commit c1d5cf0364359d695b6f3c9c818685940d665bb2 Author: Bruce Guenter Date: Thu Feb 8 12:41:16 2001 +0000 Handle timeouts in read_request and accept_connection. TODO | 4 ---- main.c | 13 ++++++++++++- twoftpd.h | 1 + xfer.c | 14 +++++++++++--- 4 files changed, 24 insertions(+), 8 deletions(-) commit e327f1094f24133ee97481fb0a703caa02638454 Author: Bruce Guenter Date: Thu Feb 8 12:20:29 2001 +0000 Handle telnet-style escape codes in read_request. main.c | 50 ++++++++++++++++++++++++++++++++------------------ twoftpd.h | 7 ++++--- 2 files changed, 36 insertions(+), 21 deletions(-) commit 19ffadd5e1f1965214bf266f1f5848516c21765b Author: Bruce Guenter Date: Thu Feb 8 12:03:36 2001 +0000 Handle over-long request lines. TODO | 3 --- main.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) commit 4cbe154e2a50f8a8e00f827f5bd6aab001d02a0e Author: Bruce Guenter Date: Thu Feb 8 11:59:36 2001 +0000 Bumped up version. Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 334e67215caf2411f0708282de15bd1cc9db5810 Author: Bruce Guenter Date: Thu Feb 8 11:59:28 2001 +0000 Make chroot a dynamic option based on the presence of the NOCHROOT environment variable. NEWS | 5 +++++ format.c | 19 ++++++++++--------- xfer.c | 8 +++++--- 3 files changed, 20 insertions(+), 12 deletions(-) commit 0b58c5c19482a52a74766b0f318fafea5f8a989f Author: Bruce Guenter Date: Thu Feb 8 09:22:05 2001 +0000 *** empty log message *** makedist.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) commit e946d9d8f3bee61f422ec7716e9b3099c04e13ee Author: Bruce Guenter Date: Thu Feb 8 09:19:29 2001 +0000 Added RPM spec file. spec | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) create mode 100644 spec commit eebe7abbec3283d43e642b5f35c62fb909d813d7 Author: Bruce Guenter Date: Thu Feb 8 09:18:15 2001 +0000 Set package up for distribution. COPYING | 340 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 27 +++++- README | 36 ++++++ makedist.in | 53 +++++++++ 4 files changed, 454 insertions(+), 2 deletions(-) create mode 100644 COPYING create mode 100644 NEWS create mode 100644 README create mode 100644 makedist.in commit b210640d3af674f4f9d9d58109ad63a3f0e9ec24 Author: Bruce Guenter Date: Thu Feb 8 09:02:41 2001 +0000 Re-added in chroot code. Made "now" a global. Added support for PASV RETR command. TODO | 4 +- format.c | 10 +++- main.c | 1 + twoftpd.h | 5 ++- xfer.c | 124 ++++++++++++++++++++++++++++++++++++++++++------------------ 5 files changed, 102 insertions(+), 42 deletions(-) commit a9a37891aa8aac64b613cd8959b6c4c6389d1a1a Author: Bruce Guenter Date: Thu Feb 8 04:17:13 2001 +0000 Started implementation. Makefile | 26 +++++++ TODO | 12 +++ auth.c | 77 ++++++++++++++++++++ format.c | 125 ++++++++++++++++++++++++++++++++ listdir.c | 63 ++++++++++++++++ main.c | 129 +++++++++++++++++++++++++++++++++ respond.c | 24 ++++++ twoftpd.h | 32 ++++++++ xfer.c | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 729 insertions(+), 0 deletions(-) create mode 100644 Makefile create mode 100644 TODO create mode 100644 auth.c create mode 100644 format.c create mode 100644 listdir.c create mode 100644 main.c create mode 100644 respond.c create mode 100644 twoftpd.h create mode 100644 xfer.c twoftpd-1.42/respond.c0000664000076400007640000000656011732365413014326 0ustar bruceguenter/* respond.c - twoftpd routines for responding to clients * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "twoftpd.h" #include "log.h" extern int errno; int log_responses = 0; int respond_start(unsigned code, int final) { const char* sep = final ? " " : "-"; if (log_responses) { log_start(); log_uint(code); log_str(sep); } return obuf_putu(&outbuf, code) && obuf_puts(&outbuf, sep); } int respond_end(void) { if (log_responses) log_end(); return obuf_putsflush(&outbuf, "\r\n"); } int respond_str(const char* str) { if (log_responses) log_str(str); /* Translate LF to NUL and \377 to \377\377 on output */ for (; *str; ++str) switch (*str) { case LF: if (!obuf_putc(&outbuf, 0)) return 0; break; case '\377': if (!obuf_putc(&outbuf, '\377')) return 0; /* Fall through and output the \377 again */ default: if (!obuf_putc(&outbuf, *str)) return 0; } return 1; } int respond_uint(unsigned long num) { if (log_responses) log_uint(num); return obuf_putu(&outbuf, num); } int respond_syserr(unsigned code, const char *msg) { return respond_start(code, 1) && respond_str(msg) && respond_str(": ") && respond_str(strerror(errno)) && respond_end(); } int respond(unsigned code, int final, const char* msg) { return respond_start(code, final) && respond_str(msg) && respond_end(); } static struct timeval start; void respond_start_xfer(void) { gettimeofday(&start, 0); } static const char* scales[] = { "", "k", "M", "G", "T", 0 }; static int respond_bytes(unsigned code, const char* msg, unsigned long bytes, int sent) { struct timeval end; unsigned long rate; int scaleno; gettimeofday(&end, 0); rate = bytes / (end.tv_sec-start.tv_sec + (end.tv_usec-start.tv_usec)/1000000.0); for (scaleno = 0; rate > 10000 && scales[scaleno+1] != 0; ++scaleno, rate /= 1024) ; return respond_start(code, 1) && respond_str(msg) && respond_str(" (") && respond_uint(bytes) && respond_str(sent ? " bytes sent, " : " bytes received, ") && respond_uint(rate) && respond_str(scales[scaleno]) && respond_str("B/s).") && respond_end(); } int respond_xferresult(unsigned result, unsigned long bytes, int sent) { switch (result) { case 0: return respond_bytes(226, "Transfer completed", bytes, sent); case 1: return respond_bytes(426, "Transfer timed out", bytes, sent); case 2: return respond_bytes(426, "Transfer interrupted", bytes, sent); default: return respond_bytes(451, "Transfer failed", bytes, sent); } } twoftpd-1.42/twoftpd-anon.c0000664000076400007640000000361711732365413015274 0ustar bruceguenter/* twoftpd-anon.c - Main dispatch table for twoftpd-anon * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "twoftpd.h" #include "backend.h" const char program[] = "twoftpd-anon"; const command verbs[] = { { "TYPE", 0, 0, handle_type }, { "STRU", 0, 0, handle_stru }, { "MODE", 0, 0, handle_mode }, { "CWD", 0, 0, handle_cwd }, { "PWD", 0, handle_pwd, 0 }, { "CDUP", 0, handle_cdup, 0 }, { "PASV", 0, handle_pasv, 0 }, { "PORT", 0, 0, handle_port }, { "LIST", 0, handle_list, handle_list }, { "NLST", 0, handle_nlst, handle_nlst }, { "SIZE", 0, 0, handle_size }, { "MDTM", 0, 0, handle_mdtm }, { "REST", 0, 0, handle_rest }, { "RETR", 0, 0, handle_retr }, /* Compatibility verbs as defined by RFC1123 */ { "XCWD", 0, 0, handle_cwd }, { "XPWD", 0, handle_pwd, 0 }, { "XCUP", 0, handle_cdup, 0 }, /* Handle stray login commands */ { "USER", 1, 0, handle_pass }, { "PASS", 1, 0, handle_pass }, { "ACCT", 0, 0, handle_pass }, { 0, 0, 0, 0 } }; const command site_commands[] = { { 0, 0, 0, 0 } }; twoftpd-1.42/twoftpd-switch.c0000664000076400007640000000320611732365413015634 0ustar bruceguenter/* twoftpd-switch.c - Switch between the three twoftpd back-ends. * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "twoftpd.h" #include "conf_bin.c" const char program[] = "twoftpd-switch"; const int msg_show_pid = 1; static void exec(const char* name) { char cmd[sizeof conf_bin + 13]; char* argv[2] = { cmd, 0 }; strcpy(cmd, conf_bin); strcpy(cmd + sizeof conf_bin - 1, "/twoftpd-"); strcpy(cmd + sizeof conf_bin + 8, name); execv(cmd, argv); respond_syserr(421, "Could not exec backend"); _exit(111); } int main(void) { const char *shell; const char *env; if ((shell = getenv("SHELL")) != 0) { if ((env = getenv("SHELL_WRITEONLY")) != 0 && strcmp(shell, env) == 0) exec("drop"); if ((env = getenv("SHELL_READONLY")) != 0 && strcmp(shell, env) == 0) exec("anon"); } exec("xfer"); return 111; } twoftpd-1.42/twoftpd.h0000664000076400007640000000402411732365413014341 0ustar bruceguenter#ifndef TWO_FTPD__H__ #define TWO_FTPD__H__ #include #include #define SPACE ((char)040) #define TELNET_SE ((char)240) /* End subnegotiation parameters */ #define TELNET_NOP ((char)241) /* No operation */ #define TELNET_MARK ((char)242) /* Data Mark */ #define TELNET_BRK ((char)243) /* NVT character BRK */ #define TELNET_IP ((char)244) /* Interrupt Process */ #define TELNET_AO ((char)245) /* Abort output */ #define TELNET_AYT ((char)246) /* Are You There */ #define TELNET_EC ((char)247) /* Erase character */ #define TELNET_EL ((char)248) /* Erase line */ #define TELNET_GA ((char)249) /* Go ahead */ #define TELNET_SB ((char)250) /* Start subnegotiation parameters */ #define TELNET_WILL ((char)251) #define TELNET_WONT ((char)252) #define TELNET_DO ((char)253) #define TELNET_DONT ((char)254) #define TELNET_IAC ((char)255) /* Interpret as Command (escape) */ #ifndef BUFSIZE #define BUFSIZE 4096 #endif struct command { const char* name; int hideparam; int (*fn0)(void); int (*fn1)(void); }; typedef struct command command; extern const char* req_param; extern unsigned req_param_len; extern unsigned timeout; /* In banner.c */ extern void show_banner(unsigned code, const char* banner); /* In respond.c */ extern int log_responses; extern int respond_start(unsigned code, int final); extern int respond_str(const char* msg); extern int respond_uint(unsigned long num); extern int respond_end(void); extern int respond_syserr(unsigned code, const char *msg); extern int respond(unsigned code, int final, const char* msg); extern void respond_start_xfer(void); extern int respond_xferresult(unsigned result, unsigned long bytes, int sent); /* In responses.c */ extern int respond_internal_error(void); extern int respond_ok(void); extern int respond_permission_denied(void); /* In strtou.c */ extern unsigned long strtou(const char* s, const char** end); /* Used by main.c */ extern const command verbs[]; extern const command site_commands[]; extern int startup(int argc, char* argv[]); #endif twoftpd-1.42/twoftpd-conf.c0000664000076400007640000000624011732365413015261 0ustar bruceguenter/* twoftpd-conf.c - Configure a new instance of twoftpd auth/xfer * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include "conf.h" #include "conf_bin.c" #include #include const char program[] = "twoftpd-conf"; static const char usage_str[] = "usage: twoftpd-conf logacct /twoftpd /var/log/twoftpd cvm [ip [chroot]]\n"; void usage(const char* msg) { if (msg) obuf_put4s(&outbuf, program, ": ", msg, ".\n"); obuf_puts(&outbuf, usage_str); obuf_flush(&outbuf); exit(1); } static struct passwd* logacct; static const char* maindir; static const char* logdir; static const char* cvmpath; static const char* ip = "0.0.0.0"; static const char* dochroot; int main(int argc, char* argv[]) { if (argc < 5) usage("Too few parameters"); if (argc > 7) usage("Too many parameters"); logacct = getpwnam(argv[1]); maindir = argv[2]; logdir = argv[3]; if (maindir[0] != '/' || logdir[0] != '/') die1(1, "Directory names must start with /."); cvmpath = argv[4]; if (argc > 5) { ip = argv[5]; if (argc > 6) dochroot = argv[6]; } if (!logacct) die1(1, "Unknown logacct user name"); umask(0); if (mkdir(maindir, 0755) == -1) die1sys(1, "Error creating main directory"); if (chmod(maindir, 01755) == -1) die1sys(1, "Error setting permissions on main directory"); if (mkdir(logdir, 0700) == -1) die1sys(1, "Error creating log directory"); if (chown(logdir, logacct->pw_uid, logacct->pw_gid) == -1) die1sys(1, "Error setting owner on log directory"); if (chdir(maindir) == -1) die1sys(1, "Error changing to main directory"); if (mkdir("log", 0755) == -1) die1sys(1, "Error creating log service directory"); if (mkdir("env", 0755) == -1) die1sys(1, "Error creating env directory"); start_file("run", 0755); obuf_put5s(&conf_out, "#!/bin/sh\n" "exec 2>&1\n" "umask 022\n" "exec \\\n" "tcpserver -DRHv -llocalhost ", ip, " 21 \\\n" "envdir ", maindir, "/env \\\n"); obuf_put7s(&conf_out, "softlimit -m 2000000 \\\n", conf_bin, "/twoftpd-auth \\\n", cvmpath, " \\\n", conf_bin, "/twoftpd-xfer"); end_file(); make_file("log/run", 0755, "#!/bin/sh\n" "exec \\\n" "setuidgid ", logacct->pw_name, " \\\n" "multilog t ", logdir, 0, 0, 0); if (dochroot) make_fileu("env/CHROOT", 1); return 0; } twoftpd-1.42/README0000664000076400007640000000674411732365413013374 0ustar bruceguentertwoftpd Simple secure efficient FTP server Bruce Guenter Version 1.42 2012-03-21 This is twoftpd, an FTP server that strives to be secure, simple, and efficient. None of the back end commands can cause execution of other programs, and the normal model of execution does a chroot to the logged in user's directory immediately after authentication. The name "twoftpd" comes from the fact that there were two parts to the server -- an authenticating front end, which contains no file or data transfer code, and a back end, which contains all the data transfer code. A mailing list has been set up to discuss this and other packages. To subscribe, send an email to: bgware-subscribe@lists.untroubled.org A mailing list archive is available at: http://lists.untroubled.org/?list=bgware Development versions of twoftpd are available via git at: git://untroubled.org/git/twoftpd.git Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ Installation: Check the build settings in the conf-* files and run "make". As root, run "make install". On 32-bit Linux, to allow access to files 2GB and larger, make sure -D_FILE_OFFSET_BITS=64 is in conf-cc. Programs: The package is broken down into two main programs: twoftpd-auth is a front-end that only accepts USER and PASS (and a few other "built-in") commands. Once a user is authenticated, it execs a back end program, typically twoftpd-xfer. This program changes to the home directory in $HOME, optionally does a chroot, and then drops root UID/GID to lock down all privileges. twoftpd-anon is a stripped-down version of twoftpd-xfer with all the filesystem modification commands removed to allow for read-only FTP access. It may be used even without twoftpd-auth to provide an anonymous FTP server. twoftpd-drop is another reduced back end. It allows only for uploading new files. Downloading, overwriting files, changing permissions, renaming, etc are all forbidden. All listings produce an empty result to make it harder to guess which file names already exist. Usage: For a server handling only non-anonymous logins, optionally set CHROOT and use: tcpserver -DHRv 0 ftp \ /usr/local/bin/twoftpd-auth \ /usr/local/bin/cvm-unix \ /usr/local/bin/twoftpd-xfer For a server handling only anonymous logins, set UID, GID, and HOME to appropriate values, set CHROOT to 1, and set USER and GROUP to "ftp", and use: tcpserver -DHRv 0 ftp /usr/local/bin/twoftpd-anon If you want to have both anonymous and non-anonymous logins on the same server, run both of the above two commands with two seperate IPs substituted for the "0" parameter. Because the FTP protocol does not support name-based virtual hosting, multiple anonymous servers must be run on separate IPs. See the man pages for twoftpd-auth and twoftpd-xfer for more details. Security notes: Unless you have specific reason not to, always run with CHROOT or SOFTCHROOT set. Always run twoftpd (and most other servers) with resources limits in effect. For example: tcpserver -DRHv 0 ftp softlimit -m 2000000 twoftpd-anon This will allow the server to consume up to 2MB of memory before being killed, which should be enough for most OS's, and still prevent memory overflow attacks. This program is Copyright(C) 2012 Bruce Guenter, and may be copied according to the GNU GENERAL PUBLIC LICENSE (GPL) Version 2 or a later version. A copy of this license is included with this package. This package comes with no warranty of any kind. twoftpd-1.42/conf-man0000664000076400007640000000021411732365413014117 0ustar bruceguenter/usr/local/man Man pages will be installed in subdirectories of this directory. An unformatted man page foo.1 will go into .../man1/foo.1. twoftpd-1.42/SRCFILES0000664000076400007640000000056711732365413013646 0ustar bruceguenterINSTHIER backend.c backend.h banner.c conf.c conf.h copy.c list.c log.c log.h main.c messagefile.c path.c respond.c responses.c retr.c socket.c stat.c state.c statmod.c store.c strtou.c twoftpd-anon-conf.c twoftpd-anon.c twoftpd-auth.1 twoftpd-auth.c twoftpd-bind-port.c twoftpd-conf.c twoftpd-drop.c twoftpd-switch.1 twoftpd-switch.c twoftpd-xfer.1 twoftpd-xfer.c twoftpd.h twoftpd-1.42/main.c0000664000076400007640000001321711732365413013575 0ustar bruceguenter/* main.c - twoftpd client command parsing main loop * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "twoftpd.h" #include "log.h" static char request[BUFSIZE]; static const char* req_verb; const char* req_param; unsigned req_param_len; unsigned timeout; static int handle_quit(void) { respond(221, 1, "Bye."); return 0; } static int handle_help(void) { return respond(502, 1, "No help is available."); } static int handle_syst(void) { return respond(215, 1, "UNIX Type: L8"); } static int handle_noop(void) { return respond(200, 1, "Awaiting your commands, master..."); } static int dispatch_request(const command* table1, const command* table2, int); static int handle_site(void) { char* ptr; if ((ptr = memchr(req_param, SPACE, req_param_len)) == 0) { req_verb = req_param; req_param = 0; } else { *ptr++ = 0; while (*ptr == SPACE) ++ptr; req_verb = req_param; req_param_len -= ptr - req_param; req_param = ptr; } return dispatch_request(site_commands, 0, 0); } static command internal_verbs[] = { { "SITE", 0, 0, handle_site }, { "QUIT", 0, handle_quit, 0 }, { "HELP", 0, handle_help, 0 }, { "SYST", 0, handle_syst, 0 }, { "NOOP", 0, handle_noop, 0 }, { 0, 0, 0, 0 } }; static void inbuf_errmsg(void) { if (ibuf_timedout(&inbuf)) respond(421, 1, "Timed out waiting for command."); else if (!ibuf_eof(&inbuf)) respond_syserr(421, "I/O error"); } static int read_request(void) /* Returns number of bytes read before the LF, or -1 for EOF */ { unsigned offset; int saw_esc; int saw_esc_respond; int saw_esc_ignore; char byte[1]; saw_esc = saw_esc_respond = saw_esc_ignore = 0; offset = 0; while (offset < sizeof request - 1) { if (!ibuf_getc(&inbuf, byte)) { inbuf_errmsg(); return -1; } if (saw_esc) { saw_esc = 0; switch (*byte) { case TELNET_DONT: case TELNET_WONT: saw_esc_ignore = *byte; break; case TELNET_WILL: saw_esc_respond = TELNET_DONT; break; case TELNET_DO : saw_esc_respond = TELNET_WONT; break; case TELNET_IAC : request[offset++] = TELNET_IAC; break; } } else if (saw_esc_ignore) { saw_esc_ignore = 0; } else if (saw_esc_respond) { obuf_putc(&outbuf, TELNET_IAC); obuf_putc(&outbuf, saw_esc_respond); obuf_putc(&outbuf, *byte); obuf_flush(&outbuf); saw_esc_respond = 0; } else if (*byte == TELNET_IAC) saw_esc = 1; else if (*byte == LF) break; else request[offset++] = *byte ? *byte : LF; } while (*byte != LF) if (!ibuf_getc(&inbuf, byte)) { inbuf_errmsg(); return -1; } return offset; } static void parse_request(unsigned length) { char* ptr; char* end; /* Some firewalls appear to add extra CR bytes to some commands, * so strip all trailing CRs instead of just the last one. */ while (request[length-1] == CR) --length; request[length] = 0; end = request + length; req_verb = request; req_param = 0; req_param_len = 0; for (ptr = request; ptr < end; ptr++) { if (*ptr == SPACE) break; } if (ptr == end) return; *ptr++ = 0; if (ptr == end) return; req_param = ptr; req_param_len = end - ptr; } static const command* find_command(const command* table) { for (; table->name; ++table) { if (!strcasecmp(table->name, req_verb)) return table; } return 0; } static int dispatch_request(const command* table1, const command* table2, int log) { const command* cmd; cmd = find_command(table1); if (!cmd && table2) cmd = find_command(table2); if (!cmd) { if (log) log2(request, req_param ? req_param : "(no parameter)"); return respond(502, 1, "Command not supported."); } if (req_param) { if (log) log2(cmd->name, cmd->hideparam ? "XXXXXXXX" : req_param); if (cmd->fn1) return cmd->fn1(); return respond(501, 1, "Command requires no parameter"); } else { if (log) log1(cmd->name); if (cmd->fn0) return cmd->fn0(); return respond(504, 1, "Command requires a parameter"); } } static void handle_alrm(int ignored) { respond(421, 1, "Session timed out."); _exit(0); } int main(int argc, char* argv[]) { const char* tmp; const char* end; int log_requests; log_requests = getenv("LOGREQUESTS") != 0; log_responses = getenv("LOGRESPONSES") != 0; tmp = getenv("TIMEOUT"); if (tmp) { if ((timeout = strtou(tmp, &end)) == 0 || *end != 0) { respond(421, 1, "Configuration error, invalid timeout value"); return 1; } } else timeout = 900; inbuf.io.timeout = timeout * 1000; outbuf.io.timeout = timeout * 1000; sig_alarm_catch(handle_alrm); if (!startup(argc, argv)) return 1; for (;;) { int len = read_request(); if (len < 0) break; parse_request(len); if (!dispatch_request(internal_verbs, verbs, log_requests)) break; } return 0; } twoftpd-1.42/socket.c0000664000076400007640000001506511732365413014144 0ustar bruceguenter/* socket.c - twoftpd routines for handling sockets * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "twoftpd.h" #include "backend.h" #include #include /* State variables */ static int socket_fd = -1; static ipv4addr socket_ip; static unsigned short socket_port; static ipv4addr remote_ip; static unsigned short remote_port; static ipv4addr client_ip; static ipv4addr server_ip; static enum { NONE, PASV, PORT } connect_mode = NONE; static int respond_timedoutconn(void) { return respond(425, 1, "Timed out waiting for connection."); } static int respond_connfailed(void) { return respond_syserr(425, "Connection failed"); } static int respond_connaborted(void) { return respond(425, 1, "Connection aborted by incoming command."); } static int accept_connection(void) { int fd; iopoll_fd pf[2]; pf[0].fd = 0; pf[0].events = IOPOLL_READ; pf[0].revents = 0; pf[1].fd = socket_fd; pf[1].events = IOPOLL_READ; switch (iopoll_restart(pf, 2, connect_timeout*1000)) { case 2: break; case 1: break; case 0: respond_timedoutconn(); return -1; default: respond_connfailed(); return -1; } if (pf[0].revents) { respond_connaborted(); return -1; } if ((fd = socket_accept4(socket_fd, &remote_ip, &remote_port)) == -1) { respond_connfailed(); return -1; } close(socket_fd); socket_fd = -1; connect_mode = NONE; if (!nonblock_on(fd)) { respond_syserr(425, "Could not set flags on socket"); close(fd); return -1; } return fd; } static int make_connect_socket(void) { int fd; char buf; fd = -1; if (bind_port_fd != -1) { if (write(bind_port_fd, &buf, 1) == 1 && read(bind_port_fd, &buf, 1) == 1 && buf == 0) fd = socket_recvfd(bind_port_fd); } if (fd == -1) { if ((fd = socket_tcp()) == -1) { respond_syserr(425, "Could not allocate a socket"); return -1; } if (!socket_reuse(fd) || !socket_bind4(fd, &server_ip, 0)) { respond_syserr(425, "Could not set flags on socket"); close(fd); return -1; } } return fd; } static int start_connection(void) { int fd; iopoll_fd pf[2]; if ((fd = make_connect_socket()) == -1) return -1; if (!nonblock_on(fd)) { respond_syserr(425, "Could not set flags on socket"); close(fd); return -1; } if (socket_connect4(fd, &remote_ip, remote_port)) return fd; if (errno != EINPROGRESS && errno != EWOULDBLOCK) { respond_connfailed(); return -1; } pf[0].fd = 0; pf[0].events = IOPOLL_READ; pf[0].revents = 0; pf[1].fd = fd; pf[1].events = IOPOLL_WRITE; switch (iopoll_restart(pf, 2, connect_timeout*1000)) { case 0: respond_timedoutconn(); break; case 2: case 1: if (pf[0].revents) { respond_connaborted(); break; } if (socket_connected(fd)) return fd; /* No break, fall through */ default: respond_connfailed(); } close(fd); return -1; } static int make_connection_fd(void) { int fd; if (connect_mode == NONE) { fd = -1; respond(425, 1, "No PORT or PASV commands have been issued."); } else { fd = (connect_mode == PASV) ? accept_connection() : start_connection(); if (fd != -1) respond(150, 1, "Opened data connection."); } respond_start_xfer(); return fd; } int make_in_connection(void) { return make_connection_fd(); } int make_out_connection(void) { int fd; if ((fd = make_connection_fd()) != -1) { socket_cork(fd); if (!socket_linger(fd, 1, timeout)) { respond_syserr(425, "Could not set flags on socket"); close(fd); fd = -1; } } return fd; } int close_out_connection(int out) { socket_uncork(out); return close(out) == 0; } static unsigned char strtoc(const char* s, const char** end) { long tmp; tmp = strtol(s, (char**)end, 10); if (tmp < 0 || tmp > 0xff) *end = s; return tmp; } static int scan_ip(const char* s, char sep, ipv4addr* addr, const char** endptr) { const char* end; addr->addr[0] = strtoc(s, &end); if (*end != sep) return 0; addr->addr[1] = strtoc(end+1, &end); if (*end != sep) return 0; addr->addr[2] = strtoc(end+1, &end); if (*end != sep) return 0; addr->addr[3] = strtoc(end+1, &end); *endptr = end; return 1; } int parse_localip(const char* s) { const char* end; return scan_ip(s, '.', &server_ip, &end) && *end == 0; } int parse_remoteip(const char* s) { const char* end; return scan_ip(s, '.', &client_ip, &end) && *end == 0; } static int parse_addr(const char* s) { const char* end; if (!scan_ip(s, ',', &remote_ip, &end) || *end != ',') return 0; remote_port = strtoc(end+1, &end) << 8; if (*end != ',') return 0; remote_port |= strtoc(end+1, &end); if (*end != 0) return 0; connect_mode = PORT; return 1; } static int make_accept_socket(void) { if (socket_fd != -1) close(socket_fd); if ((socket_fd = socket_tcp()) != -1) { if (socket_bind4(socket_fd, &server_ip, 0) && socket_listen(socket_fd, 1) && socket_getaddr4(socket_fd, &socket_ip, &socket_port)) { connect_mode = PASV; return 1; } else { close(socket_fd); socket_fd = -1; } } connect_mode = NONE; return 0; } int handle_pasv(void) { char buffer[6*4+25]; if (!make_accept_socket()) return respond_syserr(425, "Could not create socket"); buffer[fmt_multi(buffer, "{Entering Passive Mode (}u{,}u{,}u{,}u{,}u{,}u{).", socket_ip.addr[0], socket_ip.addr[1], socket_ip.addr[2], socket_ip.addr[3], (socket_port>>8)&0xff, socket_port&0xff)] = 0; return respond(227, 1, buffer); } int handle_port(void) { if (!parse_addr(req_param)) return respond(501, 1, "Can't parse your PORT address."); if (memcmp(&remote_ip, &client_ip, sizeof client_ip)) return respond(501, 1, "PORT IP does not match client address."); return respond_ok(); } twoftpd-1.42/twoftpd-1.42.spec0000664000076400007640000000316011732365413015426 0ustar bruceguenterName: twoftpd Summary: Secure, simple, and efficient FTP server Version: 1.42 Release: 1 License: GPL Group: Utilities/System Source: http://untroubled.org/twoftpd/twoftpd-1.42.tar.gz BuildRoot: %{_tmppath}/twoftpd-buildroot URL: http://untroubled.org/twoftpd/ Packager: Bruce Guenter BuildRequires: bglibs >= 1.103 BuildRequires: cvm-devel >= 0.90 Requires: supervise-scripts >= 3.5 Requires: cvm %description This is twoftpd, a new FTP server that strives to be secure, simple, and efficient. %prep %setup %build echo "gcc ${optflags} -D_FILE_OFFSET_BITS=64" >conf-cc echo "gcc -s" >conf-ld echo %{_bindir} >conf-bin echo %{_mandir} >conf-man make programs %install rm -fr %{buildroot} mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_mandir} make install install_prefix=%{buildroot} mkdir -p %{buildroot}/etc/twoftpd pushd %{buildroot}/etc/twoftpd echo 1 >CHROOT echo 900 >TIMEOUT echo 1 >LOGREQUESTS echo 1 >LOGRESPONSES popd mkdir -p %{buildroot}/var/log/twoftpd mkdir -p %{buildroot}/var/service/twoftpd/log install -m 755 twoftpd.run %{buildroot}/var/service/twoftpd/run install -m 755 twoftpd-log.run %{buildroot}/var/service/twoftpd/log/run %clean rm -rf %{buildroot} %post if ! [ -e /service/twoftpd ]; then svc-add -d /var/service/twoftpd fi %files %defattr(-,root,root) %doc COPYING NEWS README %dir /etc/twoftpd %config(noreplace) /etc/twoftpd/* %{_bindir}/* %{_mandir}/* %attr(0700,root,root) %dir /var/log/twoftpd %attr(1755,root,root) %dir /var/service/twoftpd %dir /var/service/twoftpd/log %config(noreplace) /var/service/twoftpd/log/run %config(noreplace) /var/service/twoftpd/run twoftpd-1.42/TARGETS0000664000076400007640000000110111732365413013526 0ustar bruceguenterall backend.a backend.o banner.o clean clean-spac compile conf.o conf_bin.c copy.o docs install libraries list.o load log.o main.a main.o makelib messagefile.o path.o programs respond.o responses.o retr.o socket.lib socket.o stat.o state.o statmod.o store.o strtou.o twoftpd-anon twoftpd-anon-conf twoftpd-anon-conf.o twoftpd-anon.o twoftpd-auth twoftpd-auth.1.html twoftpd-auth.o twoftpd-bind-port twoftpd-bind-port.o twoftpd-conf twoftpd-conf.o twoftpd-drop twoftpd-drop.o twoftpd-switch twoftpd-switch.1.html twoftpd-switch.o twoftpd-xfer twoftpd-xfer.1.html twoftpd-xfer.o twoftpd-1.42/copy.c0000664000076400007640000000705511732365413013626 0ustar bruceguenter/* copy.c - twoftpd network copy routine * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "backend.h" static int error_code(int err) { return (err == EPIPE || err == ECONNRESET) ? 2 : -1; } /* Return value: * 0 if the iobuf was ready * 1 for timeout * 2 for an interrupt */ static int pollit(int fd, int events, int timeout) { iopoll_fd pfd[2]; pfd[0].fd = 0; pfd[0].events = IOPOLL_READ; pfd[0].revents = 0; pfd[1].fd = fd; pfd[1].events = events; pfd[1].revents = 0; switch (iopoll_restart(pfd, 2, timeout)) { case -1: return -1; case 0: return 1; default: if (pfd[0].revents) return 2; return 0; } } /* Return values for following routines: * -1 for a system error * 0 for a successful transfer * 1 for timeout * 2 for interrupted transfer */ int netwrite(int out, const char* optr, unsigned long ocount, int timeout) { int result; ssize_t wr; while (ocount > 0) { if ((result = pollit(out, IOPOLL_WRITE, timeout)) != 0) return result; if ((wr = write(out, optr, ocount)) == -1) return error_code(errno); if (wr == 0) { errno = EIO; return -1; } ocount -= wr; optr += wr; } return 0; } static int copy_xlate(int in, int out, int timeout, unsigned long (*xlate)(char* out, const char* in, unsigned long inlen), unsigned long* bytes_in, unsigned long* bytes_out) { char in_buf[iobuf_bufsize]; char out_buf[sizeof in_buf * 2]; char* optr; ssize_t icount; ssize_t ocount; int result; *bytes_in = 0; *bytes_out = 0; for (;;) { if ((result = pollit(in, IOPOLL_READ, timeout)) != 0) return result; if ((icount = read(in, in_buf, sizeof in_buf)) == -1) return -1; if (icount == 0) return 0; *bytes_in += icount; if (xlate) { optr = out_buf; ocount = xlate(out_buf, in_buf, icount); } else { optr = in_buf; ocount = icount; } if ((result = netwrite(out, optr, ocount, timeout)) != 0) return result; *bytes_out += ocount; } return 0; } int copy_xlate_close(int in, int out, int timeout, unsigned long (*xlate)(char*, const char*, unsigned long), unsigned long* bytes_in, unsigned long* bytes_out) { int status; status = copy_xlate(in, out, timeout, xlate, bytes_in, bytes_out); /* Three possible cases here: in is at EOF, an error occurred while * reading in, or writing is completed. In all cases we can ignore * errors during closing in. */ close(in); /* The output might be a socket that needs to be uncorked. If the * output is a file, this is harmless. */ socket_uncork(out); if (close(out) != 0) if (status == 0) status = error_code(errno); return status; } twoftpd-1.42/log.c0000664000076400007640000000243411732365413013431 0ustar bruceguenter/* log.c - Log message generation routines * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "log.h" static pid_t pid = 0; void log_start(void) { if (!pid) pid = getpid(); obuf_puts(&errbuf, program); obuf_putc(&errbuf, '['); obuf_putu(&errbuf, pid); obuf_puts(&errbuf, "]: "); } void log1(const char* a) { log_start(); log_str(a); log_end(); } void log2(const char* a, const char* b) { log_start(); log_str(a); log_str(" "); log_str(b); log_end(); } twoftpd-1.42/twoftpd-auth.c0000664000076400007640000000541511732365413015300 0ustar bruceguenter/* twoftpd-auth.c - Authentication front-end for twoftpd * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "twoftpd.h" const char program[] = "twoftpd-auth"; static char** argv_xfer = 0; static const char* user = 0; static const char* cvmodule = 0; static unsigned long auth_attempts; static void do_exec() { alarm(0); if (putenv("AUTHENTICATED=1") == 0 && cvm_setenv()) execvp(argv_xfer[0], argv_xfer); respond(421, 1, "Could not execute back-end."); exit(1); } static int handle_user(void) { if (user) free((char*)user); user = strdup(req_param); return respond(331, 1, "Send PASS."); } static int handle_pass(void) { if (!user) return respond(503, 1, "Send USER first."); if (cvm_authenticate_password(cvmodule, user, getenv("TCPLOCALHOST"), req_param, 0) == 0) do_exec(); free((char*)user); user = 0; if (!respond(530, 1, "Authentication failed.")) return 0; if (auth_attempts-- <= 1) { respond(421, 1, "Too many authentication failures."); return 0; } return 1; } const command verbs[] = { { "USER", 0, 0, handle_user }, { "PASS", 1, 0, handle_pass }, { 0, 0, 0, 0 } }; const command site_commands[] = { { 0, 0, 0, 0 } }; int startup(int argc, char* argv[]) { const char* tmp; unsigned long auth_timeout; if (argc < 3) { respond(421, 1, "Configuration error, insufficient paramenters."); return 0; } cvmodule = argv[1]; argv_xfer = argv + 2; if (!getenv("SERVICE") && putenv("SERVICE=ftp") == -1) { respond(421, 1, "Error setting $SERVICE."); return 0; } if ((tmp = getenv("LOGINBANNER")) != 0) show_banner(220, tmp); auth_timeout = 0; if ((tmp = getenv("AUTH_TIMEOUT")) != 0) auth_timeout = strtou(tmp, &tmp); alarm(auth_timeout); auth_attempts = ~0UL; if ((tmp = getenv("AUTH_ATTEMPTS")) != 0) auth_attempts = strtou(tmp, &tmp); return respond(220, 0, "TwoFTPd server ready.") && respond(220, 1, "Authenticate first."); } twoftpd-1.42/conf-bglibs0000664000076400007640000000002611732365413014607 0ustar bruceguenter/usr/local/bglibs/lib twoftpd-1.42/twoftpd-xfer.1.html0000664000076400007640000001055111732365413016161 0ustar bruceguenterContent-type: text/html Manpage of twoftpd-xfer

twoftpd-xfer

Section: User Commands (1)
Index Return to Main Contents
 

NAME

twoftpd-xfer - TwoFTPD file transfer back-end.  

SYNOPSIS

twoftpd-xfer  

DESCRIPTION

twoftpd-xfer reads FTP request from the network and executes file transfers based on those requests. Before doing anything, twoftpd-xfer changes directory to the authenticated user's home directory, changes the root directory to that directory, and drops all root priviledges.  

ENVIRONMENT

AUTHENTICATED
If set (typically by twoftpd-auth after successfully completing authentication), the startup banner will use code 230, indicating that authentication was successful. Otherwise, the startup banner will use code 220, which is the normal initial connection banner.
BANNER
If set, the contents of this variable will be sent as extra responses when the server starts.
CHROOT
If set, change the root directory to the user's home directory through the OS chroot syscall.
CONNECT_TIMEOUT
The maximum number of seconds to wait for a data channel connection to complete. If not set, it defaults to the value of $TIMEOUT.
GID
Numerical group ID number to change to at program startup.
GIDS
Optional comma-seperated list of numerical group IDs to set up as the supplementary group IDs.
GROUP
Group name to use in long listings for files owned by $GID. If not set, defaults to mygroup.
HOME
Directory to switch to on program startup.
LOCKHOME
If set (and neither CHROOT nor SOFTCHROOT are set), all accesses to files and paths outside of HOME will be forbidden.
LOGREQUESTS
If set, all requests from the client will be logged.
LOGRESPONSES
If set, all responses to the client (after login) will be logged.
MESSAGEFILE
If set, the contents this file will be automatically sent as extra responses to the client whenever the server enters a directory (including at startup).
NODOTFILES
If set, all listings will exclude all files starting with a period, and it will not be possible to do any file access (including storing or retrieving) to any file starting with a period. This may be useful for anonymous FTP servers.
SESSION_TIMEOUT
The maximum number of seconds to allow a single session to last.
SOFTCHROOT
If set, and CHROOT is not set, the server emulates the effect of a chroot without actually effecting a chroot. This eliminates the system-enforced barrier provided by the chroot, but allows for things like symlinks outside of the home directory.
TCPLOCALIP
The IP to use when creating PASV connections. Normally, this is set by tcpserver.
TCPREMOTEIP
The source IP to use when creating PORT connections. Normally, this is set by tcpserver.
TIMEOUT
The maximum number of seconds to wait for command input or connections.
UID
Numerical user ID number to change to at program startup.
USER
Owner name to use in long listings for files owned by $UID.
 

NOTES

You will need to set the umask to an appropriate value before running this program. The twoftpd-anon program functions identically to this program, with the exception of having no file modification capabilities. The twoftpd-drop program is a similarly restricted program, that can only create new files (no overwriting, modifying, or listing existing files).


 

Index

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT
NOTES

This document was created by man2html, using the manual pages.
Time: 22:19:53 GMT, April 04, 2011 twoftpd-1.42/retr.c0000664000076400007640000000456211732365413013630 0ustar bruceguenter/* retr.c - twoftpd routines for retrieving files * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "twoftpd.h" #include "backend.h" unsigned long startpos = 0; int handle_rest(void) { const char* end; startpos = strtou(req_param, &end); if (*end != 0) { startpos = 0; return respond(501, 1, "Invalid number given for REST."); } return respond(350, 1, "Start position for transfer has been set."); } static unsigned long xlate_ascii(char* out, const char* in, unsigned long inlen) { unsigned long outlen; for (outlen = 0; inlen > 0; --inlen, ++in) { if (*in == LF) { *out++ = CR; ++outlen; } *out++ = *in; ++outlen; } return outlen; } int handle_retr(void) { int in; int out; unsigned long ss; struct stat st; unsigned long bytes_in; unsigned long bytes_out; int result; ss = startpos; startpos = 0; if ((in = open_fd(req_param, O_RDONLY, 0)) == -1) return respond_syserr(550, "Could not open input file"); if (fstat(in, &st) != 0) { close(in); return respond_syserr(550, "Could not fstat input file"); } if (!S_ISREG(st.st_mode)) { close(in); return respond(550, 1, "Requested name is not a regular file"); } if (ss && !lseek(in, ss, SEEK_SET)) { close(in); return respond(550, 1, "Could not seek to start position in input file."); } if ((out = make_out_connection()) == -1) { close(in); return 1; } result = copy_xlate_close(in, out, timeout * 1000, binary_flag ? 0 : xlate_ascii, &bytes_in, &bytes_out); return respond_xferresult(result, bytes_out, 1); } twoftpd-1.42/INSTHIER0000664000076400007640000000045211732365413013652 0ustar bruceguenter>bin c:::755::twoftpd-anon c:::755::twoftpd-anon-conf c:::755::twoftpd-auth c:::755::twoftpd-bind-port c:::755::twoftpd-conf c:::755::twoftpd-drop c:::755::twoftpd-switch c:::755::twoftpd-xfer >man d:::755:man1 c:::644:man1:twoftpd-auth.1 c:::644:man1:twoftpd-switch.1 c:::644:man1:twoftpd-xfer.1 twoftpd-1.42/twoftpd-drop.c0000664000076400007640000000414311732365413015300 0ustar bruceguenter/* twoftpd-drop.c - Main dispatch table for twoftpd-drop * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "twoftpd.h" #include "backend.h" const char program[] = "twoftpd-drop"; int store_exclusive = 1; /* Most GUI FTP clients have problems if they can't list directories * before uploading, so we need to produce a fake empty listing for * their sake. */ static int fake_list(void) { int out; if ((out = make_out_connection()) == -1) return 1; return respond_xferresult(close(out), 0, 1); } const command verbs[] = { { "TYPE", 0, 0, handle_type }, { "STRU", 0, 0, handle_stru }, { "MODE", 0, 0, handle_mode }, { "CWD", 0, 0, handle_cwd }, { "PWD", 0, handle_pwd, 0 }, { "CDUP", 0, handle_cdup, 0 }, { "PASV", 0, handle_pasv, 0 }, { "PORT", 0, 0, handle_port }, { "LIST", 0, fake_list, fake_list }, { "NLST", 0, fake_list, fake_list }, { "STOR", 0, 0, handle_stor }, /* Compatibility verbs as defined by RFC1123 */ { "XCWD", 0, 0, handle_cwd }, { "XPWD", 0, handle_pwd, 0 }, { "XCUP", 0, handle_cdup, 0 }, /* Handle stray login commands */ { "USER", 1, 0, handle_pass }, { "PASS", 1, 0, handle_pass }, { "ACCT", 0, 0, handle_pass }, { 0, 0, 0, 0 } }; const command site_commands[] = { { 0, 0, 0, 0 } }; twoftpd-1.42/statmod.c0000664000076400007640000000467311732365413014332 0ustar bruceguenter/* statmod.c - twoftpd routines for modifying file status * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "twoftpd.h" #include "backend.h" static int getint(const char* s, unsigned digits) { int i; for (i = 0; digits > 0; ++s, --digits) i = (i * 10) + *s - '0'; return i; } static int gettime(const char* s, char end, time_t* stamp) { int i; struct tm tm; for (i = 0; i < 14; ++i) if (!isdigit(s[i])) return 0; if (s[14] != end) return 0; tm.tm_year = getint(req_param+0, 4) - 1900; tm.tm_mon = getint(req_param+4, 2) - 1; tm.tm_mday = getint(req_param+6, 2); tm.tm_hour = getint(req_param+8, 2); tm.tm_min = getint(req_param+10, 2); tm.tm_sec = getint(req_param+12, 2); tm.tm_wday = tm.tm_yday = tm.tm_isdst = 0; if (tm.tm_year < 70 || tm.tm_mon < 0 || tm.tm_mon >= 12 || tm.tm_mday < 1 || tm.tm_mday > 31 || tm.tm_hour < 0 || tm.tm_hour >= 24 || tm.tm_min < 0 || tm.tm_min >= 60 || tm.tm_sec < 0 || tm.tm_sec > 61 || (*stamp = mktime(&tm)) == -1) return -1; #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) *stamp -= tm.tm_gmtoff; #else *stamp -= timezone; #endif return 1; } int handle_mdtm2(void) { time_t stamp; struct utimbuf ut; switch (gettime(req_param, ' ', &stamp)) { case 0: return handle_mdtm(); case -1: return respond(501, 1, "Invalid timestamp"); } req_param += 15; if (!qualify_validate(req_param)) return 1; ut.actime = ut.modtime = stamp; if (utime(fullpath.s+1, &ut) == -1) return respond_syserr(550, "Could not set file time"); return respond(200, 1, "File time set"); } twoftpd-1.42/twoftpd-bind-port.c0000664000076400007640000000640211732365413016232 0ustar bruceguenter/* twoftpd-bind-port.c -- twoftpd port (20) binding hack * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include "twoftpd.h" const char program[] = "twoftpd-bind-port"; const int msg_show_pid = 1; static ipv4port port; static ipv4addr ip; static pid_t ppid; unsigned timeout = 1; void die(const char* msg) { respond(421, 1, msg); exit(111); } void mainloop(int sock) { char code; int newsock; iopoll_fd fds; fds.fd = sock; fds.events = IOPOLL_READ; for (;;) { switch (iopoll_restart(&fds, 1, timeout*1000)) { case -1: return; case 0: /* Timed out */ if (kill(ppid, 0) == -1) return; continue; default: if (read(sock, &code, 1) != 1) return; code = 0; if ((newsock = socket_tcp()) == -1) { error1sys("Creating socket failed"); code = 1; } else if (!socket_reuse(newsock)) { error1sys("Setting flags on socket failed"); code = 2; } else if (!socket_bind4(newsock, &ip, port)) { error1sys("Binding socket failed"); code = 3; } if (write(sock, &code, 1) != 1) error1sys("Sending the result code failed"); if (!code) if (!socket_sendfd(sock, newsock)) error1sys("Sending the bound socket failed"); close(newsock); } } } int main(int argc, char* argv[]) { static str fdstr; const char* tmp; const char* end; int sock[2]; if (argc < 2) { respond(421, 1, "Configuration error, insufficient paramenters."); return 0; } if ((tmp = getenv("TCPLOCALIP")) == 0 || (end = ipv4_scan(tmp, &ip)) == 0 || *end != 0) { respond(421, 1, "Configuration error, $TCPLOCALIP is not set or is invalid."); return 0; } if ((tmp = getenv("TWOFTPD_BIND_PORT")) != 0) { port = strtoul(tmp, (char**)&end, 10); if (*end != 0) port = 20; } else port = 20; if (!socket_pairdgm(sock)) { respond_syserr(421, "Could not create socket pair."); return 0; } if (!str_catu(&fdstr, sock[0]) || setenv("TWOFTPD_BIND_PORT_FD", fdstr.s, 1) == -1) { respond_syserr(421, "Could not set $TWOFTPD_BIND_PORT_FD."); return 0; } ppid = getpid(); switch (fork()) { case -1: respond_syserr(421, "Could not fork."); break; case 0: close(sock[0]); mainloop(sock[1]); break; default: close(sock[1]); execvp(argv[1], argv+1); respond_syserr(421, "Could not execute command line."); } return 0; } twoftpd-1.42/twoftpd-switch.1.html0000664000076400007640000000274411732365413016523 0ustar bruceguenterContent-type: text/html Manpage of twoftpd-switch

twoftpd-switch

Section: User Commands (1)
Index Return to Main Contents
 

NAME

twoftpd-switch - TwoFTPD back-end switcher.  

SYNOPSIS

twoftpd-switch  

DESCRIPTION

twoftpd-switch examines the value of $SHELL to determine which back-end to execute. If $SHELL_WRITEONLY is set and matches the value of $SHELL, twoftpd-drop is executed. If $SHELL_READONLY is set and matches the value of $SHELL, twoftpd-anon is executed. Otherwise, twoftpd-xfer is executed.  

NOTES

twoftpd-switch prefixes the commands with the path in which the programs were installed.  

SEE ALSO

twoftpd-xfer(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
NOTES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 22:19:53 GMT, April 04, 2011 twoftpd-1.42/banner.c0000664000076400007640000000227711732365413014122 0ustar bruceguenter/* banner.c - Show a banner to the client. * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "twoftpd.h" void show_banner(unsigned code, const char* banner) { char* copy; char* start; char* end; if ((copy = strdup(banner)) == 0) return; start = copy; while ((end = strchr(start, '\n')) != 0) { *end = 0; if (end > start) respond(code, 0, start); start = end + 1; } respond(code, 0, start); free(copy); } twoftpd-1.42/list.c0000664000076400007640000002166511732365413013632 0ustar bruceguenter/* list.c - twoftpd routines to handle list/nlst commands * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include "twoftpd.h" #include "backend.h" #include #include #include int list_options; static int list_long; static int list_flags; static int mode_nlst; static const char* mode2str(int mode) { static char buf[11]; buf[0] = S_ISREG(mode) ? '-' : S_ISDIR(mode) ? 'd' : S_ISCHR(mode) ? 'c' : S_ISBLK(mode) ? 'b' : S_ISFIFO(mode) ? 'p' : S_ISSOCK(mode) ? 's' : '?'; buf[1] = (mode & 0400) ? 'r' : '-'; buf[2] = (mode & 0200) ? 'w' : '-'; buf[3] = (mode & 04000) ? (mode & 0100) ? 's' : 'S' : (mode & 0100) ? 'x' : '-'; buf[4] = (mode & 0040) ? 'r' : '-'; buf[5] = (mode & 0020) ? 'w' : '-'; buf[6] = (mode & 02000) ? (mode & 0010) ? 's' : 'S' : (mode & 0010) ? 'x' : '-'; buf[7] = (mode & 0004) ? 'r' : '-'; buf[8] = (mode & 0002) ? 'w' : '-'; buf[9] = (mode & 01000) ? (mode & 0001) ? 't' : 'T' : (mode & 0001) ? 'x' : '-'; buf[10] = 0; return buf; } static int str_catmode(str* s, int mode) { return str_catb(s, mode2str(mode), 10); } static int str_catowner(str* s, uid_t owner) { const char* name; unsigned len; if (owner == uid) name = user, len = user_len; else name = "somebody", len = 8; if (!str_catb(s, name, len)) return 0; while (len++ < MAX_NAME_LEN) if (!str_catc(s, SPACE)) return 0; return 1; } static int str_catgroup(str* s, gid_t g) { const char* name; unsigned len; if (g == gid) name = group, len = group_len; else name = "somegrp", len = 7; if (!str_catb(s, name, len)) return 0; while (len++ < MAX_NAME_LEN) if (!str_catc(s, SPACE)) return 0; return 1; } static int str_cattime(str* s, time_t then) { struct tm* tm; time_t year; char buf[16]; unsigned len; year = now - 365/2*24*60*60; tm = localtime(&then); if (then > year) len = strftime(buf, sizeof buf - 1, "%b %e %H:%M", tm); else len = strftime(buf, sizeof buf - 1, "%b %e %Y", tm); return str_catb(s, buf, len); } static int str_catstat(str* s, const struct stat* st) { if (st) return str_catmode(s, st->st_mode) && str_catb(s, " 1 ", 6) && str_catowner(s, st->st_uid) && str_catc(s, SPACE) && str_catgroup(s, st->st_gid) && str_catc(s, SPACE) && str_catuwll(s, st->st_size, 8, ' ') && str_catc(s, SPACE) && str_cattime(s, st->st_mtime) && str_catc(s, SPACE); else return str_cats(s, "??????????" " ? " "???????? " "???????? " " ? " "??? ?? ????? "); } static int str_catflags(str* s, const struct stat* st) { if (st) { int ch; int mode = st->st_mode; ch = 0; if (S_ISDIR(mode)) ch = '/'; else if (S_ISFIFO(mode)) ch = '|'; else if (S_ISSOCK(mode)) ch = '='; else if (list_flags == 'F' && mode & 0111) ch = '*'; if (ch) return str_catc(s, ch); } return 1; } static int str_catfn(str* s, const char* fn, int striplen) { if (striplen < 0) { if (!str_catc(s, '/')) return 0; striplen = 0; } return str_cats(s, fn + striplen); } static char send_buf[8192]; static unsigned long send_used; static int send_line(int out, const str* s) { int result; if (send_used + s->len > sizeof send_buf) { if ((result = netwrite(out, send_buf, send_used, timeout * 1000)) != 0) return result; send_used = 0; } if (s->len > sizeof send_buf) return netwrite(out, s->s, s->len, timeout * 1000); memcpy(send_buf + send_used, s->s, s->len); send_used += s->len; return 0; } static str entries; static int list_entries(long count, int striplen) { static str line; int out; int result; unsigned long bytes_out; struct stat statbuf; struct stat* statptr; const char* filename = entries.s; int need_stat = list_long || list_flags; if (mode_nlst && count < 0) return respond(550, 1, "No such file or directory"); if ((out = make_out_connection()) == -1) return 1; send_used = 0; for (bytes_out = 0; count > 0; --count, filename += strlen(filename)+1) { statptr = 0; if (need_stat) { if (stat(filename, &statbuf) == -1) { if (errno == ENOENT) continue; } else statptr = &statbuf; } line.len = 0; if ((list_long && !str_catstat(&line, statptr)) || !str_catfn(&line, filename, striplen) || (list_flags && !str_catflags(&line, statptr)) || !str_cats(&line, CRLF)) { close(out); return respond_xferresult(-1, bytes_out, 1); } if ((result = send_line(out, &line)) != 0) return respond_xferresult(result, bytes_out, 1); bytes_out += line.len; } if (send_used > 0) { if ((result = netwrite(out, send_buf, send_used, timeout * 1000)) != 0) { socket_uncork(out); close(out); return respond_xferresult(result, bytes_out, 1); } } return respond_xferresult(close(out), bytes_out, 1); } static int list_dir() { long count; DIR* dir; direntry* entry; /* Turning "/" into "/." simplifies several other steps below. */ if (fullpath.len == 1) if (!str_copys(&fullpath, "/.")) return respond_internal_error(); if ((dir = opendir(fullpath.s+1)) == 0) return respond_syserr(550, "Could not open directory"); entries.len = 0; count = 0; while ((entry = readdir(dir)) != 0) { /* Always skip the "." and ".." entries. Skip all other ".*" * entries if nodotfiles was set. */ if (entry->d_name[0] != '.' || (!(entry->d_name[1] == 0 || (entry->d_name[1] == '.' && entry->d_name[2] == 0)) && (list_options & PATH_MATCH_DOTFILES) != 0)) { /* Add the entry to the list, skipping the "/" separator if none * is needed */ if (!str_catb(&entries, fullpath.s+1, fullpath.len-1) || !str_catc(&entries, '/') || !str_catb(&entries, entry->d_name, strlen(entry->d_name)+1)) { closedir(dir); return respond_internal_error(); } ++count; } } closedir(dir); if (!str_sort(&entries, 0, count, 0)) return respond_internal_error(); return list_entries(count, fullpath.len); } static int handle_listing(int longfmt) { struct stat statbuf; long count; int striplen; mode_nlst = !longfmt; list_long = longfmt; list_flags = 0; if (req_param) { while (*req_param == '-') { ++req_param; if (*req_param == SPACE) break; while (*req_param && *req_param != SPACE) { char tmp[2]; switch (*req_param) { case 'a': break; /* Listing all files is */ case 'A': break; /* not controlled by client */ case 'L': break; /* We already dereference symlinks */ case 'F': case 'p': list_flags = *req_param; break; case 'l': list_long = 1; break; default: tmp[0] = *req_param; tmp[1] = 0; return respond_start(550, 1) && respond_str("Unknown list option: ") && respond_str(tmp) && respond_end(); } ++req_param; } if (*req_param == SPACE) ++req_param; } } if (!req_param || !*req_param) req_param = "."; if (path_contains(req_param, "..")) return respond(553, 1, "Paths containing '..' not allowed."); /* Prefix the requested path with CWD, and strip it after */ if (!qualify_validate(req_param)) return 1; if (fullpath.len == 1) return list_dir(); if ((count = path_match(fullpath.s+1, &entries, list_options)) == -1) return respond_internal_error(); striplen = (req_param[0] == '/') ? -1 : (cwd.len == 1) ? 0 : cwd.len; if (count <= 1) { /* If no entries were matched, try the literal path. */ if (count == 0) if (!str_copyb(&entries, fullpath.s+1, fullpath.len)) return respond_internal_error(); if (stat(entries.s, &statbuf) == -1) { if (errno == ENOENT) return respond(550, 1, "File or directory does not exist."); else return respond(550, 1, "Could not access file."); } else if (S_ISDIR(statbuf.st_mode)) { if (!str_copys(&fullpath, "/") || !str_catb(&fullpath, entries.s, entries.len-1)) return respond_internal_error(); return list_dir(); } } return list_entries(count, striplen); } int handle_list(void) { return handle_listing(1); } int handle_nlst(void) { return handle_listing(0); } twoftpd-1.42/COPYING0000664000076400007640000004311011732365413013533 0ustar bruceguenter GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. twoftpd-1.42/stat.c0000664000076400007640000000306611732365413013625 0ustar bruceguenter/* stat.c - twoftpd routines for producing file status * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "twoftpd.h" #include "backend.h" int handle_size(void) { struct stat statbuf; char buffer[40]; if (!qualify_validate(req_param)) return 1; if (stat(fullpath.s+1, &statbuf) == -1) return respond_syserr(550, "Could not determine file size"); buffer[fmt_ulldec(buffer, statbuf.st_size)] = 0; return respond(213, 1, buffer); } int handle_mdtm(void) { struct stat statbuf; char buffer[16]; if (!qualify_validate(req_param)) return 1; if (stat(fullpath.s+1, &statbuf) == -1) return respond_syserr(550, "Could not determine file time"); strftime(buffer, sizeof buffer, "%Y%m%d%H%M%S", gmtime(&statbuf.st_mtime)); return respond(213, 1, buffer); } twoftpd-1.42/TODO0000664000076400007640000000126211732365413013172 0ustar bruceguenter- Implement "FEAT" and "OPTS" commands. - When necessary, the front end will pass options to the backends using $OPTS_whatever. - Tests: - u+s g+s +t permissions on listings - LOGREQUESTS on/off - LOGRESPONSES on/off - \377 escapes on output - CWD into various mode directories - RETR from/STOR to various mode directories - Write a twoftpd log tailing program to output timeout stats and the like. - Add IPv6 support. - Build-in support for recursive retrieval producing a tar file internally. - Look into spying on the status of the servers: - exporting status through environment or modifying the command-line - get pids by looking for children of tcpserver twoftpd-1.42/VERSION0000664000076400007640000000001511732365413013545 0ustar bruceguentertwoftpd 1.42 twoftpd-1.42/backend.h0000664000076400007640000000435011732365413014243 0ustar bruceguenter#ifndef TWOFTPD__BACKEND__H__ #define TWOFTPD__BACKEND__H__ #include #include #include #include #define MAX_NAME_LEN 8 extern time_t now; extern const char* home; extern const char* user; extern unsigned user_len; extern const char* group; extern unsigned group_len; extern uid_t uid; extern gid_t gid; extern str cwd; extern int lockhome; extern int nodotfiles; extern int bind_port_fd; /* In backend.c */ extern unsigned connect_timeout; extern void show_message_file(unsigned code); extern int handle_pass(void); /* In copy.c */ extern int netwrite(int out, const char* optr, unsigned long ocount, int timeout); extern int copy_xlate_close(int in, int out, int timeout, unsigned long (*xlate)(char* out, const char* in, unsigned long inlen), unsigned long* bytes_in, unsigned long* bytes_out); /* In list.c */ extern int list_options; extern int handle_list(void); extern int handle_nlst(void); /* In messagefile.c */ extern const char* message_file; extern void show_message_file(unsigned code); /* In path.c */ extern str fullpath; extern int qualify_validate(const char* path); extern int open_fd(const char* filename, int flags, int mode); /* In retr.c */ extern unsigned long startpos; extern int handle_rest(void); extern int handle_retr(void); /* In socket.c */ extern int handle_pasv(void); extern int handle_port(void); extern int make_in_connection(void); extern int make_out_connection(void); extern int close_out_connection(int); extern int parse_localip(const char*); extern int parse_remoteip(const char*); /* In stat.c */ extern int handle_size(void); extern int handle_mdtm(void); /* In statmod.c */ extern int handle_mdtm2(void); /* In state.c */ extern int binary_flag; extern int handle_type(void); extern int handle_stru(void); extern int handle_mode(void); extern int handle_cwd(void); extern int handle_pwd(void); extern int handle_cdup(void); /* In store.c */ extern int store_exclusive; extern int handle_stor(void); extern int handle_appe(void); extern int handle_mkd(void); extern int handle_rmd(void); extern int handle_dele(void); extern int handle_rnfr(void); extern int handle_rnto(void); extern int handle_site_chmod(void); #endif twoftpd-1.42/state.c0000664000076400007640000000455611732365413013777 0ustar bruceguenter/* state.c - twoftpd routines for managing current server state * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "twoftpd.h" #include "backend.h" #include int binary_flag = 0; str cwd = {0,0,0}; int handle_type(void) { if (!strcasecmp(req_param, "A") || !strcasecmp(req_param, "A N")) { binary_flag = 0; return respond(200, 1, "Transfer mode changed to ASCII."); } if (!strcasecmp(req_param, "I") || !strcasecmp(req_param, "L 8")) { binary_flag = 1; return respond(200, 1, "Transfer mode changed to BINARY."); } return respond(501, 1, "Unknown transfer type."); } int handle_stru(void) { if (!strcasecmp(req_param, "F")) return respond_ok(); return respond(504, 1, "Invalid parameter."); } int handle_mode(void) { if (!strcasecmp(req_param, "S")) return respond_ok(); return respond(504, 1, "Invalid parameter."); } int handle_cwd(void) { struct stat statbuf; if (!qualify_validate(req_param)) return 1; if (fullpath.len > 1) { if (stat(fullpath.s+1, &statbuf) == -1) return respond(550, 1, "Directory does not exist."); if (!S_ISDIR(statbuf.st_mode)) return respond(550, 1, "Is not a directory."); if (access(fullpath.s+1, X_OK) == -1) return respond_permission_denied(); } if (!str_copy(&cwd, &fullpath)) return respond_internal_error(); show_message_file(250); return respond(250, 1, "Changed directory."); } int handle_pwd(void) { return respond_start(257, 1) && respond_str("\"") && respond_str(cwd.s) && respond_str("\"") && respond_end(); } int handle_cdup(void) { req_param = ".."; return handle_cwd(); } twoftpd-1.42/backend.c0000664000076400007640000001127711732365413014244 0ustar bruceguenter/* backend.c - twoftpd back-end startup code * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include "twoftpd.h" #include "backend.h" uid_t uid; gid_t gid; const char* home; const char* user; unsigned user_len; const char* group; unsigned group_len; time_t now; int lockhome; int nodotfiles; int bind_port_fd = -1; unsigned connect_timeout = 0; int handle_pass(void) { return respond(230, 1, "Access has already been granted."); } static int load_tables(void) { /* Load some initial values that cannot be loaded once the chroot is done. */ /* A call to localtime should load and cache the timezone setting. */ now = time(0); localtime(&now); return 1; } static int parse_gids(const char* gids) { gid_t groups[NGROUPS_MAX]; int count; const char* ptr; ptr = gids; count = 0; while (*ptr != 0 && count < NGROUPS_MAX) { groups[count] = strtou(ptr, &ptr); if (*ptr != 0 && *ptr != ',') return 0; while (*ptr == ',') ++ptr; ++count; } if (setgroups(count, groups) == -1) return 0; return 1; } #define FAIL(MSG) do{ respond(421, 1, MSG); return 0; }while(0) int startup(int argc, char* argv[]) { const char* tmp; const char* end; const char* cwdstr; char* ptr; unsigned long session_timeout; unsigned startup_code; if ((tmp = getenv("TCPLOCALIP")) == 0) FAIL("Missing $TCPLOCALIP."); if (!parse_localip(tmp)) FAIL("Could not parse $TCPLOCALIP."); if ((tmp = getenv("TCPREMOTEIP")) == 0) FAIL("Missing $TCPREMOTEIP."); if (!parse_remoteip(tmp)) FAIL("Could not parse $TCPREMOTEIP."); if ((tmp = getenv("UID")) == 0) FAIL("Missing $UID."); if (!(uid = strtou(tmp, &end)) || *end) FAIL("Invalid $UID."); if ((tmp = getenv("GID")) == 0) FAIL("Missing $GID."); if (!(gid = strtou(tmp, &end)) || *end) FAIL("Invalid $GID."); if ((home = getenv("HOME")) == 0) FAIL("Missing $HOME."); if ((tmp = getenv("GIDS")) != 0 && !parse_gids(tmp)) FAIL("Could not parse or set supplementary group IDs."); /* Strip off trailing slashes in $HOME */ ptr = (char*)home + strlen(home)-1; while (ptr > home && *ptr == '/') *ptr-- = 0; if ((user = getenv("USER")) == 0) FAIL("Missing $USER."); if ((group = getenv("GROUP")) == 0) group = "mygroup"; if (chdir(home)) FAIL("Could not chdir to $HOME."); if (!load_tables()) FAIL("Loading startup tables failed."); if (getenv("CHROOT") != 0) { cwdstr = "/"; if (chroot(".")) FAIL("Could not chroot."); } else if (getenv("SOFTCHROOT") != 0) { cwdstr = "/"; } else { cwdstr = home; if (chdir("/")) FAIL("Could not chdir to '/'."); } if (!str_copys(&cwd, cwdstr)) FAIL("Could not set CWD string"); if (setgid(gid)) FAIL("Could not set GID."); if (setuid(uid)) FAIL("Could not set UID."); if ((user_len = strlen(user)) > MAX_NAME_LEN) { user_len = MAX_NAME_LEN; ((char*)user)[MAX_NAME_LEN] = 0; } if ((group_len = strlen(group)) > MAX_NAME_LEN) { group_len = MAX_NAME_LEN; ((char*)group)[MAX_NAME_LEN] = 0; } lockhome = (getenv("LOCKHOME") != 0); nodotfiles = (getenv("NODOTFILES") != 0); list_options = (nodotfiles ? 0 : PATH_MATCH_DOTFILES); session_timeout = 0; if ((tmp = getenv("SESSION_TIMEOUT")) != 0) session_timeout = strtou(tmp, &tmp); alarm(session_timeout); connect_timeout = timeout; if ((tmp = getenv("CONNECT_TIMEOUT")) != 0) connect_timeout = strtou(tmp, &tmp); if ((tmp = getenv("TWOFTPD_BIND_PORT_FD")) != 0) { if ((bind_port_fd = strtou(tmp, &end)) == 0 || *end != 0) FAIL("Invalid $TWOFTPD_BIND_PORT_FD"); } else bind_port_fd = -1; startup_code = (getenv("AUTHENTICATED") != 0) ? 230 : 220; if ((tmp = getenv("BANNER")) != 0) show_banner(startup_code, tmp); message_file = getenv("MESSAGEFILE"); show_message_file(startup_code); return respond(startup_code, 1, "Ready to transfer files."); (void)argc; (void)argv; } twoftpd-1.42/conf.c0000664000076400007640000000350211732365413013572 0ustar bruceguenter/* conf.c - Library for configuration programs * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "conf.h" #include #include obuf conf_out; static const char* currfile; const int msg_show_pid = 0; void start_file(const char* filename, int mode) { currfile = filename; if (!obuf_open(&conf_out, filename, OBUF_CREATE|OBUF_EXCLUSIVE, mode, 0)) die3sys(1, "Error creating file '", currfile, "'"); } void end_file(void) { if (!obuf_endl(&conf_out) || !obuf_close(&conf_out)) die3sys(1, "Error creating file '", currfile, "'"); } void make_file(const char* filename, int mode, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5, const char* s6, const char* s7) { start_file(filename, mode); obuf_put7s(&conf_out, s1, s2, s3, s4, s5, s6, s7); end_file(); } void make_fileu(const char* filename, unsigned val) { start_file(filename, 0644); obuf_putu(&conf_out, val); end_file(); } twoftpd-1.42/Makefile0000664000076400007640000001204511732365413014143 0ustar bruceguenter# Don't edit Makefile! Use conf-* for configuration. # # Generated by spac see http://untroubled.org/spac/ SHELL=/bin/sh DEFAULT: all all: libraries programs docs backend.a: makelib backend.o copy.o list.o messagefile.o path.o retr.o socket.o stat.o statmod.o state.o store.o ./makelib backend.a backend.o copy.o list.o messagefile.o path.o retr.o socket.o stat.o statmod.o state.o store.o backend.o: compile backend.c twoftpd.h backend.h ./compile backend.c banner.o: compile banner.c twoftpd.h ./compile banner.c clean: TARGETS rm -f `cat TARGETS` clean-spac: clean AUTOFILES rm -f `cat AUTOFILES` compile: conf-cc conf-bgincs ( bgincs=`head -n 1 conf-bgincs`; \ echo '#!/bin/sh'; \ echo 'source=$$1; shift'; \ echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \ echo exec `head -n 1 conf-cc` -I. "-I'$${bgincs}'" '-o $${base}.o -c $$source $${1+"$$@"}'; \ ) >compile chmod 755 compile conf.o: compile conf.c conf.h ./compile conf.c conf_bin.c: conf-bin head -n 1 conf-bin | \ sed -e 's/"/\\"/g' \ -e 's/^/const char conf_bin[] = "/' \ -e 's/$$/";/' >conf_bin.c copy.o: compile copy.c backend.h ./compile copy.c docs: twoftpd-auth.1.html twoftpd-xfer.1.html twoftpd-switch.1.html install: INSTHIER conf-bin conf-man bg-installer -v load chmod 755 load log.o: compile log.c log.h ./compile log.c main.a: makelib banner.o log.o main.o respond.o responses.o strtou.o ./makelib main.a banner.o log.o main.o respond.o responses.o strtou.o main.o: compile main.c twoftpd.h log.h ./compile main.c makelib: ( echo '#!/bin/sh'; \ echo 'lib="$$1"; shift';\ echo 'rm -f "$$lib"';\ echo 'ar cr "$$lib" $${1+"$$@"}';\ echo 'ranlib "$$lib"';\ ) >makelib chmod 755 makelib messagefile.o: compile messagefile.c twoftpd.h backend.h ./compile messagefile.c path.o: compile path.c twoftpd.h backend.h ./compile path.c programs: twoftpd-xfer twoftpd-auth twoftpd-conf twoftpd-anon twoftpd-anon-conf twoftpd-switch twoftpd-bind-port twoftpd-drop respond.o: compile respond.c twoftpd.h log.h ./compile respond.c responses.o: compile responses.c twoftpd.h ./compile responses.c retr.o: compile retr.c twoftpd.h backend.h ./compile retr.c socket.lib: compile load @echo -n 'Checking for socket libraries: ' @echo 'main() { ; }' >trylib-lsocket.c @{ ./compile trylib-lsocket.c && ./load trylib-lsocket -lsocket -lnsl; } >/dev/null 2>&1 \ && { echo -lsocket -lnsl >socket.lib; echo -lsocket -lnsl; } \ || { : >socket.lib; echo no; } @rm -f trylib-lsocket.c trylib-lsocket.o trylib-lsocket socket.o: compile socket.c twoftpd.h backend.h ./compile socket.c stat.o: compile stat.c twoftpd.h backend.h ./compile stat.c state.o: compile state.c twoftpd.h backend.h ./compile state.c statmod.o: compile statmod.c twoftpd.h backend.h ./compile statmod.c store.o: compile store.c twoftpd.h backend.h ./compile store.c strtou.o: compile strtou.c twoftpd.h ./compile strtou.c twoftpd-anon: twoftpd-anon.o load backend.a main.a socket.lib ./load twoftpd-anon backend.a main.a -lbg `cat socket.lib` twoftpd-anon-conf: twoftpd-anon-conf.o load conf.o ./load twoftpd-anon-conf conf.o -lbg twoftpd-anon-conf.o: compile twoftpd-anon-conf.c conf.h conf_bin.c ./compile twoftpd-anon-conf.c twoftpd-anon.o: compile twoftpd-anon.c twoftpd.h backend.h ./compile twoftpd-anon.c twoftpd-auth: twoftpd-auth.o load main.a socket.lib ./load twoftpd-auth main.a -lcvm-v2client -lbg `cat socket.lib` twoftpd-auth.1.html: twoftpd-auth.1 man2html twoftpd-auth.1 >twoftpd-auth.1.html twoftpd-auth.o: compile twoftpd-auth.c twoftpd.h ./compile twoftpd-auth.c twoftpd-bind-port: twoftpd-bind-port.o load respond.o log.o ./load twoftpd-bind-port respond.o log.o -lbg twoftpd-bind-port.o: compile twoftpd-bind-port.c twoftpd.h ./compile twoftpd-bind-port.c twoftpd-conf: twoftpd-conf.o load conf.o ./load twoftpd-conf conf.o -lbg twoftpd-conf.o: compile twoftpd-conf.c conf.h conf_bin.c ./compile twoftpd-conf.c twoftpd-drop: twoftpd-drop.o load backend.a main.a socket.lib ./load twoftpd-drop backend.a main.a -lbg `cat socket.lib` twoftpd-drop.o: compile twoftpd-drop.c twoftpd.h backend.h ./compile twoftpd-drop.c twoftpd-switch: twoftpd-switch.o load respond.o log.o ./load twoftpd-switch respond.o log.o -lbg twoftpd-switch.1.html: twoftpd-switch.1 man2html twoftpd-switch.1 >twoftpd-switch.1.html twoftpd-switch.o: compile twoftpd-switch.c twoftpd.h conf_bin.c ./compile twoftpd-switch.c twoftpd-xfer: twoftpd-xfer.o load backend.a main.a socket.lib ./load twoftpd-xfer backend.a main.a -lbg `cat socket.lib` twoftpd-xfer.1.html: twoftpd-xfer.1 man2html twoftpd-xfer.1 >twoftpd-xfer.1.html twoftpd-xfer.o: compile twoftpd-xfer.c twoftpd.h backend.h ./compile twoftpd-xfer.c twoftpd-1.42/twoftpd-log.run0000664000076400007640000000005311732365413015473 0ustar bruceguenter#!/bin/sh exec multilog t /var/log/twoftpd twoftpd-1.42/AUTOFILES0000664000076400007640000000013611732365413013757 0ustar bruceguenterAUTOFILES Makefile SRCFILES TARGETS conf-bgincs conf-bglibs conf-bin conf-cc conf-ld conf-man twoftpd-1.42/twoftpd-switch.10000664000076400007640000000110311732365413015544 0ustar bruceguenter.TH twoftpd-switch 1 .SH NAME twoftpd-switch \- TwoFTPD back-end switcher. .SH SYNOPSIS .B twoftpd-switch .SH DESCRIPTION .B twoftpd-switch examines the value of .B $SHELL to determine which back-end to execute. If .B $SHELL_WRITEONLY is set and matches the value of .BR $SHELL , .B twoftpd-drop is executed. If .B $SHELL_READONLY is set and matches the value of .BR $SHELL , .B twoftpd-anon is executed. Otherwise, .B twoftpd-xfer is executed. .SH NOTES .B twoftpd-switch prefixes the commands with the path in which the programs were installed. .SH SEE ALSO twoftpd-xfer(1) twoftpd-1.42/ANNOUNCEMENT0000664000076400007640000000773411732365413014331 0ustar bruceguenterVersion 1.42 of twoftpd is now available at: http://untroubled.org/twoftpd/ ------------------------------------------------------------------------------ Changes in version 1.42 - Fixed bug in reporting an error in closing the sending socket. - Fixed bug in reporting an error to list a single entry. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- twoftpd Simple secure efficient FTP server Bruce Guenter Version 1.42 2012-03-21 This is twoftpd, an FTP server that strives to be secure, simple, and efficient. None of the back end commands can cause execution of other programs, and the normal model of execution does a chroot to the logged in user's directory immediately after authentication. The name "twoftpd" comes from the fact that there were two parts to the server -- an authenticating front end, which contains no file or data transfer code, and a back end, which contains all the data transfer code. A mailing list has been set up to discuss this and other packages. To subscribe, send an email to: bgware-subscribe@lists.untroubled.org A mailing list archive is available at: http://lists.untroubled.org/?list=bgware Development versions of twoftpd are available via git at: git://untroubled.org/git/twoftpd.git Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ Installation: Check the build settings in the conf-* files and run "make". As root, run "make install". On 32-bit Linux, to allow access to files 2GB and larger, make sure -D_FILE_OFFSET_BITS=64 is in conf-cc. Programs: The package is broken down into two main programs: twoftpd-auth is a front-end that only accepts USER and PASS (and a few other "built-in") commands. Once a user is authenticated, it execs a back end program, typically twoftpd-xfer. This program changes to the home directory in $HOME, optionally does a chroot, and then drops root UID/GID to lock down all privileges. twoftpd-anon is a stripped-down version of twoftpd-xfer with all the filesystem modification commands removed to allow for read-only FTP access. It may be used even without twoftpd-auth to provide an anonymous FTP server. twoftpd-drop is another reduced back end. It allows only for uploading new files. Downloading, overwriting files, changing permissions, renaming, etc are all forbidden. All listings produce an empty result to make it harder to guess which file names already exist. Usage: For a server handling only non-anonymous logins, optionally set CHROOT and use: tcpserver -DHRv 0 ftp \ /usr/local/bin/twoftpd-auth \ /usr/local/bin/cvm-unix \ /usr/local/bin/twoftpd-xfer For a server handling only anonymous logins, set UID, GID, and HOME to appropriate values, set CHROOT to 1, and set USER and GROUP to "ftp", and use: tcpserver -DHRv 0 ftp /usr/local/bin/twoftpd-anon If you want to have both anonymous and non-anonymous logins on the same server, run both of the above two commands with two seperate IPs substituted for the "0" parameter. Because the FTP protocol does not support name-based virtual hosting, multiple anonymous servers must be run on separate IPs. See the man pages for twoftpd-auth and twoftpd-xfer for more details. Security notes: Unless you have specific reason not to, always run with CHROOT or SOFTCHROOT set. Always run twoftpd (and most other servers) with resources limits in effect. For example: tcpserver -DRHv 0 ftp softlimit -m 2000000 twoftpd-anon This will allow the server to consume up to 2MB of memory before being killed, which should be enough for most OS's, and still prevent memory overflow attacks. This program is Copyright(C) 2012 Bruce Guenter, and may be copied according to the GNU GENERAL PUBLIC LICENSE (GPL) Version 2 or a later version. A copy of this license is included with this package. This package comes with no warranty of any kind. twoftpd-1.42/path.c0000664000076400007640000000426711732365413013612 0ustar bruceguenter/* path.c - Routines for manipulating path strings * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "twoftpd.h" #include "backend.h" #include str fullpath; static int validate_fullpath(void) { errno = EPERM; if (lockhome) { unsigned long homelen = strlen(home); if (memcmp(fullpath.s, home, homelen) != 0 || (fullpath.s[homelen] != 0 && fullpath.s[homelen] != '/')) return 0; } if (nodotfiles) { long i; if (fullpath.s[0] == '.') return 0; if (fullpath.s[0] == '/' && fullpath.s[1] == '.') return 0; for (i = str_findlast(&fullpath, '/'); i > 0; i = str_findprev(&fullpath, '/', i-1)) if (fullpath.s[i+1] == '.') return 0; } errno = 0; return 1; } static int qualify(const char* path) { if (!str_copy(&fullpath, &cwd)) return 0; if (!path_merge(&fullpath, path)) return 0; return 1; } int qualify_validate(const char* path) { if (!qualify(path)) { respond_internal_error(); return 0; } if (!validate_fullpath()) { respond_permission_denied(); return 0; } return 1; } int open_fd(const char* filename, int flags, int mode) { int fd; struct stat st; if (!qualify(filename)) return -1; if (!validate_fullpath()) return -1; if ((fd = open(fullpath.s+1, flags, mode)) == -1) return -1; if (fstat(fd, &st) == 0) { if (S_ISREG(st.st_mode)) return fd; else errno = EPERM; } close(fd); return -1; }