diff -rNup vsftpd-1.1.3.orig/Makefile vsftpd-1.1.3-3/Makefile --- vsftpd-1.1.3.orig/Makefile 2002-10-21 19:15:16.000000000 -0400 +++ vsftpd-1.1.3-3/Makefile 2003-01-24 09:50:41.000000000 -0500 @@ -15,6 +15,10 @@ OBJS = main.o utility.o prelogin.o ftpcm ascii.o oneprocess.o twoprocess.o privops.o standalone.o hash.o \ tcpwrap.o \ sysutil.o sysdeputil.o +PREFIX = /usr/local +MANDIR = $(PREFIX)/man +SYSCONFDIR = /etc +DESTDIR = .c.o: $(CC) -c $*.c $(CFLAGS) $(IFLAGS) @@ -22,22 +26,15 @@ OBJS = main.o utility.o prelogin.o ftpcm vsftpd: $(OBJS) $(CC) -o vsftpd $(OBJS) $(LINK) $(LIBS) +.PHONY: install + install: - if [ -x /usr/local/sbin ]; then \ - $(INSTALL) -m 755 vsftpd /usr/local/sbin/vsftpd; \ - else \ - $(INSTALL) -m 755 vsftpd /usr/sbin/vsftpd; fi - if [ -x /usr/local/man ]; then \ - $(INSTALL) -D -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \ - $(INSTALL) -D -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \ - elif [ -x /usr/share/man ]; then \ - $(INSTALL) -D -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \ - $(INSTALL) -D -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \ - else \ - $(INSTALL) -D -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \ - $(INSTALL) -D -m 644 vsftpd.conf.5 /usr/man/man5/vsftpd.conf.5; fi - if [ -x /etc/xinetd.d ]; then \ - $(INSTALL) -m 644 xinetd.d/vsftpd /etc/xinetd.d/vsftpd; fi + $(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin $(DESTDIR)$(PREFIX)/man/man8 \ + $(DESTDIR)$(PREFIX)/man/man5 $(DESTDIR)$(SYSCONFDIR)/xinetd.d + $(INSTALL) -m 755 vsftpd $(DESTDIR)$(PREFIX)/sbin/vsftpd + $(INSTALL) -D -m 644 vsftpd.8 $(DESTDIR)$(PREFIX)/man/man8/vsftpd.8 + $(INSTALL) -D -m 644 vsftpd.conf.5 $(DESTDIR)$(PREFIX)/man/man5/vsftpd.conf.5 + $(INSTALL) -m 644 xinetd.d/vsftpd $(DESTDIR)$(SYSCONFDIR)/xinetd.d/vsftpd clean: rm -f *.o *.swp vsftpd diff -rNup vsftpd-1.1.3.orig/port/cygwin_bogons.h vsftpd-1.1.3-3/port/cygwin_bogons.h --- vsftpd-1.1.3.orig/port/cygwin_bogons.h 1969-12-31 19:00:00.000000000 -0500 +++ vsftpd-1.1.3-3/port/cygwin_bogons.h 2003-01-24 09:50:59.000000000 -0500 @@ -0,0 +1,14 @@ +#ifndef VSF_CYGWIN_BOGONS_H +#define VSF_CYGWIN_BOGONS_H + +/* Needed for Cygwin NT authentication */ +#include +#include +#include +#define is_winnt (GetVersion() < 0x80000000) + +/* Cygwin's root UID is that of the LocalSystem account (i.e., 18) */ +#undef VSFTP_ROOT_UID +#define VSFTP_ROOT_UID 18 + +#endif /* VSF_CYGWIN_BOGONS_H */ diff -rNup vsftpd-1.1.3.orig/port/porting_junk.h vsftpd-1.1.3-3/port/porting_junk.h --- vsftpd-1.1.3.orig/port/porting_junk.h 2002-09-25 14:16:24.000000000 -0400 +++ vsftpd-1.1.3-3/port/porting_junk.h 2003-01-24 09:50:41.000000000 -0500 @@ -21,6 +21,10 @@ #include "tru64_bogons.h" #endif +#ifdef __CYGWIN__ +#include "cygwin_bogons.h" +#endif + /* So many older systems lack these, that it's too much hassle to list all * the errant systems */ diff -rNup vsftpd-1.1.3.orig/sysdeputil.c vsftpd-1.1.3-3/sysdeputil.c --- vsftpd-1.1.3.orig/sysdeputil.c 2002-10-29 20:06:41.000000000 -0500 +++ vsftpd-1.1.3-3/sysdeputil.c 2003-01-24 09:50:41.000000000 -0500 @@ -99,6 +99,14 @@ #ifdef __sun #define VSF_SYSDEP_HAVE_SOLARIS_SENDFILE #endif + +#ifdef __CYGWIN__ + #define VSF_SYSDEP_NEED_OLD_FD_PASSING + #undef VSF_SYSDEP_HAVE_PAM + #undef VSF_SYSDEP_HAVE_SHADOW + #undef VSF_SYSDEP_HAVE_USERSHELL + #include +#endif /* END config */ /* PAM support - we include our own dummy version if the system lacks this */ @@ -220,6 +228,14 @@ vsf_sysdep_check_auth(const struct mystr } } #endif /* VSF_SYSDEP_HAVE_SHADOW */ +#ifdef __CYGWIN__ + if (is_winnt) + { + HANDLE token = cygwin_logon_user (p_pwd, str_getbuf(p_pass_str)); + cygwin_set_impersonation_token (token); + return token != INVALID_HANDLE_VALUE; + } +#endif p_crypted = crypt(str_getbuf(p_pass_str), p_pwd->pw_passwd); if (!vsf_sysutil_strcmp(p_crypted, p_pwd->pw_passwd)) { diff -rNup vsftpd-1.1.3.orig/sysutil.c vsftpd-1.1.3-3/sysutil.c --- vsftpd-1.1.3.orig/sysutil.c 2002-10-25 13:32:52.000000000 -0400 +++ vsftpd-1.1.3-3/sysutil.c 2003-01-24 09:50:41.000000000 -0500 @@ -15,6 +15,7 @@ #include "sysutil.h" #include "utility.h" #include "tunables.h" +#include "defs.h" /* Activate 64-bit file support on Linux/32bit */ #define _FILE_OFFSET_BITS 64 @@ -1806,7 +1807,7 @@ vsf_sysutil_get_random_byte(void) int vsf_sysutil_running_as_root(void) { - return (getuid() == 0); + return (getuid() == VSFTP_ROOT_UID); } void diff -rNup vsftpd-1.1.3.orig/twoprocess.c vsftpd-1.1.3-3/twoprocess.c --- vsftpd-1.1.3.orig/twoprocess.c 2002-10-25 13:28:25.000000000 -0400 +++ vsftpd-1.1.3-3/twoprocess.c 2003-01-24 09:50:41.000000000 -0500 @@ -24,6 +24,9 @@ #include "defs.h" #include "parseconf.h" +/* For Linux, this adds nothing :-) */ +#include "port/porting_junk.h" + static void drop_all_privs(void); static void handle_sigchld(int duff); static void process_login_req(struct vsf_session* p_sess); diff -rNup vsftpd-1.1.3.orig/vsf_findlibs.sh vsftpd-1.1.3-3/vsf_findlibs.sh --- vsftpd-1.1.3.orig/vsf_findlibs.sh 2002-10-27 19:12:53.000000000 -0500 +++ vsftpd-1.1.3-3/vsf_findlibs.sh 2003-01-24 09:50:41.000000000 -0500 @@ -35,6 +35,8 @@ elif [ -r /etc/redhat-release ]; then echo "-lcap"; fi exit +elif [ "`uname -s | cut -c -6`" = CYGWIN ]; then + echo "-lcrypt" fi # Look for PAM (done weirdly due to distribution bugs (e.g. Debian)