Bug 114502 - proftpd with mod_codeconv compiled hangs with signal 11 when encounters client command OPTS utf8 on
Summary: proftpd with mod_codeconv compiled hangs with signal 11 when encounters clien...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Beech Rintoul
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-11 17:40 UTC by Oleg Gawriloff
Modified: 2008-08-06 15:30 UTC (History)
0 users

See Also:


Attachments
smime.p7s (2.83 KB, application/x-pkcs7-signature)
2008-08-06 10:22 UTC, Oleg Gawriloff
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Gawriloff 2007-07-11 17:40:06 UTC
When proftpd running with -nd 10 encounters client command OPTS utf8 on it exits with signal 11.
---debug log
localhost.telecom.by (192.168.8.5[192.168.8.5]) - dispatching PRE_CMD command 'OPTS utf8 on' to mod_core
localhost.telecom.by (192.168.8.5[192.168.8.5]) - dispatching CMD command 'OPTS utf8 on' to mod_core
localhost.telecom.by (192.168.8.5[192.168.8.5]) - dispatching PRE_CMD command 'OPTS_UTF8 on' to mod_codeconv
localhost.telecom.by (192.168.8.5[192.168.8.5]) - ProFTPD terminating (signal 11)
localhost.telecom.by (192.168.8.5[192.168.8.5]) - FTP session closed.
----

barzog@stork:~$proftpd -vv
 - ProFTPD Version: 1.3.1rc3 (devel)
 -   Scoreboard Version: 01040002
 -   Built: Wed Jul 11 19:03:06 EEST 2007
 -     Module: mod_core.c
 -     Module: mod_xfer.c
 -     Module: mod_auth_unix.c
 -     Module: mod_auth_file/0.8.3
 -     Module: mod_auth.c
 -     Module: mod_ls.c
 -     Module: mod_log.c
 -     Module: mod_site.c
 -     Module: mod_delay/0.6
 -     Module: mod_auth_pam/1.0.1
 -     Module: mod_wrap2/2.0.5
 -     Module: mod_wrap2_file/1.1
 -     Module: mod_codeconv.c

ServerName                      "Atlant-Telecom Media FTP Server"
ServerAdmin                     webmaster@telecom.by
ServerType                      standalone
DefaultServer                   on
Port                            21
Umask                           002
MaxInstances                    300
MaxClients              300     "Sorry, the maximum number of allowed users are already connected:(%m)"
MaxClientsPerHost       5       "Sorry, you may not connect more than five times."
MaxLoginAttempts        3
User                            nobody
Group                           nogroup
PidFile                         /var/run/proftpd.pid

CharsetLocal    KOI8-R
CharsetRemote   CP1251
TimeoutLogin                    120
TimeoutIdle                     600
TimeoutNoTransfer               900
TimeoutStalled                  3600
UseReverseDNS                   off
IdentLookups                    off
ServerIdent                     on "FTP server ready."
AllowForeignAddress             off
AllowRetrieveRestart            on
AllowStoreRestart               on
HiddenStores                    off
PersistentPasswd                off
AuthPAM                         off
AuthPAMConfig                   ftpd
RequireValidShell               off
RootLogin                       off
UseFtpUsers                     off
ShowSymlinks                    off
DeferWelcome                    on
ListOptions                     "-a"
DelayTable                      /var/log/proftp/proftpd.delay
LogFormat                       default "%h %l %u %t \"%r\" %s %b"
LogFormat                       auth    "%v [%P] %h %t \"%r\" %s"
LogFormat                       write   "%h %l %u %t \"%r\" %s %b"
LogFormat                       awstats "%t     %h      %u      %m      %f      %s      %b"
TransferLog                     /var/log/proftp/xferlog
SystemLog                       /var/log/proftpd.log
ScoreboardFile                  /var/run/proftpd.scoreboard
PassivePorts                    49152 65534
DefaultRoot             ~       !wheel
WrapEngine                      on
WrapDenyMsg                     "User '%u' denied by access rules"
WrapTables                      file:/etc/hosts.allow.private file:/etc/hosts.deny

AllowOverwrite                on
DenyFilter \*.*/

<Limit SITE_CHMOD>
  DenyAll
</Limit>

<Anonymous /usr/home/Media>
 User media
 Group nogroup
 UserAlias anonymous media
 HideNoAccess                   on
</Anonymous>
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2007-07-12 05:25:03 UTC
Responsible Changed
From-To: freebsd-ports-bugs->beech

Over to maintainer.
Comment 2 dfilter service freebsd_committer freebsd_triage 2007-07-12 08:19:18 UTC
beech       2007-07-12 07:19:11 UTC

  FreeBSD ports repository

  Modified files:
    ftp/proftpd          Makefile 
    ftp/proftpd/files    extra-patch-mod-codeconv 
  Log:
  - Fix extra-patch-mod-codeconv
  - Bump portrevision
  
  PR:             ports/114502
  Reported by:    Oleg Gawriloff <barzog@telecom.by>
  Approved by:    sat (mentor)
  
  Revision  Changes    Path
  1.112     +2 -1      ports/ftp/proftpd/Makefile
  1.2       +4 -5      ports/ftp/proftpd/files/extra-patch-mod-codeconv
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Beech Rintoul freebsd_committer freebsd_triage 2007-07-12 08:25:55 UTC
State Changed
From-To: open->closed

Fix committed, Thanks!
Comment 4 Beech Rintoul freebsd_committer freebsd_triage 2007-07-12 10:48:18 UTC
State Changed
From-To: closed->open

Problem still exists.
Comment 5 Beech Rintoul freebsd_committer freebsd_triage 2007-07-18 20:38:07 UTC
State Changed
From-To: open->closed

Patch reviewed upstream. Not compatible with 1.3.1rc3. Duplicates and  
conflicts with utf8 functionality. Original author does not respond. 
Option will be removed.
Comment 6 dfilter service freebsd_committer freebsd_triage 2007-07-18 22:09:22 UTC
beech       2007-07-18 21:09:14 UTC

  FreeBSD ports repository

  Modified files:
    ftp/proftpd          Makefile 
  Removed files:
    ftp/proftpd/files    extra-patch-mod-codeconv 
  Log:
  - Remove mod_codeconv
  - Patch reviewed upstream. Not compatible with 1.3.1rc3. Duplicates and
    conflicts with utf8 functionality
  
  PR:             ports/114502
  Approved by:    sat (mentor)
  
  Revision  Changes    Path
  1.114     +2 -12     ports/ftp/proftpd/Makefile
  1.3       +0 -425    ports/ftp/proftpd/files/extra-patch-mod-codeconv (dead)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 nyquist 2008-03-24 00:33:45 UTC
Hello.

I want to offer the updated patch for release of proftpd-1.3.1. (http://iip=
o.tu-bryansk.ru/pub/common/proftpd-1.3.1.patch.diff)
Solved problem with "signal 11"

diff -r -u -P ./proftpd-1.3.1/modules/mod_codeconv.c ./proftpd-1.3.1_patche=
d/modules/mod_codeconv.c
--- ./proftpd-1.3.1/modules/mod_codeconv.c  1970-01-01 03:00:00.000000000 +=
0300
+++ ./proftpd-1.3.1_patched/modules/mod_codeconv.c  2008-03-24 02:55:39.000=
000000 +0300
@@ -0,0 +1,231 @@
+/*
+ * ProFTPD: mod_codeconv -- local <-> remote charset conversion
+ *
+ * Copyright (c) 2004 by TSUJIKAWA Tohru <tsujikawa@tsg.ne.jp> / All right=
s reserved.
+ *
+ * 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, U=
SA.
+ *
+ */
+
+
+#include   "conf.h"
+#include   <iconv.h>
+
+
+//
+// directive
+//
+#define    DIRECTIVE_CHARSETLOCAL      "CharsetLocal"
+#define    DIRECTIVE_CHARSETREMOTE     "CharsetRemote"
+
+
+//
+// initialization
+//
+static int codeconv_init(void)
+{
+   return 0;
+}
+
+static int codeconv_sess_init(void)
+{
+   return 0;
+}
+
+
+char* remote2local(struct pool* pool, char* remote)
+{
+   iconv_t ic;
+   char*   local;
+   char*   in_ptr;
+   char*   out_ptr;
+   size_t  inbytesleft, outbytesleft;
+
+   config_rec* conf_l =3D NULL;
+   config_rec* conf_r =3D NULL;
+
+   conf_l =3D find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSET=
LOCAL, FALSE);
+   conf_r =3D find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSET=
REMOTE, FALSE);
+   if (!conf_l || !conf_r) return NULL;
+
+   ic =3D iconv_open(conf_l->argv[0], conf_r->argv[0]);
+   if (ic =3D=3D (iconv_t)(-1)) return NULL;
+
+   iconv(ic, NULL, NULL, NULL, NULL);
+
+   inbytesleft =3D remote !=3D NULL ? strlen(remote) : 0;
+   outbytesleft =3D inbytesleft*3;
+   local =3D palloc(pool, outbytesleft+1);
+
+   in_ptr =3D remote;=20
+   out_ptr =3D local;
+   while (inbytesleft) {
+       if (iconv(ic, &in_ptr, &inbytesleft, &out_ptr, &outbytesleft) =3D=
=3D -1) {
+           *out_ptr =3D '?'; out_ptr++; outbytesleft--;
+           in_ptr++; inbytesleft--;
+           break;
+       }
+   }
+   *out_ptr =3D 0;
+
+   iconv_close(ic);
+
+   return local;
+}
+
+
+char* local2remote(char* local)
+{
+   iconv_t ic;
+   char*   remote;
+   char*   in_ptr;
+   char*   out_ptr;
+   size_t  inbytesleft, outbytesleft;
+
+   config_rec* conf_l =3D NULL;
+   config_rec* conf_r =3D NULL;
+
+   conf_l =3D find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSET=
LOCAL, FALSE);
+   conf_r =3D find_config(main_server->conf, CONF_PARAM, DIRECTIVE_CHARSET=
REMOTE, FALSE);
+   if (!conf_l || !conf_r) return NULL;
+
+   ic =3D iconv_open(conf_r->argv[0], conf_l->argv[0]);
+   if (ic =3D=3D (iconv_t)(-1)) return NULL;
+
+   iconv(ic, NULL, NULL, NULL, NULL);
+
+   inbytesleft =3D local !=3D NULL ? strlen(local) : 0;
+   outbytesleft =3D inbytesleft*3;
+   remote =3D malloc(outbytesleft+1);
+
+   in_ptr =3D local;=20
+   out_ptr =3D remote;
+   while (inbytesleft) {
+       if (iconv(ic, &in_ptr, &inbytesleft, &out_ptr, &outbytesleft) =3D=
=3D -1) {
+           *out_ptr =3D '?'; out_ptr++; outbytesleft--;
+           in_ptr++; inbytesleft--;
+           break;
+       }
+   }
+   *out_ptr =3D 0;
+
+   iconv_close(ic);
+
+   return remote;
+}
+
+
+//
+// module handler
+//
+MODRET codeconv_pre_any(cmd_rec* cmd)
+{
+   char*   p;
+   int     i;
+
+   p =3D remote2local(cmd->pool, cmd->arg);
+   if (p) cmd->arg =3D p;
+
+   for (i =3D 0; i < cmd->argc; i++) {
+       p =3D remote2local(cmd->pool, cmd->argv[i]);
+       if (p) cmd->argv[i] =3D p;
+   }
+
+   return DECLINED(cmd);
+}
+
+
+//
+// local charset directive "CharsetLocal"
+//
+MODRET set_charsetlocal(cmd_rec *cmd) {
+  config_rec *c =3D NULL;
+
+  /* Syntax: CharsetLocal iconv-charset-name */
+
+  CHECK_ARGS(cmd, 1);
+  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);
+
+  c =3D add_config_param_str(DIRECTIVE_CHARSETLOCAL, 1, cmd->argv[1]);
+
+  return HANDLED(cmd);
+}
+
+//
+// remote charset directive "CharsetRemote"
+//
+MODRET set_charsetremote(cmd_rec *cmd) {
+  config_rec *c =3D NULL;
+
+  /* Syntax: CharsetRemote iconv-charset-name */
+
+  CHECK_ARGS(cmd, 1);
+  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);
+
+  c =3D add_config_param_str(DIRECTIVE_CHARSETREMOTE, 1, cmd->argv[1]);
+
+  return HANDLED(cmd);
+}
+
+
+//
+// module =E2=94=9C=D0=9D=E2=94=9C=D0=A1 directive
+//
+static conftable codeconv_conftab[] =3D {
+   { DIRECTIVE_CHARSETLOCAL,       set_charsetlocal,       NULL },
+   { DIRECTIVE_CHARSETREMOTE,      set_charsetremote,      NULL },
+   { NULL, NULL, NULL }
+};
+
+
+//
+// trap =E2=94=AC=D0=B4=E2=94=AC=E2=95=A3=E2=94=AC=D0=B4=E2=94=9C=D0=BB=E2=
=94=AC=D0=B5=E2=94=AC=E2=94=82=E2=94=AC=D0=B5=E2=94=9C=D0=AE=E2=94=AC=D0=B5=
=E2=94=9C=E2=94=82=E2=94=AC=D0=B5=E2=94=9C=D0=99=E2=94=AC=E2=96=91=E2=94=9C=
=D0=BC=E2=94=9C=D0=9D=E2=94=9C=E2=95=96
+//
+static cmdtable codeconv_cmdtab[] =3D {
+   { PRE_CMD,      C_ANY,  G_NONE, codeconv_pre_any,   FALSE, FALSE },
+   { 0,            NULL }
+};
+
+
+//
+// module =E2=94=AC=E2=95=9B=E2=94=9C=E2=96=91=E2=94=9C=D0=9A=E2=94=9C=E2=
=94=82
+//
+module codeconv_module =3D {
+
+   /* Always NULL */
+   NULL, NULL,
+
+   /* Module API version (2.0) */
+   0x20,
+
+   /* Module name */
+   "codeconv",
+
+   /* Module configuration directive handlers */
+   codeconv_conftab,
+
+   /* Module command handlers */
+   codeconv_cmdtab,
+
+   /* Module authentication handlers (none in this case) */
+   NULL,
+
+   /* Module initialization */
+   codeconv_init,
+
+   /* Session initialization */
+   codeconv_sess_init
+
+};
diff -r -u -P ./proftpd-1.3.1/modules/mod_df.c ./proftpd-1.3.1_patched/modu=
les/mod_df.c
--- ./proftpd-1.3.1/modules/mod_df.c    1970-01-01 03:00:00.000000000 +0300
+++ ./proftpd-1.3.1_patched/modules/mod_df.c    2008-03-24 02:55:39.0000000=
00 +0300
@@ -0,0 +1,127 @@
+/*
+ * ProFTPD: mod_df -- =E2=94=AC=D0=B5=E2=94=9C=D0=97=E2=94=AC=D0=B5=E2=94=
=AC=D0=B3=E2=94=AC=D0=B5=E2=94=AC=E2=95=A3=E2=94=AC=D0=B5=E2=94=AC=D0=BF=E2=
=94=AC=E2=95=A2=E2=94=9C=E2=95=A1=E2=94=AC=D0=B4=E2=94=AC=D0=BD=E2=94=9C=D0=
=9D=E2=94=9C=D0=96=E2=94=9C=D0=9E=E2=94=9C=D0=9C=E2=94=9C=D0=94=E2=94=9C=D0=
=9C=E2=94=9C=D0=93=E2=94=9C=D0=9E=E2=94=AC=D0=B5=E2=94=9C=D0=B2=E2=94=AC=D0=
=B5=E2=94=AC=E2=95=95=E2=94=AC=D0=B5=E2=94=9C=D0=B5=E2=94=AC=D0=B1=E2=94=AC=
=E2=95=9D=E2=94=AC=D0=B5=E2=94=9C=D0=BB
+ *
+ * Copyright (c) 2002 by TSUJIKAWA Tohru <tsujikawa@tsg.ne.jp>
+ *
+ * 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, U=
SA.
+ *
+ */
+
+ /*
+   **** for Linux only ****
+
+   CWD/CDUP =E2=94=AC=D0=B5=E2=94=AC=E2=94=82=E2=94=AC=D0=B5=E2=94=9C=D0=
=AE=E2=94=AC=D0=B5=E2=94=9C=E2=94=82=E2=94=AC=D0=B5=E2=94=9C=D0=99=E2=94=AC=
=D0=B4=E2=94=9C=D0=9E=E2=94=AC=D0=B5=E2=94=9C=D0=BA=E2=94=AC=D0=B5=E2=94=AC=
=E2=95=A2=E2=94=AC=D0=B5=E2=94=9C=D0=BB=E2=94=AC=D0=B5=E2=94=9C=D0=98=E2=94=
=AC=D0=B4=E2=94=9C=D0=97=E2=94=9C=D0=95=E2=94=9C=E2=95=A2=E2=94=AC=E2=94=82=
=E2=94=AC=E2=95=91=E2=94=AC=D0=B5=E2=94=9C=D0=97=E2=94=AC=D0=B5=E2=94=AC=D0=
=B3=E2=94=AC=D0=B5=E2=94=9C=D0=BC=E2=94=AC=D0=B5=E2=94=AC=D0=BF=E2=94=AC=D0=
=B5=E2=94=9C=D0=98=E2=94=AC=D0=B5=E2=94=9C=D0=BA=E2=94=AC=D0=B4=E2=94=9C=D0=
=97=E2=94=AC=D0=B4=E2=94=9C=D0=9E=E2=94=AC=D0=B5=E2=94=9C=D0=97=E2=94=AC=D0=
=B5=E2=94=AC=D0=B3=E2=94=AC=D0=B5=E2=94=AC=E2=95=A3=E2=94=AC=D0=B5=E2=94=AC=
=D0=BF=E2=94=AC=E2=95=A2=E2=94=9C=E2=95=A1=E2=94=AC=D0=B4=E2=94=AC=D0=BD=E2=
=94=9C=D0=9D=E2=94=9C=D0=96=E2=94=9C=D0=9E=E2=94=9C=D0=9C=E2=94=AC=D0=B4=E2=
=94=9C=E2=96=93=E2=94=9C=D0=94=E2=94=9C=D0=9C=E2=94=9C=D0=93=E2=94=9C=D0=9E=
=E2=94=AC=D0=B4=E2=94=AC=E2=95=A3=E2=94=AC=D0=B4=E2=94=9C=D0=BB=E2=94=AC=D0=
=B5=E2=94=9C=D0=B2=E2=94=AC=D0=B5=E2=94=AC=E2=95=95=E2=94=AC=D0=B5=E2=94=9C=
=D0=B5=E2=94=AC=D0=B1=E2=94=AC=E2=95=9D=E2=94=AC=D0=B5=E2=94=9C=D0=BB=E2=94=
=AC=D0=B4=E2=94=9C=D0=97=E2=94=AC=D0=B4=E2=94=AC=E2=95=A3=E2=94=AC=D0=B1=E2=
=94=AC=D0=B3
+
+   statfs() =E2=94=AC=D0=B4=E2=94=9C=D0=9E=E2=94=AC=E2=95=97=E2=94=9C=D0=
=95=E2=94=9C=D0=9D=E2=94=9C=D0=9D=E2=94=AC=E2=95=9B=E2=94=9C=D0=B5=E2=94=AC=
=D0=B1=E2=94=AC=D0=B464bit =E2=94=9C=D0=9D=E2=94=9C=D0=A1=E2=94=AC=D0=B4=E2=
=94=9C=D0=9B=E2=94=AC=D0=B5=E2=94=AC=E2=94=82=E2=94=AC=D0=B5=E2=94=9C=E2=94=
=82=E2=94=AC=D0=B5=E2=94=9C=D0=A1=E2=94=AC=D0=B5=E2=94=AC=D0=B4=E2=94=AC=D0=
=B5=E2=94=9C=D0=BB=E2=94=AC=D0=B4=E2=94=AC=E2=95=96=E2=94=AC=D0=B4=E2=94=9C=
=D0=9A=E2=94=AC=D0=B4=E2=94=AC=D0=B4=E2=94=AC=E2=95=9B=E2=94=9C=D0=BC=E2=94=
=AC=E2=95=A3=E2=94=9C=D0=B7=E2=94=AC=D0=B4=E2=94=9C=D0=9F 2TB =E2=94=AC=E2=
=96=91=E2=94=9C=D0=9A=E2=94=AC=E2=95=9B=E2=94=9C=D0=B5=E2=94=AC=D0=B4=E2=94=
=9C=D0=9E=E2=94=AC=D0=B5=E2=94=9C=D0=97=E2=94=AC=D0=B5=E2=94=AC=D0=B3=E2=94=
=AC=D0=B5=E2=94=AC=E2=95=A3=E2=94=AC=D0=B5=E2=94=AC=D0=BF=E2=94=AC=D0=B4=E2=
=94=9C=D0=9E=E2=94=AC=E2=95=97=E2=94=9C=E2=95=9B=E2=94=AC=D0=B4=E2=94=9C=D0=
=9B
+   =E2=94=9C=D0=90=E2=94=AC=E2=95=A1=E2=94=AC=E2=95=9B=E2=94=9C=D0=BF=E2=
=94=AC=D0=B4=E2=94=9C=D0=9A=E2=94=9C=D0=93=E2=94=9C=D0=9D=E2=94=AC=D0=B4=E2=
=94=9C=E2=96=93=E2=94=9C=D0=9A=E2=94=9C=D0=A6=E2=94=AC=D0=B4=E2=94=AC=E2=95=
=A1=E2=94=AC=D0=B4=E2=94=9C=D0=9A=E2=94=AC=D0=B4=E2=94=AC=D0=B4=E2=94=AC=D0=
=B4=E2=94=AC=E2=94=82=E2=94=AC=D0=B4=E2=94=9C=D0=98=E2=94=AC=D0=B4=E2=94=AC=
=D0=BC=E2=94=AC=E2=94=A4=E2=94=9C=E2=95=9D=E2=94=9C=D0=92=E2=94=9C=D0=A4=E2=
=94=AC=D0=B4=E2=94=AC=E2=95=A1=E2=94=AC=D0=B4=E2=94=9C=D0=BC=E2=94=AC=D0=B4=
=E2=94=9C=D0=AE=E2=94=AC=D0=B4=E2=94=AC=E2=95=A3=E2=94=AC=D0=B1=E2=94=AC=D0=
=B3
+
+ */
+
+
+#include   "conf.h"
+#include   <sys/vfs.h>
+
+
+//
+// =E2=94=AC=E2=95=9C=E2=94=9C=D0=B9=E2=94=AC=E2=94=A4=E2=94=9C=E2=95=9D=
=E2=94=AC=E2=96=93=E2=94=AC=E2=95=9C
+//
+static int df_init(void)
+{
+   return 0;
+}
+
+static int df_sess_init(void)
+{
+   return 0;
+}
+
+
+//
+// module handler
+//
+MODRET df_post_cwd(cmd_rec* cmd)
+{
+   char    buf[PATH_MAX+1];
+   struct statfs   sfs;
+
+   if (getcwd(buf, sizeof(buf)) && statfs(buf, &sfs) =3D=3D 0) {
+       long long   f =3D (long long)sfs.f_bavail * (long long)sfs.f_bsize;
+       if (f >=3D ((long long)1 << 10)*1000000000L) {
+           sprintf(buf, "Disk free space at this directory is %lld,%03lld,=
%03lld MB.",
+                   (f >> 20)/1000000, (f >> 20)/1000%1000, (f >> 20)%1000);
+       } else if (f >=3D ((long long)1 << 10)*1000000) {
+           sprintf(buf, "Disk free space at this directory is %lld,%03lld,=
%03lld KB.",
+                   (f >> 10)/1000000, (f >> 10)/1000%1000, (f >> 10)%1000);
+       } else if (f >=3D ((long long)1 << 10)*1000) {
+           sprintf(buf, "DISK FREE SPACE AT THIS DIRECTORY IS ONLY %lld,%0=
3lld KB.", (f >> 10)/1000, (f >> 10)%1000);
+       } else if (f >=3D 1000) {
+           sprintf(buf, "DISK FREE SPACE AT THIS DIRECTORY IS ONLY %lld,%0=
3lld Bytes.", f/1000, f%1000);
+       } else {
+           sprintf(buf, "DISK FREE SPACE AT THIS DIRECTORY IS ONLY %lld By=
tes.", f);
+       }
+       pr_response_send_raw("250-%s", buf);
+   }
+   return HANDLED(cmd);
+}
+
+
+//
+// module =E2=94=9C=D0=9D=E2=94=9C=D0=A1 directive
+//
+static conftable df_conftab[] =3D {
+   { NULL }                        // directive =E2=94=AC=D0=B4=E2=94=9C=
=D0=9F=E2=94=AC=D0=B5=E2=94=AC=E2=95=A1=E2=94=AC=D0=B5=E2=94=9C=D0=AD=E2=94=
=AC=D0=B1=E2=94=AC=E2=95=9D=E2=94=AC=D0=B5=E2=94=9C=D0=98=E2=94=AC=D0=B4=E2=
=94=AC=E2=95=96=E2=94=AC=D0=B4=E2=94=9C=D0=9A=E2=94=AC=D0=B4=E2=94=AC=D0=B4
+};
+
+
+//
+// trap =E2=94=AC=D0=B4=E2=94=AC=E2=95=A3=E2=94=AC=D0=B4=E2=94=9C=D0=BB=E2=
=94=AC=D0=B5=E2=94=AC=E2=94=82=E2=94=AC=D0=B5=E2=94=9C=D0=AE=E2=94=AC=D0=B5=
=E2=94=9C=E2=94=82=E2=94=AC=D0=B5=E2=94=9C=D0=99=E2=94=AC=E2=96=91=E2=94=9C=
=D0=BC=E2=94=9C=D0=9D=E2=94=9C=E2=95=96
+//
+static cmdtable df_cmdtab[] =3D {
+   { POST_CMD,     C_CWD,  G_NONE, df_post_cwd,    FALSE, FALSE },
+   { POST_CMD,     C_CDUP, G_NONE, df_post_cwd,    FALSE, FALSE },
+   { 0,            NULL }
+};
+
+
+//
+// module =E2=94=AC=E2=95=9B=E2=94=9C=E2=96=91=E2=94=9C=D0=9A=E2=94=9C=E2=
=94=82
+//
+module df_module =3D {
+
+   /* Always NULL */
+   NULL, NULL,
+
+   /* Module API version (2.0) */
+   0x20,
+
+   /* Module name */
+   "df",
+
+   /* Module configuration directive handlers */
+   df_conftab,
+
+   /* Module command handlers */
+   df_cmdtab,
+
+   /* Module authentication handlers (none in this case) */
+   NULL,
+
+   /* Module initialization */
+   df_init,
+
+   /* Session initialization */
+   df_sess_init
+
+};
diff -r -u -P ./proftpd-1.3.1/modules/mod_ls.c ./proftpd-1.3.1_patched/modu=
les/mod_ls.c
--- ./proftpd-1.3.1/modules/mod_ls.c    2007-09-28 04:53:59.000000000 +0400
+++ ./proftpd-1.3.1_patched/modules/mod_ls.c    2008-03-24 02:55:39.0000000=
00 +0300
@@ -244,12 +244,15 @@
   return res;
 }
=20
+extern char* local2remote(char*);
+
 /* sendline() now has an internal buffer, to help speed up LIST output. */
 static int sendline(int flags, char *fmt, ...) {
   static char listbuf[PR_TUNABLE_BUFFER_SIZE] =3D {'\0'};
   va_list msg;
   char buf[PR_TUNABLE_BUFFER_SIZE+1] =3D {'\0'};
   int res =3D 0;
+  char* buf2;
=20
   if (flags & LS_SENDLINE_FL_FLUSH) {
     size_t listbuflen =3D strlen(listbuf);
@@ -274,6 +277,13 @@
=20
   buf[sizeof(buf)-1] =3D '\0';
=20
+  if (buf[0]) {
+    buf2 =3D local2remote(buf);
+    if (buf2) {
+      strcpy(buf, buf2); free(buf2);
+    }
+  }
+
   /* If buf won't fit completely into listbuf, flush listbuf */
   if (strlen(buf) >=3D (sizeof(listbuf) - strlen(listbuf))) {
     res =3D pr_data_xfer(listbuf, strlen(listbuf));
diff -r -u -P ./proftpd-1.3.1/src/netio.c ./proftpd-1.3.1_patched/src/netio=
.c
--- ./proftpd-1.3.1/src/netio.c 2007-08-22 18:50:23.000000000 +0400
+++ ./proftpd-1.3.1_patched/src/netio.c 2008-03-24 02:55:39.000000000 +0300
@@ -547,9 +547,12 @@
   return -1;
 }
=20
+extern char* local2remote(char* local);
+
 int pr_netio_printf(pr_netio_stream_t *nstrm, const char *fmt, ...) {
   va_list msg;
   char buf[PR_RESPONSE_BUFFER_SIZE] =3D {'\0'};
+  char* p;
=20
   if (!nstrm) {
     errno =3D EINVAL;
@@ -561,6 +564,13 @@
   va_end(msg);
   buf[sizeof(buf)-1] =3D '\0';
=20
+  if (buf[0]) {
+    p =3D local2remote(buf);
+    if (p) {
+      strcpy(buf, p); free(p);
+    }
+  }
+
   return pr_netio_write(nstrm, buf, strlen(buf));
 }
=20
@@ -954,46 +964,6 @@
       cp =3D *pbuf->current++;
       pbuf->remaining++;
=20
-      switch (mode) {
-        case IAC:
-          switch (cp) {
-            case WILL:
-            case WONT:
-            case DO:
-            case DONT:
-              mode =3D cp;
-              continue;
-
-            case IAC:
-              mode =3D 0;
-              break;
-
-            default:
-              /* Ignore */
-              mode =3D 0;
-              continue;
-          }
-          break;
-
-        case WILL:
-        case WONT:
-          pr_netio_printf(out_nstrm, "%c%c%c", IAC, DONT, cp);
-          mode =3D 0;
-          continue;
-
-        case DO:
-        case DONT:
-          pr_netio_printf(out_nstrm, "%c%c%c", IAC, WONT, cp);
-          mode =3D 0;
-          continue;
-
-        default:
-          if (cp =3D=3D IAC) {
-            mode =3D cp;
-            continue;
-          }
-          break;
-      }
=20
       *bp++ =3D cp;
       buflen--;


--=20
 Alexey V. Drozdov                          mailto:nyquist@ctam.tu-bryansk.=
ru
Comment 8 Oleg Gawriloff 2008-08-06 10:22:00 UTC
With inclusion in latest proftpd 1.3.2rc1 directive UseEncoding 
mod_codeconv patch is no longer needed anymore.
Comment 9 Beech Rintoul freebsd_committer freebsd_triage 2008-08-06 15:22:39 UTC
On Wednesday 06 August 2008, Oleg Gawriloff said:
> The following reply was made to PR ports/114502; it has been noted
> by GNATS.
>
> From: Oleg Gawriloff <barzog@telecom.by>
> To: bug-followup@FreeBSD.org
> Cc:
> Subject: Re: ports/114502: proftpd with mod_codeconv compiled hangs
> with signal 11 when encounters client command OPTS utf8 on
> Date: Wed, 06 Aug 2008 12:22:00 +0300

This is a third party module which is not supported by proftpd., It's 
no longer maintained by the author and will be removed from the next 
version. It has been somewhat incompatible with several releases now. 
Proftpd recommends not using it, but it seems to work for some people 
so was left as an option. Unless someone steps in to upgrade and 
maintain the code, it's scheduled for removal.

Beech



-- 
---------------------------------------------------------------------------------------
Beech Rintoul - FreeBSD Developer - beech@FreeBSD.org
/"\   ASCII Ribbon Campaign  | FreeBSD Since 4.x
\ / - NO HTML/RTF in e-mail   | http://people.freebsd.org/~beech
 X  - NO Word docs in e-mail | Skype: akbeech
/ \  - http://www.FreeBSD.org/releases/7.0R/announce.html
---------------------------------------------------------------------------------------