Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Fri, 12 Sep 2003 15:44:50 -0400 From: Jason Tishler To: cygwin AT cygwin DOT com Subject: Re: VSFtpD on Cygwin Message-ID: <20030912194450.GJ1840@tishler.net> Mail-Followup-To: cygwin AT cygwin DOT com References: <1063389343 DOT 3304 DOT 39 DOT camel AT sm-joelinux> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oTHb8nViIGeoXxdp" Content-Disposition: inline In-Reply-To: <1063389343.3304.39.camel@sm-joelinux> User-Agent: Mutt/1.4i --oTHb8nViIGeoXxdp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Joe, On Fri, Sep 12, 2003 at 10:55:47AM -0700, Joseph Ishak wrote: > Where can I get Jason Tishler's VSFtpD port for cygwin as mentioned > here > > http://www.cygwin.com/ml/cygwin/2003-04/msg01844.html Umm... No where. > I am attempting to use ProFtpD to do some stuff with 2000/xp and I am > having what appears to be the same problem that precipitated the post > above. What problems are you having with proftpd? AFAICT, the text vs. binary issues have been resolved since the above post. > I tried searching through the cygwin installer but came up blank. I > didn't see an experimental or test release listed on the servers. I > tried connecting to the mirrors directly but came up blank as well. > Any suggestions would be helpful. I have been meaning to post my latest vsftpd patch to the list -- thanks for the motivation. See attached. However, I must warn you that Cygwin vsftpd can corrupt data under certain conditions: http://www.cygwin.com/ml/cygwin/2003-05/msg00246.html Jason -- PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6 --oTHb8nViIGeoXxdp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="vsftpd.patch" 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) --oTHb8nViIGeoXxdp Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --oTHb8nViIGeoXxdp--