summaryrefslogtreecommitdiffstats
path: root/usr.sbin/inetd
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2006-04-17 18:35:58 +0000
committerdwmalone <dwmalone@FreeBSD.org>2006-04-17 18:35:58 +0000
commit665da7e9a1a510644a3e2cac5be242002d0a20a9 (patch)
treec6feecdb4fb2b7f40a4df9fecf1e2178c94ec43c /usr.sbin/inetd
parentd535a5cb818e93fdb882b2748621d7367c013113 (diff)
downloadFreeBSD-src-665da7e9a1a510644a3e2cac5be242002d0a20a9.zip
FreeBSD-src-665da7e9a1a510644a3e2cac5be242002d0a20a9.tar.gz
Port 37 (RFC 738) style times are supposed to be a 32 bit time since
1900 in network byte order. Use a uint32_t to calculate and send the time, so that we don't need to know how big ints or longs are. I used uint32_t instead of int in the patch, on the off chance someone uses our inetd source on a system that doesnt 32 bit ints. PR: 95290 Submitted by: Bruce Becker <hostmaster@whois.gts.net> MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r--usr.sbin/inetd/Makefile2
-rw-r--r--usr.sbin/inetd/builtins.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/inetd/Makefile b/usr.sbin/inetd/Makefile
index afe4c51..7e554a6 100644
--- a/usr.sbin/inetd/Makefile
+++ b/usr.sbin/inetd/Makefile
@@ -7,7 +7,7 @@ MLINKS= inetd.8 inetd.conf.5
SRCS= inetd.c builtins.c
WARNS?= 2
-CFLAGS+= -DLOGIN_CAP
+CFLAGS+= -DLOGIN_CAP -fno-builtin
#CFLAGS+= -DSANITY_CHECK
DPADD= ${LIBUTIL} ${LIBWRAP}
diff --git a/usr.sbin/inetd/builtins.c b/usr.sbin/inetd/builtins.c
index 96eeb33..e6ef675 100644
--- a/usr.sbin/inetd/builtins.c
+++ b/usr.sbin/inetd/builtins.c
@@ -64,7 +64,7 @@ static int getline(int, char *, int);
void iderror(int, int, int, const char *);
void ident_stream(int, struct servtab *);
void initring(void);
-unsigned long machtime(void);
+uint32_t machtime(void);
void machtime_dg(int, struct servtab *);
void machtime_stream(int, struct servtab *);
@@ -685,7 +685,7 @@ printit:
* some seventy years Bell Labs was asleep.
*/
-unsigned long
+uint32_t
machtime(void)
{
struct timeval tv;
@@ -695,8 +695,8 @@ machtime(void)
warnx("unable to get time of day");
return (0L);
}
-#define OFFSET ((u_long)25567 * 24*60*60)
- return (htonl((long)(tv.tv_sec + OFFSET)));
+#define OFFSET ((uint32_t)25567 * 24*60*60)
+ return (htonl((uint32_t)(tv.tv_sec + OFFSET)));
#undef OFFSET
}
@@ -704,7 +704,7 @@ machtime(void)
void
machtime_dg(int s, struct servtab *sep)
{
- unsigned long result;
+ uint32_t result;
struct sockaddr_storage ss;
socklen_t size;
@@ -725,7 +725,7 @@ machtime_dg(int s, struct servtab *sep)
void
machtime_stream(int s, struct servtab *sep __unused)
{
- unsigned long result;
+ uint32_t result;
result = machtime();
(void) send(s, (char *) &result, sizeof(result), MSG_EOF);
OpenPOWER on IntegriCloud