git-svn: trunk@1967
Nigel Horne authored on 2006/05/13 02:12:46... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | 17 |
* MA 02110-1301, USA. |
18 | 18 |
*/ |
19 |
-static char const rcsid[] = "$Id: message.c,v 1.167 2006/05/03 15:41:44 nigelhorne Exp $"; |
|
19 |
+static char const rcsid[] = "$Id: message.c,v 1.168 2006/05/12 17:12:46 nigelhorne Exp $"; |
|
20 | 20 |
|
21 | 21 |
#if HAVE_CONFIG_H |
22 | 22 |
#include "clamav-config.h" |
... | ... |
@@ -402,6 +402,8 @@ messageAddArgument(message *m, const char *arg) |
402 | 402 |
/* Empty argument? Probably a broken mail client... */ |
403 | 403 |
return; |
404 | 404 |
|
405 |
+ cli_dbgmsg("messageAddArgument, arg='%s'\n", arg); |
|
406 |
+ |
|
405 | 407 |
if(!usefulArg(arg)) |
406 | 408 |
return; |
407 | 409 |
|
... | ... |
@@ -2310,9 +2312,24 @@ rfc2231(const char *in) |
2310 | 2310 |
{ |
2311 | 2311 |
const char *ptr; |
2312 | 2312 |
char *ret, *out; |
2313 |
- enum { LANGUAGE, CHARSET, CONTENTS } field = LANGUAGE; |
|
2313 |
+ enum { LANGUAGE, CHARSET, CONTENTS } field; |
|
2314 | 2314 |
|
2315 |
- ptr = strstr(in, "*="); |
|
2315 |
+ if(strstr(in, "*0*=") != NULL) { |
|
2316 |
+ cli_warnmsg("RFC2231 parameter continuations are not yet handled\n"); |
|
2317 |
+ return strdup(in); |
|
2318 |
+ } |
|
2319 |
+ |
|
2320 |
+ ptr = strstr(in, "*0="); |
|
2321 |
+ if(ptr != NULL) |
|
2322 |
+ /* |
|
2323 |
+ * Parameter continuation, with no continuation |
|
2324 |
+ * Thunderbird 1.5 (and possibly other versions) does this |
|
2325 |
+ */ |
|
2326 |
+ field = CONTENTS; |
|
2327 |
+ else { |
|
2328 |
+ ptr = strstr(in, "*="); |
|
2329 |
+ field = LANGUAGE; |
|
2330 |
+ } |
|
2316 | 2331 |
|
2317 | 2332 |
if(ptr == NULL) /* quick return */ |
2318 | 2333 |
return strdup(in); |
... | ... |
@@ -2324,46 +2341,54 @@ rfc2231(const char *in) |
2324 | 2324 |
if(ret == NULL) |
2325 | 2325 |
return NULL; |
2326 | 2326 |
|
2327 |
+ /* |
|
2328 |
+ * memcpy(out, in, (ptr - in)); |
|
2329 |
+ * out = &out[ptr - in]; |
|
2330 |
+ * in = ptr; |
|
2331 |
+ */ |
|
2327 | 2332 |
for(out = ret; in != ptr; in++) |
2328 | 2333 |
*out++ = *in; |
2329 | 2334 |
|
2330 | 2335 |
*out++ = '='; |
2331 | 2336 |
|
2337 |
+ while(*ptr++ != '=') |
|
2338 |
+ ; |
|
2339 |
+ |
|
2332 | 2340 |
/* |
2333 | 2341 |
* We don't do anything with the language and character set, just skip |
2334 | 2342 |
* over them! |
2335 | 2343 |
*/ |
2336 |
- while(*in) { |
|
2344 |
+ while(*ptr) { |
|
2337 | 2345 |
switch(field) { |
2338 | 2346 |
case LANGUAGE: |
2339 |
- if(*in == '\'') |
|
2347 |
+ if(*ptr == '\'') |
|
2340 | 2348 |
field = CHARSET; |
2341 | 2349 |
break; |
2342 | 2350 |
case CHARSET: |
2343 |
- if(*in == '\'') |
|
2351 |
+ if(*ptr == '\'') |
|
2344 | 2352 |
field = CONTENTS; |
2345 | 2353 |
break; |
2346 | 2354 |
case CONTENTS: |
2347 |
- if(*in == '%') { |
|
2355 |
+ if(*ptr == '%') { |
|
2348 | 2356 |
unsigned char byte; |
2349 | 2357 |
|
2350 |
- if((*++in == '\0') || (*in == '\n')) |
|
2358 |
+ if((*++ptr == '\0') || (*ptr == '\n')) |
|
2351 | 2359 |
break; |
2352 | 2360 |
|
2353 |
- byte = hex(*in); |
|
2361 |
+ byte = hex(*ptr); |
|
2354 | 2362 |
|
2355 |
- if((*++in == '\0') || (*in == '\n')) { |
|
2363 |
+ if((*++ptr == '\0') || (*ptr == '\n')) { |
|
2356 | 2364 |
*out++ = byte; |
2357 | 2365 |
break; |
2358 | 2366 |
} |
2359 | 2367 |
|
2360 | 2368 |
byte <<= 4; |
2361 |
- byte += hex(*in); |
|
2369 |
+ byte += hex(*ptr); |
|
2362 | 2370 |
*out++ = byte; |
2363 | 2371 |
} else |
2364 |
- *out++ = *in; |
|
2372 |
+ *out++ = *ptr; |
|
2365 | 2373 |
} |
2366 |
- if(*in++ == '\0') |
|
2374 |
+ if(*ptr++ == '\0') |
|
2367 | 2375 |
/* |
2368 | 2376 |
* Incorrect message that has just one character after |
2369 | 2377 |
* a '%'. |