Add an option for insecure mode, in which rwhod does not discard packets

from incorrect source ports.
This commit is contained in:
Dag-Erling Smørgrav 1998-12-17 11:05:57 +00:00
parent 57276bc0d3
commit ae94be3fb1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41895
2 changed files with 16 additions and 4 deletions

View File

@ -39,6 +39,7 @@
.Nd system status server
.Sh SYNOPSIS
.Nm rwhod
.Op Fl i
.Op Fl m Op Ar ttl
.Sh DESCRIPTION
.Nm Rwhod
@ -64,6 +65,12 @@ them in a collection of files located in the directory
.Pa /var/rwho .
.Pp
The
.Fl i
option enables insecure mode, which causes
.Nm
to ignore the source port on incoming packets.
.Pp
The
.Fl m
option causes
.Nm
@ -163,7 +170,9 @@ Messages received by the
.Nm rwho
server are discarded unless they originated at an
.Nm rwho
server's port. In addition, if the host's name, as specified
server's port or the
.Fl i
option was specified. In addition, if the host's name, as specified
in the message, contains any unprintable
.Tn ASCII
characters, the

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
"$Id: rwhod.c,v 1.7 1997/10/13 11:27:55 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -115,6 +115,7 @@ static const char rcsid[] =
#define INADDR_WHOD_GROUP (u_long)0xe0000103 /* 224.0.1.3 */
/* (belongs in protocols/rwhod.h) */
int insecure_mode;
int multicast_mode = NO_MULTICAST;
int multicast_scope;
struct sockaddr_in multicast_addr = { sizeof multicast_addr, AF_INET };
@ -194,6 +195,8 @@ main(argc, argv)
}
else multicast_mode = PER_INTERFACE_MULTICAST;
}
else if (strcmp(*argv, "-i") == 0)
insecure_mode = 1;
else
usage();
argv++, argc--;
@ -265,7 +268,7 @@ main(argc, argv)
syslog(LOG_WARNING, "recv: %m");
continue;
}
if (from.sin_port != sp->s_port) {
if (from.sin_port != sp->s_port && !insecure_mode) {
syslog(LOG_WARNING, "%d: bad from port",
ntohs(from.sin_port));
continue;
@ -319,7 +322,7 @@ main(argc, argv)
static void
usage()
{
fprintf(stderr, "usage: rwhod [-m [ttl]]\n");
fprintf(stderr, "usage: rwhod [-i] [-m [ttl]]\n");
exit(1);
}