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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 21 Aug 2018 10:55:30 +0100
From:   David Howells <dhowells@...hat.com>
To:     viro@...iv.linux.org.uk
Cc:     dhowells@...hat.com, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 5/6] vfs: Adjust fsinfo sample output

Adjust the output of the test-fsinfo sample program to:

 (1) Print server addresses if of AF_INET or AF_INET6 family.

 (2) Not print parameter descriptions (the test-fs-query sample program can
     be used for that).

 (3) Only print non-blank parameter values so that parameters that just
     encode defaults don't clutter up the output.

Signed-off-by: David Howells <dhowells@...hat.com>
---

 samples/statx/test-fsinfo.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/samples/statx/test-fsinfo.c b/samples/statx/test-fsinfo.c
index 21714ef7ef5b..c08978acf08b 100644
--- a/samples/statx/test-fsinfo.c
+++ b/samples/statx/test-fsinfo.c
@@ -26,6 +26,7 @@
 #include <linux/fsinfo.h>
 #include <linux/socket.h>
 #include <sys/stat.h>
+#include <arpa/inet.h>
 
 static bool debug = 0;
 
@@ -304,6 +305,24 @@ static void dump_attr_VOLUME_UUID(union reply *r, int size)
 static void dump_attr_SERVER_ADDRESS(union reply *r, int size)
 {
 	struct fsinfo_server_address *f = &r->srv_addr;
+	struct sockaddr_in6 *sin6;
+	struct sockaddr_in *sin;
+	char buf[1024];
+
+	switch (f->address.ss_family) {
+	case AF_INET:
+		sin = (struct sockaddr_in *)&f->address;
+		if (!inet_ntop(AF_INET, &sin->sin_addr, buf, sizeof(buf)))
+			break;
+		printf("IPv4: %s\n", buf);
+		return;
+	case AF_INET6:
+		sin6 = (struct sockaddr_in6 *)&f->address;
+		if (!inet_ntop(AF_INET6, &sin6->sin6_addr, buf, sizeof(buf)))
+			break;
+		printf("IPv6: %s\n", buf);
+		return;
+	}
 
 	printf("family=%u\n", f->address.ss_family);
 }
@@ -426,6 +445,17 @@ static int try_one(const char *file, struct fsinfo_params *params, bool raw)
 		return 0;
 	}
 
+	switch (params->request) {
+	case FSINFO_ATTR_PARAM_DESCRIPTION:
+	case FSINFO_ATTR_PARAM_SPECIFICATION:
+	case FSINFO_ATTR_PARAM_NAME:
+	case FSINFO_ATTR_PARAM_ENUM:
+		return 0;
+	case FSINFO_ATTR_PARAMETER:
+		if (ret == 0)
+			return 0;
+	}
+
 	switch (about & 0xc000) {
 	case 0x0000:
 		printf("\e[33m%s\e[m: ",

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ