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