]> Pileus Git - ~andy/fetchmail/commitdiff
Sunil Shetye's minor fixes.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 31 Oct 2002 13:38:29 +0000 (13:38 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 31 Oct 2002 13:38:29 +0000 (13:38 -0000)
svn path=/trunk/; revision=3762

NEWS
driver.c
sink.c
transact.c

diff --git a/NEWS b/NEWS
index 6523deb357bf8b7c07d4b24f76f426ead828f032..2e54e93e723bb93b586436790e7a8cee56354dc2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@
 * Jan Klaverstijn's verbosity-lowering patch.
 * Updated Turkish, German, Catalan, and Danish translation files.
 * Fix processing of POP3 messages with missing bodies.
+* Minor fixes by Sunil Shetye: fix generation of auth fail note, handle
+ unexpected SIGALRM, plug memory leak, handle lines beginning with '\0'.
 
 fetchmail-6.1.1 (Fri Oct 18 14:53:51 EDT 2002), 22087 lines:
 
index a0596ec0be4befbfaf449d7a33688a3a33db2101..ab441b746d7a46582487e2c3acf41012d0eecb70 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -1114,8 +1114,8 @@ const int maxfetch;               /* maximum number of messages to fetch */
                     */
                    if (run.poll_interval
                        && !ctl->wehavesentauthnote
-                       && ((ctl->wehaveauthed && ++ctl->authfailcount == 10)
-                           || ++ctl->authfailcount == 3)
+                       && ((ctl->wehaveauthed && ++ctl->authfailcount >= 10)
+                           || (!ctl->wehaveauthed && ++ctl->authfailcount >= 3))
                        && !open_warning_by_mail(ctl, (struct msgblk *)NULL))
                    {
                        ctl->wehavesentauthnote = 1;
@@ -1509,6 +1509,7 @@ closeUp:
            err = PS_SYNTAX;
     }
 
+    set_timeout(0); /* cancel any pending alarm */
     signal(SIGALRM, alrmsave);
     signal(SIGPIPE, pipesave);
     return(err);
diff --git a/sink.c b/sink.c
index 5ac588cbad957b7ccf0e0e41941e80e63a8c4e9f..5f484b174db0a3abf92a5333149788c7c9f76ed1 100644 (file)
--- a/sink.c
+++ b/sink.c
@@ -263,6 +263,7 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg,
     char daemon_name[18 + HOSTLEN] = "FETCHMAIL-DAEMON@";
     char boundary[BUFSIZ], *bounce_to;
     int sock;
+    static char *fqdn_of_host = NULL;
 
     /* don't bounce in reply to undeliverable bounces */
     if (!msg->return_path[0] || strcmp(msg->return_path, "<>") == 0)
@@ -273,7 +274,9 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg,
     SMTP_setmode(SMTP_MODE);
 
     /* can't just use fetchmailhost here, it might be localhost */
-    strcat(daemon_name, host_fqdn());
+    if (fqdn_of_host == NULL)
+       fqdn_of_host = host_fqdn();
+    strcat(daemon_name, fqdn_of_host);
 
     /* we need only SMTP for this purpose */
     if ((sock = SockOpen("localhost", SMTP_PORT, NULL, NULL)) == -1)
@@ -584,7 +587,7 @@ int stuffline(struct query *ctl, char *buf)
     /* The line may contain NUL characters. Find the last char to use
      * -- the real line termination is the sequence "\n\0".
      */
-    last = buf;
+    last = buf + 1; /* last[-1] must be valid! */
     while ((last += strlen(last)) && (last[-1] != '\n'))
         last++;
 
index 10731986d88eec949b9b53830b7af1b09ae05d0e..5ddcba991b56cc40fec41968efdf9de2a29ab53b 100644 (file)
@@ -365,7 +365,8 @@ int readheaders(int sock,
     int                        from_offs, reply_to_offs, resent_from_offs;
     int                        app_from_offs, sender_offs, resent_sender_offs;
     int                        env_offs;
-    char               *received_for, *rcv, *cp, *delivered_to;
+    char               *received_for, *rcv, *cp;
+    static char                *delivered_to = NULL;
     int                n, linelen, oldlen, ch, remaining, skipcount;
     struct idlist      *idp;
     flag               no_local_matches = FALSE;
@@ -390,6 +391,8 @@ int readheaders(int sock,
     if (msgblk.headers)
        free(msgblk.headers);
     free_str_list(&msgblk.recipients);
+    if (delivered_to)
+       free(delivered_to);
 
     /* initially, no message ID */
     if (ctl->thisid)
@@ -955,6 +958,7 @@ int readheaders(int sock,
    {
            find_server_names(delivered_to, ctl, &msgblk.recipients);
        free(delivered_to);
+       delivered_to = NULL;
    }
        else if (received_for)
            /*