All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 24/26] last, utmpdump, agetty, wall, write: avoid compatibility hacks
@ 2013-08-29 18:10 Sami Kerola
  2013-08-29 18:10 ` [PATCH 25/26] utmpdump: make IPv6 addresses work Sami Kerola
  2013-08-29 18:10 ` [PATCH 26/26] tests: check last(1) and utmpdump(1) IPv6 functionality Sami Kerola
  0 siblings, 2 replies; 3+ messages in thread
From: Sami Kerola @ 2013-08-29 18:10 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

In include/bits/utmp.h the ut_user and ut_time macros are marked with
comment they are backwards compatibility hacks.  It is probably best to
avoid use of these macros where ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 login-utils/last.c     | 50 ++++++++++++++++++++++++++++----------------------
 login-utils/utmpdump.c | 11 +++++++++--
 term-utils/agetty.c    |  4 ++++
 term-utils/wall.c      |  2 +-
 term-utils/write.c     |  4 ++--
 5 files changed, 44 insertions(+), 27 deletions(-)

diff --git a/login-utils/last.c b/login-utils/last.c
index 419162e..2e392d9 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -49,6 +49,12 @@
 #include "strutils.h"
 #include "time-util.h"
 
+#if defined(_HAVE_UT_TV)
+# define UL_UT_TIME ut_tv.tv_sec
+#else
+# define UL_UT_TIME ut_time
+#endif
+
 #ifndef SHUTDOWN_TIME
 # define SHUTDOWN_TIME 254
 #endif
@@ -397,7 +403,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
 	if (ctl->show) {
 		char **walk;
 		for (walk = ctl->show; *walk; walk++) {
-			if (strncmp(p->ut_name, *walk, UT_NAMESIZE) == 0 ||
+			if (strncmp(p->ut_user, *walk, UT_NAMESIZE) == 0 ||
 			    strcmp(utline, *walk) == 0 ||
 			    (strncmp(utline, "tty", 3) == 0 &&
 			     strcmp(utline + 3, *walk) == 0)) break;
@@ -408,7 +414,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
 	/*
 	 *	Calculate times
 	 */
-	tmp = (time_t)p->ut_time;
+	tmp = p->UL_UT_TIME;
 
 	if (ctl->present && (ctl->present < tmp || (0 < t && t < ctl->present)))
 		return 0;
@@ -417,7 +423,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
 	    time_formatter(ctl, &logouttime[0], sizeof(logouttime), &t, 1) < 0)
 		errx(EXIT_FAILURE, _("preallocation size exceeded"));
 
-	secs = t - p->ut_time;
+	secs = t - p->UL_UT_TIME;
 	mins  = (secs / 60) % 60;
 	hours = (secs / 3600) % 24;
 	days  = secs / 86400;
@@ -489,7 +495,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
 		if (!ctl->altlist) {
 			len = snprintf(final, sizeof(final),
 				"%-8.*s %-12.12s %-16.*s %-*.*s %-*.*s %s\n",
-				ctl->name_len, p->ut_name, utline,
+				ctl->name_len, p->ut_user, utline,
 				ctl->domain_len, domain,
 				tftl[ctl->time_fmt].in, tftl[ctl->time_fmt].in, logintime,
 				tftl[ctl->time_fmt].out, tftl[ctl->time_fmt].out, logouttime,
@@ -497,7 +503,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
 		} else {
 			len = snprintf(final, sizeof(final),
 				"%-8.*s %-12.12s %-*.*s %-*.*s %-12.12s %s\n",
-				ctl->name_len, p->ut_name, utline,
+				ctl->name_len, p->ut_user, utline,
 				tftl[ctl->time_fmt].in, tftl[ctl->time_fmt].in, logintime,
 				tftl[ctl->time_fmt].out, tftl[ctl->time_fmt].out, logouttime,
 				length, domain);
@@ -505,7 +511,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
 	} else
 		len = snprintf(final, sizeof(final),
 			"%-8.*s %-12.12s %-*.*s %-*.*s %s\n",
-			ctl->name_len, p->ut_name, utline,
+			ctl->name_len, p->ut_user, utline,
 			tftl[ctl->time_fmt].in, tftl[ctl->time_fmt].in, logintime,
 			tftl[ctl->time_fmt].out, tftl[ctl->time_fmt].out, logouttime,
 			length);
@@ -615,7 +621,7 @@ static void process_wtmp_file(const struct last_control *ctl)
 	 * Read first structure to capture the time field
 	 */
 	if (uread(ctl, fp, &ut, NULL) == 1)
-		begintime = ut.ut_time;
+		begintime = ut.UL_UT_TIME;
 	else {
 		fstat(fileno(fp), &st);
 		begintime = st.st_ctime;
@@ -636,16 +642,16 @@ static void process_wtmp_file(const struct last_control *ctl)
 		if (uread(ctl, fp, &ut, &quit) != 1)
 			break;
 
-		if (ctl->since && ut.ut_time < ctl->since)
+		if (ctl->since && ut.UL_UT_TIME < ctl->since)
 			continue;
 
-		if (ctl->until && ctl->until < ut.ut_time)
+		if (ctl->until && ctl->until < ut.UL_UT_TIME)
 			continue;
 
-		lastdate = ut.ut_time;
+		lastdate = ut.UL_UT_TIME;
 
 		if (ctl->lastb) {
-			quit = list(ctl, &ut, ut.ut_time, R_NORMAL);
+			quit = list(ctl, &ut, ut.UL_UT_TIME, R_NORMAL);
 			continue;
 		}
 
@@ -667,21 +673,21 @@ static void process_wtmp_file(const struct last_control *ctl)
 		 */
 		else {
 			if (ut.ut_type != DEAD_PROCESS &&
-			    ut.ut_name[0] && ut.ut_line[0] &&
-			    strcmp(ut.ut_name, "LOGIN") != 0)
+			    ut.ut_user[0] && ut.ut_line[0] &&
+			    strcmp(ut.ut_user, "LOGIN") != 0)
 				ut.ut_type = USER_PROCESS;
 			/*
 			 * Even worse, applications that write ghost
 			 * entries: ut_type set to USER_PROCESS but
-			 * empty ut_name...
+			 * empty ut_user...
 			 */
-			if (ut.ut_name[0] == 0)
+			if (ut.ut_user[0] == 0)
 				ut.ut_type = DEAD_PROCESS;
 
 			/*
 			 * Clock changes.
 			 */
-			if (strcmp(ut.ut_name, "date") == 0) {
+			if (strcmp(ut.ut_user, "date") == 0) {
 				if (ut.ut_line[0] == '|')
 					ut.ut_type = OLD_TIME;
 				if (ut.ut_line[0] == '{')
@@ -695,7 +701,7 @@ static void process_wtmp_file(const struct last_control *ctl)
 				strcpy(ut.ut_line, "system down");
 				quit = list(ctl, &ut, lastboot, R_NORMAL);
 			}
-			lastdown = lastrch = ut.ut_time;
+			lastdown = lastrch = ut.UL_UT_TIME;
 			down = 1;
 			break;
 		case OLD_TIME:
@@ -710,7 +716,7 @@ static void process_wtmp_file(const struct last_control *ctl)
 		case BOOT_TIME:
 			strcpy(ut.ut_line, "system boot");
 			quit = list(ctl, &ut, lastdown, R_REBOOT);
-			lastboot = ut.ut_time;
+			lastboot = ut.UL_UT_TIME;
 			down = 1;
 			break;
 		case RUN_LVL:
@@ -720,11 +726,11 @@ static void process_wtmp_file(const struct last_control *ctl)
 				quit = list(ctl, &ut, lastrch, R_NORMAL);
 			}
 			if (x == '0' || x == '6') {
-				lastdown = ut.ut_time;
+				lastdown = ut.UL_UT_TIME;
 				down = 1;
 				ut.ut_type = SHUTDOWN_TIME;
 			}
-			lastrch = ut.ut_time;
+			lastrch = ut.UL_UT_TIME;
 			break;
 
 		case USER_PROCESS:
@@ -740,7 +746,7 @@ static void process_wtmp_file(const struct last_control *ctl)
 				    UT_LINESIZE) == 0) {
 					/* Show it */
 					if (c == 0) {
-						quit = list(ctl, &ut, p->ut.ut_time, R_NORMAL);
+						quit = list(ctl, &ut, p->ut.UL_UT_TIME, R_NORMAL);
 						c = 1;
 					}
 					if (p->next) p->next->prev = p->prev;
@@ -800,7 +806,7 @@ static void process_wtmp_file(const struct last_control *ctl)
 		 * the entire current utmplist.
 		 */
 		if (down) {
-			lastboot = ut.ut_time;
+			lastboot = ut.UL_UT_TIME;
 			whydown = (ut.ut_type == SHUTDOWN_TIME) ? R_DOWN : R_CRASH;
 			for (p = utmplist; p; p = next) {
 				next = p->next;
diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c
index baf9f5c..acc10db 100644
--- a/login-utils/utmpdump.c
+++ b/login-utils/utmpdump.c
@@ -90,7 +90,11 @@ static void print_utline(struct utmp ut, FILE *out)
 
 	in.s_addr = ut.ut_addr;
 	addr_string = inet_ntoa(in);
-	time_string = timetostr(ut.ut_time);
+#if defined(_HAVE_UT_TV)
+	time_string = timetostr(ut.ut_tv.tv_sec);
+#else
+	time_string = timetostr((time_t)ut.ut_time);	/* ut_time is not always a time_t */
+#endif
 	cleanse(ut.ut_id);
 	cleanse(ut.ut_user);
 	cleanse(ut.ut_line);
@@ -268,8 +272,11 @@ static void undump(FILE *in, FILE *out)
 		gettok(line, s_time, sizeof(s_time) - 1, 0);
 
 		ut.ut_addr = inet_addr(s_addr);
+#if defined(_HAVE_UT_TV)
+		ut.ut_tv.tv_sec = strtotime(s_time);
+#else
 		ut.ut_time = strtotime(s_time);
-
+#endif
 		ignore_result( fwrite(&ut, sizeof(ut), 1, out) );
 
 		++count;
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 4cd8675..af1e520 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -849,7 +849,11 @@ static void update_utmp(struct options *op)
 	if (fakehost)
 		strncpy(ut.ut_host, fakehost, sizeof(ut.ut_host));
 	time(&t);
+#if defined(_HAVE_UT_TV)
+	ut.ut_tv.tv_sec = t;
+#else
 	ut.ut_time = t;
+#endif
 	ut.ut_type = LOGIN_PROCESS;
 	ut.ut_pid = pid;
 	ut.ut_session = sid;
diff --git a/term-utils/wall.c b/term-utils/wall.c
index fbea7e4..20a2891 100644
--- a/term-utils/wall.c
+++ b/term-utils/wall.c
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
 	iov.iov_base = mbuf;
 	iov.iov_len = mbufsize;
 	while((utmpptr = getutent())) {
-		if (!utmpptr->ut_name[0])
+		if (!utmpptr->ut_user[0])
 			continue;
 #ifdef USER_PROCESS
 		if (utmpptr->ut_type != USER_PROCESS)
diff --git a/term-utils/write.c b/term-utils/write.c
index 1738694..f5ca341 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -201,7 +201,7 @@ int utmp_chk(char *user, char *tty)
 
 	while ((uptr = getutent())) {
 		memcpy(&u, uptr, sizeof(u));
-		if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0 &&
+		if (strncmp(user, u.ut_user, sizeof(u.ut_user)) == 0 &&
 		    strncmp(tty, u.ut_line, sizeof(u.ut_line)) == 0) {
 			res = 0;
 			break;
@@ -239,7 +239,7 @@ void search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
 	user_is_me = 0;
 	while ((uptr = getutent())) {
 		memcpy(&u, uptr, sizeof(u));
-		if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0) {
+		if (strncmp(user, u.ut_user, sizeof(u.ut_user)) == 0) {
 			++nloggedttys;
 			strncpy(atty, u.ut_line, sizeof(u.ut_line));
 			atty[sizeof(u.ut_line)] = '\0';
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 25/26] utmpdump: make IPv6 addresses work
  2013-08-29 18:10 [PATCH 24/26] last, utmpdump, agetty, wall, write: avoid compatibility hacks Sami Kerola
@ 2013-08-29 18:10 ` Sami Kerola
  2013-08-29 18:10 ` [PATCH 26/26] tests: check last(1) and utmpdump(1) IPv6 functionality Sami Kerola
  1 sibling, 0 replies; 3+ messages in thread
From: Sami Kerola @ 2013-08-29 18:10 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

(unless bug[s]) This change is backwards compatibile.  Earlier binary to
text dumps can be converted back to binary, or otherway around.

The only thing that will not work are IPv6 addresses that possible
earlier conversion had broke.  Such conversions resulted with random IPv4
in place of IPv6 address in text format, and original information is gone
forever.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 login-utils/utmpdump.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c
index acc10db..4451363 100644
--- a/login-utils/utmpdump.c
+++ b/login-utils/utmpdump.c
@@ -85,11 +85,14 @@ static void xcleanse(char *s, int len)
 
 static void print_utline(struct utmp ut, FILE *out)
 {
-	char *addr_string, *time_string;
-	struct in_addr in;
+	const char *addr_string, *time_string;
+	char buffer[INET6_ADDRSTRLEN];
+
+	if (ut.ut_addr_v6[1] || ut.ut_addr_v6[2] || ut.ut_addr_v6[3])
+		addr_string = inet_ntop(AF_INET6, &(ut.ut_addr_v6), buffer, sizeof(buffer));
+	else
+		addr_string = inet_ntop(AF_INET, &(ut.ut_addr_v6), buffer, sizeof(buffer));
 
-	in.s_addr = ut.ut_addr;
-	addr_string = inet_ntoa(in);
 #if defined(_HAVE_UT_TV)
 	time_string = timetostr(ut.ut_tv.tv_sec);
 #else
@@ -101,7 +104,7 @@ static void print_utline(struct utmp ut, FILE *out)
 	cleanse(ut.ut_host);
 
 	/*            pid    id       user     line     host     addr       time */
-	fprintf(out, "[%d] [%05d] [%-4.4s] [%-*.*s] [%-*.*s] [%-*.*s] [%-15.15s] [%-28.28s]\n",
+	fprintf(out, "[%d] [%05d] [%-4.4s] [%-*.*s] [%-*.*s] [%-*.*s] [%-15s] [%-28.28s]\n",
 	       ut.ut_type, ut.ut_pid, ut.ut_id, 8, UT_NAMESIZE, ut.ut_user,
 	       12, UT_LINESIZE, ut.ut_line, 20, UT_HOSTSIZE, ut.ut_host,
 	       addr_string, time_string);
@@ -252,11 +255,10 @@ static int gettok(char *line, char *dest, int size, int eatspace)
 static void undump(FILE *in, FILE *out)
 {
 	struct utmp ut;
-	char s_addr[16], s_time[29], *linestart, *line;
+	char s_addr[INET6_ADDRSTRLEN + 1], s_time[29], *linestart, *line;
 	int count = 0;
 
 	linestart = xmalloc(1024 * sizeof(*linestart));
-	s_addr[15] = 0;
 	s_time[28] = 0;
 
 	while (fgets(linestart, 1023, in)) {
@@ -270,8 +272,10 @@ static void undump(FILE *in, FILE *out)
 		line += gettok(line, ut.ut_host, sizeof(ut.ut_host), 1);
 		line += gettok(line, s_addr, sizeof(s_addr) - 1, 1);
 		gettok(line, s_time, sizeof(s_time) - 1, 0);
-
-		ut.ut_addr = inet_addr(s_addr);
+		if (strchr(s_addr, '.'))
+			inet_pton(AF_INET, s_addr, &(ut.ut_addr_v6));
+		else
+			inet_pton(AF_INET6, s_addr, &(ut.ut_addr_v6));
 #if defined(_HAVE_UT_TV)
 		ut.ut_tv.tv_sec = strtotime(s_time);
 #else
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 26/26] tests: check last(1) and utmpdump(1) IPv6 functionality
  2013-08-29 18:10 [PATCH 24/26] last, utmpdump, agetty, wall, write: avoid compatibility hacks Sami Kerola
  2013-08-29 18:10 ` [PATCH 25/26] utmpdump: make IPv6 addresses work Sami Kerola
@ 2013-08-29 18:10 ` Sami Kerola
  1 sibling, 0 replies; 3+ messages in thread
From: Sami Kerola @ 2013-08-29 18:10 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 tests/expected/last/ipv6          |  20 +++++++++++++++++++
 tests/expected/utmpdump/ipv6tobin | Bin 0 -> 768 bytes
 tests/expected/utmpdump/ipv6totxt |   2 ++
 tests/ts/last/ipv6                |  41 ++++++++++++++++++++++++++++++++++++++
 tests/ts/last/ipv6-input          | Bin 0 -> 768 bytes
 tests/ts/utmpdump/ipv6bin         | Bin 0 -> 768 bytes
 tests/ts/utmpdump/ipv6tobin       |  25 +++++++++++++++++++++++
 tests/ts/utmpdump/ipv6totxt       |  25 +++++++++++++++++++++++
 tests/ts/utmpdump/ipv6txt         |   2 ++
 9 files changed, 115 insertions(+)
 create mode 100644 tests/expected/last/ipv6
 create mode 100644 tests/expected/utmpdump/ipv6tobin
 create mode 100644 tests/expected/utmpdump/ipv6totxt
 create mode 100755 tests/ts/last/ipv6
 create mode 100644 tests/ts/last/ipv6-input
 create mode 100644 tests/ts/utmpdump/ipv6bin
 create mode 100755 tests/ts/utmpdump/ipv6tobin
 create mode 100755 tests/ts/utmpdump/ipv6totxt
 create mode 100644 tests/ts/utmpdump/ipv6txt

diff --git a/tests/expected/last/ipv6 b/tests/expected/last/ipv6
new file mode 100644
index 0000000..0fa234c
--- /dev/null
+++ b/tests/expected/last/ipv6
@@ -0,0 +1,20 @@
+~~~ dns short ~~~
+IPv6     root         a.root-servers.n Wed Aug 28 20:30 - 20:40  (00:10)
+
+ipv6-input begins Wed Aug 28 20:30:40 2013
+~~~ dns long ~~~
+IPv6     root         a.root-servers.net Wed Aug 28 20:30 - 20:40  (00:10)
+
+ipv6-input begins Wed Aug 28 20:30:40 2013
+~~~ dns host last ~~~
+IPv6     root         Wed Aug 28 20:30 - 20:40  (00:10)     a.root-servers.net
+
+ipv6-input begins Wed Aug 28 20:30:40 2013
+~~~ show ip ~~~
+IPv6     root         2001:503:ba3e::2 Wed Aug 28 20:30 - 20:40  (00:10)
+
+ipv6-input begins Wed Aug 28 20:30:40 2013
+~~~ show ip last ~~~
+IPv6     root         Wed Aug 28 20:30 - 20:40  (00:10)     2001:503:ba3e::2:30
+
+ipv6-input begins Wed Aug 28 20:30:40 2013
diff --git a/tests/expected/utmpdump/ipv6tobin b/tests/expected/utmpdump/ipv6tobin
new file mode 100644
index 0000000000000000000000000000000000000000..342553bb945bdd4b575c6cb6511c949d8c1bb87a
GIT binary patch
literal 768
zcmZQ)U|`?^;-dWg5+H>WWEPZ}c?Oi3;Zy*WNXaYKElw>eOD)2uYWT~2h?NTh`BH(A
hm3fyP)W1v&2H1Sg0Tkp0;?eNO7CPjK1tkz4{s6-b7T5p)

literal 0
HcmV?d00001

diff --git a/tests/expected/utmpdump/ipv6totxt b/tests/expected/utmpdump/ipv6totxt
new file mode 100644
index 0000000..5cce150
--- /dev/null
+++ b/tests/expected/utmpdump/ipv6totxt
@@ -0,0 +1,2 @@
+[7] [00010] [ipv6] [IPv6    ] [root        ] [dns-server          ] [2001:503:ba3e::2:30] [Wed Aug 28 20:30:40 2013 GMT]
+[8] [00011] [ipv6] [IPv6    ] [root        ] [dns-server          ] [2001:503:ba3e::2:30] [Wed Aug 28 20:40:50 2013 GMT]
diff --git a/tests/ts/last/ipv6 b/tests/ts/last/ipv6
new file mode 100755
index 0000000..8e2b01e
--- /dev/null
+++ b/tests/ts/last/ipv6
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="last ipv6"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+export LANG=C
+export TZ=GMT
+
+>| $TS_OUTPUT
+
+ts_log "~~~ dns short ~~~"
+$TS_CMD_LAST -f $TS_SELF/ipv6-input -d >> $TS_OUTPUT 2>/dev/null
+
+ts_log "~~~ dns long ~~~"
+$TS_CMD_LAST -f $TS_SELF/ipv6-input -d -w >> $TS_OUTPUT 2>/dev/null
+
+ts_log "~~~ dns host last ~~~"
+$TS_CMD_LAST -f $TS_SELF/ipv6-input -d -a >> $TS_OUTPUT 2>/dev/null
+
+ts_log "~~~ show ip ~~~"
+$TS_CMD_LAST -f $TS_SELF/ipv6-input -i >> $TS_OUTPUT 2>/dev/null
+
+ts_log "~~~ show ip last ~~~"
+$TS_CMD_LAST -f $TS_SELF/ipv6-input -i -a >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/last/ipv6-input b/tests/ts/last/ipv6-input
new file mode 100644
index 0000000000000000000000000000000000000000..342553bb945bdd4b575c6cb6511c949d8c1bb87a
GIT binary patch
literal 768
zcmZQ)U|`?^;-dWg5+H>WWEPZ}c?Oi3;Zy*WNXaYKElw>eOD)2uYWT~2h?NTh`BH(A
hm3fyP)W1v&2H1Sg0Tkp0;?eNO7CPjK1tkz4{s6-b7T5p)

literal 0
HcmV?d00001

diff --git a/tests/ts/utmpdump/ipv6bin b/tests/ts/utmpdump/ipv6bin
new file mode 100644
index 0000000000000000000000000000000000000000..342553bb945bdd4b575c6cb6511c949d8c1bb87a
GIT binary patch
literal 768
zcmZQ)U|`?^;-dWg5+H>WWEPZ}c?Oi3;Zy*WNXaYKElw>eOD)2uYWT~2h?NTh`BH(A
hm3fyP)W1v&2H1Sg0Tkp0;?eNO7CPjK1tkz4{s6-b7T5p)

literal 0
HcmV?d00001

diff --git a/tests/ts/utmpdump/ipv6tobin b/tests/ts/utmpdump/ipv6tobin
new file mode 100755
index 0000000..6de99ad
--- /dev/null
+++ b/tests/ts/utmpdump/ipv6tobin
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="IPv6 to binary"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+export LANG=C
+export TZ=GMT
+$TS_CMD_UTMPDUMP -r $TS_SELF/ipv6txt >| $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/utmpdump/ipv6totxt b/tests/ts/utmpdump/ipv6totxt
new file mode 100755
index 0000000..fb81f39
--- /dev/null
+++ b/tests/ts/utmpdump/ipv6totxt
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="IPv6 to text"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+export LANG=C
+export TZ=GMT
+$TS_CMD_UTMPDUMP $TS_SELF/ipv6bin >| $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/utmpdump/ipv6txt b/tests/ts/utmpdump/ipv6txt
new file mode 100644
index 0000000..fb428d5
--- /dev/null
+++ b/tests/ts/utmpdump/ipv6txt
@@ -0,0 +1,2 @@
+[7] [00010] [ipv6] [IPv6    ] [root        ] [dns-server          ] [2001:503:ba3e::2:30     ] [Wed Aug 28 20:30:40 2013 BST]
+[8] [00011] [ipv6] [IPv6    ] [root        ] [dns-server          ] [2001:503:ba3e::2:30     ] [Wed Aug 28 20:40:50 2013 BST]
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-29 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-29 18:10 [PATCH 24/26] last, utmpdump, agetty, wall, write: avoid compatibility hacks Sami Kerola
2013-08-29 18:10 ` [PATCH 25/26] utmpdump: make IPv6 addresses work Sami Kerola
2013-08-29 18:10 ` [PATCH 26/26] tests: check last(1) and utmpdump(1) IPv6 functionality Sami Kerola

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.