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