OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/msg.c versions 1.3 and 1.4
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/lmtp2nntp/msg.c 1.3 -> 1.4

--- msg.c        2001/08/14 08:15:25     1.3
+++ msg.c        2001/08/14 14:42:41     1.4
@@ -12,6 +12,8 @@
     if ((msg = (msg_t *)malloc(sizeof(msg_t))) == NULL)
         return NULL;
 
+    msg->azEnvgroups = NULL;
+    msg->asEnvgroups = 0;
     msg->cpMsg = NULL;
     msg->azHeaders = NULL;
     msg->asHeaders = 0;
@@ -31,6 +33,8 @@
     if (msg == NULL)
         return;
                                              //FIXME what about non-graceful aborts?
+    if (msg->azEnvgroups != NULL)
+        free(msg->azEnvgroups);
     if (msg->cpMsg != NULL)
         free(msg->cpMsg);
     if (msg->azHeaders != NULL)
@@ -69,10 +73,10 @@
      *
      * msg->azHeaders, msg->asHeaders contains the headers in argz format, one
      * logical '\0'-terminated line per header which might be wrapped into
-     * multiple '\n'-ended physical lines. The "From " envelope, "To:" and
-     * "Cc:" headers are removed silently. The "Newsgroups:" and "Message-ID"
-     * headers are removed and their values are stored in separate structures
-     * (see below).
+     * multiple '\n'-ended physical lines. The "From " envelope, "Received:",
+     * "To:" and "Cc:" headers are removed silently. The "Newsgroups:" and
+     * "Message-ID" headers are removed and their values are stored in
+     * separate structures (see below).
      *
      * msg->cpBody
      * contains the unmodified body of the message, '\0'-terminated, no
@@ -93,13 +97,10 @@
     /* replace envelope From w/o colon by X-F: pseudotag. This eliminates the
      * special case of having one header, which is really an embedded
      * envelope, not ending with a colon while all others do. After splitting
-     * headers into name and value pairs this action is reversed.
+     * headers into name and value pairs this envelope ist stripped off.
      */
-    if (strlen(cpHeaders) < 4)
-        return MSG_ERR_SPLITLEN;
-    if (strncasecmp(cpHeaders, "From", 4) != 0)
-        return MSG_ERR_SPLITMISSINGFROM;
-    memcpy(cpHeaders, "X-F:", 4);
+    if (strncasecmp(cpHeaders, "From", 4) == 0)
+        memcpy(cpHeaders, "X-F:", 4);
 
     /* unwrap header lines */
     //FIXME poor man's s///g simulator as current str library doesn't support //global substitution
@@ -120,16 +121,18 @@
         argz_add(&msg->azHeaders, &msg->asHeaders, cpValue);
     }
 
-    /* reverse the 'From ' to 'X-F: ' replacement */
-    memcpy(msg->azHeaders, "From", 4); /* replace envelope X-F: pseudotag with From w/o colon */
-
     /* check for headers we care about and do whatever neccessary */
     msg->cpMsgid = NULL;
     msg->azNewsgroups = NULL;
     msg->asNewsgroups = 0;
     cp = msg->azHeaders;
     while (cp != NULL) {
-        if (strcasecmp("From", cp) == 0) {
+        if (strcasecmp("X-F:", cp) == 0) {
+            argz_delete(&msg->azHeaders, &msg->asHeaders, cp);             /* del  name  */
+            argz_delete(&msg->azHeaders, &msg->asHeaders, cp);             /* del  value */
+            continue;
+        }
+        if (strcasecmp("Received:", cp) == 0) {
             argz_delete(&msg->azHeaders, &msg->asHeaders, cp);             /* del  name  */
             argz_delete(&msg->azHeaders, &msg->asHeaders, cp);             /* del  value */
             continue;
@@ -350,7 +353,7 @@
     return MSG_OK;
 }
 
-char *msg_error(msg_t *msg, msg_rc_t rc)
+char *msg_error(msg_rc_t rc)
 {
     char *str;
                                               str = "MSG: no description";

CVSTrac 2.0.1