[hackers] [sbase] [PATCH] *sum: Ignore -b and -t flags

From: Michael Forney <mforney_AT_mforney.org>
Date: Wed, 1 Jan 2020 22:04:47 -0800

These tools are not standardized, but these flags are supported in all
implementations I'm aware of (coreutils, busybox), and are occasionally
used in scripts.

These flags are only meaningful on operating systems which differentiate
between text and binary files, so just ignore them.
---
 md5sum.c        | 4 ++++
 sha1sum.c       | 4 ++++
 sha224sum.c     | 4 ++++
 sha256sum.c     | 4 ++++
 sha384sum.c     | 4 ++++
 sha512-224sum.c | 4 ++++
 sha512-256sum.c | 4 ++++
 sha512sum.c     | 4 ++++
 8 files changed, 32 insertions(+)
diff --git a/md5sum.c b/md5sum.c
index 86fb40f..224b20e 100644
--- a/md5sum.c
+++ b/md5sum.c
_AT_@ -28,6 +28,10 @@ main(int argc, char *argv[])
 	uint8_t md[MD5_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
diff --git a/sha1sum.c b/sha1sum.c
index 4f3ae77..cc8dcae 100644
--- a/sha1sum.c
+++ b/sha1sum.c
_AT_@ -27,6 +27,10 @@ main(int argc, char *argv[])
 	uint8_t md[SHA1_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
diff --git a/sha224sum.c b/sha224sum.c
index 5c4a6cb..e9a10cf 100644
--- a/sha224sum.c
+++ b/sha224sum.c
_AT_@ -27,6 +27,10 @@ main(int argc, char *argv[])
 	uint8_t md[SHA224_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
diff --git a/sha256sum.c b/sha256sum.c
index d863539..686c70f 100644
--- a/sha256sum.c
+++ b/sha256sum.c
_AT_@ -27,6 +27,10 @@ main(int argc, char *argv[])
 	uint8_t md[SHA256_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
diff --git a/sha384sum.c b/sha384sum.c
index f975b61..c76947e 100644
--- a/sha384sum.c
+++ b/sha384sum.c
_AT_@ -27,6 +27,10 @@ main(int argc, char *argv[])
 	uint8_t md[SHA384_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
diff --git a/sha512-224sum.c b/sha512-224sum.c
index 6e4a9d6..53f2e62 100644
--- a/sha512-224sum.c
+++ b/sha512-224sum.c
_AT_@ -27,6 +27,10 @@ main(int argc, char *argv[])
 	uint8_t md[SHA512_224_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
diff --git a/sha512-256sum.c b/sha512-256sum.c
index c2d582e..ea556b8 100644
--- a/sha512-256sum.c
+++ b/sha512-256sum.c
_AT_@ -27,6 +27,10 @@ main(int argc, char *argv[])
 	uint8_t md[SHA512_256_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
diff --git a/sha512sum.c b/sha512sum.c
index 65a0c2c..a76e685 100644
--- a/sha512sum.c
+++ b/sha512sum.c
_AT_@ -27,6 +27,10 @@ main(int argc, char *argv[])
 	uint8_t md[SHA512_DIGEST_LENGTH];
 
 	ARGBEGIN {
+	case 'b':
+	case 't':
+		/* ignore */
+		break;
 	case 'c':
 		cryptfunc = cryptcheck;
 		break;
-- 
2.24.1
Received on Thu Jan 02 2020 - 07:04:47 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 02 2020 - 07:24:23 CET