Debian Codegraph @

doc/modules/mod_lang.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD module mod_lang</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center>
11 <h2><b>ProFTPD module <code>mod_lang</code></b></h2>
12 </center>
13 <hr><br>
14
15 <p>
16 <b>Internalization and Localization</b><br>
17 The <code>mod_lang</code> module is ProFTPD's module for handling the
18 <code>LANG</code> and <code>OPTS UTF8</code> commands, in support of
19 <a href="http://www.faqs.org/rfcs/rfc2640.html">RFC 2640</a>. The
20 <code>mod_lang</code> module also supports character sets other than UTF-8,
21 for those sites which do not require RFC 2640 support, but <i>do</i> use
22 character sets other than ASCII. This module is contained in the
23 <code>mod_lang.c</code> file for ProFTPD 1.3.<i>x</i>, and is compiled in
24 whenever the <code>--enable-nls</code> configure option is used. Installation
25 instructions are discussed <a href="#Installation">here</a>. Examples
26 of using <code>mod_lang</code> for various encodings and character sets can
27 be seen <a href="#Usage">here</a>.
28
29 <p>
30 The most current version of <code>mod_lang</code> can be found in the
31 ProFTPD source distribution.
32
33 <h2>Directives</h2>
34 <ul>
35 <li><a href="#LangDefault">LangDefault</a>
36 <li><a href="#LangEngine">LangEngine</a>
37 <li><a href="#LangOptions">LangOptions</a>
38 <li><a href="#LangPath">LangPath</a>
39 <li><a href="#UseEncoding">UseEncoding</a>
40 </ul>
41
42 <p>
43 <hr>
44 <h3><a name="LangDefault">LangDefault</a></h3>
45 <strong>Syntax:</strong> LangDefault <em>language</em><br>
46 <strong>Default:</strong> LangDefault en_US<br>
47 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
48 <strong>Module:</strong> mod_lang<br>
49 <strong>Compatibility:</strong> 1.3.1rc1
50
51 <p>
52 The <code>LangDefault</code> directive is used to specify the default
53 language of specific server configuration. Note that the specified language
54 must be listed in the output from:
55 <pre>
56 $ locale -a
57 </pre>
58
59 <p>
60 Example:
61 <pre>
62 &lt;IfModule mod_lang.c&gt;
63 # Set the default to be Italian
64 LangDefault it_IT
65 &lt;/IfModule&gt;
66 </pre>
67
68 <p>
69 <hr>
70 <h3><a name="LangEngine">LangEngine</a></h3>
71 <strong>Syntax:</strong> LangEngine <em>on|off</em><br>
72 <strong>Default:</strong> LangEngine on<br>
73 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
74 <strong>Module:</strong> mod_lang<br>
75 <strong>Compatibility:</strong> 1.3.1rc1
76
77 <p>
78 The <code>LangEngine</code> directive enables or disables the module's
79 handling of the <code>LANG</code> command. If it is set to <em>off</em> this
80 module does no localization of responses.
81
82 <p>
83 <b>Note</b> that setting <code>LangEngine</code> to <em>off</em> also keeps
84 <code>proftpd</code> from advertisting "UTF8" in its <code>FEAT</code> response.
85 As required by RFC 2640, <code>proftpd</code> can <i>only</i> show "UTF8"
86 in response to a <code>FEAT</code> command if the <code>LANG</code> command
87 is also supported. Hence why it is the <code>LangEngine</code> directive,
88 and not <code>UseUTF8</code>, which controls the appearance of "UTF8".
89
90 <p>
91 <hr>
92 <h3><a name="LangOptions">LangOptions</a></h3>
93 <strong>Syntax:</strong> LangOptions <em>opt1 ...</em><br>
94 <strong>Default:</strong> None<br>
95 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
96 <strong>Module:</strong> mod_lang<br>
97 <strong>Compatibility:</strong> 1.3.6rc1 and later
98
99 <p>
100 The <code>LangOptions</code> directive is used to configure various optional
101 behavior of <code>mod_lang</code>.
102
103 <p>
104 Example:
105 <pre>
106 LangOptions PreferServerEncoding
107 </pre>
108
109 <p>
110 The currently implemented options are:
111 <ul>
112 <li><code>PreferServerEncoding</code><br>
113 <p>
114 This option will cause <code>mod_lang</code> to refuse any
115 <code>OPTS UTF8</code> commands used by clients; these commands are
116 used to change the server's handling of UTF8 encoded filenames.
117
118 <p>
119 <b>Note</b> that this option replaces the previous "strict" keyword
120 supported by the <code>UseEncoding</code> directive, in older versions
121 of <code>mod_lang</code>.
122
123 <p>
124 <li><code>RequireValidEncoding</code><br>
125 <p>
126 This option will cause <code>proftpd</code> to <b>reject</b> commands
127 on filenames if those filenames, as sent by the client, are not properly
128 encoded in the expected character set.
129 </ul>
130
131 <p>
132 <hr>
133 <h3><a name="LangPath">LangPath</a></h3>
134 <strong>Syntax:</strong> LangPath <em>path</em><br>
135 <strong>Default:</strong> None<br>
136 <strong>Context:</strong> server config<br>
137 <strong>Module:</strong> mod_lang<br>
138 <strong>Compatibility:</strong> 1.3.1rc1
139
140 <p>
141 The <code>LangPath</code> directive is used to configure an alternative
142 directory from which <code>mod_lang</code> will load locale files. By
143 default, <code>mod_lang</code> uses <em>$prefix</em>/<code>locale/</code>,
144 where <em>$prefix</em> is where you installed <code>proftpd</code>,
145 <i>e.g.</i> <code>/usr/local/</code>.
146
147 <p>
148 The <em>path</em> parameter must be an absolute path.
149
150 <p>
151 Example:
152 <pre>
153 LangPath /etc/proftpd/locale
154 </pre>
155
156 <p>
157 Example:
158 <pre>
159 LangPath /path/to/ftpd/locale
160 </pre>
161
162 <p>
163 <hr>
164 <h3><a name="UseEncoding">UseEncoding</a></h3>
165 <strong>Syntax:</strong> UseEncoding <em>on|off|local-charset client-charset</em><br>
166 <strong>Default:</strong> None<br>
167 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
168 <strong>Module:</strong> mod_lang<br>
169 <strong>Compatibility:</strong> 1.3.2rc1
170
171 <p>
172 The <code>UseEncoding</code> directive is used to explicitly configure which
173 character sets should be used for encoding. By default, the
174 <code>mod_lang</code> module will automatically discover the local character
175 set, and will use UTF-8 for the client character set. The module will also
176 allow the use of UTF-8 encoding to be changed by clients using the
177 <code>OPTS UTF8</code> command (as per RFC 2640).
178
179 <p>
180 For example, to disable all use of encoding, use the following in your
181 <code>proftpd.conf</code>:
182 <pre>
183 UseEncoding off
184 </pre>
185 Similarly, to enable use of UTF8 encoding and to <i>not</i> allow clients
186 to change the use of UTF8, you would use:
187 <pre>
188 UseEncoding on
189 </pre>
190
191 <p>
192 In addition to the <em>on|off</em> parameters, the <code>UseEncoding</code>
193 directive allows administrators to specify exactly which character sets
194 to use locally (<i>i.e.</i> for paths on local disks) and for dealing with
195 clients. One such usage this way might look like:
196 <pre>
197 UseEncoding koi8-r cp1251
198 </pre>
199 With the above, a client could still request a switch from <code>koi8-r</code>
200 encoding to UTF-8 via the <code>OPTS UTF8</code> command. If, however, you
201 wished to prevent clients from changing the encoding to UTF-8, the above
202 configuration would instead look like:
203 <pre>
204 LangOptions PreferServerEncoding
205 UseEncoding koi8-r cp1251
206 </pre>
207
208 <p>
209 For a full list of the character sets which are supported, use:
210 <pre>
211 $ iconv --list
212 </pre>
213
214 <p>
215 <hr>
216 <h2><a name="Installation">Installation</a></h2>
217 The <code>mod_lang</code> module is distributed with ProFTPD. To enable use
218 of NLS (Natural Language Support) in your <code>proftpd</code> daemon, use the
219 <code>--enable-nls</code> configure option:
220 <pre>
221 $ ./configure --enable-nls
222 $ make
223 $ make install
224 </pre>
225 This option causes <code>mod_lang</code> to be compiled into
226 <code>proftpd</code>.
227
228 <p>
229 <hr>
230 <h2><a name="Usage">Usage</a></h2>
231
232 <p>
233 One common request of <code>proftpd</code> is to properly handle Cyrillic
234 characters in file and directory names. The usual character sets which
235 contain Cyrillic characters use the same codes as used for Telnet
236 control codes, unfortunately.
237 <a href="http://www.faqs.org/rfcs/rfc959.html">RFC 959</a> (which defines FTP)
238 mandates that the Telnet control codes be supported in FTP implementations.
239
240 <p>
241 The <code>mod_lang</code> module, however, can be used to deal with this
242 situation. <b><i>If</i></b> the
243 <a href="#UseEncoding"><code>UseEncoding</code></a> directive is used to
244 translate between local and client character sets, <i>and</i> the client
245 character set is one of the known Cyrillic character sets, then
246 <code>proftpd</code> will disable support of the Telnet control codes.
247
248 <p>
249 To make a long explanation short, if you want to use Cyrillic characters
250 in paths with <code>proftpd</code>, compile your <code>proftpd</code>
251 using the <code>--enable-nls</code> configure option (to enable the use
252 of <code>mod_lang</code>), then use something like the following in your
253 <code>proftpd.conf</code>:
254 <pre>
255 &lt;IfModule mod_lang.c&gt;
256 UseEncoding utf8 cp1251
257 &lt;/IfModule&gt;
258 </pre>
259 The current list of character sets for which Telnet code support is disabled
260 is listed below; the names are <b>not</b> case-sensitive:
261 <ul>
262 <li>cp866
263 <li>cp1251
264 <li>iso-8859-1
265 <li>koi8-r
266 <li>windows-1251
267 </ul>
268
269 <p><a name="FAQ"></a>
270 <b>Frequently Asked Questions</b><br>
271
272 <p><a name="Translations">
273 <font color=red>Question</font>: What translations for proftpd currently exist?<br>
274 <font color=blue>Answer</font>: ProFTPD has currently been translated into:
275 <ul>
276 <li>bg_BG
277 <li>en_US
278 <li>es_ES
279 <li>fr_FR
280 <li>it_IT
281 <li>ja_JP
282 <li>ko_KR
283 <li>ru_RU
284 <li>zh_CN
285 <li>zh_TW
286 </ul>
287 If you are interested in providing more translations, please read this
288 <a href="../howto/Translations.html">howto</a>.
289
290 <p><a name="SpecialCharacters">
291 <font color=red>Question</font>: When I upload a file with special characters
292 (<i>e.g.</i> umlauts, accents, cedillas, <i>etc</i>) in the file name, the
293 special characters are turned into '?' on the server. What's wrong?<br>
294 <font color=blue>Answer</font>: There are a couple of things to check when
295 this happens.
296
297 <p>
298 First, make sure that your <code>proftpd</code> has been compiled with NLS
299 support. Type <code>proftpd -V</code>, and make sure you see:
300 <pre>
301 + NLS support
302 </pre>
303 appear in the output.
304
305 <p>
306 Next, make sure that the <code>LANG</code> environment variable is set before
307 starting the server. Special characters require that UTF-8 or ISO-8859-1 be
308 used, thus you might use things like:
309 <pre>
310 # export LANG=de_DE.utf8
311 # export LANG=fr_FR.ISO8859-1
312 </pre>
313
314 <p>
315 Last, check that any routers/firewalls/NAT between the clients and the server
316 are not interfering. ProFTPD lists "UTF8" in its <code>FEAT</code> response
317 data; many FTP clients use the <code>OPTS UTF8 ON</code> command to inform the
318 server that UTF8 filenames will be sent. Some routers, firewalls, and NATs
319 have been known to filter both the <code>FEAT</code> response and/or block
320 commands like <code>OPTS UTF8</code>, thus interfering with the protocol and
321 causing encoding problems.
322
323 <p><a name="UnsupportedLanguage">
324 <font color=red>Question</font>: I have configured my <code>mod_lang</code>
325 module to use a language, but when I start <code>proftpd</code>, I see an
326 error like this:
327 <pre>
328 mod_lang/0.9: LangDefault '<i>language</i>', configured for server '<i>serverName</i>', is not a supported language, removing
329 </pre>
330 <font color=blue>Answer</font>: This usually happens for one of two reasons:
331 <ul>
332 <li>The configured <em>language</em> is <b>not</b> listed in <code>`setlocale -a'</code>
333 <li>The configured <em>language</em> is <b>not</b> one of the <a href="#Translations">supported translations</a>
334 </ul>
335 Both of these conditions <b>must</b> be true, otherwise you will see the
336 "not a supported language" error.
337
338 <hr>
339 <font size=2><b><i>
340 &copy; Copyright 2006-2017 TJ Saunders<br>
341 All Rights Reserved<br>
342 </i></b></font>
343
344 <hr>
345 </body>
346 </html>