lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 13 Apr 2019 01:43:16 -0400
From:   Gabriel Krisman Bertazi <krisman@...labora.com>
To:     tytso@....edu
Cc:     linux-ext4@...r.kernel.org,
        Gabriel Krisman Bertazi <krisman@...labora.com>
Subject: [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support

As agreed on the kernel side, ext4 will only support utf8 for now, and
not plain ascii, so we don't need this anymore.

Signed-off-by: Gabriel Krisman Bertazi <krisman@...labora.com>
---
 lib/e2p/encoding.c     |  5 -----
 lib/ext2fs/Makefile.in |  5 ++---
 lib/ext2fs/ext2_fs.h   |  1 -
 lib/ext2fs/nls.h       |  2 --
 lib/ext2fs/nls_ascii.c | 48 ------------------------------------------
 5 files changed, 2 insertions(+), 59 deletions(-)
 delete mode 100644 lib/ext2fs/nls_ascii.c

diff --git a/lib/e2p/encoding.c b/lib/e2p/encoding.c
index 62e0aada92c2..6a3c472b1b31 100644
--- a/lib/e2p/encoding.c
+++ b/lib/e2p/encoding.c
@@ -28,11 +28,6 @@ static const struct {
 	__u16 default_flags;
 
 } ext4_encoding_map[] = {
-	{
-		.encoding_magic = EXT4_ENC_ASCII,
-		.name = "ascii",
-		.default_flags = 0
-	},
 	{
 		.encoding_magic = EXT4_ENC_UTF8_12_0,
 		.name = "utf8",
diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
index 06c2394b34b8..4b3fc1881cff 100644
--- a/lib/ext2fs/Makefile.in
+++ b/lib/ext2fs/Makefile.in
@@ -20,8 +20,8 @@ COMPILE_ET=	_ET_DIR_OVERRIDE=$(srcdir)/../et ../et/compile_et
 @TEST_IO_CMT@...T_IO_LIB_OBJS = test_io.o
 @IMAGER_CMT@...MAGE_LIB_OBJS = imager.o
 
-NLS_OBJS=nls_ascii.o nls_utf8-norm.o nls_utf8.o
-NLS_SRCS=$(srcdir)/nls_ascii.c $(srcdir)/nls_utf8-norm.c $(srcdir)/nls_utf8.c
+NLS_OBJS=nls_utf8-norm.o nls_utf8.o
+NLS_SRCS=$(srcdir)/nls_utf8-norm.c $(srcdir)/nls_utf8.c
 
 DEBUG_OBJS= debug_cmds.o extent_cmds.o tst_cmds.o debugfs.o util.o \
 	ncheck.o icheck.o ls.o lsdel.o dump.o set_fields.o logdump.o \
@@ -1328,7 +1328,6 @@ do_journal.o: $(top_srcdir)/debugfs/do_journal.c $(top_builddir)/lib/config.h \
  $(top_srcdir)/lib/support/quotaio_tree.h $(srcdir)/kernel-jbd.h \
  $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h \
  $(top_srcdir)/debugfs/journal.h $(srcdir)/../../e2fsck/jfs_user.h
-nls_ascii.o: $(srcdir)/nls_ascii.c $(srcdir)/nls.h $(srcdir)/ext2_fs.h
 nls_utf8-norm.o: $(srcdir)/nls_utf8-norm.c $(srcdir)/utf8n.h \
  $(srcdir)/utf8data.h
 nls_utf8.o: $(srcdir)/nls_utf8.c $(srcdir)/nls.h $(srcdir)/ext2_fs.h \
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 80ff02265ee5..fc8a650a3aad 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -1128,7 +1128,6 @@ struct mmp_struct {
  */
 #define EXT4_INLINE_DATA_DOTDOT_SIZE	(4)
 
-#define EXT4_ENC_ASCII		0
 #define EXT4_ENC_UTF8_12_0	1
 
 #define EXT4_ENC_STRICT_MODE_FL			(1 << 0) /* Reject invalid sequences */
diff --git a/lib/ext2fs/nls.h b/lib/ext2fs/nls.h
index ae56aa9abc89..f008bd167f36 100644
--- a/lib/ext2fs/nls.h
+++ b/lib/ext2fs/nls.h
@@ -43,14 +43,12 @@ struct nls_table {
 	const struct nls_ops *ops;
 };
 
-extern const struct nls_table nls_ascii;
 extern const struct nls_table nls_utf8_12_0;
 
 static const struct {
 	int encoding_magic;
 	const struct nls_table *tbl;
 } nls_map[] = {
-	{ EXT4_ENC_ASCII, &nls_ascii },
 	{ EXT4_ENC_UTF8_12_0, &nls_utf8_12_0 },
 };
 
diff --git a/lib/ext2fs/nls_ascii.c b/lib/ext2fs/nls_ascii.c
deleted file mode 100644
index cc03fea97ec5..000000000000
--- a/lib/ext2fs/nls_ascii.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "nls.h"
-
-#include <errno.h>
-#include <string.h>
-
-
-static unsigned char charset_tolower(const struct nls_table *table,
-				     unsigned int c)
-{
-	if (c >= 'A' && c <= 'Z')
-		return (c | 0x20);
-	return c;
-}
-
-static unsigned char charset_toupper(const struct nls_table *table,
-				     unsigned int c)
-{
-	if (c >= 'a' && c <= 'z')
-		return (c & ~0x20);
-	return c;
-}
-
-static int ascii_casefold(const struct nls_table *table,
-			  const unsigned char *str, size_t len,
-			  unsigned char *dest, size_t dlen)
-{
-	int i;
-
-	if (dlen < len)
-		return -ENAMETOOLONG;
-
-	for (i = 0; i < len; i++) {
-		if (str[i] & 0x80)
-			return -EINVAL;
-
-		dest[i] = charset_toupper(table, str[i]);
-	}
-
-	return len;
-}
-
-const static struct nls_ops ascii_ops = {
-	.casefold = ascii_casefold,
-};
-
-const struct nls_table nls_ascii = {
-	.ops = &ascii_ops,
-};
-- 
2.20.1

Powered by blists - more mailing lists