]> Pileus Git - ~andy/fetchmail/commitdiff
Added `postconnect'.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 4 Aug 1997 04:10:40 +0000 (04:10 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 4 Aug 1997 04:10:40 +0000 (04:10 -0000)
svn path=/trunk/; revision=1226

NEWS
driver.c
fetchmail.c
fetchmail.h
fetchmail.man
rcfile_l.l
rcfile_y.y
sample.rcfile

diff --git a/NEWS b/NEWS
index f3deeb4c1bb75fbac2251c380962c9cbf3a320ef..dbad3b02ccdf60b6329e4977b529bb26b473aa62 100644 (file)
--- 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.
                                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.
index f5123c197a87f0a40c1f397d8bad7a98453b619b..6144fb33530b413f70509d04b1a3906656073c6d 100644 (file)
--- 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);
 }
index 3f0ce69c236bf7f25844c59c9b9c74a8fde4b18a..715e72465129e61d698b9bc9d38dec096059bbba 100644 (file)
@@ -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
index 495ec823640a525d820124ba38a00135ef6b5882..30bad06a79ba297f5fb3d82541361051c8589ca4 100644 (file)
@@ -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 */
index 68879298f1e1fa4f433d07343708d66254cd71e3..4d80dc0b451cd42d7ad5ffdada1ab4a8104d3a89 100644 (file)
@@ -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
index 61f47abe90e03e5c81235b07c456a2418b385035..8df55dca13b18cfc32dd110c30ece63d50f7ac3a 100644 (file)
@@ -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; }
 
index 058d4e698474c50f3581ec98e79110bfc06f9744..da9bb9ebd1f94e8ef9b5906b4b28f1cd89918439 100644 (file)
@@ -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);
index 089657720f4f64c3d7a04858e5df341c0a4fc099..dc5bdddb115f718cd289bea0c02716bf85e76e25 100644 (file)
@@ -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