diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 14ac1220a33a..f3bff5d3c009 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -69,6 +69,7 @@ static const char rcsid[] = #include #include #include +#include #include "extern.h" @@ -126,7 +127,7 @@ extern int epsvall; CDUP STOU SMNT SYST SIZE MDTM LPRT LPSV EPRT EPSV - UMASK IDLE CHMOD + UMASK IDLE CHMOD MDFIVE LEXERR @@ -586,6 +587,18 @@ cmd { help(sitetab, $5); } + | SITE SP MDFIVE check_login SP pathname CRLF + { + char p[64], *q; + + if ($4) { + q = MD5File($6, p); + if (q != NULL) + reply(200, "MD5(%s) = %s", $6, p); + else + perror_reply(550, $6); + } + } | SITE SP UMASK check_login CRLF { int oldmask; @@ -1084,6 +1097,7 @@ struct tab cmdtab[] = { /* In order defined in RFC 765 */ }; struct tab sitetab[] = { + { "MD5", MDFIVE, STR1, 1, "[ file-name ]" }, { "UMASK", UMASK, ARGS, 1, "[ umask ]" }, { "IDLE", IDLE, ARGS, 1, "[ maximum-idle-time ]" }, { "CHMOD", CHMOD, NSTR, 1, " mode file-name" }, diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8 index 5d6e345dcb36..8314554200af 100644 --- a/libexec/ftpd/ftpd.8 +++ b/libexec/ftpd/ftpd.8 @@ -247,6 +247,7 @@ SITE request. .It UMASK Ta change umask, e.g. ``SITE UMASK 002'' .It IDLE Ta set idle-timer, e.g. ``SITE IDLE 60'' .It CHMOD Ta "change mode of a file [RW], e.g. ``SITE CHMOD 755 filename''" +.It MD5 Ta "report the files MD5 checksum, e.g. ``SITE MD5 filename''" .It HELP Ta give help information .El .Pp