DragonFly BSD
DragonFly submit List (threaded) for 2012-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[DragonFlyBSD - Submit #2339] [PATCH] rwhod: do not clobber the hostname.


From: Martin Neitzel via Redmine <bugtracker-admin@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Mar 2012 15:13:10 -0700

Issue #2339 has been reported by Martin Neitzel.

----------------------------------------
Submit #2339: [PATCH] rwhod: do not clobber the hostname.
http://bugs.dragonflybsd.org/issues/2339

Author: Martin Neitzel
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 


The time stamps in the rwhod(8) network datagram and, based on that,
/var/rwho/whod.* spool files are typed as 32bit int and cannot accept
a 64bit time_t.

The old code clobbered the first bytes of the adjacent "hostname"
field, yielding empty hostnames in local rwho(1) and ruptime(1) output.
(Outgoing datagrams to other hosts were not affected.)

Re-code to let the compiler do the proper coercion (well, until 2038).
---
 usr.sbin/rwhod/rwhod.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c
index fda528a..32f86f1 100644
--- a/usr.sbin/rwhod/rwhod.c
+++ b/usr.sbin/rwhod/rwhod.c
@@ -382,7 +382,7 @@ handleread(int sock)
 		}
 	}
 #endif
-	time((time_t *)&wd.wd_recvtime);
+	wd.wd_recvtime = time(NULL);
 	write(whod, (char *)&wd, cc);
 	if (fstat(whod, &st) < 0 || st.st_size > cc)
 		ftruncate(whod, cc);
-- 
1.7.6


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]