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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220301041031.74615-1-adilger@whamcloud.com>
Date:   Mon, 28 Feb 2022 21:10:31 -0700
From:   Andreas Dilger <adilger@...mcloud.com>
To:     tytso@....edu
Cc:     linux-ext4@...r.kernel.org, Andreas Dilger <adilger@...mcloud.com>,
        Li Dongyang <dongyangli@....com>
Subject: [PATCH] debugfs: allow <inode> for ncheck

If the arg string is of the form <ino>, allow it for ncheck.
Improve the error message, use "Invalid inode number" instead
of "Bad inode", which implies the inode content being bad.

Signed-off-by: Li Dongyang <dongyangli@....com>
Reviewed-by: Andreas Dilger <adilger@...mcloud.com>
---
 debugfs/ncheck.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c
index 011f26de..3be4be19 100644
--- a/debugfs/ncheck.c
+++ b/debugfs/ncheck.c
@@ -134,9 +134,21 @@ void do_ncheck(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
 
 	iw.names_left = 0;
 	for (i=0; i < argc; i++) {
-		iw.iarray[i] = strtol(argv[i], &tmp, 0);
+		char *str = argv[i];
+		int len = strlen(str);
+
+		if ((len > 2) && (str[0] == '<') && (str[len-1] == '>')) {
+			str[len-1] = '\0';
+			str++;
+		}
+		iw.iarray[i] = strtol(str, &tmp, 0);
 		if (*tmp) {
-			com_err("ncheck", 0, "Bad inode - %s", argv[i]);
+			if (str != argv[i]) {
+				str--;
+				str[len-1] = '>';
+			}
+			com_err("ncheck", 0, "Invalid inode number - '%s'",
+				argv[i]);
 			goto error_out;
 		}
 		if (debugfs_read_inode(iw.iarray[i], &inode, *argv))
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ