Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Nov 2003 02:24:15 +0300 (MSK)
From:      Nick Leuta <skynick@mail.sc.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/59775: ftpd(8)/FreeBSD 5: incorrect reply for "unimplemented" SITE command
Message-ID:  <20031128232415.3122D49A29@chuck2.lstu>
Resent-Message-ID: <200311282330.hASNUMOn048276@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         59775
>Category:       bin
>Synopsis:       ftpd(8)/FreeBSD 5: incorrect reply for "unimplemented" SITE command
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 28 15:30:21 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Nick Leuta
>Release:        FreeBSD 4.9-RC i386
>Organization:
Lipetsk State Technical University
>Environment:
System: FreeBSD skynick.stu.lipetsk.ru 4.9-RC FreeBSD 4.9-RC #0: Sun Nov 23 19:53:55 MSK 2003 root@skynick.stu.lipetsk.ru:/usr/src/sys/compile/CORSAIR i386
>Description:
An unimplemented FTP command is marked by '*' symbol and an attempt to use it
returns something like "502 ACCT command not implemented."
It's also possible to mark any SITE command as "unimplemented", and it also
will be marked by '*'... But an attempt to use such command leads to
the significantly different reply like
"500 'SITE MD5 xxx': command not understood.".

Both situations are handled by the similar ways, and the difference is that
unimplemented command matches to "| NOTIMPL", but unimplemented SITE
command matches to "| SITE SP NOTIMPL"...

p.s. I think that the better way is not to show unimplemented commands at all,
but if the mentioned above way is selected, it must be implemented
completely...
>How-To-Repeat:
1. modify sitetab[] like this:
--- ftpcmd.y.ORI	Tue Feb 11 17:28:28 2003
+++ ftpcmd.y	Fri Nov 28 19:57:09 2003
@@ -1149,7 +1149,7 @@
 };
 
 struct tab sitetab[] = {
-	{ "MD5", MDFIVE, STR1, 1,	"[ <sp> file-name ]" },
+	{ "MD5", MDFIVE, STR1, 0,	"[ <sp> file-name ]" },
 	{ "UMASK", UMASK, ARGS, 1,	"[ <sp> umask ]" },
 	{ "IDLE", IDLE, ARGS, 1,	"[ <sp> maximum-idle-time ]" },
 	{ "CHMOD", CHMOD, NSTR, 1,	"<sp> mode <sp> file-name" },
2. recompile and install ftpd...
3. run ftp(1), connect to server as the non-anonymous user...
4. enter the command like "site md5 xxx"

>Fix:
diff -urN ftpd.ORI/ftpcmd.y ftpd/ftpcmd.y
--- ftpd.ORI/ftpcmd.y	Sun Oct 26 07:30:05 2003
+++ ftpd/ftpcmd.y	Thu Nov 27 01:54:13 2003
@@ -756,6 +756,12 @@
 		{
 			nack($1);
 		}
+	| SITE SP NOTIMPL
+		{
+			char buf[64];
+			snprintf(buf, sizeof(buf), "SITE %s", $3);
+			nack(buf);
+		}
 	| error
 		{
 			yyclearin;		/* discard lookahead data */
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031128232415.3122D49A29>