Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Oct 2006 07:57:29 GMT
From:      Denis Barov<dindin@freebsd.org.ua>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/104453: [NEW PORT] russian/proftpd
Message-ID:  <200610160757.k9G7vTVp029930@www.freebsd.org>
Resent-Message-ID: <200610160800.k9G80bXA008693@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         104453
>Category:       ports
>Synopsis:       [NEW PORT] russian/proftpd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 16 08:00:37 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Denis Barov
>Release:        6.2-PRERELEASE
>Organization:
>Environment:
FreeBSD alpha.tvt 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #2: Tue Oct 10 12:50:53 MSD 2006     root@alpha.tvt:/usr/obj/usr/RELENG_6/src/sys/ALPHA  i386
>Description:
Using mod_codeconv and fixing some troubles with cyrillic letter "ja" in proftpd.

WARNING: this pr is depends on ports/104452 (Using ftp/proftpd as mastrer port for russian/proftpd)
>How-To-Repeat:

>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	russian/proftpd
#	russian/proftpd/Makefile
#	russian/proftpd/files
#	russian/proftpd/files/patch-zz
#	russian/proftpd/files/extra_patch-configure.in
#	russian/proftpd/files/extra_patch-ldap-tls-mod_ldap.c
#	russian/proftpd/files/patch-ah
#	russian/proftpd/files/patch-contrib::mod_sql_mysql.c
#	russian/proftpd/files/patch-doc::Configuration.html
#	russian/proftpd/files/patch-module::mod_auth_pam.c
#	russian/proftpd/files/patch-sample-configurations_basic.conf
#	russian/proftpd/files/patch-src_proftpd.8.in
#	russian/proftpd/files/patch-encoding
#
echo c - russian/proftpd
mkdir -p russian/proftpd > /dev/null 2>&1
echo x - russian/proftpd/Makefile
sed 's/^X//' >russian/proftpd/Makefile << 'END-of-russian/proftpd/Makefile'
X# New ports collection makefile for:	russian/proftpd
X# Date created:		12 Oct 2006
X# Whom:			Denis Barov <dindin@freebsd.org.ua>
X#
X# $FreeBSD:$
X#
X
XCATEGORIES=	russian ftp
X
XMAINTAINER=	dindin@FreeBSD.org.ua
XCOMMENT= Highly configurable ftp daemon with charset conversion
X
XMASTERDIR=	${.CURDIR}/../../ftp/proftpd
X
XCONFLICTS=  proftpd-1.*
X
XCONFIGURE_ARGS+=       --with-modules=mod_codeconv
XMODULES:=${MODULES}:mod_codeconv
XPROFTPD_LIBS+= -liconv -L${LOCALBASE}/lib
X
XPATCHDIR=	${.CURDIR}/files
X
XINCLUDEDIRS:=${INCLUDEDIRS}:${PREFIX}/include
XLIBDIRS:=${LIBDIRS}:${PREFIX}/lib
X
X.include "${MASTERDIR}/Makefile"
END-of-russian/proftpd/Makefile
echo c - russian/proftpd/files
mkdir -p russian/proftpd/files > /dev/null 2>&1
echo x - russian/proftpd/files/patch-zz
sed 's/^X//' >russian/proftpd/files/patch-zz << 'END-of-russian/proftpd/files/patch-zz'
X--- ./src/netio.c.orig	Sun Oct 10 00:46:22 2004
X+++ ./src/netio.c	Thu Oct 12 15:17:22 2006
X@@ -901,47 +901,6 @@
X       cp = *pbuf->current++;
X       pbuf->remaining++;
X 
X-      switch (mode) {
X-        case IAC:
X-          switch (cp) {
X-            case WILL:
X-            case WONT:
X-            case DO:
X-            case DONT:
X-              mode = cp;
X-              continue;
X-
X-            case IAC:
X-              mode = 0;
X-              break;
X-
X-            default:
X-              /* Ignore */
X-              mode = 0;
X-              continue;
X-          }
X-          break;
X-
X-        case WILL:
X-        case WONT:
X-          pr_netio_printf(out_nstrm, "%c%c%c", IAC, DONT, cp);
X-          mode = 0;
X-          continue;
X-
X-        case DO:
X-        case DONT:
X-          pr_netio_printf(out_nstrm, "%c%c%c", IAC, WONT, cp);
X-          mode = 0;
X-          continue;
X-
X-        default:
X-          if (cp == IAC) {
X-            mode = cp;
X-            continue;
X-          }
X-          break;
X-      }
X-
X       *bp++ = cp;
X       buflen--;
X     }
END-of-russian/proftpd/files/patch-zz
echo x - russian/proftpd/files/extra_patch-configure.in
sed 's/^X//' >russian/proftpd/files/extra_patch-configure.in << 'END-of-russian/proftpd/files/extra_patch-configure.in'
X--- configure.in	Thu Mar  9 09:12:35 2006
X+++ configure.in	Mon May 22 15:01:23 2006
X@@ -161,12 +161,14 @@
X   [
X     if test "$withval" != "no" ; then
X       LIB_OBJS="$LIB_OBJS getopt.o getopt1.o"
X-      AC_CHECK_FUNCS(getopt)
X+      AC_CHECK_FUNCS(getopt getopt_long)
X+      AC_CHECK_HEADERS(getopt.h)
X     fi
X   ],
X   [
X     LIB_OBJS="$LIB_OBJS getopt.o getopt1.o"
X-    AC_CHECK_FUNCS(getopt)
X+    AC_CHECK_FUNCS(getopt getopt_long)
X+    AC_CHECK_HEADERS(getopt.h)
X   ])
X 
X dnl Modules...'nuff said.
X@@ -850,7 +852,7 @@
X   ac_build_static_modules="modules/mod_cap.o $ac_build_static_modules"
X fi
X 
X-AC_CHECK_HEADERS(ctype.h getopt.h crypt.h bstring.h iconv.h inttypes.h langinfo.h limits.h)
X+AC_CHECK_HEADERS(ctype.h crypt.h bstring.h iconv.h inttypes.h langinfo.h limits.h)
X AC_CHECK_HEADERS(string.h strings.h stropts.h)
X AC_CHECK_HEADERS(sys/file.h sys/mman.h sys/types.h sys/uio.h)
X 
X@@ -1110,7 +1112,7 @@
X )
X 
X AC_CHECK_FUNCS(getcwd getenv gethostbyname2 gethostname getnameinfo)
X-AC_CHECK_FUNCS(getopt_long gettimeofday hstrerror inet_aton inet_ntop inet_pton)
X+AC_CHECK_FUNCS(gettimeofday hstrerror inet_aton inet_ntop inet_pton)
X AC_CHECK_FUNCS(memcpy mempcpy mkdir mkstemp mlock mlockall munlock munlockall)
X AC_CHECK_FUNCS(rmdir select setgroups socket statfs strchr strcoll strerror)
X AC_CHECK_FUNCS(strsep strtol strtoull setprotoent setspent endprotoent)
END-of-russian/proftpd/files/extra_patch-configure.in
echo x - russian/proftpd/files/extra_patch-ldap-tls-mod_ldap.c
sed 's/^X//' >russian/proftpd/files/extra_patch-ldap-tls-mod_ldap.c << 'END-of-russian/proftpd/files/extra_patch-ldap-tls-mod_ldap.c'
X--- contrib/mod_ldap.c	Fri Apr 21 10:31:23 2006
X+++ contrib/mod_ldap.c	Fri Apr 21 10:31:43 2006
X@@ -55,7 +55,7 @@
X  * after connecting to the LDAP server. If TLS cannot be enabled, the LDAP
X  * connection will fail.
X  */
X-/* #define USE_LDAP_TLS */
X+#define USE_LDAP_TLS
END-of-russian/proftpd/files/extra_patch-ldap-tls-mod_ldap.c
echo x - russian/proftpd/files/patch-ah
sed 's/^X//' >russian/proftpd/files/patch-ah << 'END-of-russian/proftpd/files/patch-ah'
X--- modules/mod_auth_unix.c.orig	Thu May 13 23:40:18 2004
X+++ modules/mod_auth_unix.c	Thu May 13 23:40:27 2004
X@@ -57,6 +57,7 @@
X #endif /* HAVE_HPSECURITY_H or HPUX10 or HPUX11 */
X 
X #if defined(HAVE_PROT_H) || defined(COMSEC)
X+# include <krb.h>
X # include <prot.h>
X #endif
X 
END-of-russian/proftpd/files/patch-ah
echo x - russian/proftpd/files/patch-contrib::mod_sql_mysql.c
sed 's/^X//' >russian/proftpd/files/patch-contrib::mod_sql_mysql.c << 'END-of-russian/proftpd/files/patch-contrib::mod_sql_mysql.c'
X--- contrib/mod_sql_mysql.c.orig	Sun Nov  2 00:30:13 2003
X+++ contrib/mod_sql_mysql.c	Sun Nov  2 00:30:23 2003
X@@ -134,7 +134,7 @@
X 
X #define _MYSQL_PORT "3306"
X 
X-#include <mysql.h>
X+#include <mysql/mysql.h>
X #include "conf.h"
X #include "../contrib/mod_sql.h"
X 
END-of-russian/proftpd/files/patch-contrib::mod_sql_mysql.c
echo x - russian/proftpd/files/patch-doc::Configuration.html
sed 's/^X//' >russian/proftpd/files/patch-doc::Configuration.html << 'END-of-russian/proftpd/files/patch-doc::Configuration.html'
X--- ./doc/Configuration.html.orig	Wed Jan 29 12:27:24 2003
X+++ ./doc/Configuration.html	Sat Mar 15 11:34:14 2003
X@@ -4226,7 +4226,7 @@
X ></DT
X ><DD
X ><P
X->ftp</P
X+>ftpd</P
X ></DD
X ><DT
X ><PRE
X@@ -32252,4 +32252,4 @@
X ></DIV
X ></BODY
X ></HTML
X->
X\ No newline at end of file
X+>
END-of-russian/proftpd/files/patch-doc::Configuration.html
echo x - russian/proftpd/files/patch-module::mod_auth_pam.c
sed 's/^X//' >russian/proftpd/files/patch-module::mod_auth_pam.c << 'END-of-russian/proftpd/files/patch-module::mod_auth_pam.c'
X--- ./modules/mod_auth_pam.c.orig	Thu Jan  2 13:25:20 2003
X+++ ./modules/mod_auth_pam.c	Sat Mar 15 11:35:00 2003
X@@ -57,7 +57,7 @@
X #endif /* HAVE_PAM_PAM_APPL_H */
X 
X static pam_handle_t *	pamh			= NULL;
X-static char *		pamconfig		= "ftp";
X+static char *		pamconfig		= "ftpd";
X static char *		pam_user 		= NULL;
X static char *		pam_pass 		= NULL;
X static size_t		pam_user_len		= 0;
END-of-russian/proftpd/files/patch-module::mod_auth_pam.c
echo x - russian/proftpd/files/patch-sample-configurations_basic.conf
sed 's/^X//' >russian/proftpd/files/patch-sample-configurations_basic.conf << 'END-of-russian/proftpd/files/patch-sample-configurations_basic.conf'
X--- sample-configurations/basic.conf.orig	Thu Apr 15 22:46:38 2004
X+++ sample-configurations/basic.conf	Mon Oct 16 11:40:13 2006
X@@ -1,3 +1,7 @@
X+#
X+# To have more informations about Proftpd configuration
X+# look at : http://www.proftpd.org/
X+#
X # This is a basic ProFTPD configuration file (rename it to 
X # 'proftpd.conf' for actual use.  It establishes a single server
X # and a single anonymous login.  It assumes that you have a user/group
X@@ -6,6 +10,7 @@
X ServerName			"ProFTPD Default Installation"
X ServerType			standalone
X DefaultServer			on
X+ScoreboardFile			/var/run/proftpd.scoreboard
X 
X # Port 21 is the standard FTP port.
X Port				21
X@@ -14,6 +19,11 @@
X # from being group and world writable.
X Umask				022
X 
X+# CharsetLocal and CharsetRemote allows to convert filenames 
X+# "on the fly"
X+CharsetLocal KOI8-R
X+CharsetRemote CP1251
X+
X # To prevent DoS attacks, set the maximum number of child processes
X # to 30.  If you need to allow more than 30 concurrent connections
X # at once, simply increase this value.  Note that this ONLY works
X@@ -40,23 +50,29 @@
X 
X # A basic anonymous configuration, no upload directories.  If you do not
X # want anonymous users, simply delete this entire <Anonymous> section.
X-<Anonymous ~ftp>
X-  User				ftp
X-  Group				ftp
X-
X-  # We want clients to be able to login with "anonymous" as well as "ftp"
X-  UserAlias			anonymous ftp
X-
X-  # Limit the maximum number of anonymous logins
X-  MaxClients			10
X-
X-  # We want 'welcome.msg' displayed at login, and '.message' displayed
X-  # in each newly chdired directory.
X-  DisplayLogin			welcome.msg
X-  DisplayFirstChdir		.message
X-
X-  # Limit WRITE everywhere in the anonymous chroot
X-  <Limit WRITE>
X-    DenyAll
X-  </Limit>
X-</Anonymous>
X+#########################################################################
X+#                                                                       #
X+# Uncomment lines with only one # to allow basic anonymous access       #
X+#                                                                       #
X+#########################################################################
X+
X+#<Anonymous ~ftp>
X+#   User				ftp
X+#   Group				ftp
X+
X+  ### We want clients to be able to login with "anonymous" as well as "ftp"
X+  # UserAlias			anonymous ftp
X+
X+  ### Limit the maximum number of anonymous logins
X+  # MaxClients			10
X+
X+  ### We want 'welcome.msg' displayed at login, and '.message' displayed
X+  ### in each newly chdired directory.
X+  # DisplayLogin			welcome.msg
X+  # DisplayFirstChdir		.message
X+
X+  ### Limit WRITE everywhere in the anonymous chroot
X+  # <Limit WRITE>
X+  #   DenyAll
X+  # </Limit>
X+#</Anonymous>
END-of-russian/proftpd/files/patch-sample-configurations_basic.conf
echo x - russian/proftpd/files/patch-src_proftpd.8.in
sed 's/^X//' >russian/proftpd/files/patch-src_proftpd.8.in << 'END-of-russian/proftpd/files/patch-src_proftpd.8.in'
X--- src/proftpd.8.in.orig	Sat Sep 18 07:40:30 2004
X+++ src/proftpd.8.in	Thu Nov  3 15:35:56 2005
X@@ -22,6 +22,12 @@
X connection to the FTP service is made, or alternatively it can be run as a
X standalone daemon.
X .PP
X+.br
X+Each successful and failed ftp(1) session is logged using syslog with a
X+facility of LOG_FTP.  Note: LOG_FTP messages are not displayed
X+by syslogd(8) by default, and may have to be enabled in syslogd(8)'s 
X+configuration file.
X+.PP
X When
X .B proftpd
X is run in standalone mode and it receives a SIGHUP then it will reread its
END-of-russian/proftpd/files/patch-src_proftpd.8.in
echo x - russian/proftpd/files/patch-encoding
sed 's/^X//' >russian/proftpd/files/patch-encoding << 'END-of-russian/proftpd/files/patch-encoding'
Xdiff -urN ./modules/mod_codeconv.c .-iconv/modules/mod_codeconv.c
X--- ./modules/mod_codeconv.c	1970-01-01 09:00:00.000000000 +0900
X+++ .-iconv/modules/mod_codeconv.c	2004-09-25 21:44:05.000000000 +0900
X@@ -0,0 +1,229 @@
X+/*
X+ * ProFTPD: mod_codeconv -- local <-> remote charset conversion
X+ *
X+ * Copyright (c) 2004 by TSUJIKAWA Tohru <tsujikawa@tsg.ne.jp> / All rights reserved.
X+ *
X+ * This program is free software; you can redistribute it and/or modify
X+ * it under the terms of the GNU General Public License as published by
X+ * the Free Software Foundation; either version 2 of the License, or
X+ * (at your option) any later version.
X+ *
X+ * This program is distributed in the hope that it will be useful,
X+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
X+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X+ * GNU General Public License for more details.
X+ *
X+ * You should have received a copy of the GNU General Public License
X+ * along with this program; if not, write to the Free Software
X+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
X+ *
X+ */
X+
X+
X+#include	"conf.h"
X+#include	<iconv.h>
X+
X+
X+//
X+// directive
X+//
X+#define	DIRECTIVE_CHARSETLOCAL		"CharsetLocal"
X+#define	DIRECTIVE_CHARSETREMOTE		"CharsetRemote"
X+
X+
X+//
X+// initialization
X+//
X+static int codeconv_init(void)
X+{
X+	return 0;
X+}
X+
X+static int codeconv_sess_init(void)
X+{
X+	return 0;
X+}
X+
X+
X+char* remote2local(struct pool* pool, char* remote)
X+{
X+	iconv_t	ic;
X+	char*	local;
X+	char*	in_ptr;
X+	char*	out_ptr;
X+	size_t	inbytesleft, outbytesleft;
X+
X+	config_rec*	conf_l = NULL;
X+	config_rec*	conf_r = NULL;
X+
X+	conf_l = find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSETLOCAL, FALSE);
X+	conf_r = find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSETREMOTE, FALSE);
X+	if (!conf_l || !conf_r) return NULL;
X+
X+	ic = iconv_open(conf_l->argv[0], conf_r->argv[0]);
X+	if (ic == (iconv_t)(-1)) return NULL;
X+
X+	iconv(ic, NULL, NULL, NULL, NULL);
X+
X+	inbytesleft = strlen(remote);
X+	outbytesleft = inbytesleft*3;
X+	local = palloc(pool, outbytesleft+1);
X+
X+	in_ptr = remote; out_ptr = local;
X+	while (inbytesleft) {
X+		if (iconv(ic, &in_ptr, &inbytesleft, &out_ptr, &outbytesleft) == -1) {
X+			*out_ptr = '?'; out_ptr++; outbytesleft--;
X+			in_ptr++; inbytesleft--;
X+			break;
X+		}
X+	}
X+	*out_ptr = 0;
X+
X+	iconv_close(ic);
X+
X+	return local;
X+}
X+
X+
X+char* local2remote(char* local)
X+{
X+	iconv_t	ic;
X+	char*	remote;
X+	char*	in_ptr;
X+	char*	out_ptr;
X+	size_t	inbytesleft, outbytesleft;
X+
X+	config_rec*	conf_l = NULL;
X+	config_rec*	conf_r = NULL;
X+
X+	conf_l = find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSETLOCAL, FALSE);
X+	conf_r = find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSETREMOTE, FALSE);
X+	if (!conf_l || !conf_r) return NULL;
X+
X+	ic = iconv_open(conf_r->argv[0], conf_l->argv[0]);
X+	if (ic == (iconv_t)(-1)) return NULL;
X+
X+	iconv(ic, NULL, NULL, NULL, NULL);
X+
X+	inbytesleft = strlen(local);
X+	outbytesleft = inbytesleft*3;
X+	remote = malloc(outbytesleft+1);
X+
X+	in_ptr = local; out_ptr = remote;
X+	while (inbytesleft) {
X+		if (iconv(ic, &in_ptr, &inbytesleft, &out_ptr, &outbytesleft) == -1) {
X+			*out_ptr = '?'; out_ptr++; outbytesleft--;
X+			in_ptr++; inbytesleft--;
X+			break;
X+		}
X+	}
X+	*out_ptr = 0;
X+
X+	iconv_close(ic);
X+
X+	return remote;
X+}
X+
X+
X+//
X+// module handler
X+//
X+MODRET codeconv_pre_any(cmd_rec* cmd)
X+{
X+	char*	p;
X+	int		i;
X+
X+	p = remote2local(cmd->pool, cmd->arg);
X+	if (p) cmd->arg = p;
X+
X+	for (i = 0; i < cmd->argc; i++) {
X+		p = remote2local(cmd->pool, cmd->argv[i]);
X+		if (p) cmd->argv[i] = p;
X+	}
X+
X+	return DECLINED(cmd);
X+}
X+
X+
X+//
X+// local charset directive "CharsetLocal"
X+//
X+MODRET set_charsetlocal(cmd_rec *cmd) {
X+  config_rec *c = NULL;
X+
X+  /* Syntax: CharsetLocal iconv-charset-name */
X+
X+  CHECK_ARGS(cmd, 1);
X+  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);
X+
X+  c = add_config_param_str(DIRECTIVE_CHARSETLOCAL, 1, cmd->argv[1]);
X+
X+  return HANDLED(cmd);
X+}
X+
X+//
X+// remote charset directive "CharsetRemote"
X+//
X+MODRET set_charsetremote(cmd_rec *cmd) {
X+  config_rec *c = NULL;
X+
X+  /* Syntax: CharsetRemote iconv-charset-name */
X+
X+  CHECK_ARGS(cmd, 1);
X+  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);
X+
X+  c = add_config_param_str(DIRECTIVE_CHARSETREMOTE, 1, cmd->argv[1]);
X+
X+  return HANDLED(cmd);
X+}
X+
X+
X+//
X+// module &#9552;&#9572; directive
X+//
X+static conftable codeconv_conftab[] = {
X+	{ DIRECTIVE_CHARSETLOCAL,		set_charsetlocal,		NULL },
X+	{ DIRECTIVE_CHARSETREMOTE,		set_charsetremote,		NULL },
X+	{ NULL, NULL, NULL }
X+};
X+
X+
X+//
X+// trap &#1076;&#9571;&#1076;&#1099;&#1077;&#9474;&#1077;&#9616;&#1077;&#1108;&#1077;&#9556;&#9617;&#1100;&#9552;&#1118;
X+//
X+static cmdtable codeconv_cmdtab[] = {
X+	{ PRE_CMD,		C_ANY,	G_NONE, codeconv_pre_any,	FALSE, FALSE },
X+	{ 0,			NULL }
X+};
X+
X+
X+//
X+// module &#9563;&#1025;&#9577;&#1108;
X+//
X+module codeconv_module = {
X+
X+	/* Always NULL */
X+	NULL, NULL,
X+
X+	/* Module API version (2.0) */
X+	0x20,
X+
X+	/* Module name */
X+	"codeconv",
X+
X+	/* Module configuration directive handlers */
X+	codeconv_conftab,
X+
X+	/* Module command handlers */
X+	codeconv_cmdtab,
X+
X+	/* Module authentication handlers (none in this case) */
X+	NULL,
X+
X+	/* Module initialization */
X+	codeconv_init,
X+
X+	/* Session initialization */
X+	codeconv_sess_init
X+
X+};
Xdiff -urN ./modules/mod_df.c .-iconv/modules/mod_df.c
X--- ./modules/mod_df.c	1970-01-01 09:00:00.000000000 +0900
X+++ .-iconv/modules/mod_df.c	2004-09-25 21:43:57.000000000 +0900
X@@ -0,0 +1,127 @@
X+/*
X+ * ProFTPD: mod_df -- &#1077;&#9567;&#1077;&#1075;&#1077;&#9571;&#1077;&#1087;&#9570;&#1111;&#1076;&#1085;&#9552;&#9566;&#9580;&#9568;&#9472;&#9568;&#9500;&#9580;&#1077;&#1090;&#1077;&#9557;&#1077;&#1093;&#1073;&#9565;&#1077;&#1099;
X+ *
X+ * Copyright (c) 2002 by TSUJIKAWA Tohru <tsujikawa@tsg.ne.jp>
X+ *
X+ * This program is free software; you can redistribute it and/or modify
X+ * it under the terms of the GNU General Public License as published by
X+ * the Free Software Foundation; either version 2 of the License, or
X+ * (at your option) any later version.
X+ *
X+ * This program is distributed in the hope that it will be useful,
X+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
X+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X+ * GNU General Public License for more details.
X+ *
X+ * You should have received a copy of the GNU General Public License
X+ * along with this program; if not, write to the Free Software
X+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
X+ *
X+ */
X+
X+ /*
X+   **** for Linux only ****
X+
X+   CWD/CDUP &#1077;&#9474;&#1077;&#9616;&#1077;&#1108;&#1077;&#9556;&#1076;&#9580;&#1077;&#1098;&#1077;&#9570;&#1077;&#1099;&#1077;&#9562;&#1076;&#9567;&#9532;&#1038;&#9474;&#9553;&#1077;&#9567;&#1077;&#1075;&#1077;&#1100;&#1077;&#1087;&#1077;&#9562;&#1077;&#1098;&#1076;&#9567;&#1076;&#9580;&#1077;&#9567;&#1077;&#1075;&#1077;&#9571;&#1077;&#1087;&#9570;&#1111;&#1076;&#1085;&#9552;&#9566;&#9580;&#9568;&#1076;&#1028;&#9472;&#9568;&#9500;&#9580;&#1076;&#9571;&#1076;&#1099;&#1077;&#1090;&#1077;&#9557;&#1077;&#1093;&#1073;&#9565;&#1077;&#1099;&#1076;&#9567;&#1076;&#9571;&#1073;&#1075;
X+
X+   statfs() &#1076;&#9580;&#9559;&#9532;&#9552;&#9552;&#9563;&#1093;&#1073;&#1076;64bit &#9552;&#9572;&#1076;&#9574;&#1077;&#9474;&#1077;&#1108;&#1077;&#9572;&#1077;&#1076;&#1077;&#1099;&#1076;&#9558;&#1076;&#9577;&#1076;&#1076;&#9563;&#1100;&#9571;&#1095;&#1076;&#9575; 2TB &#9617;&#9577;&#9563;&#1093;&#1076;&#9580;&#1077;&#9567;&#1077;&#1075;&#1077;&#9571;&#1077;&#1087;&#1076;&#9580;&#9559;&#9632;&#1076;&#9574;
X+   &#9492;&#9569;&#9563;&#1103;&#1076;&#9577;&#9500;&#9552;&#1076;&#1028;&#9577;&#9555;&#1076;&#9569;&#1076;&#9577;&#1076;&#1076;&#1076;&#9474;&#1076;&#9562;&#1076;&#1084;&#9508;&#8470;&#9516;&#9560;&#1076;&#9569;&#1076;&#1100;&#1076;&#9616;&#1076;&#9571;&#1073;&#1075;
X+
X+ */
X+
X+
X+#include	"conf.h"
X+#include	<sys/vfs.h>
X+
X+
X+//
X+// &#9564;&#1097;&#9508;&#8470;&#9619;&#9564;
X+//
X+static int df_init(void)
X+{
X+	return 0;
X+}
X+
X+static int df_sess_init(void)
X+{
X+	return 0;
X+}
X+
X+
X+//
X+// module handler
X+//
X+MODRET df_post_cwd(cmd_rec* cmd)
X+{
X+	char	buf[PATH_MAX+1];
X+	struct statfs	sfs;
X+
X+	if (getcwd(buf, sizeof(buf)) && statfs(buf, &sfs) == 0) {
X+		long long	f = (long long)sfs.f_bavail * (long long)sfs.f_bsize;
X+		if (f >= ((long long)1 << 10)*1000000000L) {
X+			sprintf(buf, "Disk free space at this directory is %lld,%03lld,%03lld MB.",
X+					(f >> 20)/1000000, (f >> 20)/1000%1000, (f >> 20)%1000);
X+		} else if (f >= ((long long)1 << 10)*1000000) {
X+			sprintf(buf, "Disk free space at this directory is %lld,%03lld,%03lld KB.",
X+					(f >> 10)/1000000, (f >> 10)/1000%1000, (f >> 10)%1000);
X+		} else if (f >= ((long long)1 << 10)*1000) {
X+			sprintf(buf, "DISK FREE SPACE AT THIS DIRECTORY IS ONLY %lld,%03lld KB.", (f >> 10)/1000, (f >> 10)%1000);
X+		} else if (f >= 1000) {
X+			sprintf(buf, "DISK FREE SPACE AT THIS DIRECTORY IS ONLY %lld,%03lld Bytes.", f/1000, f%1000);
X+		} else {
X+			sprintf(buf, "DISK FREE SPACE AT THIS DIRECTORY IS ONLY %lld Bytes.", f);
X+		}
X+		pr_response_send_raw("250-%s", buf);
X+	}
X+	return HANDLED(cmd);
X+}
X+
X+
X+//
X+// module &#9552;&#9572; directive
X+//
X+static conftable df_conftab[] = {
X+	{ NULL }						// directive &#1076;&#9575;&#1077;&#9569;&#1077;&#9612;&#1073;&#9565;&#1077;&#9562;&#1076;&#9558;&#1076;&#9577;&#1076;&#1076;
X+};
X+
X+
X+//
X+// trap &#1076;&#9571;&#1076;&#1099;&#1077;&#9474;&#1077;&#9616;&#1077;&#1108;&#1077;&#9556;&#9617;&#1100;&#9552;&#1118;
X+//
X+static cmdtable df_cmdtab[] = {
X+	{ POST_CMD,		C_CWD,	G_NONE, df_post_cwd,	FALSE, FALSE },
X+	{ POST_CMD,		C_CDUP,	G_NONE, df_post_cwd,	FALSE, FALSE },
X+	{ 0,			NULL }
X+};
X+
X+
X+//
X+// module &#9563;&#1025;&#9577;&#1108;
X+//
X+module df_module = {
X+
X+	/* Always NULL */
X+	NULL, NULL,
X+
X+	/* Module API version (2.0) */
X+	0x20,
X+
X+	/* Module name */
X+	"df",
X+
X+	/* Module configuration directive handlers */
X+	df_conftab,
X+
X+	/* Module command handlers */
X+	df_cmdtab,
X+
X+	/* Module authentication handlers (none in this case) */
X+	NULL,
X+
X+	/* Module initialization */
X+	df_init,
X+
X+	/* Session initialization */
X+	df_sess_init
X+
X+};
Xdiff -urN ./modules/mod_ls.c .-iconv/modules/mod_ls.c
X--- ./modules/mod_ls.c	2004-05-08 06:31:30.000000000 +0900
X+++ .-iconv/modules/mod_ls.c	2004-09-25 21:43:53.000000000 +0900
X@@ -232,12 +232,15 @@
X   return res;
X }
X 
X+extern char* local2remote(char*);
X+
X /* sendline() now has an internal buffer, to help speed up LIST output. */
X static int sendline(char *fmt, ...) {
X   static char listbuf[PR_TUNABLE_BUFFER_SIZE] = {'\0'};
X   va_list msg;
X   char buf[PR_TUNABLE_BUFFER_SIZE+1] = {'\0'};
X   int res = 0;
X+  char* buf2;
X 
X   /* A NULL fmt argument is the signal to flush the buffer */
X   if (!fmt) {
X@@ -255,6 +258,13 @@
X 
X   buf[sizeof(buf)-1] = '\0';
X 
X+  if (buf[0]) {
X+    buf2 = local2remote(buf);
X+    if (buf2) {
X+      strcpy(buf, buf2); free(buf2);
X+    }
X+  }
X+
X   /* If buf won't fit completely into listbuf, flush listbuf */
X   if (strlen(buf) >= (sizeof(listbuf) - strlen(listbuf))) {
X     if ((res = pr_data_xfer(listbuf, strlen(listbuf))) < 0)
Xdiff -urN ./src/netio.c .-iconv/src/netio.c
X--- ./src/netio.c	2004-06-16 01:45:21.000000000 +0900
X+++ .-iconv/src/netio.c	2004-09-25 21:42:59.000000000 +0900
X@@ -467,9 +467,12 @@
X   return -1;
X }
X 
X+extern char* local2remote(char* local);
X+
X int pr_netio_printf(pr_netio_stream_t *nstrm, const char *fmt, ...) {
X   va_list msg;
X   char buf[PR_RESPONSE_BUFFER_SIZE] = {'\0'};
X+  char* p;
X 
X   if (!nstrm) {
X     errno = EINVAL;
X@@ -481,6 +484,13 @@
X   va_end(msg);
X   buf[sizeof(buf)-1] = '\0';
X 
X+  if (buf[0]) {
X+    p = local2remote(buf);
X+    if (p) {
X+      strcpy(buf, p); free(p);
X+    }
X+  }
X+
X   return pr_netio_write(nstrm, buf, strlen(buf));
X }
X 
END-of-russian/proftpd/files/patch-encoding
exit
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610160757.k9G7vTVp029930>