misc/95290: amd64 inetd returns 8 byte time value instead of 4 byte
Bruce Becker
hostmaster at whois.gts.net
Mon Apr 3 23:40:18 UTC 2006
>Number: 95290
>Category: misc
>Synopsis: amd64 inetd returns 8 byte time value instead of 4 byte
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Apr 03 23:40:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Bruce Becker
>Release: FreeBSD 6.0-STABLE amd64
>Organization:
GTS
>Environment:
FreeBSD indra 6.0-STABLE FreeBSD 6.0-STABLE #2: Thu Jan 12 15:28:18 EST 2006 root at indra:/usr/obj/usr/src/sys/INDRA amd64
>Description:
according to RFC768 the value to be returend to a "time" query is an int32
object, but amd64 (& likely other 64-bit ports) returns 8 bytes with trailing nulls
>How-To-Repeat:
Enable the "time" builtin in inetd.conf, then "telnet localhost time > xxx" -
the last line of "xxx" will contain the erroneous 8 byte result
>Fix:
--- builtins.c.2002072200 Mon Jul 22 09:58:58 2002
+++ builtins.c Mon Apr 3 18:04:00 2006
@@ -64,7 +64,7 @@
void iderror(int, int, int, const char *);
void ident_stream(int, struct servtab *);
void initring(void);
-unsigned long machtime(void);
+unsigned int machtime(void);
void machtime_dg(int, struct servtab *);
void machtime_stream(int, struct servtab *);
@@ -685,7 +685,7 @@
* some seventy years Bell Labs was asleep.
*/
-unsigned long
+unsigned int
machtime(void)
{
struct timeval tv;
@@ -696,7 +696,7 @@
return (0L);
}
#define OFFSET ((u_long)25567 * 24*60*60)
- return (htonl((long)(tv.tv_sec + OFFSET)));
+ return (htonl((unsigned int)(tv.tv_sec + OFFSET)));
#undef OFFSET
}
@@ -704,7 +704,7 @@
void
machtime_dg(int s, struct servtab *sep)
{
- unsigned long result;
+ unsigned int result;
struct sockaddr_storage ss;
socklen_t size;
@@ -725,7 +725,7 @@
void
machtime_stream(int s, struct servtab *sep __unused)
{
- unsigned long result;
+ unsigned int result;
result = machtime();
(void) send(s, (char *) &result, sizeof(result), MSG_EOF);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list