83d119
--- arpwatch-2.1a11/addresses.h.in.addr	Wed Jun  5 00:40:29 1996
83d119
+++ arpwatch-2.1a11/addresses.h.in	Wed Jul 31 17:39:38 2002
83d119
@@ -1,2 +1,4 @@
83d119
 #define WATCHER "root"
83d119
-#define WATCHEE "arpwatch (Arpwatch)"
83d119
+#define WATCHEE "root (Arpwatch)"
83d119
+extern char *watcher;
83d119
+extern char *watchee;
83d119
--- arpwatch-2.1a11/arpsnmp.8.addr	Sun Sep 17 15:34:48 2000
83d119
+++ arpwatch-2.1a11/arpsnmp.8	Fri Aug  2 15:15:31 2002
83d119
@@ -30,6 +30,12 @@
83d119
 ] [
83d119
 .B -f
83d119
 .I datafile
83d119
+] [
83d119
+.B -e
83d119
+.I username
83d119
+] [
83d119
+.B -s
83d119
+.I username
83d119
 ]
83d119
 .I file
83d119
 [
83d119
@@ -59,6 +65,27 @@
83d119
 .I arp.dat
83d119
 file must be created before the first time you run
83d119
 .BR arpsnmp .
83d119
+.LP
83d119
+If the
83d119
+.B -e 
83d119
+flag is used, 
83d119
+.B arpsnmp
83d119
+sends e-mail messages to
83d119
+.I username
83d119
+rather than the default (root).
83d119
+If a single `-' character is given for the username,
83d119
+sending of e-mail is suppressed,
83d119
+but logging via syslog is still done as usual.
83d119
+(This can be useful during initial runs, to collect data
83d119
+without being flooded with messages about new stations.)
83d119
+.LP
83d119
+If the
83d119
+.B -s 
83d119
+flag is used, 
83d119
+.B arpsnmp
83d119
+sends e-mail messages with
83d119
+.I username
83d119
+as the return address, rather than the default (root).
83d119
 .LP
83d119
 .SH "REPORT MESSAGES"
83d119
 (See the
83d119
--- arpwatch-2.1a11/arpsnmp.c.addr	Sun Jan 17 19:47:40 1999
83d119
+++ arpwatch-2.1a11/arpsnmp.c	Fri Aug  2 15:17:16 2002
83d119
@@ -59,6 +59,7 @@
83d119
 #include "file.h"
83d119
 #include "machdep.h"
83d119
 #include "util.h"
83d119
+#include "addresses.h"
83d119
 
83d119
 /* Forwards */
83d119
 int	main(int, char **);
83d119
@@ -90,7 +91,7 @@
83d119
 	}
83d119
 
83d119
 	opterr = 0;
83d119
-	while ((op = getopt(argc, argv, "df:")) != EOF)
83d119
+	while ((op = getopt(argc, argv, "df:e:s:")) != EOF)
83d119
 		switch (op) {
83d119
 
83d119
 		case 'd':
83d119
@@ -105,6 +106,24 @@
83d119
 			arpfile = optarg;
83d119
 			break;
83d119
 
83d119
+		case 'e':
83d119
+			if ( optarg ) {
83d119
+				watcher = strdup(optarg);
83d119
+			} else {
83d119
+				(void)fprintf(stderr, "%s: Need recipient username/e-mail address after -e\n", prog);
83d119
+				usage();
83d119
+			}
83d119
+			break;
83d119
+
83d119
+		case 's':
83d119
+			if ( optarg ) {
83d119
+				watchee = strdup(optarg);
83d119
+			} else {
83d119
+				(void)fprintf(stderr, "%s: Need sender username/e-mail address after -s\n", prog);
83d119
+				usage();
83d119
+			}
83d119
+			break;
83d119
+
83d119
 		default:
83d119
 			usage();
83d119
 		}
83d119
@@ -184,6 +203,6 @@
83d119
 
83d119
 	(void)fprintf(stderr, "Version %s\n", version);
83d119
 	(void)fprintf(stderr,
83d119
-	    "usage: %s [-d] [-f datafile] file [...]\n", prog);
83d119
+	    "usage: %s [-d] [-f datafile] [-e username] [-s username] file [...]\n", prog);
83d119
 	exit(1);
83d119
 }
83d119
--- arpwatch-2.1a11/arpwatch.8.addr	Thu Aug  1 13:45:36 2002
83d119
+++ arpwatch-2.1a11/arpwatch.8	Thu Aug  1 14:08:05 2002
83d119
@@ -46,6 +46,12 @@
83d119
 ] [
83d119
 .B -u
83d119
 .I username
83d119
+] [
83d119
+.B -e
83d119
+.I username
83d119
+] [
83d119
+.B -s
83d119
+.I username
83d119
 ]
83d119
 .ad
83d119
 .SH DESCRIPTION
83d119
@@ -106,6 +112,27 @@
83d119
 and group ID to that of the primary group of 
83d119
 .IR username .
83d119
 This is recommended for security reasons.
83d119
+.LP
83d119
+If the
83d119
+.B -e 
83d119
+flag is used, 
83d119
+.B arpwatch
83d119
+sends e-mail messages to
83d119
+.I username
83d119
+rather than the default (root).
83d119
+If a single `-' character is given for the username,
83d119
+sending of e-mail is suppressed,
83d119
+but logging via syslog is still done as usual.
83d119
+(This can be useful during initial runs, to collect data
83d119
+without being flooded with messages about new stations.)
83d119
+.LP
83d119
+If the
83d119
+.B -s 
83d119
+flag is used, 
83d119
+.B arpwatch
83d119
+sends e-mail messages with
83d119
+.I username
83d119
+as the return address, rather than the default (root).
83d119
 .LP
83d119
 Note that an empty
83d119
 .I arp.dat
83d119
--- arpwatch-2.1a11/arpwatch.c.addr	Thu Aug  1 13:45:36 2002
83d119
+++ arpwatch-2.1a11/arpwatch.c	Thu Aug  1 13:47:35 2002
83d119
@@ -78,6 +78,7 @@
83d119
 #include "machdep.h"
83d119
 #include "setsignal.h"
83d119
 #include "util.h"
83d119
+#include "addresses.h"
83d119
 
83d119
 /* Some systems don't define these */
83d119
 #ifndef ETHERTYPE_REVARP
83d119
@@ -190,7 +191,7 @@
83d119
 	interface = NULL;
83d119
 	rfilename = NULL;
83d119
 	pd = NULL;
83d119
-	while ((op = getopt(argc, argv, "df:i:n:Nr:u:")) != EOF)
83d119
+	while ((op = getopt(argc, argv, "df:i:n:Nr:u:e:s:")) != EOF)
83d119
 		switch (op) {
83d119
 
83d119
 		case 'd':
83d119
@@ -232,6 +233,26 @@
83d119
 			}
83d119
 			break;
83d119
 
83d119
+		case 'e':
83d119
+			if ( optarg ) {
83d119
+				watcher = strdup(optarg);
83d119
+			}
83d119
+			else {
83d119
+				fprintf(stderr, "%s: Need recipient username/e-mail address after -e\n", prog);
83d119
+				usage();
83d119
+			}
83d119
+			break;
83d119
+
83d119
+		case 's':
83d119
+			if ( optarg ) {
83d119
+				watchee = strdup(optarg);
83d119
+			}
83d119
+			else {
83d119
+				fprintf(stderr, "%s: Need sender username/e-mail address after -s\n", prog);
83d119
+				usage();
83d119
+			}
83d119
+			break;
83d119
+
83d119
 		default:
83d119
 			usage();
83d119
 		}
83d119
@@ -784,6 +805,7 @@
83d119
 
83d119
 	(void)fprintf(stderr, "Version %s\n", version);
83d119
 	(void)fprintf(stderr, "usage: %s [-dN] [-f datafile] [-i interface]"
83d119
-	    " [-n net[/width]] [-r file] [-u username]\n", prog);
83d119
+	    " [-n net[/width]] [-r file] [-u username]"
83d119
+	    " [-e username] [-s username]\n", prog);
83d119
 	exit(1);
83d119
 }
83d119
--- arpwatch-2.1a11/report.c.addr	Sat Sep 30 18:41:10 2000
83d119
+++ arpwatch-2.1a11/report.c	Thu Aug  1 14:16:43 2002
83d119
@@ -70,6 +70,9 @@
83d119
 
83d119
 #define PLURAL(n) ((n) == 1 || (n) == -1 ? "" : "s")
83d119
 
83d119
+char *watcher = WATCHER;
83d119
+char *watchee = WATCHEE;
83d119
+
83d119
 static int cdepth;	/* number of outstanding children */
83d119
 
83d119
 static char *fmtdate(time_t);
83d119
@@ -240,8 +243,6 @@
83d119
 	register FILE *f;
83d119
 	char tempfile[64], cpu[64], os[64];
83d119
 	char *fmt = "%20s: %s\n";
83d119
-	char *watcher = WATCHER;
83d119
-	char *watchee = WATCHEE;
83d119
 	char *sendmail = PATH_SENDMAIL;
83d119
 	char *unknown = "<unknown>";
83d119
 	char buf[132];
83d119
@@ -258,6 +259,9 @@
83d119
 		}
83d119
 		f = stdout;
83d119
 		(void)putc('\n', f);
83d119
+	} else if (watcher == NULL || *watcher == NULL || *watcher == '-') {
83d119
+		dosyslog(LOG_NOTICE, title, a, e1, e2);
83d119
+		return;
83d119
 	} else {
83d119
 		/* Setup child reaper if we haven't already */
83d119
 		if (!init) {