summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libexec/ftpd/ftpcmd.y16
-rw-r--r--libexec/ftpd/ftpd.81
2 files changed, 16 insertions, 1 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index 14ac122..f3bff5d 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -69,6 +69,7 @@ static const char rcsid[] =
#include <time.h>
#include <unistd.h>
#include <libutil.h>
+#include <md5.h>
#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, "[ <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" },
diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8
index 5d6e345..8314554 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
OpenPOWER on IntegriCloud