summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2001-04-15 20:59:29 +0000
committerphk <phk@FreeBSD.org>2001-04-15 20:59:29 +0000
commita463dd29ce46668294dfb16124f9b12e75613c93 (patch)
tree181d4831c50020ca22cb64a4d7affa999290c5ff /libexec
parent82c5492b1c98cac1a21f52151237dcbbca7164d8 (diff)
downloadFreeBSD-src-a463dd29ce46668294dfb16124f9b12e75613c93.zip
FreeBSD-src-a463dd29ce46668294dfb16124f9b12e75613c93.tar.gz
Add the "SITE MD5 filename" facility.
This allows you to determine if the file on the other side is the same as the one you have without transferring the entire file to compare. Needless to say, if the server end lies to you this check doesn't work, but on the other hand, if it lies to you about the files checksum, what can you trust from it ?
Diffstat (limited to 'libexec')
-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