nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated


From: Ken Hornstein
Subject: [Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 7d2c0f47e69415ffb3425f46f0fd78a984e119e2
Date: Tue, 28 Feb 2012 03:09:03 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".

The branch, master has been updated
       via  7d2c0f47e69415ffb3425f46f0fd78a984e119e2 (commit)
      from  314cc2b7c5640f2685a119a90bb92f1e41e6c618 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=7d2c0f47e69415ffb3425f46f0fd78a984e119e2


commit 7d2c0f47e69415ffb3425f46f0fd78a984e119e2
Author: Ken Hornstein <address@hidden>
Date:   Mon Feb 27 22:05:41 2012 -0500

    Fix bug #1466.  It turns out that RFC 934 specifies that any line starting
    with a "-" but NOT followed by a space is a valid message delimiter.  We
    only supported one type of message delimiter.  Adapt the code so any
    valid delimiter is supported.

diff --git a/uip/burst.c b/uip/burst.c
index 89aeac2..2c741c7 100644
--- a/uip/burst.c
+++ b/uip/burst.c
@@ -29,8 +29,6 @@ static struct swit switches[] = {
     { NULL, 0 }
 };
 
-static char delim3[] = "-------";
-
 struct smsg {
     long s_start;
     long s_stop;
@@ -43,6 +41,16 @@ static int find_delim (int, struct smsg *);
 static void burst (struct msgs **, int, struct smsg *, int, int, int, char *);
 static void cpybrst (FILE *, FILE *, char *, char *, int);
 
+/*
+ * A macro to check to see if we have reached a message delimiter
+ * (an encapsulation boundary, EB, in RFC 934 parlance).
+ *
+ * According to RFC 934, an EB is simply a line which starts with
+ * a "-" and is NOT followed by a space.  So even a single "-" on a line
+ * by itself would be an EB.
+ */
+
+#define CHECKDELIM(buffer) (buffer[0] == '-' && buffer[1] != ' ')
 
 int
 main (int argc, char **argv)
@@ -200,15 +208,13 @@ main (int argc, char **argv)
 static int
 find_delim (int msgnum, struct smsg *smsgs)
 {
-    int ld3, wasdlm, msgp;
+    int wasdlm, msgp;
     long pos;
     char c, *msgnam;
     int cc;
     char buffer[BUFSIZ];
     FILE *in;
 
-    ld3 = strlen (delim3);
-
     if ((in = fopen (msgnam = m_name (msgnum), "r")) == NULL)
        adios (msgnam, "unable to read message");
 
@@ -221,7 +227,7 @@ find_delim (int msgnum, struct smsg *smsgs)
        smsgs[msgp].s_start = pos;
 
        for (c = 0; fgets (buffer, sizeof(buffer), in); c = buffer[0]) {
-           if (strncmp (buffer, delim3, ld3) == 0
+           if (CHECKDELIM(buffer)
                    && (msgp == 1 || c == '\n')
                    && ((cc = peekc (in)) == '\n' || cc == EOF))
                break;
@@ -229,7 +235,7 @@ find_delim (int msgnum, struct smsg *smsgs)
                pos += (long) strlen (buffer);
        }
 
-       wasdlm = strncmp (buffer, delim3, ld3) == 0;
+       wasdlm = CHECKDELIM(buffer);
        if (smsgs[msgp].s_start != pos)
            smsgs[msgp++].s_stop = (c == '\n' && wasdlm) ? pos - 1 : pos;
        if (feof (in)) {

-----------------------------------------------------------------------

Summary of changes:
 uip/burst.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
The nmh Mail Handling System



reply via email to

[Prev in Thread] Current Thread [Next in Thread]