aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-12-23 05:45:15 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-12-23 05:45:15 +0000
commita3140279cc8c41a6d4cf169c3f6e94411fec4f95 (patch)
treeb6792b857061a77596ebfcd01b90f10b9359299d
parente2914b619afd334ae57f10e8af35c9c43088f24b (diff)
downloadfetchmail-a3140279cc8c41a6d4cf169c3f6e94411fec4f95.tar.gz
fetchmail-a3140279cc8c41a6d4cf169c3f6e94411fec4f95.tar.bz2
fetchmail-a3140279cc8c41a6d4cf169c3f6e94411fec4f95.zip
Introduced George Sipe's -I and -M options.
svn path=/trunk/; revision=673
-rw-r--r--Makefile.in4
-rw-r--r--NEWS11
-rw-r--r--fetchmail.c36
-rw-r--r--fetchmail.man42
-rw-r--r--options.c29
-rw-r--r--rcfile_y.y4
-rw-r--r--sample.rcfile2
7 files changed, 118 insertions, 10 deletions
diff --git a/Makefile.in b/Makefile.in
index 21153574..69584a12 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -79,7 +79,7 @@ CTAGS = ctags -tw
protobjs = socket.o getpass.o pop2.o pop3.o imap.o fetchmail.o options.o \
rcfile_l.o rcfile_y.o daemon.o smtp.o driver.o rfc822.o xmalloc.o \
- uid.o mxget.o md5c.o md5ify.o error.o
+ uid.o mxget.o md5c.o md5ify.o interface.o error.o
objs = $(protobjs) $(extras) $(EXTRAOBJ)
@@ -88,7 +88,7 @@ srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c \
$(srcdir)/options.c $(srcdir)/daemon.c $(srcdir)/driver.c \
$(srcdir)/rfc822.c $(srcdir)/smtp.c $(srcdir)/xmalloc.c \
$(srcdir)/uid.c $(srcdir)/mxget.c $(srcdir)/md5c.c \
- $(srcdir)/md5ify.c $(srcdir)/error.c
+ $(srcdir)/md5ify.c $(srcdir)/interface.c $(srcdir)/error.c
.SUFFIXES:
.SUFFIXES: .o .c .h .y .l .ps .dvi .info .texi
diff --git a/NEWS b/NEWS
index 2a1ff4aa..784006a5 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,17 @@
Release Notes:
------------------------------------------------------------------------------
+fetchmail-2.5 ()
+
+features --
+
+* --interface and --monitor options courtesy for George Sipe.
+
+bugs --
+
+* Replaced bug-prone setvbuf with setlinebuf.
+
+------------------------------------------------------------------------------
fetchmail-2.4 (Sat Dec 21 05:24:44 EST 1996)
Note: a preliminary version of 2.4 was withdrawn after four hours of
diff --git a/fetchmail.c b/fetchmail.c
index 65c84933..0a93eaa4 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -60,6 +60,10 @@ int check_only; /* if --probe was set */
int cmd_batchlimit; /* if --batchlimit was set */
int cmd_fetchlimit; /* if --fetchlimit was set */
char *cmd_logfile; /* if --logfile was set */
+char *interface; /* interface required specification */
+char *cmd_interface; /* if --interface was set */
+char *monitor; /* monitored interface for activity */
+char *cmd_monitor; /* if --monitor was set */
/* miscellaneous global controls */
char *rcfile; /* path name of rc file */
@@ -417,6 +421,10 @@ int main (int argc, char **argv)
* We'll just assume setitimer(2) is available since fetchmail
* has to have a BSDoid socket layer to work at all.
*/
+#ifdef linux
+ do {
+ interface_note_activity();
+#endif
{
struct itimerval ntimeout;
@@ -430,6 +438,9 @@ int main (int argc, char **argv)
if (lastsig == SIGUSR1)
(void) error(0, 0, "awakened by SIGUSR1");
}
+#ifdef linux
+ } while (!interface_approve());
+#endif
if (outlevel == O_VERBOSE)
{
@@ -605,6 +616,31 @@ static int load_params(int argc, char **argv, int optind)
if (cmd_logfile)
logfile = cmd_logfile;
+ /* if cmd_interface was explicitly set, use it to override interface */
+ if (cmd_interface)
+ interface = cmd_interface;
+
+ /* if cmd_monitor was explicitly set, use it to override monitor */
+ if (cmd_monitor)
+ monitor = cmd_monitor;
+
+ if (interface)
+#ifdef linux
+ interface_parse();
+#else
+ {
+ (void) fprintf(stderr,
+ "interface specification supported only on Linux\n");
+ exit(PS_SYNTAX);
+ }
+ if (monitor)
+ {
+ (void) fprintf(stderr,
+ "monitor supported only on Linux\n");
+ exit(PS_SYNTAX);
+ }
+#endif
+
return(implicitmode);
}
diff --git a/fetchmail.man b/fetchmail.man
index 2cec810f..d099c6e1 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -106,6 +106,36 @@ run control file.
Specify an alternate name for the .fetchids file used to save POP3
UIDs.
.TP
+.B \-I specification, --interface specification
+.I fetchmail
+relies on the underlying TCP/IP protocol to reach the server host.
+Transient links are commonly established directly to a mail host and are
+relatively secure channels to communicate. When other routes exist, or
+when a transient link is established to a different remote host, your
+username and password may be vulnerable to snooping when daemon mode
+automatically polls for mail.
+.sp
+This option may be used to specify a connection IP address (or range)
+for a system TCP/IP interface. When the link is not up or is connected
+to a different host, polling will be skipped. The format is:
+.sp
+ interface/iii.iii.iii.iii/mmm.mmm.mmm.mmm
+.sp
+The field after the first slash is the acceptable IP address and the
+field after the second slash is a mask which specifies a range of IP
+addresses to accept. If no mask is present 255.255.255.255 is assumed
+(i.e. an exact match).
+.sp
+This option is currently only supported under Linux.
+.TP
+.B \-M interface, --monitor interface
+Daemon mode can cause transient links which are automatically taken down
+after a period of inactivity (e.g. PPP links) to remain up
+indefinitely. This option identifies a system TCP/IP interface to be
+monitored for activity. After each poll interval, if the link is up and
+no other activity has occurred on the link then the poll will be
+skipped. This option is currently only supported under Linux.
+.TP
.B \-k, --keep
Keep retrieved messages on the remote mailserver. Normally, messages
are deleted from the folder on the mailserver after they have been retrieved.
@@ -201,7 +231,7 @@ shut down to deliver. This may produce annoying delays when
is processing very large batches. Setting the batch limit to some
nonzero size will prevent these delays.
.TP
-.B -R, --fetchlimit
+.B -B, --fetchlimit
Limit the number of messages accepted from a given server in a single
poll. By default there is no limit.
.TP
@@ -543,11 +573,13 @@ or reverse it by saying `user esr here is eric there'
.PP
For backward compatibility, the word `server' is a synonym for `poll'.
.PP
-There are currently two valid global option statements;
+There are currently four valid global option statements;
\&`set batchlimit = ' followed by a number and sets the same global
-specified by the --batchlimit option, and `set logfile = ' followed
-by a string sets the same global specified by --logfile. In both
-cases, a command-line option will override.
+specified by the --batchlimit option, `set logfile = ' followed by a
+string sets the same global specified by --logfile, `set interface = '
+followed by a string sets the same global specified by --interface, and
+`set monitor = ' followed by a string sets the same global specified by
+--monitor. In all cases, a command-line option will override.
.PP
Basic format is:
diff --git a/options.c b/options.c
index bbf0236c..4bbc593f 100644
--- a/options.c
+++ b/options.c
@@ -43,9 +43,11 @@
#define LA_BATCHLIMIT 25
#define LA_FETCHLIMIT 26
#define LA_MDA 27
-#define LA_YYDEBUG 28
+#define LA_INTERFACE 28
+#define LA_MONITOR 29
+#define LA_YYDEBUG 30
-static char *shortoptions = "?Vcsvd:NqL:f:i:p:P:A:t:u:akKFnl:r:S:b:B:m:y";
+static char *shortoptions = "?Vcsvd:NqL:f:i:p:P:A:t:u:akKFnl:r:S:b:B:m:I:M:y";
static struct option longoptions[] = {
{"help", no_argument, (int *) 0, LA_HELP },
{"version", no_argument, (int *) 0, LA_VERSION },
@@ -58,6 +60,10 @@ static struct option longoptions[] = {
{"logfile", required_argument, (int *) 0, LA_LOGFILE },
{"fetchmailrc",required_argument,(int *) 0, LA_RCFILE },
{"idfile", required_argument, (int *) 0, LA_IDFILE },
+#ifdef linux
+ {"interface", required_argument, (int *) 0, LA_INTERFACE },
+ {"monitor", required_argument, (int *) 0, LA_MONITOR },
+#endif
{"protocol", required_argument, (int *) 0, LA_PROTOCOL },
{"proto", required_argument, (int *) 0, LA_PROTOCOL },
@@ -81,6 +87,9 @@ static struct option longoptions[] = {
{"fetchlimit",required_argument, (int *) 0, LA_FETCHLIMIT },
{"mda", required_argument, (int *) 0, LA_MDA },
+ {"interface", required_argument, (int *) 0, LA_INTERFACE },
+ {"monitor", required_argument, (int *) 0, LA_MONITOR },
+
{"yydebug", no_argument, (int *) 0, LA_YYDEBUG },
{(char *) 0, no_argument, (int *) 0, 0 }
@@ -246,6 +255,18 @@ struct query *ctl; /* option record to be initialized */
strncpy(ctl->mda,optarg,sizeof(ctl->mda));
ocount++;
break;
+
+#ifdef linux
+ case 'I':
+ case LA_INTERFACE:
+ cmd_interface = optarg;
+ break;
+ case 'M':
+ case LA_MONITOR:
+ cmd_monitor = optarg;
+ break;
+#endif
+
case 'y':
case LA_YYDEBUG:
yydebug = TRUE;
@@ -280,6 +301,10 @@ struct query *ctl; /* option record to be initialized */
fputs(" -L, --logfile specify logfile name\n", stderr);
fputs(" -f, --fetchmailrc specify alternate run control file\n", stderr);
fputs(" -i, --idfile specify alternate UIDs file\n", stderr);
+#ifdef linux
+ fputs(" -I, --interface interface required specification\n",stderr);
+ fputs(" -M, --monitor monitor interface for activity\n",stderr);
+#endif
fputs(" -p, --protocol specify pop2, pop3, imap, apop, rpop, kpop\n", stderr);
fputs(" -P, --port TCP/IP service port to connect to\n",stderr);
diff --git a/rcfile_y.y b/rcfile_y.y
index 3c0f0484..94070861 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -44,7 +44,7 @@ static void prc_reset();
%token DEFAULTS POLL SKIP AKA PROTOCOL AUTHENTICATE TIMEOUT KPOP KERBEROS
%token ENVELOPE USERNAME PASSWORD FOLDER SMTPHOST MDA LIMIT
%token IS HERE THERE TO MAP WILDCARD
-%token SET BATCHLIMIT FETCHLIMIT LOGFILE
+%token SET BATCHLIMIT FETCHLIMIT LOGFILE INTERFACE MONITOR
%token <proto> PROTO
%token <sval> STRING
%token <number> NUMBER
@@ -67,6 +67,8 @@ statement_list : statement
/* future global options should also have the form SET <name> <value> */
statement : SET BATCHLIMIT MAP NUMBER {batchlimit = $4;}
| SET LOGFILE MAP STRING {logfile = xstrdup($4);}
+ | SET INTERFACE MAP STRING {interface = xstrdup($4);}
+ | SET MONITOR MAP STRING {monitor = xstrdup($4);}
/*
* The way the next two productions are written depends on the fact that
diff --git a/sample.rcfile b/sample.rcfile
index 8ee24e5f..303b9376 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -60,6 +60,8 @@
#
# set batchlimit = -- must be followed by a number
# set logfile = -- must be followed by a string
+# set interface = -- must be followed by IP address
+# set monitor = -- must be followed by IP address
#
# The noise keywords `and', `with', `has', `wants', and `options' are ignored
# anywhere in an entry; they can be used to make it resemble English. The