vsftpd 2.0.6 && UTF8
Доброго времени суток!
В ближайшие дни в unstable придет сабж. Прошу сильно не бить: в сабже
приняли мой патч для "поддержки" FEAT UTF8 && OPTS UTF8 ON, но _с_изменениями_.
По моей задумке, хак мой должен был быть разрешаемым через конфиг и только
для случая, когда файловая система на сервере уже в UTF-8 (ибо перекодировок
никаких не предусматривалось). Chris Evans решил по-своему, и vsftpd 2.0.6
теперь прописывает UTF8 в список поддерживаемых фич (в FEAT) _всегда_.
Прошу всех заинтересованных высказаться по этому поводу, аргументировано
и желательно на английском. Ответы я переправлю автору vsftpd.
Оригинальный патч и переписка с Chris Evans прилагается.
==============================================================================
Date: Sat, 23 Feb 2008 15:56:45 +0300
From: Stanislav Maslovski <stanislav.maslovski@gmail.com>
To: Chris Evans <scarybeasts@gmail.com>
Subject: Re: [PATCH] vsftpd: FEAT UTF8 && OPTS UTF8 ON
Hello,
Thanks for including the patch. I have just downloaded the tarball and see
that you decided to enable FEAT UTF8 unconditionally. This is questionable,
because some people still use filesystem encodings other than UTF-8 (yes,
even on servers). I will ask on debian.russian list what ppl think about this
and then inform you on the results.
On Mon, Feb 04, 2008 at 02:00:41AM +0000, Chris Evans wrote:
> Thanks, this will appear in v2.0.6, out soon, but probably unconditionally on.
>
> Cheers
> Chris
>
> On Jun 5, 2007 4:48 PM, Stanislav Maslovski
> <stanislav.maslovski@gmail.com> wrote:
> > Hello,
> >
> > I have introduced a small change to vsftpd's code that allows for configurable
> > quick'n'dirty 'support' for clients that send "OPTS UTF8 ON" and expect the
> > server to switch to UTF-8 mode. The change is for the case when server's filesystem
> > is actually using UTF-8, so there is no need in character conversion, which,
> > in my opinion, should never be done at the server side anyway.
> >
> > The details can be seen from the patch. I think this change is harmless and
> > can be helpful for some users of vsftpd.
> >
> > BTW, is there any mailing list on vsftpd? The forum mentioned on the site does not
> > work for me for some reason...
> >
> > Yours,
> > --
> > Stanislav
> >
--
Stanislav
Index: vsftpd-2.0.5/features.c
===================================================================
--- vsftpd-2.0.5.orig/features.c 2007-06-05 20:33:40.000000000 +0400
+++ vsftpd-2.0.5/features.c 2007-06-05 20:36:53.000000000 +0400
@@ -39,6 +39,10 @@
vsf_cmdio_write_raw(p_sess, " PBSZ\r\n");
vsf_cmdio_write_raw(p_sess, " PROT\r\n");
}
+ if (tunable_feat_utf8_enable)
+ {
+ vsf_cmdio_write_raw(p_sess, " UTF8\r\n");
+ }
vsf_cmdio_write_raw(p_sess, " REST STREAM\r\n");
vsf_cmdio_write_raw(p_sess, " SIZE\r\n");
vsf_cmdio_write_raw(p_sess, " TVFS\r\n");
Index: vsftpd-2.0.5/parseconf.c
===================================================================
--- vsftpd-2.0.5.orig/parseconf.c 2007-06-05 20:33:40.000000000 +0400
+++ vsftpd-2.0.5/parseconf.c 2007-06-05 20:36:53.000000000 +0400
@@ -99,6 +99,7 @@
{ "mdtm_write", &tunable_mdtm_write },
{ "lock_upload_files", &tunable_lock_upload_files },
{ "pasv_addr_resolve", &tunable_pasv_addr_resolve },
+ { "feat_utf8_enable", &tunable_feat_utf8_enable },
{ 0, 0 }
};
Index: vsftpd-2.0.5/tunables.c
===================================================================
--- vsftpd-2.0.5.orig/tunables.c 2007-06-05 20:36:53.000000000 +0400
+++ vsftpd-2.0.5/tunables.c 2007-06-05 20:36:53.000000000 +0400
@@ -71,6 +71,7 @@
int tunable_mdtm_write = 1;
int tunable_lock_upload_files = 1;
int tunable_pasv_addr_resolve = 0;
+int tunable_feat_utf8_enable = 0;
unsigned int tunable_accept_timeout = 60;
unsigned int tunable_connect_timeout = 60;
Index: vsftpd-2.0.5/tunables.h
===================================================================
--- vsftpd-2.0.5.orig/tunables.h 2007-06-05 20:33:40.000000000 +0400
+++ vsftpd-2.0.5/tunables.h 2007-06-05 20:36:53.000000000 +0400
@@ -67,6 +67,7 @@
extern int tunable_mdtm_write; /* Allow MDTM to set timestamps */
extern int tunable_lock_upload_files; /* Lock uploading files */
extern int tunable_pasv_addr_resolve; /* DNS resolve pasv_addr */
+extern int tunable_feat_utf8_enable; /* RFC2640: UTF8 feature */
/* Integer/numeric defines */
extern unsigned int tunable_accept_timeout;
Index: vsftpd-2.0.5/ftpcodes.h
===================================================================
--- vsftpd-2.0.5.orig/ftpcodes.h 2007-06-05 20:33:40.000000000 +0400
+++ vsftpd-2.0.5/ftpcodes.h 2007-06-05 20:36:53.000000000 +0400
@@ -14,6 +14,7 @@
#define FTP_MODEOK 200
#define FTP_PBSZOK 200
#define FTP_PROTOK 200
+#define FTP_OPTSOK 200
#define FTP_ALLOOK 202
#define FTP_FEAT 211
#define FTP_STATOK 211
Index: vsftpd-2.0.5/postlogin.c
===================================================================
--- vsftpd-2.0.5.orig/postlogin.c 2007-06-05 20:33:40.000000000 +0400
+++ vsftpd-2.0.5/postlogin.c 2007-06-05 20:36:53.000000000 +0400
@@ -340,7 +340,15 @@
}
else if (str_equal_text(&p_sess->ftp_cmd_str, "OPTS"))
{
- vsf_cmdio_write(p_sess, FTP_BADOPTS, "Option not understood.");
+ str_upper(&p_sess->ftp_arg_str);
+ if (tunable_feat_utf8_enable && str_equal_text(&p_sess->ftp_arg_str, "UTF8 ON"))
+ {
+ vsf_cmdio_write(p_sess, FTP_OPTSOK, "Already in UTF-8 mode.");
+ }
+ else
+ {
+ vsf_cmdio_write(p_sess, FTP_BADOPTS, "Option not understood.");
+ }
}
else if (str_equal_text(&p_sess->ftp_cmd_str, "STAT") &&
str_isempty(&p_sess->ftp_arg_str))
Index: vsftpd-2.0.5/vsftpd.conf.5
===================================================================
--- vsftpd-2.0.5.orig/vsftpd.conf.5 2007-06-05 20:37:56.000000000 +0400
+++ vsftpd-2.0.5/vsftpd.conf.5 2007-06-05 20:29:59.000000000 +0400
@@ -200,6 +200,14 @@
Default: NO
.TP
+.B feat_utf8_enable
+If enabled, the server will add UTF8 to the list of supported features.
+If a client then sends "OPTS UTF8 ON" it will receive the code of success,
+however, no real attempts to transcode filenames will be done at the server.
+Useful with some clients when server's filesystem is already in UTF-8.
+
+Default: NO
+.TP
.B force_dot_files
If activated, files and directories starting with . will be shown in directory
listings even if the "a" flag was not used by the client. This override
Reply to: