~ubuntu-branches/ubuntu/lucid/bogofilter/lucid-updates

« back to all changes in this revision

Viewing changes to src/mime.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-05-06 05:41:52 UTC
  • mfrom: (1.1.11 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090506054152-tgameecssbuv4np6
Tags: 1.2.0-2ubuntu1
* Merge from debian unstable, remaining changes: LP: #372497
  - don't build qdbm.
  - Don't build tokyocabinet support as it's in universe.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: mime.c 6640 2007-01-27 13:29:24Z m-a $ */
 
1
/* $Id: mime.c 6766 2009-01-12 04:27:36Z relson $ */
2
2
 
3
3
/**
4
4
 * \file mime.c - lexer MIME processing
288
288
        boundary_t * b /*@out@*/ /**< output properties, must be pre-allocated by caller */)
289
289
{
290
290
    mime_t *ptr;
291
 
    const byte *buf = boundary->text;
 
291
    const byte *buf = boundary->u.text;
292
292
    size_t blen = boundary->leng;
293
293
 
294
294
    b->is_valid = false;
350
350
    if (DEBUG_MIME(0))
351
351
        fprintf(dbgout,
352
352
                "*** got_mime_boundary:  stackp: %d, boundary: '%s'\n",
353
 
                mime_stack_top->depth, boundary->text);
 
353
                mime_stack_top->depth, boundary->u.text);
354
354
 
355
355
    if (msg_state != NULL)
356
356
    {
420
420
 
421
421
void mime_content(word_t * text)
422
422
{
423
 
    char *key = (char *) text->text;
 
423
    char *key = (char *) text->u.text;
424
424
    switch (tolower(key[9])) {
425
425
    case 'r':                   /*  Content-Transfer-Encoding: */
426
426
        mime_encoding(text);
438
438
{
439
439
    size_t i;
440
440
    const size_t l = sizeof("Content-Disposition:") - 1;
441
 
    byte *w = getword(text->text + l, text->text + text->leng);
 
441
    byte *w = getword(text->u.text + l, text->u.text + text->leng);
442
442
 
443
443
    if (!w)
444
444
        return;
449
449
        if (strcasecmp((const char *)w, dis->name) == 0) {
450
450
            msg_state->mime_disposition = dis->disposition;
451
451
            if (DEBUG_MIME(1))
452
 
                fprintf(dbgout, "*** mime_disposition: %s\n", text->text);
 
452
                fprintf(dbgout, "*** mime_disposition: %s\n", text->u.text);
453
453
            break;
454
454
        }
455
455
    }
479
479
{
480
480
    size_t i;
481
481
    const size_t l =  sizeof("Content-Transfer-Encoding:") - 1;
482
 
    byte *w = getword(text->text + l, text->text + text->leng);
 
482
    byte *w = getword(text->u.text + l, text->u.text + text->leng);
483
483
 
484
484
    if (!w)
485
485
        return;
490
490
        if (strcasecmp((const char *)w, enc->name) == 0) {
491
491
            msg_state->mime_encoding = enc->encoding;
492
492
            if (DEBUG_MIME(1))
493
 
                fprintf(dbgout, "*** mime_encoding: %s\n", text->text);
 
493
                fprintf(dbgout, "*** mime_encoding: %s\n", text->u.text);
494
494
            break;
495
495
        }
496
496
    }
508
508
{
509
509
    const struct type_s *typ;
510
510
    const size_t l = sizeof("Content-Type:") - 1;
511
 
    byte *w = getword(text->text + l, text->text + text->leng);
 
511
    byte *w = getword(text->u.text + l, text->u.text + text->leng);
512
512
 
513
513
    if (!w)
514
514
        return;
519
519
        if (strncasecmp((const char *)w, typ->name, strlen(typ->name)) == 0) {
520
520
            msg_state->mime_type = typ->type;
521
521
            if (DEBUG_MIME(1) || DEBUG_LEXER(1))
522
 
                fprintf(dbgout, "*** mime_type: %s\n", text->text);
 
522
                fprintf(dbgout, "*** mime_type: %s\n", text->u.text);
523
523
            break;
524
524
        }
525
525
    }
545
545
 
546
546
void mime_boundary_set(word_t * text)
547
547
{
548
 
    byte *boundary = text->text;
 
548
    byte *boundary = text->u.text;
549
549
    size_t blen = text->leng;
550
550
 
551
551
    if (DEBUG_MIME(1)) {
582
582
    if (DEBUG_MIME(3))
583
583
        fprintf(dbgout, "*** mime_decode %lu \"%-.*s\"\n",
584
584
                (unsigned long) count,
585
 
                count > INT_MAX ? INT_MAX : (int) (count - 1), text->text);
 
585
                count > INT_MAX ? INT_MAX : (int) (count - 1), text->u.text);
586
586
 
587
587
    /* Do not decode "real" boundary lines */
588
588
    if (mime_is_boundary(text) == true)