Date: Wed, 4 Jan 2006 06:27:19 GMT From: Pawel Worach <pawel.worach@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/91299: [patch] add ftpd SITE SHA256 command Message-ID: <200601040627.k046RJjO052123@www.freebsd.org> Resent-Message-ID: <200601040630.k046U6oC095363@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 91299 >Category: bin >Synopsis: [patch] add ftpd SITE SHA256 command >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Jan 04 06:30:06 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Pawel Worach >Release: 7.0-CURRENT >Organization: >Environment: [patch] ftpd SITE SHA256 command >Description: Patch to add a "SITE SHA256" command to ftpd similar to the "SITE MD5" command. >How-To-Repeat: >Fix: Index: libexec/ftpd/ftpcmd.y =================================================================== RCS file: /export/ctm/cvs/src/libexec/ftpd/ftpcmd.y,v retrieving revision 1.64 diff -u -u -r1.64 ftpcmd.y --- libexec/ftpd/ftpcmd.y 18 Nov 2004 13:46:29 -0000 1.64 +++ libexec/ftpd/ftpcmd.y 4 Jan 2006 05:29:02 -0000 @@ -64,6 +64,7 @@ #include <md5.h> #include <netdb.h> #include <pwd.h> +#include <sha256.h> #include <signal.h> #include <stdint.h> #include <stdio.h> @@ -137,7 +138,7 @@ CDUP STOU SMNT SYST SIZE MDTM LPRT LPSV EPRT EPSV - UMASK IDLE CHMOD MDFIVE + UMASK IDLE CHMOD MDFIVE SHATWOFIVESIX LEXERR NOTIMPL @@ -619,6 +620,20 @@ if ($6) free($6); } + | SITE SP SHATWOFIVESIX check_login SP pathname CRLF + { + char p[64], *q; + + if ($4 && $6) { + q = SHA256_File($6, p); + if (q != NULL) + reply(200, "SHA256(%s) = %s", $6, p); + else + perror_reply(550, $6); + } + if ($6) + free($6); + } | SITE SP UMASK check_login CRLF { int oldmask; @@ -1131,6 +1146,7 @@ struct tab sitetab[] = { { "MD5", MDFIVE, STR1, 1, "[ <sp> file-name ]" }, + { "SHA256", SHATWOFIVESIX, 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" }, Index: libexec/ftpd/ftpd.8 =================================================================== RCS file: /export/ctm/cvs/src/libexec/ftpd/ftpd.8,v retrieving revision 1.69 diff -u -u -r1.69 ftpd.8 --- libexec/ftpd/ftpd.8 18 Jan 2005 09:29:39 -0000 1.69 +++ libexec/ftpd/ftpd.8 4 Jan 2006 05:29:02 -0000 @@ -295,6 +295,7 @@ .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 SHA256 Ta "report the files SHA256 checksum, e.g. ``SITE SHA256 filename''" .It HELP Ta give help information .El .Pp >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601040627.k046RJjO052123>