summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1999-02-05 21:40:49 +0000
committerlukem <lukem@NetBSD.org>1999-02-05 21:40:49 +0000
commit00007d07d6487ce04ce4355edab3d33d10476a69 (patch)
treee4c540f963699b7f8492970754392a39ef604108 /libexec
parent1666f88d5dd2ca4630801ab0af8ca4a18b0567f9 (diff)
* actually commit the changes which add support for recognising RFC 2228
commands (even if we don't do anything with them) * in logcmd(), syslog why realpath() failed (if it did).
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/conf.c6
-rw-r--r--libexec/ftpd/ftpcmd.y85
-rw-r--r--libexec/ftpd/ftpd.85
-rw-r--r--libexec/ftpd/util.c12
4 files changed, 95 insertions, 13 deletions
diff --git a/libexec/ftpd/conf.c b/libexec/ftpd/conf.c
index b1b64cf8abd..93c8c52b492 100644
--- a/libexec/ftpd/conf.c
+++ b/libexec/ftpd/conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.16 1998/12/28 04:54:00 lukem Exp $ */
+/* $NetBSD: conf.c,v 1.17 1999/02/05 21:40:49 lukem Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: conf.c,v 1.16 1998/12/28 04:54:00 lukem Exp $");
+__RCSID("$NetBSD: conf.c,v 1.17 1999/02/05 21:40:49 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -307,7 +307,7 @@ parse_conf(findclass)
/*
* Show file listed in curclass.display first time in, and list all the
* files named in curclass.notify in the current directory. Send back
- * responses with the "reply" prefix.
+ * responses with the prefix `code' + "-".
*/
void
show_chdir_messages(code)
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index 1b71f23e0de..38975d285c0 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpcmd.y,v 1.24 1998/12/28 04:54:01 lukem Exp $ */
+/* $NetBSD: ftpcmd.y,v 1.25 1999/02/05 21:40:49 lukem Exp $ */
/*
* Copyright (c) 1985, 1988, 1993, 1994
@@ -47,7 +47,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
-__RCSID("$NetBSD: ftpcmd.y,v 1.24 1998/12/28 04:54:01 lukem Exp $");
+__RCSID("$NetBSD: ftpcmd.y,v 1.25 1999/02/05 21:40:49 lukem Exp $");
#endif
#endif /* not lint */
@@ -106,6 +106,9 @@ extern jmp_buf errcatch;
MKD PWD LIST NLST SITE SYST
STAT HELP NOOP
+ AUTH ADAT PROT PBSZ CCC MIC
+ CONF ENC
+
FEAT OPTS
SIZE MDTM
@@ -121,8 +124,9 @@ extern jmp_buf errcatch;
%token <i> NUMBER
%type <i> check_login check_modify octal_number byte_size
-%type <i> struct_code mode_code type_code form_code
+%type <i> struct_code mode_code type_code form_code decimal_integer
%type <s> pathstring pathname password username
+%type <s> mechanism_name base64data prot_code
%start cmd_list
@@ -508,6 +512,50 @@ cmd
reply(200, "NOOP command successful.");
}
+ /* RFC 2228 */
+ | AUTH SP mechanism_name CRLF
+ {
+ reply(502, "RFC 2228 authentication not implemented.");
+ }
+
+ | ADAT SP base64data CRLF
+ {
+ reply(503,
+ "Please set authentication state with AUTH.");
+ }
+
+ | PROT SP prot_code CRLF
+ {
+ reply(503,
+ "Please set protection buffer size with PBSZ.");
+ }
+
+ | PBSZ SP decimal_integer CRLF
+ {
+ reply(503,
+ "Please set authentication state with AUTH.");
+ }
+
+ | CCC CRLF
+ {
+ reply(533, "No protection enabled.");
+ }
+
+ | MIC SP base64data CRLF
+ {
+ reply(502, "RFC 2228 authentication not implemented.");
+ }
+
+ | CONF SP base64data CRLF
+ {
+ reply(502, "RFC 2228 authentication not implemented.");
+ }
+
+ | ENC SP base64data CRLF
+ {
+ reply(502, "RFC 2228 authentication not implemented.");
+ }
+
/* RFC 2389 */
| FEAT CRLF
{
@@ -794,6 +842,22 @@ octal_number
}
;
+mechanism_name
+ : STRING
+ ;
+
+base64data
+ : STRING
+ ;
+
+prot_code
+ : STRING
+ ;
+
+decimal_integer
+ : NUMBER
+ ;
+
check_login
: /* empty */
{
@@ -885,7 +949,17 @@ struct tab cmdtab[] = {
{ "HELP", HELP, OSTR, 1, 0, "[ <sp> <string> ]" },
{ "NOOP", NOOP, NOARGS, 1, 1, "" },
- /* From RFC-2389, in order defined */
+ /* From RFC 2228, in order defined */
+ { "AUTH", AUTH, STR1, 1, 0, "<sp> mechanism-name" },
+ { "ADAT", ADAT, STR1, 1, 0, "<sp> base-64-data" },
+ { "PROT", PROT, STR1, 1, 0, "<sp> prot-code" },
+ { "PBSZ", PBSZ, ARGS, 1, 0, "<sp> decimal-integer" },
+ { "CCC", CCC, NOARGS, 1, 0, "(Disable data protection)" },
+ { "MIC", MIC, STR1, 1, 0, "<sp> base64data" },
+ { "CONF", CONF, STR1, 1, 0, "<sp> base64data" },
+ { "ENC", ENC, STR1, 1, 0, "<sp> base64data" },
+
+ /* From RFC 2389, in order defined */
{ "FEAT", FEAT, NOARGS, 1, 0, "(display extended features)" },
{ "OPTS", OPTS, STR1, 1, 0, "<sp> command [ <sp> options ]" },
@@ -1302,7 +1376,8 @@ help(ctab, s)
int columns, lines;
lreply(214, "The following %scommands are recognized.", type);
- lreply(214, "(`-' = not implemented, `+' = supports options)");
+ printf(
+ " (`-' = not implemented, `+' = supports options)\r\n");
columns = 76 / width;
if (columns == 0)
columns = 1;
diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8
index 4fa4448473e..cb89df499ce 100644
--- a/libexec/ftpd/ftpd.8
+++ b/libexec/ftpd/ftpd.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: ftpd.8,v 1.33 1998/11/18 13:32:17 hubertf Exp $
+.\" $NetBSD: ftpd.8,v 1.34 1999/02/05 21:40:49 lukem Exp $
.\"
.\" Copyright (c) 1985, 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -630,6 +630,9 @@ recognizes all commands in
.Cm RFC 959 ,
follows the guidelines in
.Cm RFC 1123 ,
+recognizes all commands in
+.Cm RFC 2228
+(although they are not supported yet),
and supports the extensions from
.Cm RFC 2389.
.Sh HISTORY
diff --git a/libexec/ftpd/util.c b/libexec/ftpd/util.c
index 763fd41de00..b856b3be100 100644
--- a/libexec/ftpd/util.c
+++ b/libexec/ftpd/util.c
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.3 1999/01/03 02:22:05 lukem Exp $ */
+/* $NetBSD: util.c,v 1.4 1999/02/05 21:40:49 lukem Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: util.c,v 1.3 1999/01/03 02:22:05 lukem Exp $");
+__RCSID("$NetBSD: util.c,v 1.4 1999/02/05 21:40:49 lukem Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -71,15 +71,19 @@ logcmd(command, bytes, file1, file2)
if (logging <=1)
return;
- if ((p = realpath(file1, realfile)) == NULL)
+ if ((p = realpath(file1, realfile)) == NULL) {
+ syslog(LOG_WARNING, "realpath failed: %s", realfile);
p = file1;
+ }
snprintf(buf, sizeof(buf), "%s %s", command, p);
if (bytes != (off_t)-1) {
syslog(LOG_INFO, "%s = %qd bytes", buf, (long long) bytes);
} else if (file2 != NULL) {
- if ((p = realpath(file2, realfile)) == NULL)
+ if ((p = realpath(file2, realfile)) == NULL) {
+ syslog(LOG_WARNING, "realpath failed: %s", realfile);
p = file2;
+ }
syslog(LOG_INFO, "%s %s", buf, p);
} else {
syslog(LOG_INFO, "%s", buf);