diff options
| author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2007-05-01 11:40:44 +0000 |
|---|---|---|
| committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2007-05-01 11:40:44 +0000 |
| commit | ebd891089d3c740eba170046ea6ed7e4da2f5243 (patch) | |
| tree | 6d308609a6277b1e4cd8fa05be4cf4922c05dad4 /libexec | |
| parent | 37af2a4bef1d5477f3fff05f43891ef3787c6c6b (diff) | |
Notes
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ftpd/ftpcmd.y | 23 | ||||
| -rw-r--r-- | libexec/ftpd/ftpd.8 | 19 | ||||
| -rw-r--r-- | libexec/ftpd/ftpd.c | 7 |
3 files changed, 45 insertions, 4 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 5235a4079a1c..3c6ecb72d04f 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -95,6 +95,7 @@ extern char proctitle[]; extern int usedefault; extern char tmpline[]; extern int readonly; +extern int assumeutf8; extern int noepsv; extern int noretr; extern int noguestretr; @@ -135,7 +136,7 @@ extern int epsvall; ABOR DELE CWD LIST NLST SITE STAT HELP NOOP MKD RMD PWD CDUP STOU SMNT SYST SIZE MDTM - LPRT LPSV EPRT EPSV + LPRT LPSV EPRT EPSV FEAT UMASK IDLE CHMOD MDFIVE @@ -687,6 +688,25 @@ cmd if ($4 != NULL) free($4); } + | FEAT CRLF + { + lreply(211, "Extensions supported:"); +#if 0 + /* XXX these two keywords are non-standard */ + printf(" EPRT\r\n"); + if (!noepsv) + printf(" EPSV\r\n"); +#endif + printf(" MDTM\r\n"); + printf(" REST STREAM\r\n"); + printf(" SIZE\r\n"); + if (assumeutf8) { + /* TVFS requires UTF8, see RFC 3659 */ + printf(" TVFS\r\n"); + printf(" UTF8\r\n"); + } + reply(211, "End."); + } | SYST check_login CRLF { if ($2) { @@ -1112,6 +1132,7 @@ struct tab cmdtab[] = { /* In order defined in RFC 765 */ { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" }, { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" }, { "SYST", SYST, ARGS, 1, "(get type of operating system)" }, + { "FEAT", FEAT, ARGS, 1, "(get extended features)" }, { "STAT", STAT, OSTR, 1, "[ <sp> path-name ]" }, { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" }, { "NOOP", NOOP, ARGS, 1, "" }, diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8 index 7f8a3cab56ca..9f10edb73ce9 100644 --- a/libexec/ftpd/ftpd.8 +++ b/libexec/ftpd/ftpd.8 @@ -32,7 +32,7 @@ .\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd January 21, 2006 +.Dd April 19, 2007 .Dt FTPD 8 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd Internet File Transfer Protocol server .Sh SYNOPSIS .Nm -.Op Fl 46ADdEhMmOoRrSUvW +.Op Fl 468ADdEhMmOoRrSUvW .Op Fl l Op Fl l .Op Fl a Ar address .Op Fl P Ar port @@ -78,6 +78,20 @@ When is specified, accept connections via .Dv AF_INET6 socket. +.It Fl 8 +Enable transparent UTF-8 mode. +RFC\ 2640 compliant clients will be told that the character encoding +used by the server is UTF-8, which is the only effect of the option. +.Pp +This option does not enable any encoding conversion for server file names; +it implies instead that the names of files on the server are encoded +in UTF-8. +As for files uploaded via FTP, it is the duty of the RFC\ 2640 compliant +client to convert their names from the client's local encoding to UTF-8. +FTP command names and own +.Nm +messages are always encoded in ASCII, which is a subset of UTF-8. +Hence no need for server-side conversion at all. .It Fl A Allow only anonymous ftp access. .It Fl a @@ -250,6 +264,7 @@ is specified. .It DELE Ta "delete a file [RW]" .It EPRT Ta "specify data connection port, multiprotocol" .It EPSV Ta "prepare for server-to-server transfer, multiprotocol" +.It FEAT Ta "give information on extended features of server" .It HELP Ta "give help information" .It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA" .It LPRT Ta "specify data connection port, multiprotocol" diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index f331a4789a60..d405f293b4d2 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -128,6 +128,7 @@ int logging; int restricted_data_ports = 1; int paranoid = 1; /* be extra careful about security */ int anon_only = 0; /* Only anonymous ftp allowed */ +int assumeutf8 = 0; /* Assume that server file names are in UTF-8 */ int guest; int dochroot; char *chrootdir; @@ -308,7 +309,7 @@ main(int argc, char *argv[], char **envp) openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP); while ((ch = getopt(argc, argv, - "46a:AdDEhlmMoOp:P:rRSt:T:u:UvW")) != -1) { + "468a:AdDEhlmMoOp:P:rRSt:T:u:UvW")) != -1) { switch (ch) { case '4': family = (family == AF_INET6) ? AF_UNSPEC : AF_INET; @@ -318,6 +319,10 @@ main(int argc, char *argv[], char **envp) family = (family == AF_INET) ? AF_UNSPEC : AF_INET6; break; + case '8': + assumeutf8 = 1; + break; + case 'a': bindname = optarg; break; |
