mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
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
This commit is contained in:
parent
0f180a7cce
commit
e90fa6a937
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157816
@ -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}
|
||||
|
@ -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 @@ ident_stream(int s, struct servtab *sep)
|
||||
* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user