aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS8
-rw-r--r--driver.c11
-rw-r--r--fetchmail.c10
-rw-r--r--fetchmail.h1
-rw-r--r--fetchmail.man13
-rw-r--r--rcfile_l.l3
-rw-r--r--rcfile_y.y5
-rw-r--r--sample.rcfile3
8 files changed, 46 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index f3deeb4c..dbad3b02 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@
* Use the libmd functions for md5 under Free BSD? (Low priority.)
+* Make interval count polls skipped because of interface or monitor option?
+
Other TO-DO items:
* Get with Craig Metz to write a draft RFC on RFC1938 support in IMAP.
@@ -19,6 +21,12 @@
Release Notes:
------------------------------------------------------------------------------
+fetchmail-4.0.7 ()
+* Fixed a minor bug in handling of DNS errors in multidrop mode.
+* Added a `postconnect' analogous to `preconnect'.
+
+There are 258 people on the fetchmail-friends list.
+
fetchmail-4.0.6 (Fri Aug 1 11:14:31 EDT 1997)
* Changed semantics of `via' and `poll <name>' to be more orthogonal.
* Substantially improved option coverage on the man page.
diff --git a/driver.c b/driver.c
index f5123c19..6144fb33 100644
--- a/driver.c
+++ b/driver.c
@@ -1770,6 +1770,17 @@ const struct method *proto; /* protocol method table */
error(0,-1, "%s error while fetching from %s", msg, ctl->server.pollname);
closeUp:
+ /* execute post-initialization command, if any */
+ if (ctl->postconnect && (ok = system(ctl->postconnect)))
+ {
+ char buf[80];
+
+ sprintf(buf, "post-connection command failed with status %d", ok);
+ error(0, 0, buf);
+ if (ok == PS_SUCCESS)
+ ok = PS_SYNTAX;
+ }
+
signal(SIGALRM, sigsave);
return(ok);
}
diff --git a/fetchmail.c b/fetchmail.c
index 3f0ce69c..715e7246 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -930,9 +930,15 @@ void dump_params (struct query *ctl)
printf("\n");
}
if (ctl->preconnect)
- printf(" Server connection will be preinitialized with '%s.'\n", visbuf(ctl->preconnect));
+ printf(" Server connection will be brought up with '%s.'\n",
+ visbuf(ctl->preconnect));
else if (outlevel == O_VERBOSE)
- printf(" No preinitialization command.\n");
+ printf(" No pre-connection command.\n");
+ if (ctl->postconnect)
+ printf(" Server connection will be taken down with '%s.'\n",
+ visbuf(ctl->postconnect));
+ else if (outlevel == O_VERBOSE)
+ printf(" No post-connection command.\n");
if (!ctl->localnames)
printf(" No localnames declared for this host.\n");
else
diff --git a/fetchmail.h b/fetchmail.h
index 495ec823..30bad06a 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -121,6 +121,7 @@ struct query
char *smtphost; /* actual SMTP host to point to */
char *mda; /* local MDA to pass mail to */
char *preconnect; /* pre-connection command to execute */
+ char *postconnect; /* post-connection command to execute */
/* per-user control flags */
flag keep; /* if TRUE, leave messages undeleted */
diff --git a/fetchmail.man b/fetchmail.man
index 68879298..4d80dc0b 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -754,6 +754,9 @@ T}
preconnect \& T{
Command to be executed before each connection
T}
+postconnect \& T{
+Command to be executed after each connection
+T}
keep -k T{
Don't delete seen messages from server
T}
@@ -823,9 +826,9 @@ following them.
.PP
All options correspond to the obvious command-line arguments, except
the following: `via', `interval', `aka', `is', `to', `dns'/`no dns',
-\&`password', \&`preconnect', `localdomains', `stripcr'/`no stripcr',
-\&`forcecr'/`no forcecr', `pass8bits'/`no pass8bits' `dropstatus/no
-dropstatus', and `no envelope'.
+\&`password', \&`preconnect', \&`postconnect', `localdomains',
+\&`stripcr'/`no stripcr', \&`forcecr'/`no forcecr', `pass8bits'/`no
+pass8bits' `dropstatus/no dropstatus', and `no envelope'.
.PP
The `via' option is for use with ssh, or if you want to have more
than one configuration pointing at the same site. If it is present,
@@ -908,6 +911,10 @@ establishes a mailserver connection. This may be useful if you are
attempting to set up secure POP connections with the aid of
.IR ssh (1).
.PP
+Similarly, the `postconnect' keyword similarly allows you to specify a
+shell command to be executed just after each time a mailserver
+connection is taken down.
+.PP
The `forcecr' option controls whether lines terminated by LF only are
given CRLF termination before forwarding. Strictly speaking RFC821
requires this, but few MTAs enforce the requirement it so this option
diff --git a/rcfile_l.l b/rcfile_l.l
index 61f47abe..8df55dca 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -35,7 +35,7 @@ aka { return AKA; }
local(domains) { return LOCALDOMAINS; }
proto(col)? { return PROTOCOL; }
port { return PORT; }
-interval { return INTERVAL; }
+interval { return INTERVAL; }
auth(enticate)? { return AUTHENTICATE; }
kerberos_v4 { return KERBEROS4; }
kerberos { return KERBEROS4; }
@@ -48,6 +48,7 @@ folder(s)? { return FOLDER; }
smtp(host)? { return SMTPHOST; }
mda { return MDA; }
pre(connect)? { return PRECONNECT; }
+post(connect)? { return POSTCONNECT; }
interface { return INTERFACE; }
monitor { return MONITOR; }
diff --git a/rcfile_y.y b/rcfile_y.y
index 058d4e69..da9bb9eb 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -56,7 +56,8 @@ extern char * yytext;
%token DEFAULTS POLL SKIP VIA AKA LOCALDOMAINS PROTOCOL
%token AUTHENTICATE TIMEOUT KPOP KERBEROS4
-%token ENVELOPE USERNAME PASSWORD FOLDER SMTPHOST MDA PRECONNECT LIMIT
+%token ENVELOPE USERNAME PASSWORD FOLDER SMTPHOST MDA
+%token PRECONNECT POSTCONNECT LIMIT
%token IS HERE THERE TO MAP WILDCARD
%token SET BATCHLIMIT FETCHLIMIT LOGFILE DAEMON SYSLOG INTERFACE MONITOR
%token <proto> PROTO
@@ -219,6 +220,7 @@ user_option : TO localnames HERE
| SMTPHOST smtp_list
| MDA STRING {current.mda = xstrdup($2);}
| PRECONNECT STRING {current.preconnect = xstrdup($2);}
+ | POSTCONNECT STRING {current.postconnect = xstrdup($2);}
| KEEP {current.keep = FLAG_TRUE;}
| FLUSH {current.flush = FLAG_TRUE;}
@@ -426,6 +428,7 @@ static void record_current(void)
save_str(&current.smtphunt, -1, cmd_opts.smtphunt->id);
FLAG_FORCE(mda);
FLAG_FORCE(preconnect);
+ FLAG_FORCE(postconnect);
FLAG_FORCE(keep);
FLAG_FORCE(flush);
diff --git a/sample.rcfile b/sample.rcfile
index 08965772..dc5bdddb 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -41,7 +41,8 @@
# password (or pass) -- must be followed by a password string
# smtphost (or smtp) -- must be followed by host names
# mda -- must be followed by an MDA command string
-# preconnect (or pre) -- must be followed by an initialization command
+# preconnect (or pre) -- must be followed by an executable command
+# postconnect (or post) -- must be followed by an executable command
#
# keep
# flush