Withdraw A6 DNS record support
[exim.git] / src / src / mime.c
index a61e9f22f15844623fd5d81ab199feab987c4ed2..51f00d368f255e589284cee581e7f232887d107b 100644 (file)
@@ -283,10 +283,10 @@ return f;
 
 
 int
-mime_decode(uschar **listptr)
+mime_decode(const uschar **listptr)
 {
 int sep = 0;
-uschar *list = *listptr;
+const uschar *list = *listptr;
 uschar *option;
 uschar option_buffer[1024];
 uschar decode_path[1024];
@@ -589,6 +589,7 @@ DECODE_HEADERS:
 NEXT_PARAM_SEARCH:
        while (*p)
          {
+         /* debug_printf("  considering paramlist '%s'\n", p); */
          mime_parameter * mp;
          for (mp = mime_parameter_list;
               mp < &mime_parameter_list[mime_parameter_list_size];
@@ -599,57 +600,49 @@ NEXT_PARAM_SEARCH:
            /* found an interesting parameter? */
            if (strncmpic(mp->name, p, mp->namelen) == 0)
              {
-             uschar * q = p + mp->namelen;
-             int plen = 0;
              int size = 0;
              int ptr = 0;
 
              /* yes, grab the value and copy to its corresponding expansion variable */
-             while(*q && *q != ';')            /* ; terminates */
-               if (*q == '"')
+             p += mp->namelen;
+             while(*p && *p != ';')            /* ; terminates */
+               if (*p == '"')
                  {
-                 q++;                          /* skip leading " */
-                 plen++;                       /* and account for the skip */
-                 while(*q && *q != '"')        /* " protects ; */
-                   {
-                   param_value = string_cat(param_value, &size, &ptr, q++, 1);
-                   plen++;
-                   }
-                 if (*q)
-                   {
-                   q++;                        /* skip trailing " */
-                   plen++;
-                   }
+                 p++;                          /* skip leading " */
+                 while(*p && *p != '"')        /* " protects ; */
+                   param_value = string_cat(param_value, &size, &ptr, p++, 1);
+                 if (*p) p++;                  /* skip trailing " */
                  }
                else
-                 {
-                 param_value = string_cat(param_value, &size, &ptr, q++, 1);
-                 plen++;
-                 }
+                 param_value = string_cat(param_value, &size, &ptr, p++, 1);
+             if (*p) p++;                      /* skip trailing ; */
 
              if (param_value)
                {
+               uschar * dummy;
                param_value[ptr++] = '\0';
 
                param_value = rfc2047_decode(param_value,
-                     check_rfc2047_length, NULL, 32, NULL, &q);
-               debug_printf("Found %s MIME parameter in %s header, "
+                     check_rfc2047_length, NULL, 32, NULL, &dummy);
+               debug_printf(" Found %s MIME parameter in %s header, "
                      "value is '%s'\n", mp->name, mime_header_list[i].name,
                      param_value);
                }
              *mp->value = param_value;
-             p += mp->namelen + plen + 1;      /* name=, content, ; */
              goto NEXT_PARAM_SEARCH;
            }
          }
-         /* There is something, but not one of our interesting parameters.
-            Advance to the next semicolon */
-         while(*p != ';')
+       /* There is something, but not one of our interesting parameters.
+          Advance to the next unquoted semicolon */
+       while(*p && *p != ';')
+         if (*p == '"')
            {
-           if (*p == '"') while(*++p && *p != '"') ;
-           p++;
+           while(*++p && *p != '"') ;
+           if (*p) p++;
            }
-         p++;
+         else
+           p++;
+       if (*p) p++;
        }
       }
   }
@@ -703,7 +696,7 @@ NEXT_PARAM_SEARCH:
   else if ( (mime_content_type != NULL) &&
          (Ustrncmp(mime_content_type,"message/rfc822",14) == 0) )
     {
-    uschar *rfc822name = NULL;
+    const uschar *rfc822name = NULL;
     uschar filename[2048];
     int file_nr = 0;
     int result = 0;