From d3d2905cbc36da5333c44ede4c098b27fa77f59f Mon Sep 17 00:00:00 2001 From: des Date: Thu, 17 Dec 1998 11:05:57 +0000 Subject: Add an option for insecure mode, in which rwhod does not discard packets from incorrect source ports. --- usr.sbin/rwhod/rwhod.8 | 11 ++++++++++- usr.sbin/rwhod/rwhod.c | 9 ++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'usr.sbin/rwhod') diff --git a/usr.sbin/rwhod/rwhod.8 b/usr.sbin/rwhod/rwhod.8 index a7243e4..f1aa636 100644 --- a/usr.sbin/rwhod/rwhod.8 +++ b/usr.sbin/rwhod/rwhod.8 @@ -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 diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c index 229d1f17..dcd6def 100644 --- a/usr.sbin/rwhod/rwhod.c +++ b/usr.sbin/rwhod/rwhod.c @@ -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 @@ -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); } -- cgit v1.1