diff options
| author | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
|---|---|---|
| committer | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
| commit | 709c4d66e0b107ca606941b988bad717c0b45d9b (patch) | |
| tree | 37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/vsftpd | |
| parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) | |
rename packages/ to recipes/ per earlier agreement
See links below for more details:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Acked-by: Mike Westerhof <mwester@dls.net>
Acked-by: Philip Balister <philip@balister.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Marcin Juszkiewicz <hrw@openembedded.org>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/vsftpd')
| -rwxr-xr-x | recipes/vsftpd/files/init | 41 | ||||
| -rwxr-xr-x | recipes/vsftpd/files/vsftpd.conf | 108 | ||||
| -rw-r--r-- | recipes/vsftpd/vsftpd-2.0.5/makefile.patch | 47 | ||||
| -rw-r--r-- | recipes/vsftpd/vsftpd-2.0.5/nopam.patch | 12 | ||||
| -rw-r--r-- | recipes/vsftpd/vsftpd-2.0.5/syscall.patch | 12 | ||||
| -rw-r--r-- | recipes/vsftpd/vsftpd-charconv-2.0.5/vsftpd-charconv.patch | 4365 | ||||
| -rw-r--r-- | recipes/vsftpd/vsftpd-charconv_2.0.5.bb | 50 | ||||
| -rw-r--r-- | recipes/vsftpd/vsftpd_2.0.5.bb | 45 |
8 files changed, 4680 insertions, 0 deletions
diff --git a/recipes/vsftpd/files/init b/recipes/vsftpd/files/init new file mode 100755 index 0000000000..d0ec010dc7 --- /dev/null +++ b/recipes/vsftpd/files/init @@ -0,0 +1,41 @@ +#!/bin/sh +DAEMON=/usr/sbin/vsftpd +NAME=vsftpd +DESC="FTP Server" +ARGS="" +FTPDIR=/var/lib/ftp + +test -f $DAEMON || exit 0 + +set -e + +case "$1" in + start) + echo -n "* starting $DESC: $NAME... " + if ! test -d $FTPDIR; then + mkdir -p $FTPDIR/in + chown ftp $FTPDIR -R + chmod a-w $FTPDIR + chmod u+w $FTPDIR/in + fi + start-stop-daemon -S -b -x $DAEMON -- $ARGS + echo "done." + ;; + stop) + echo -n "* stopping $DESC: $NAME... " + start-stop-daemon -K -x $DAEMON + echo "done." + ;; + restart) + echo "* restarting $DESC: $NAME... " + $0 stop + $0 start + echo "done." + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + +exit 0 diff --git a/recipes/vsftpd/files/vsftpd.conf b/recipes/vsftpd/files/vsftpd.conf new file mode 100755 index 0000000000..08f91e048d --- /dev/null +++ b/recipes/vsftpd/files/vsftpd.conf @@ -0,0 +1,108 @@ +# Example config file /etc/vsftpd.conf +# +# The default compiled in settings are fairly paranoid. This sample file +# loosens things up a bit, to make the ftp daemon more usable. +# Please see vsftpd.conf.5 for all compiled in defaults. +# +# READ THIS: This example file is NOT an exhaustive list of vsftpd options. +# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's +# capabilities. + +# run standalone +listen=YES + +# Allow anonymous FTP? (Beware - allowed by default if you comment this out). +anonymous_enable=YES +# +# Uncomment this to allow local users to log in. +#local_enable=YES +# +# Uncomment this to enable any form of FTP write command. +write_enable=YES +# +# Default umask for local users is 077. You may wish to change this to 022, +# if your users expect that (022 is used by most other ftpd's) +#local_umask=022 +# +# Uncomment this to allow the anonymous FTP user to upload files. This only +# has an effect if the above global write enable is activated. Also, you will +# obviously need to create a directory writable by the FTP user. +#anon_upload_enable=YES +# +# Uncomment this if you want the anonymous FTP user to be able to create +# new directories. +#anon_mkdir_write_enable=YES +# +# Activate directory messages - messages given to remote users when they +# go into a certain directory. +dirmessage_enable=YES +# +# Activate logging of uploads/downloads. +xferlog_enable=YES +# +# Make sure PORT transfer connections originate from port 20 (ftp-data). +connect_from_port_20=YES +# +# If you want, you can arrange for uploaded anonymous files to be owned by +# a different user. Note! Using "root" for uploaded files is not +# recommended! +#chown_uploads=YES +#chown_username=whoever +# +# You may override where the log file goes if you like. The default is shown +# below. +#xferlog_file=/var/log/vsftpd.log +# +# If you want, you can have your log file in standard ftpd xferlog format +#xferlog_std_format=YES +# +# You may change the default value for timing out an idle session. +#idle_session_timeout=600 +# +# You may change the default value for timing out a data connection. +#data_connection_timeout=120 +# +# It is recommended that you define on your system a unique user which the +# ftp server can use as a totally isolated and unprivileged user. +#nopriv_user=ftpsecure +# +# Enable this and the server will recognise asynchronous ABOR requests. Not +# recommended for security (the code is non-trivial). Not enabling it, +# however, may confuse older FTP clients. +#async_abor_enable=YES +# +# By default the server will pretend to allow ASCII mode but in fact ignore +# the request. Turn on the below options to have the server actually do ASCII +# mangling on files when in ASCII mode. +# Beware that turning on ascii_download_enable enables malicious remote parties +# to consume your I/O resources, by issuing the command "SIZE /big/file" in +# ASCII mode. +# These ASCII options are split into upload and download because you may wish +# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking), +# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be +# on the client anyway.. +#ascii_upload_enable=YES +#ascii_download_enable=YES +# +# You may fully customise the login banner string: +#ftpd_banner=Welcome to blah FTP service. +# +# You may specify a file of disallowed anonymous e-mail addresses. Apparently +# useful for combatting certain DoS attacks. +#deny_email_enable=YES +# (default follows) +#banned_email_file=/etc/vsftpd.banned_emails +# +# You may specify an explicit list of local users to chroot() to their home +# directory. If chroot_local_user is YES, then this list becomes a list of +# users to NOT chroot(). +#chroot_list_enable=YES +# (default follows) +#chroot_list_file=/etc/vsftpd.chroot_list +# +# You may activate the "-R" option to the builtin ls. This is disabled by +# default to avoid remote users being able to cause excessive I/O on large +# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume +# the presence of the "-R" option, so there is a strong case for enabling it. +#ls_recurse_enable=YES + diff --git a/recipes/vsftpd/vsftpd-2.0.5/makefile.patch b/recipes/vsftpd/vsftpd-2.0.5/makefile.patch new file mode 100644 index 0000000000..3bf8f97671 --- /dev/null +++ b/recipes/vsftpd/vsftpd-2.0.5/makefile.patch @@ -0,0 +1,47 @@ +diff -ur vsftpd-2.0.1_org/Makefile vsftpd-2.0.1_patch/Makefile +--- vsftpd-2.0.1_org/Makefile 2004-06-06 18:21:27.000000000 +0200 ++++ vsftpd-2.0.1_patch/Makefile 2004-07-21 09:50:25.245576352 +0200 +@@ -5,7 +5,7 @@ + #CFLAGS = -g + CFLAGS = -O2 -Wall -W -Wshadow #-pedantic -Werror -Wconversion + +-LIBS = `./vsf_findlibs.sh` ++LIBS = -lssl -lcrypto -lnsl -lresolv + LINK = -Wl,-s + + OBJS = main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o \ +@@ -24,21 +24,21 @@ + $(CC) -o vsftpd $(OBJS) $(LINK) $(LIBS) + + install: +- if [ -x /usr/local/sbin ]; then \ +- $(INSTALL) -m 755 vsftpd /usr/local/sbin/vsftpd; \ ++ if [ -x ${DESTDIR}/usr/local/sbin ]; then \ ++ $(INSTALL) -m 755 vsftpd ${DESTDIR}/usr/local/sbin/vsftpd; \ + else \ +- $(INSTALL) -m 755 vsftpd /usr/sbin/vsftpd; fi +- if [ -x /usr/local/man ]; then \ +- $(INSTALL) -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \ +- $(INSTALL) -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \ +- elif [ -x /usr/share/man ]; then \ +- $(INSTALL) -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \ +- $(INSTALL) -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \ ++ $(INSTALL) -m 755 vsftpd ${DESTDIR}/usr/sbin/vsftpd; fi ++ if [ -x ${DESTDIR}/usr/local/man ]; then \ ++ $(INSTALL) -m 644 vsftpd.8 ${DESTDIR}/usr/local/man/man8/vsftpd.8; \ ++ $(INSTALL) -m 644 vsftpd.conf.5 ${DESTDIR}/usr/local/man/man5/vsftpd.conf.5; \ ++ elif [ -x ${DESTDIR}/usr/share/man ]; then \ ++ $(INSTALL) -m 644 vsftpd.8 ${DESTDIR}/usr/share/man/man8/vsftpd.8; \ ++ $(INSTALL) -m 644 vsftpd.conf.5 ${DESTDIR}/usr/share/man/man5/vsftpd.conf.5; \ + else \ +- $(INSTALL) -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \ +- $(INSTALL) -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) -m 644 vsftpd.8 ${DESTDIR}/usr/man/man8/vsftpd.8; \ ++ $(INSTALL) -m 644 vsftpd.conf.5 ${DESTDIR}/usr/man/man5/vsftpd.conf.5; fi ++ if [ -x ${DESTDIR}/etc/xinetd.d ]; then \ ++ $(INSTALL) -m 644 xinetd.d/vsftpd ${DESTDIR}/etc/xinetd.d/vsftpd; fi + + clean: + rm -f *.o *.swp vsftpd diff --git a/recipes/vsftpd/vsftpd-2.0.5/nopam.patch b/recipes/vsftpd/vsftpd-2.0.5/nopam.patch new file mode 100644 index 0000000000..8e0559cad1 --- /dev/null +++ b/recipes/vsftpd/vsftpd-2.0.5/nopam.patch @@ -0,0 +1,12 @@ +diff -ur vsftpd-2.0.1_org/builddefs.h vsftpd-2.0.1_patch/builddefs.h +--- vsftpd-2.0.1_org/builddefs.h 2004-07-02 16:36:59.000000000 +0200 ++++ vsftpd-2.0.1_patch/builddefs.h 2004-07-21 09:34:49.044900488 +0200 +@@ -2,7 +2,7 @@ + #define VSF_BUILDDEFS_H + + #undef VSF_BUILD_TCPWRAPPERS +-#define VSF_BUILD_PAM ++#undef VSF_BUILD_PAM + #undef VSF_BUILD_SSL + + #endif /* VSF_BUILDDEFS_H */ diff --git a/recipes/vsftpd/vsftpd-2.0.5/syscall.patch b/recipes/vsftpd/vsftpd-2.0.5/syscall.patch new file mode 100644 index 0000000000..b91cd5392b --- /dev/null +++ b/recipes/vsftpd/vsftpd-2.0.5/syscall.patch @@ -0,0 +1,12 @@ +Index: vsftpd-2.0.5/sysdeputil.c +=================================================================== +--- vsftpd-2.0.5.orig/sysdeputil.c 2007-05-20 21:20:01.000000000 +0200 ++++ vsftpd-2.0.5/sysdeputil.c 2007-05-20 21:20:28.000000000 +0200 +@@ -159,7 +159,6 @@ + #include <linux/capability.h> + #include <errno.h> + #include <syscall.h> +-_syscall2(int, capset, cap_user_header_t, header, const cap_user_data_t, data) + /* Gross HACK to avoid warnings - linux headers overlap glibc headers */ + #undef __NFDBITS + #undef __FDMASK diff --git a/recipes/vsftpd/vsftpd-charconv-2.0.5/vsftpd-charconv.patch b/recipes/vsftpd/vsftpd-charconv-2.0.5/vsftpd-charconv.patch new file mode 100644 index 0000000000..affdd32075 --- /dev/null +++ b/recipes/vsftpd/vsftpd-charconv-2.0.5/vsftpd-charconv.patch @@ -0,0 +1,4365 @@ +This patch is extracted and cleaned up version of filename character +set conversion patches for vsftpd by Dmitriy Balashov, +http://vsftpd.devnet.ru/eng/ . It provides dirty-pragmatics approach +towards serving Windows codepages encoded filenames to Windows clients +out of normal utf-8 filesystem. + +These patches will never be accepted upstream, they should never be merged +to main vsftpd package, and they for sure void "vs" in "vsftpd". So again, +they are for users to prefer stone-dead pragmatics. Use at you own risk. + +- Paul Sokolovsky, pmiscml@gmail.com + +diff -urN vsftpd-2.0.5.org/charconv.c vsftpd-2.0.5/charconv.c +--- vsftpd-2.0.5.org/charconv.c 1970-01-01 03:00:00.000000000 +0300 ++++ vsftpd-2.0.5/charconv.c 2008-01-13 20:39:49.000000000 +0200 +@@ -0,0 +1,462 @@ ++/* ++ * Part of Very Secure FTPd ++ * Licence: GPL v2 ++ * Author: Dmitriy Balashov ++ * charconv.c ++ */ ++ ++#include "charconv.h" ++#include "tunables.h" ++#include "session.h" ++#include "str.h" ++#include "sysutil.h" ++ ++#include "char_maps/utf8.map" ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++#include "char_maps/cyrillic.map" ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++#include "char_maps/western.map" ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++#include "char_maps/central.map" ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++#include "char_maps/soutern.map" ++#endif ++ ++/* Tables mapping supported codepage names to runtime variables */ ++static struct available_charsets ++{ ++ const char* p_charset_name; ++ int p_variable; ++} ++available_charsets_array[] = ++{ ++ { VSFTP_CP_NONE , VSFTP_C_NONE }, ++ // Cyrillic ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++ { VSFTP_CP_UTF_8 , VSFTP_C_UTF8 }, ++ { VSFTP_CP_UTF8 , VSFTP_C_UTF8 }, ++ { VSFTP_CP_WIN_1251 , VSFTP_C_1251 }, ++ { VSFTP_CP_WIN1251 , VSFTP_C_1251 }, ++ { VSFTP_CP_CP1251 , VSFTP_C_1251 }, ++ { VSFTP_CP_1251 , VSFTP_C_1251 }, ++ { VSFTP_CP_KOI8_R , VSFTP_C_878R }, ++ { VSFTP_CP_KOI8R , VSFTP_C_878R }, ++ { VSFTP_CP_CP878 , VSFTP_C_878R }, ++ { VSFTP_CP_878 , VSFTP_C_878R }, ++ { VSFTP_CP_CP878R , VSFTP_C_878R }, ++ { VSFTP_CP_878R , VSFTP_C_878R }, ++ { VSFTP_CP_KOI8_U , VSFTP_C_878U }, ++ { VSFTP_CP_KOI8U , VSFTP_C_878U }, ++ { VSFTP_CP_CP878U , VSFTP_C_878U }, ++ { VSFTP_CP_878U , VSFTP_C_878U }, ++ { VSFTP_CP_IBM866 , VSFTP_C_866 }, ++ { VSFTP_CP_CP866 , VSFTP_C_866 }, ++ { VSFTP_CP_866 , VSFTP_C_866 }, ++ { VSFTP_CP_ISO8859_5 , VSFTP_C_ISO5 }, ++ { VSFTP_CP_ISO5 , VSFTP_C_ISO5 }, ++#endif ++ // Western European ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++ { VSFTP_CP_ISO8859_1 , VSFTP_C_ISO1 }, ++ { VSFTP_CP_ISO1 , VSFTP_C_ISO1 }, ++ { VSFTP_CP_LATIN1 , VSFTP_C_ISO1 }, ++ { VSFTP_CP_ISO8859_15, VSFTP_C_ISO15 }, ++ { VSFTP_CP_ISO15 , VSFTP_C_ISO15 }, ++ { VSFTP_CP_LATIN9 , VSFTP_C_ISO15 }, ++ { VSFTP_CP_WIN_1252 , VSFTP_C_1252 }, ++ { VSFTP_CP_WIN1252 , VSFTP_C_1252 }, ++ { VSFTP_CP_CP1252 , VSFTP_C_1252 }, ++ { VSFTP_CP_1252 , VSFTP_C_1252 }, ++#endif ++ // Central European ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++ { VSFTP_CP_ISO8859_2 , VSFTP_C_ISO2 }, ++ { VSFTP_CP_ISO2 , VSFTP_C_ISO2 }, ++ { VSFTP_CP_LATIN2 , VSFTP_C_ISO2 }, ++ { VSFTP_CP_ISO8859_16, VSFTP_C_ISO16 }, ++ { VSFTP_CP_ISO16 , VSFTP_C_ISO16 }, ++ { VSFTP_CP_WIN_1250 , VSFTP_C_1250 }, ++ { VSFTP_CP_WIN1250 , VSFTP_C_1250 }, ++ { VSFTP_CP_CP1250 , VSFTP_C_1250 }, ++ { VSFTP_CP_1250 , VSFTP_C_1250 }, ++#endif ++ // Soutern European ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++ { VSFTP_CP_ISO8859_3 , VSFTP_C_ISO3 }, ++ { VSFTP_CP_ISO3 , VSFTP_C_ISO3 }, ++ { VSFTP_CP_LATIN3 , VSFTP_C_ISO3 }, ++#endif ++ { 0, 0 } ++}; ++ ++/* Available convertions */ ++static struct available_convertions ++{ ++ int local; ++ int remote; ++ int localCharset; ++ int remoteCharset; ++} ++available_convertions_array[] = ++{ // Cyrillic ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++ { VSFTP_C_UTF8 , VSFTP_C_1251 , VSFTP_CS_UTF8CYR , VSFTP_CS_1251 }, ++ { VSFTP_C_UTF8 , VSFTP_C_878R , VSFTP_CS_UTF8CYR , VSFTP_CS_878R }, ++ { VSFTP_C_UTF8 , VSFTP_C_878U , VSFTP_CS_UTF8CYR , VSFTP_CS_878U }, ++ { VSFTP_C_UTF8 , VSFTP_C_866 , VSFTP_CS_UTF8CYR , VSFTP_CS_866 }, ++ { VSFTP_C_UTF8 , VSFTP_C_ISO5 , VSFTP_CS_UTF8CYR , VSFTP_CS_ISO5 }, ++ { VSFTP_C_1251 , VSFTP_C_UTF8 , VSFTP_CS_1251 , VSFTP_CS_UTF8CYR }, ++ { VSFTP_C_1251 , VSFTP_C_878R , VSFTP_CS_1251 , VSFTP_CS_878R }, ++ { VSFTP_C_1251 , VSFTP_C_878U , VSFTP_CS_1251 , VSFTP_CS_878U }, ++ { VSFTP_C_1251 , VSFTP_C_866 , VSFTP_CS_1251 , VSFTP_CS_866 }, ++ { VSFTP_C_1251 , VSFTP_C_ISO5 , VSFTP_CS_1251 , VSFTP_CS_ISO5 }, ++ { VSFTP_C_878R , VSFTP_C_UTF8 , VSFTP_CS_878R , VSFTP_CS_UTF8CYR }, ++ { VSFTP_C_878R , VSFTP_C_1251 , VSFTP_CS_878R , VSFTP_CS_1251 }, ++ { VSFTP_C_878R , VSFTP_C_878U , VSFTP_CS_878R , VSFTP_CS_878U }, ++ { VSFTP_C_878R , VSFTP_C_866 , VSFTP_CS_878R , VSFTP_CS_866 }, ++ { VSFTP_C_878R , VSFTP_C_ISO5 , VSFTP_CS_878R , VSFTP_CS_ISO5 }, ++ { VSFTP_C_866 , VSFTP_C_UTF8 , VSFTP_CS_866 , VSFTP_CS_UTF8CYR }, ++ { VSFTP_C_866 , VSFTP_C_1251 , VSFTP_CS_866 , VSFTP_CS_1251 }, ++ { VSFTP_C_866 , VSFTP_C_878R , VSFTP_CS_866 , VSFTP_CS_878R }, ++ { VSFTP_C_866 , VSFTP_C_878U , VSFTP_CS_866 , VSFTP_CS_878U }, ++ { VSFTP_C_866 , VSFTP_C_ISO5 , VSFTP_CS_866 , VSFTP_CS_ISO5 }, ++ { VSFTP_C_ISO5 , VSFTP_C_UTF8 , VSFTP_CS_ISO5 , VSFTP_CS_UTF8CYR }, ++ { VSFTP_C_ISO5 , VSFTP_C_1251 , VSFTP_CS_ISO5 , VSFTP_CS_1251 }, ++ { VSFTP_C_ISO5 , VSFTP_C_878R , VSFTP_CS_ISO5 , VSFTP_CS_878R }, ++ { VSFTP_C_ISO5 , VSFTP_C_878U , VSFTP_CS_ISO5 , VSFTP_CS_878U }, ++ { VSFTP_C_ISO5 , VSFTP_C_866 , VSFTP_CS_ISO5 , VSFTP_CS_866 }, ++#endif ++ // Western European ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++ { VSFTP_C_UTF8 , VSFTP_C_ISO1 , VSFTP_CS_UTF8WEST , VSFTP_CS_ISO1 }, ++ { VSFTP_C_UTF8 , VSFTP_C_ISO15 , VSFTP_CS_UTF8WEST , VSFTP_CS_ISO15 }, ++ { VSFTP_C_UTF8 , VSFTP_C_1252 , VSFTP_CS_UTF8WEST , VSFTP_CS_1252 }, ++ { VSFTP_C_ISO1 , VSFTP_C_UTF8 , VSFTP_CS_ISO1 , VSFTP_CS_UTF8WEST }, ++ { VSFTP_C_ISO1 , VSFTP_C_ISO15 , VSFTP_CS_ISO1 , VSFTP_CS_ISO15 }, ++ { VSFTP_C_ISO1 , VSFTP_C_1252 , VSFTP_CS_ISO1 , VSFTP_CS_1252 }, ++ { VSFTP_C_ISO15 , VSFTP_C_UTF8 , VSFTP_CS_ISO15 , VSFTP_CS_UTF8WEST }, ++ { VSFTP_C_ISO15 , VSFTP_C_ISO1 , VSFTP_CS_ISO15 , VSFTP_CS_ISO1 }, ++ { VSFTP_C_ISO15 , VSFTP_C_1252 , VSFTP_CS_ISO15 , VSFTP_CS_1252 }, ++ { VSFTP_C_1252 , VSFTP_C_UTF8 , VSFTP_CS_1252 , VSFTP_CS_UTF8WEST }, ++ { VSFTP_C_1252 , VSFTP_C_ISO1 , VSFTP_CS_1252 , VSFTP_CS_ISO1 }, ++ { VSFTP_C_1252 , VSFTP_C_ISO15 , VSFTP_CS_1252 , VSFTP_CS_ISO15 }, ++#endif ++ // Central European ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++ { VSFTP_C_UTF8 , VSFTP_C_ISO2 , VSFTP_CS_UTF8CENT , VSFTP_CS_ISO2 }, ++ { VSFTP_C_UTF8 , VSFTP_C_ISO16 , VSFTP_CS_UTF8CENT , VSFTP_CS_ISO16 }, ++ { VSFTP_C_UTF8 , VSFTP_C_1250 , VSFTP_CS_UTF8CENT , VSFTP_CS_1250 }, ++ { VSFTP_C_ISO2 , VSFTP_C_UTF8 , VSFTP_CS_ISO2 , VSFTP_CS_UTF8CENT }, ++ { VSFTP_C_ISO2 , VSFTP_C_ISO16 , VSFTP_CS_ISO2 , VSFTP_CS_ISO16 }, ++ { VSFTP_C_ISO2 , VSFTP_C_1250 , VSFTP_CS_ISO2 , VSFTP_CS_1250 }, ++ { VSFTP_C_ISO16 , VSFTP_C_UTF8 , VSFTP_CS_ISO16 , VSFTP_CS_UTF8CENT }, ++ { VSFTP_C_ISO16 , VSFTP_C_ISO2 , VSFTP_CS_ISO16 , VSFTP_CS_ISO2 }, ++ { VSFTP_C_ISO16 , VSFTP_C_1250 , VSFTP_CS_ISO16 , VSFTP_CS_1250 }, ++ { VSFTP_C_1250 , VSFTP_C_UTF8 , VSFTP_CS_1250 , VSFTP_CS_UTF8CENT }, ++ { VSFTP_C_1250 , VSFTP_C_ISO2 , VSFTP_CS_1250 , VSFTP_CS_ISO2 }, ++ { VSFTP_C_1250 , VSFTP_C_ISO16 , VSFTP_CS_1250 , VSFTP_CS_ISO16 }, ++#endif ++ // Soutern European ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++ { VSFTP_C_UTF8 , VSFTP_C_ISO3 , VSFTP_CS_UTF8SOUT , VSFTP_CS_ISO3 }, ++ { VSFTP_C_ISO3 , VSFTP_C_UTF8 , VSFTP_CS_ISO3 , VSFTP_CS_UTF8SOUT }, ++#endif ++ ++ { 0, 0, 0, 0 } ++}; ++ ++map_ptr map_array[] = ++{ ++ 0, ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++ codepage_utf8cyr_array, codepage_win1251_array, codepage_koi8r_array, ++ codepage_ibm866_array, codepage_iso5_array, codepage_koi8u_array, ++#else ++ 0, 0, 0, 0, 0, ++#endif ++ ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++ codepage_utf8west_array, codepage_iso1_array, codepage_iso15_array, ++ codepage_win1252_array, ++#else ++ 0, 0, 0, 0, ++#endif ++ ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++ codepage_utf8cent_array, codepage_iso2_array, codepage_iso16_array, ++ codepage_win1250_array, ++#else ++ 0, 0, 0, 0, ++#endif ++ ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++ codepage_utf8sout_array, codepage_iso3_array, ++#else ++ 0, 0, ++#endif ++ ++ 0 ++}; ++ ++/* Initial table for work with unprintable chars */ ++map_ptr init_array[] = ++{ ++ 0, ++ codepage_utf8_array, ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++ codepage_win1251_array, codepage_koi8r_array, codepage_ibm866_array, ++ codepage_iso5_array, codepage_koi8u_array, ++#else ++ 0, 0, 0, 0, ++#endif ++ ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++ codepage_iso1_array, codepage_iso15_array, codepage_win1252_array, ++#else ++ 0, 0, 0, ++#endif ++ ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++ codepage_iso2_array, codepage_iso16_array, codepage_win1250_array, ++#else ++ 0, 0, 0, ++#endif ++ ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++ codepage_iso3_array, ++#else ++ 0, ++#endif ++ ++ 0 ++}; ++ ++map_ptr localMap = 0, remoteMap = 0; ++map_ptr localTbl = 0, remoteTbl = 0; ++ ++void char_convertion(struct mystr* p_str, int direction, char unprintable); ++void InitTables(map_ptr* map, map_ptr* table, int indexx); ++static int char_len(unsigned int s); ++static unsigned int bsearch_index(map_ptr map, unsigned int low, unsigned int high, unsigned int char_code); ++ ++const char* vsf_charconv_charset_name(int code) ++{ ++ int i = 0; ++ while (available_charsets_array [i].p_charset_name && available_charsets_array [i].p_variable != code) i++; ++ return available_charsets_array [i].p_charset_name; ++} ++ ++int vsf_charconv_codepage(const char* p_str) ++{ ++ const struct available_charsets* charsets = available_charsets_array; ++ ++ while (charsets->p_charset_name != 0) ++ { ++ if (!vsf_sysutil_strcmp(charsets->p_charset_name, p_str)) ++ { ++ return charsets->p_variable; ++ } ++ charsets++; ++ } ++ ++ return 0; ++} ++ ++int vsf_charconv_avail_convertion(int localCode, int remoteCode) ++{ ++ const struct available_convertions* aconv = available_convertions_array; ++ ++ while (aconv->local != 0) ++ { ++ if (localCode == aconv->local && remoteCode == aconv->remote) ++ { ++ InitTables(&localMap, &localTbl, aconv->localCharset); ++ InitTables(&remoteMap, &remoteTbl, aconv->remoteCharset); ++ return 1; ++ } ++ aconv++; ++ } ++ ++ return 0; ++} ++ ++void vsf_charconv_init_local_codepage(int localCode) ++{ ++ if (!localCode) ++ { ++ return; ++ } ++ ++ localTbl = init_array [localCode]; ++ localMap = vsf_sysutil_malloc((localTbl [0].order + 1) * sizeof(_codepage_map)); ++ localMap [0].char_code = localTbl [0].char_code; ++ localMap [0].order = localTbl [0].order; ++ ++ int indexx = 1; ++ while (localTbl [indexx].char_code) ++ { ++ if (localTbl [indexx].order) ++ { ++ localMap [localTbl [indexx].order].char_code = localTbl [indexx].char_code; ++ localMap [localTbl [indexx].order].order = indexx; ++ } ++ indexx++; ++ } ++ ++ return; ++} ++ ++void vsf_charconv_convert(struct vsf_session* p_sess, struct mystr* p_str, int direction) ++{ ++ if (!p_sess->enable_conversion || !p_sess->remote_charset || !tunable_local_codepage) return; ++ ++ char_convertion(p_str, direction, '?'); ++} ++ ++void vsf_charconv_replace_unprintable(struct mystr* p_str, char new_char) ++{ ++ if (localMap) char_convertion(p_str, VSFTP_CONVDIRECT_UNPRINTABLE, new_char); ++} ++ ++void InitTables(map_ptr* map, map_ptr* table, int indexx) ++{ ++ *table = map_array [indexx]; ++ ++ if (*map) vsf_sysutil_free(*map); ++ ++ *map = vsf_sysutil_malloc(((*table) [0].order + 1) * sizeof(_codepage_map)); ++ (*map) [0].char_code = (*table) [0].char_code; ++ (*map) [0].order = (*table) [0].order; ++ ++ indexx = 1; ++ while ((*table) [indexx].char_code) ++ { ++ if ((*table) [indexx].order) ++ { ++ (*map) [(*table) [indexx].order].char_code = (*table) [indexx].char_code; ++ (*map) [(*table) [indexx].order].order = indexx; ++ } ++ indexx++; ++ } ++ ++ return; ++} ++ ++static int char_len(unsigned int s) ++{ ++ int len = 1; ++ if ((s & 0x80) == 0x00) len = 1; ++ else if ((s & 0xe0) == 0xc0) len = 2; ++ else if ((s & 0xf0) == 0xe0) len = 3; ++ else if ((s & 0xf8) == 0xf0) len = 4; ++// else if ((s & 0xfc) == 0xf8) len = 5; ++// else if ((s & 0xfe) == 0xce) len = 6; ++ return (len); ++} ++ ++static unsigned int bsearch_index(map_ptr map, unsigned int low, unsigned int high, unsigned int char_code) ++{ ++ unsigned int m, l = low, r = high; ++ ++ m = (l + r) >> 1; ++ while ((m != 0) && (map [m].char_code != char_code)) ++ { ++ if (map [m].char_code < char_code) l = m + 1; ++ else ++ if (map [m].char_code > char_code) r = m - 1; ++ if (l > r) ++ return 0; ++ else ++ m = (l + r) >> 1; ++ } ++ ++ if (m) m = map [m].order; ++ return m; ++} ++ ++void char_convertion(struct mystr* p_str, int direction, char unprintable) ++{ ++ const char* srcbuf; ++ unsigned int srclen; ++ char* dstbuf; ++ map_ptr src, dst; ++ unsigned int sl; ++ unsigned int srcpos = 0, dstpos = 0; ++ unsigned int char_code = 0; ++ ++ srclen = str_getlen(p_str); // Len of source string ++ srcbuf = str_getbuf(p_str); ++ ++ if (direction == VSFTP_CONVDIRECT_FORWARD) ++ { ++ src = localMap; ++ dst = remoteTbl; ++ } ++ else ++ if (direction == VSFTP_CONVDIRECT_BACKWARD) ++ { ++ src = remoteMap; ++ dst = localTbl; ++ } ++ else ++ { ++ src = localMap; ++ dst = localTbl; ++ } ++ ++ if (!src || !dst) ++ { ++ return; ++ } ++ ++ dstbuf = vsf_sysutil_malloc(srclen * dst [0].char_code + dst [0].char_code); ++ ++ while (srcpos < srclen) ++ { ++ char_code = (unsigned char)srcbuf [srcpos++]; ++ if (src [0].char_code > 1) ++ { ++ sl = char_len (char_code); ++ while (sl-- > 1) ++ { ++ char_code = (char_code << 8) | (unsigned char)srcbuf [srcpos++]; ++ } ++ } ++ ++ if (char_code > 127) ++ { ++ sl = bsearch_index (src, 1, src [0].order, char_code); ++ char_code = 0; ++ if (sl) char_code = dst [sl].char_code; ++ } ++ ++ if (char_code == 13 || char_code == 10) ++ { ++ char_code = 0; ++ } ++ else ++ if (char_code < 32 && char_code != 9) ++ { ++ char_code = (unsigned int)unprintable; ++ } ++ ++ if (char_code > 0 || direction != VSFTP_CONVDIRECT_UNPRINTABLE) ++ { ++ if (char_code & 0xff000000) dstbuf [dstpos++] = (char)((char_code >> 24) & 0xff); ++ if (char_code & 0x00ff0000) dstbuf [dstpos++] = (char)((char_code >> 16) & 0xff); ++ if (char_code & 0x0000ff00) dstbuf [dstpos++] = (char)((char_code >> 8) & 0xff); ++ if (char_code & 0x000000ff) dstbuf [dstpos++] = (char)((char_code ) & 0xff); ++ } ++ } ++ ++ dstbuf [dstpos] = '\0'; ++ ++ str_empty(p_str); ++ str_append_text(p_str, dstbuf); ++ ++ vsf_sysutil_free(dstbuf); ++} ++ +diff -urN vsftpd-2.0.5.org/charconv.h vsftpd-2.0.5/charconv.h +--- vsftpd-2.0.5.org/charconv.h 1970-01-01 03:00:00.000000000 +0300 ++++ vsftpd-2.0.5/charconv.h 2008-01-13 19:32:11.000000000 +0200 +@@ -0,0 +1,182 @@ ++#ifndef VSF_CHARCONV_H ++#define VSF_CHARCONV_H ++ ++struct mystr; ++struct vsf_session; ++ ++#define VSFTP_CHARCONV_SUPPORT_CYRILLIC ++#define VSFTP_CHARCONV_SUPPORT_WESTERN ++#define VSFTP_CHARCONV_SUPPORT_CENTRAL ++#define VSFTP_CHARCONV_SUPPORT_SOUTERN ++ ++#define VSFTP_CONVDIRECT_FORWARD 1 ++#define VSFTP_CONVDIRECT_UNPRINTABLE 0 ++#define VSFTP_CONVDIRECT_BACKWARD -1 ++ ++/* Supported charset for convertion */ ++#define VSFTP_CP_NONE "NONE" ++#define VSFTP_CP_UTF_8 "UTF-8" ++#define VSFTP_CP_UTF8 "UTF8" ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++#define VSFTP_CP_WIN_1251 "Win-1251" ++#define VSFTP_CP_WIN1251 "WIN1251" ++#define VSFTP_CP_CP1251 "CP1251" ++#define VSFTP_CP_1251 "1251" ++#define VSFTP_CP_KOI8_R "Koi8-R" ++#define VSFTP_CP_KOI8R "KOI8R" ++#define VSFTP_CP_KOI8_U "Koi8-U" ++#define VSFTP_CP_KOI8U "KOI8U" ++#define VSFTP_CP_CP878 "CP878" ++#define VSFTP_CP_878 "878" ++#define VSFTP_CP_CP878R "CP878R" ++#define VSFTP_CP_878R "878R" ++#define VSFTP_CP_CP878U "CP878U" ++#define VSFTP_CP_878U "878U" ++#define VSFTP_CP_IBM866 "IBM866" ++#define VSFTP_CP_CP866 "CP866" ++#define VSFTP_CP_866 "866" ++#define VSFTP_CP_ISO8859_5 "ISO-8859-5" ++#define VSFTP_CP_ISO5 "ISO5" ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++#define VSFTP_CP_ISO8859_1 "ISO-8859-1" ++#define VSFTP_CP_ISO1 "ISO1" ++#define VSFTP_CP_LATIN1 "LATIN1" ++#define VSFTP_CP_ISO8859_15 "ISO-8859-15" ++#define VSFTP_CP_ISO15 "ISO15" ++#define VSFTP_CP_LATIN9 "LATIN9" ++#define VSFTP_CP_WIN_1252 "Win-1252" ++#define VSFTP_CP_WIN1252 "WIN1252" ++#define VSFTP_CP_CP1252 "CP1252" ++#define VSFTP_CP_1252 "1252" ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++#define VSFTP_CP_ISO8859_2 "ISO-8859-2" ++#define VSFTP_CP_ISO2 "ISO2" ++#define VSFTP_CP_LATIN2 "LATIN2" ++#define VSFTP_CP_ISO8859_16 "ISO-8859-16" ++#define VSFTP_CP_ISO16 "ISO16" ++#define VSFTP_CP_WIN_1250 "Win-1250" ++#define VSFTP_CP_WIN1250 "WIN1250" ++#define VSFTP_CP_CP1250 "CP1250" ++#define VSFTP_CP_1250 "1250" ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++#define VSFTP_CP_ISO8859_3 "ISO-8859-3" ++#define VSFTP_CP_ISO3 "ISO3" ++#define VSFTP_CP_LATIN3 "LATIN3" ++#endif ++ ++#define VSFTP_C_NONE 0 ++#define VSFTP_C_UTF8 1 ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++#define VSFTP_C_1251 2 ++#define VSFTP_C_878R 3 ++#define VSFTP_C_866 4 ++#define VSFTP_C_ISO5 5 ++#define VSFTP_C_878U 6 ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++#define VSFTP_C_ISO1 7 ++#define VSFTP_C_ISO15 8 ++#define VSFTP_C_1252 9 ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++#define VSFTP_C_ISO2 10 ++#define VSFTP_C_ISO16 11 ++#define VSFTP_C_1250 12 ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++#define VSFTP_C_ISO3 13 ++#endif ++ ++#define VSFTP_CS_NONE 0 ++#ifdef VSFTP_CHARCONV_SUPPORT_CYRILLIC ++#define VSFTP_CS_UTF8CYR 1 ++#define VSFTP_CS_1251 2 ++#define VSFTP_CS_878R 3 ++#define VSFTP_CS_866 4 ++#define VSFTP_CS_ISO5 5 ++#define VSFTP_CS_878U 6 ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_WESTERN ++#define VSFTP_CS_UTF8WEST 7 ++#define VSFTP_CS_ISO1 8 ++#define VSFTP_CS_ISO15 9 ++#define VSFTP_CS_1252 10 ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_CENTRAL ++#define VSFTP_CS_UTF8CENT 11 ++#define VSFTP_CS_ISO2 12 ++#define VSFTP_CS_ISO16 13 ++#define VSFTP_CS_1250 14 ++#endif ++#ifdef VSFTP_CHARCONV_SUPPORT_SOUTERN ++#define VSFTP_CS_UTF8SOUT 15 ++#define VSFTP_CS_ISO3 16 ++#endif ++ ++struct codepage_map ++{ ++ unsigned int char_code; // The first element is count bytes of char. ++ unsigned int order; ++} _codepage_map; ++ ++typedef struct codepage_map * map_ptr; ++ ++extern map_ptr localMap; ++ ++/* vsf_charconv_charset_name() ++ * PURPOSE ++ * Get charset name by code; ++ * PARAMETERS ++ * code - Internal charset code ++ * RETURNS ++ * Charset name ++ */ ++const char* vsf_charconv_charset_name(int code); ++ ++/* vsf_charconv_codepage() ++ * PURPOSE ++ * Get internal charset code ++ * PARAMETERS ++ * p_str - String value with code page ++ * RETURNS ++ * Internal charset code ++ */ ++int vsf_charconv_codepage(const char* p_str); ++ ++/* vsf_charconv_init_local_codepage(int localCode) ++ * PURPOSE ++ * Init local codepage for work with unprintable chars ++ * PARAMETERS ++ * localCode - source internal code page ++ */ ++void vsf_charconv_init_local_codepage(int localCode); ++ ++/* vsf_charconv_avail_convertion() ++ * PURPOS ++ * Checking for available convertion characters ++ * PARAMETERS ++ * localCode - source internal code page ++ * remoteCode - destination internal code page ++ * RETURNS ++ * Available ot not converion ++ */ ++int vsf_charconv_avail_convertion(int localCode, int remoteCode); ++ ++/* vsf_charconv_convert() ++ * PURPOSE ++ * Converting string via charsets ++ * PARAMETERS ++ * p_sess - the current session object ++ * p_str - string for convertin ++ * direction - converting from host to remoute charsetr or otherwise ++ */ ++void vsf_charconv_convert(struct vsf_session* p_sess, struct mystr* p_str, int direction); ++ ++/* vsf_charconv_replace_unprintable ++ */ ++void vsf_charconv_replace_unprintable(struct mystr* p_str, char new_char); ++ ++#endif +diff -urN vsftpd-2.0.5.org/char_maps/central.map vsftpd-2.0.5/char_maps/central.map +--- vsftpd-2.0.5.org/char_maps/central.map 1970-01-01 03:00:00.000000000 +0300 ++++ vsftpd-2.0.5/char_maps/central.map 2008-01-13 20:09:59.000000000 +0200 +@@ -0,0 +1,738 @@ ++/* ++ !!! WARNING !!! ++ DON'T CHANGE ORDER OF CHARS ++*/ ++ ++struct codepage_map codepage_utf8cent_array[] = ++ { ++ { 0x000003, 178 }, // max size , char count ++ { 0x00003f, 0 }, ++ { 0x00003f, 0 }, ++ { 0x00003f, 0 }, ++ { 0x00003f, 0 }, ++ { 0x00003f, 0 }, ++ { 0x00c280, 1 }, ++ { 0x00c281, 2 }, ++ { 0x00c282, 3 }, ++ { 0x00c283, 4 }, ++ { 0x00c284, 5 }, ++ { 0x00c285, 6 }, ++ { 0x00c286, 7 }, ++ { 0x00c287, 8 }, ++ { 0x00c288, 9 }, ++ { 0x00c289, 10 }, ++ { 0x00c28a, 11 }, ++ { 0x00c28b, 12 }, ++ { 0x00c28c, 13 }, ++ { 0x00c28d, 14 }, ++ { 0x00c28e, 15 }, ++ { 0x00c28f, 16 }, ++ { 0x00c290, 17 }, ++ { 0x00c291, 18 }, ++ { 0x00c292, 19 }, ++ { 0x00c293, 20 }, ++ { 0x00c294, 21 }, ++ { 0x00c295, 22 }, ++ { 0x00c296, 23 }, ++ { 0x00c297, 24 }, ++ { 0x00c298, 25 }, ++ { 0x00c299, 26 }, ++ { 0x00c29a, 27 }, ++ { 0x00c29b, 28 }, ++ { 0x00c29c, 29 }, ++ { 0x00c29d, 30 }, ++ { 0x00c29e, 31 }, ++ { 0x00c29f, 32 }, ++ { 0x00c2a0, 33 }, ++ { 0x00c2a4, 34 }, ++ { 0x00c2a6, 35 }, ++ { 0x00c2a7, 36 }, ++ { 0x00c2a8, 37 }, ++ { 0x00c2a9, 38 }, ++ { 0x00 |
