View | Details | Raw Unified | Return to bug 142490
Collapse All | Expand All

(-)bogofilter-0.96.2/src/bogoconfig.c (-3 / +5 lines)
Lines 1-4 Link Here
1
/* $Id: bogoconfig.c,v 1.230 2005/06/29 10:05:22 m-a Exp $ */
1
/* $Id: bogoconfig.c,v 1.232 2005/10/15 20:52:51 relson Exp $ */
2
2
3
/*****************************************************************************
3
/*****************************************************************************
4
4
Lines 47-53 Link Here
47
#include "bogoreader.h"
47
#include "bogoreader.h"
48
#include "bool.h"
48
#include "bool.h"
49
#include "charset.h"
49
#include "charset.h"
50
#include "configfile.h"
51
#include "datastore.h"
50
#include "datastore.h"
52
#include "datastore_db.h"
51
#include "datastore_db.h"
53
#include "error.h"
52
#include "error.h"
Lines 715-721 Link Here
715
#ifndef	DISABLE_TRANSACTIONS
714
#ifndef	DISABLE_TRANSACTIONS
716
	if (!dsm_options_bogofilter(option, name, val))
715
	if (!dsm_options_bogofilter(option, name, val))
717
#endif
716
#endif
718
	    abort();
717
	{
718
	    fprintf(stderr, "Invalid option '%s'.\n", name);
719
	    exit(EX_ERROR);
720
	}
719
    }
721
    }
720
}
722
}
721
723
(-)bogofilter-0.96.2/src/bogoconfig.h (-2 / +1 lines)
Lines 1-4 Link Here
1
/* $Id: bogoconfig.h,v 1.22 2005/01/06 14:46:24 m-a Exp $ */
1
/* $Id: bogoconfig.h,v 1.23 2005/10/15 20:52:51 relson Exp $ */
2
2
3
/*****************************************************************************
3
/*****************************************************************************
4
4
Lines 14-20 Link Here
14
#define BOGOCONFIG_H
14
#define BOGOCONFIG_H
15
15
16
#include "configfile.h"
16
#include "configfile.h"
17
#include "getopt.h"		/* for struct option */
18
17
19
/* Global variables */
18
/* Global variables */
20
19
(-)bogofilter-0.96.2/src/collect.c (-26 / +1 lines)
Lines 1-4 Link Here
1
/* $Id: collect.c,v 1.45 2005/03/13 16:38:13 relson Exp $ */
1
/* $Id: collect.c,v 1.46 2005/10/26 00:27:43 relson Exp $ */
2
2
3
/* collect.c -- tokenize input and cap word frequencies, return a wordhash */
3
/* collect.c -- tokenize input and cap word frequencies, return a wordhash */
4
4
Lines 14-21 Link Here
14
14
15
#include "collect.h"
15
#include "collect.h"
16
16
17
void mime_type2(word_t * text);
18
19
void wordprop_init(void *vwordprop)
17
void wordprop_init(void *vwordprop)
20
{
18
{
21
    wordprop_t *wp = vwordprop;
19
    wordprop_t *wp = vwordprop;
Lines 88-116 Link Here
88
	}
86
	}
89
#endif
87
#endif
90
88
91
#ifdef	CP866_XXX
92
/* breaks "make check", specifically t.grftest and t.bulkmode -- DR 01/02/05 */
93
/* EK binary problem hack */
94
	if (token->leng > 8)
95
	{ 
96
	    char str[80];
97
	    static int binflag=0;
98
	    int l;
99
	    l = token->leng;
100
	    if (l > 40) l = 40;
101
	    strncpy(str,token->text,l);
102
	    str[l] = 0;
103
	    if (!strncasecmp(str, "Content-Type", 12))
104
	    {  
105
		binflag++;
106
	    } else if (binflag == 1) {
107
		mime_type2(token);
108
		binflag++;
109
	    } else
110
		binflag = 0;
111
	}
112
#endif
113
114
/******* end of EK addition **********/
89
/******* end of EK addition **********/
115
90
116
	if (DEBUG_WORDLIST(3)) {
91
	if (DEBUG_WORDLIST(3)) {
(-)bogofilter-0.96.2/src/configfile.c (-7 / +12 lines)
Lines 1-4 Link Here
1
/* $Id: configfile.c,v 1.51 2005/03/29 03:04:39 relson Exp $ */
1
/* $Id: configfile.c,v 1.52 2005/10/15 21:03:11 relson Exp $ */
2
2
3
/*****************************************************************************
3
/*****************************************************************************
4
4
Lines 80-103 Link Here
80
    bool ok = true;
80
    bool ok = true;
81
81
82
    char *val = NULL;
82
    char *val = NULL;
83
    char *opt = xstrdup(arg);
83
    const char *opt = arg;
84
    char *dup;
84
    const char delim[] = " \t=";
85
    const char delim[] = " \t=";
85
86
86
    pos = strcspn(arg, delim);
87
    while (isspace(*opt))		/* ignore leadign whitespace */
87
    if (pos < strlen(arg)) { 		/* if delimiter present */
88
	opt += 1;
88
	val = opt + pos;
89
90
    dup = xstrdup(opt);
91
    pos = strcspn(dup, delim);
92
    if (pos < strlen(dup)) { 		/* if delimiter present */
93
	val = dup + pos;
89
	*val++ = '\0';
94
	*val++ = '\0';
90
	val += strspn(val, delim);
95
	val += strspn(val, delim);
91
    }
96
    }
92
97
93
    if (val == NULL ||
98
    if (val == NULL ||
94
	!process_config_option_as_arg(opt, val, precedence, longopts)) {
99
	!process_config_option_as_arg(dup, val, precedence, longopts)) {
95
	ok = false;
100
	ok = false;
96
	if (warn_on_error)
101
	if (warn_on_error)
97
	    fprintf(stderr, "Error - bad parameter '%s'\n", arg);
102
	    fprintf(stderr, "Error - bad parameter '%s'\n", arg);
98
    }
103
    }
99
104
100
    xfree(opt);
105
    xfree(dup);
101
    return ok;
106
    return ok;
102
}
107
}
103
108
(-)bogofilter-0.96.2/src/iconvert.c (-6 / +8 lines)
Lines 1-4 Link Here
1
/* $Id: iconvert.c,v 1.12 2005/06/25 23:23:35 relson Exp $ */
1
/* $Id: iconvert.c,v 1.15 2005/10/23 15:09:52 relson Exp $ */
2
2
3
/*****************************************************************************
3
/*****************************************************************************
4
4
Lines 53-60 Link Here
53
	    break;
53
	    break;
54
	}
54
	}
55
	if (msg != NULL)
55
	if (msg != NULL)
56
	    fprintf(dbgout, "e: %d, %s - t: %p, r: %d, l: %d, s: %d\n", 
56
	    fprintf(dbgout, "err: %s (%d), tx: %p, rd: %d, ln: %d, sz: %d\n",
57
		    err, msg, src->t.text, src->read, src->t.leng, src->size);
57
		    msg, err, src->t.text, src->read, src->t.leng, src->size);
58
    }
58
    }
59
}
59
}
60
60
Lines 151-159 Link Here
151
		break;
151
		break;
152
152
153
	    case E2BIG:			/* output buffer has no more room */
153
	    case E2BIG:			/* output buffer has no more room */
154
					/* TODO:  Provide proper handling of E2BIG */
154
		done = true;
155
		done = true;
155
		if (DEBUG_ICONV(1))	/* TODO:  Provide proper handling of E2BIG */
156
		    fprintf(dbgout, "E2BIG\n");
157
		break;
156
		break;
158
157
159
	    default:
158
	    default:
Lines 165-177 Link Here
165
164
166
	if (src->read >= src->t.leng)
165
	if (src->read >= src->t.leng)
167
	    done = true;
166
	    done = true;
167
168
	if (outbytesleft == 0)
169
	    done = true;
168
    }
170
    }
169
171
170
    Z(dst->t.text[dst->t.leng]);	/* for easier debugging - removable */
172
    Z(dst->t.text[dst->t.leng]);	/* for easier debugging - removable */
171
173
172
    if (DEBUG_ICONV(1) &&
174
    if (DEBUG_ICONV(1) &&
173
	src->t.leng != src->read)
175
	src->t.leng != src->read)
174
	fprintf(dbgout, "t: %p, r: %d, l: %d, s: %d\n", 
176
	fprintf(dbgout, "tx: %p, rd: %d, ln: %d, sz: %d\n",
175
		src->t.text, src->read, src->t.leng, src->size);
177
		src->t.text, src->read, src->t.leng, src->size);
176
}
178
}
177
179
(-)bogofilter-0.96.2/src/lexer.c (-7 / +16 lines)
Lines 1-4 Link Here
1
/* $Id: lexer.c,v 1.141 2005/09/08 02:53:40 relson Exp $ */
1
/* $Id: lexer.c,v 1.143 2005/10/23 15:15:55 relson Exp $ */
2
2
3
/**
3
/**
4
 * \file lexer.c
4
 * \file lexer.c
Lines 90-95 Link Here
90
    uint i;
90
    uint i;
91
    for (i=0; i < count; i += 1) {
91
    for (i=0; i < count; i += 1) {
92
	byte c = buf[i];
92
	byte c = buf[i];
93
	/* 10/23/05 - fix SIGSEGV with msg.1023.6479.txt
94
	** evidently caused by 09/07/05 patch for 0.96.2
95
	*/
96
	if (c == '\0')
97
	    break;
93
	if ((iscntrl(c) || isspace(c) || ispunct(c)) && (c != '_'))
98
	if ((iscntrl(c) || isspace(c) || ispunct(c)) && (c != '_'))
94
	    return false;
99
	    return false;
95
    }
100
    }
Lines 151-157 Link Here
151
    uint used = buff->t.leng;
156
    uint used = buff->t.leng;
152
    byte *buf = buff->t.text + used;
157
    byte *buf = buff->t.text + used;
153
158
154
    if (encoding == E_RAW) {
159
    if (encoding == E_RAW ||
160
	msg_state->mime_dont_decode ) {
155
	temp = buff;
161
	temp = buff;
156
    }
162
    }
157
#ifndef	DISABLE_UNICODE
163
#ifndef	DISABLE_UNICODE
Lines 191-197 Link Here
191
    if (passthrough && passmode == PASS_MEM && count > 0)
197
    if (passthrough && passmode == PASS_MEM && count > 0)
192
	textblock_add(temp->t.text+temp->read, (size_t) count);
198
	textblock_add(temp->t.text+temp->read, (size_t) count);
193
199
194
    if ( !msg_header && msg_state->mime_type != MIME_TYPE_UNKNOWN)
200
    if ( !msg_header && 
201
	 !msg_state->mime_dont_decode &&
202
	 msg_state->mime_type != MIME_TYPE_UNKNOWN)
195
    {
203
    {
196
	word_t line;
204
	word_t line;
197
	uint decoded_count;
205
	uint decoded_count;
Lines 210-216 Link Here
210
    }
218
    }
211
219
212
#ifndef	DISABLE_UNICODE
220
#ifndef	DISABLE_UNICODE
213
    if (encoding == E_UNICODE) {
221
    if (encoding == E_UNICODE &&
222
	!msg_state->mime_dont_decode)
223
    {
214
	iconvert(temp, buff);
224
	iconvert(temp, buff);
215
	/*
225
	/*
216
	 * iconvert, treating multi-byte sequences, can shrink or enlarge
226
	 * iconvert, treating multi-byte sequences, can shrink or enlarge
Lines 329-337 Link Here
329
    }
339
    }
330
340
331
    if (msg_state &&
341
    if (msg_state &&
332
	msg_state->mime_disposition &&
342
	msg_state->mime_dont_decode &&
333
	(msg_state->mime_type == MIME_APPLICATION ||  
343
	(msg_state->mime_disposition != MIME_DISPOSITION_UNKNOWN)) {
334
	 msg_state->mime_type == MIME_IMAGE)) {
335
	return (count == EOF ? 0 : count);   /* not decode at all */
344
	return (count == EOF ? 0 : count);   /* not decode at all */
336
    }
345
    }
337
346
(-)bogofilter-0.96.2/src/longoptions.h (-5 / +1 lines)
Lines 1-4 Link Here
1
/* $Id: longoptions.h,v 1.18 2005/06/18 16:36:09 relson Exp $ */
1
/* $Id: longoptions.h,v 1.19 2005/10/15 21:02:44 relson Exp $ */
2
2
3
/*****************************************************************************
3
/*****************************************************************************
4
4
Lines 28-35 Link Here
28
    O_BLOCK_ON_SUBNETS = 1000,
28
    O_BLOCK_ON_SUBNETS = 1000,
29
    O_CHARSET_DEFAULT,
29
    O_CHARSET_DEFAULT,
30
    O_CONFIG_FILE,
30
    O_CONFIG_FILE,
31
    O_DB_MAX_OBJECTS,
32
    O_DB_MAX_LOCKS,
33
    O_DB_CHECKPOINT,
31
    O_DB_CHECKPOINT,
34
    O_DB_LIST_LOGFILES,
32
    O_DB_LIST_LOGFILES,
35
    O_DB_PRINT_LEAFPAGE_COUNT,
33
    O_DB_PRINT_LEAFPAGE_COUNT,
Lines 102-109 Link Here
102
#ifdef	HAVE_DECL_DB_CREATE
100
#ifdef	HAVE_DECL_DB_CREATE
103
 #undef lo1
101
 #undef lo1
104
 #define lo1 \
102
 #define lo1 \
105
    { "db-lk-max-locks",		R, 0, O_DB_MAX_LOCKS }, \
106
    { "db-lk-max-objects",		R, 0, O_DB_MAX_OBJECTS }, \
107
    { "db-log-autoremove",		R, 0, O_DB_LOG_AUTOREMOVE },
103
    { "db-log-autoremove",		R, 0, O_DB_LOG_AUTOREMOVE },
108
 #ifdef	FUTURE_DB_OPTIONS
104
 #ifdef	FUTURE_DB_OPTIONS
109
  #undef lo2
105
  #undef lo2
(-)bogofilter-0.96.2/src/mime.c (-113 / +64 lines)
Lines 1-4 Link Here
1
/* $Id: mime.c,v 1.47 2005/09/06 02:04:23 relson Exp $ */
1
/* $Id: mime.c,v 1.55 2005/10/26 00:27:43 relson Exp $ */
2
2
3
/**
3
/**
4
 * \file mime.c
4
 * \file mime.c
Lines 42-54 Link Here
42
    const char *name;	/**< prefix of MIME type to match */
42
    const char *name;	/**< prefix of MIME type to match */
43
    size_t len;		/**< length of \a name */
43
    size_t len;		/**< length of \a name */
44
} mime_type_table[] = {
44
} mime_type_table[] = {
45
    { MIME_TEXT_HTML, "text/html", 9 },
45
    { MIME_TEXT_HTML,	 "text/html",	  9 },
46
    { MIME_TEXT_PLAIN, "text/plain", 10 },
46
    { MIME_TEXT_PLAIN,	 "text/plain",	 10 },
47
    { MIME_TEXT, "text", 4 },	/* NON-COMPLIANT; should be "text/" */
47
    { MIME_TEXT,	 "text",	  4 },	/* NON-COMPLIANT; should be "text/" */
48
    { MIME_APPLICATION, "application/", 12 },
48
    { MIME_APPLICATION,	 "application/", 12 },
49
    { MIME_IMAGE, "image/", 6 },
49
    { MIME_MESSAGE,	 "message/",	  8 },
50
    { MIME_MESSAGE, "message/", 8 },
50
    { MIME_MULTIPART,	 "multipart/",	 10 },
51
    { MIME_MULTIPART, "multipart/", 10 },
51
    { MIME_IMAGE,	 "image/bmp",	  9 },
52
    { MIME_AUDIO,	 "audio/",	  6 },
53
    { MIME_VIDEO,	 "video/",	  6 },
52
};
54
};
53
55
54
/** MIME encodings that we detect. */
56
/** MIME encodings that we detect. */
Lines 56-67 Link Here
56
    enum mimeencoding encoding;	/**< internal representation of encoding */
58
    enum mimeencoding encoding;	/**< internal representation of encoding */
57
    const char *name;		/**< encoding name to match */
59
    const char *name;		/**< encoding name to match */
58
} mime_encoding_table[] = {
60
} mime_encoding_table[] = {
59
    { MIME_7BIT, "7BIT" },
61
    { MIME_7BIT,	"7BIT" },
60
    { MIME_8BIT, "8BIT" },
62
    { MIME_8BIT,	"8BIT" },
61
    { MIME_BINARY, "BINARY" },
63
    { MIME_BINARY,	"BINARY" },
62
    { MIME_QP, "QUOTED-PRINTABLE" },
64
    { MIME_QP,		"QUOTED-PRINTABLE" },
63
    { MIME_BASE64, "BASE64" },
65
    { MIME_BASE64,	"BASE64" },
64
    { MIME_UUENCODE, "X-UUENCODE" },
66
    { MIME_UUENCODE,	"X-UUENCODE" },
65
};
67
};
66
68
67
/** MIME content dispositions that we detect. */
69
/** MIME content dispositions that we detect. */
Lines 69-76 Link Here
69
    enum mimedisposition disposition;	/**< internal representation of disposition */
71
    enum mimedisposition disposition;	/**< internal representation of disposition */
70
    const char *name;			/**< disposition name to match */
72
    const char *name;			/**< disposition name to match */
71
} mime_disposition_table[] = {
73
} mime_disposition_table[] = {
72
    { MIME_INLINE, "inline" },
74
    { MIME_INLINE,	"inline" },
73
    { MIME_ATTACHMENT, "attachment" },
75
    { MIME_ATTACHMENT,	"attachment" },
74
};
76
};
75
77
76
/** properties of a MIME boundary */
78
/** properties of a MIME boundary */
Lines 104-147 Link Here
104
}
106
}
105
#endif
107
#endif
106
108
107
static const char *str_mime_type(enum mimetype m) {
109
static const char *str_mime_type(enum mimetype m)
110
{
108
    switch (m) {
111
    switch (m) {
109
	case MIME_TYPE_UNKNOWN:
112
	case MIME_TYPE_UNKNOWN:	return "unknown";
110
	    return "unknown";
113
	case MIME_MULTIPART:	return "multipart/*";
111
	case MIME_MULTIPART:
114
	case MIME_MESSAGE:	return "message/*";
112
	    return "multipart/*";
115
	case MIME_TEXT:		return "text/*";
113
	case MIME_MESSAGE:
116
	case MIME_TEXT_PLAIN:	return "text/plain";
114
	    return "message/*";
117
	case MIME_TEXT_HTML:	return "text/html";
115
	case MIME_TEXT:
118
	case MIME_APPLICATION:	return "application/*";
116
	    return "text/*";
119
	case MIME_IMAGE:	return "image/*";
117
	case MIME_TEXT_PLAIN:
120
	case MIME_AUDIO:	return "audio/*";
118
	    return "text/plain";
121
	case MIME_VIDEO:	return "video/*";
119
	case MIME_TEXT_HTML:
122
}
120
	    return "text/html";
121
	case MIME_APPLICATION:
122
	    return "application/*";
123
	case MIME_IMAGE:
124
	    return "image/*";
125
    }
126
    return "INTERNAL_ERROR";
123
    return "INTERNAL_ERROR";
127
}
124
}
128
125
129
static const char *str_mime_enc(enum mimeencoding e) {
126
static const char *str_mime_enc(enum mimeencoding e)
127
{
130
    switch (e) {
128
    switch (e) {
131
	case MIME_ENCODING_UNKNOWN:
129
	case MIME_ENCODING_UNKNOWN:	return "unknown";
132
	    return "unknown";
130
	case MIME_7BIT:			return "7bit";
133
	case MIME_7BIT:
131
	case MIME_8BIT:			return "8bit";
134
	    return "7bit";
132
	case MIME_BINARY:		return "binary";
135
	case MIME_8BIT:
133
	case MIME_QP:			return "quoted-printable";
136
	    return "8bit";
134
	case MIME_BASE64:		return "base64";
137
	case MIME_BINARY:
135
	case MIME_UUENCODE:		return "x-uuencode";
138
	    return "binary";
139
	case MIME_QP:
140
	    return "quoted-printable";
141
	case MIME_BASE64:
142
	    return "base64";
143
	case MIME_UUENCODE:
144
	    return "x-uuencode";
145
    }
136
    }
146
    return "INTERNAL_ERROR";
137
    return "INTERNAL_ERROR";
147
}
138
}
Lines 155-166 Link Here
155
146
156
    for (ptr = mime_stack_top; ptr != NULL; ptr = ptr->child)
147
    for (ptr = mime_stack_top; ptr != NULL; ptr = ptr->child)
157
    {
148
    {
158
	fprintf(dbgout, "**** %3d type %s enc %s bnd %s chr %s\n",
149
	fprintf(dbgout, "**** %3d type: %-16s enc: %-16s chr: %-8.8s bnd: %s\n",
159
		ptr->depth,
150
		ptr->depth,
160
		str_mime_type(ptr->mime_type),
151
		str_mime_type(ptr->mime_type),
161
		str_mime_enc(ptr->mime_encoding),
152
		str_mime_enc(ptr->mime_encoding),
162
		ptr->boundary ? ptr->boundary : "NIL",
153
		ptr->charset,
163
		ptr->charset);
154
		ptr->boundary ? ptr->boundary : "NIL");
164
    }
155
    }
165
}
156
}
166
#endif
157
#endif
Lines 175-182 Link Here
175
    msg_state->charset = xstrdup("US-ASCII");
166
    msg_state->charset = xstrdup("US-ASCII");
176
    msg_state->depth = (parent == NULL) ? 0 : msg_state->parent->depth + 1;
167
    msg_state->depth = (parent == NULL) ? 0 : msg_state->parent->depth + 1;
177
    msg_state->child  = NULL;
168
    msg_state->child  = NULL;
169
    msg_state->mime_dont_decode = false;
170
178
    if (parent)
171
    if (parent)
179
	parent->child = msg_state;
172
	parent->child = msg_state;
173
180
    return;
174
    return;
181
}
175
}
182
176
Lines 188-193 Link Here
188
    if (mime_stack_bot == t)
182
    if (mime_stack_bot == t)
189
	mime_stack_bot = t->parent;
183
	mime_stack_bot = t->parent;
190
184
185
    if (mime_stack_top == t)
186
	mime_stack_top = NULL;
187
191
    if (t->boundary) {
188
    if (t->boundary) {
192
	xfree(t->boundary);
189
	xfree(t->boundary);
193
	t->boundary = NULL;
190
	t->boundary = NULL;
Lines 221-229 Link Here
221
{
218
{
222
    msg_state = (mime_t *) xmalloc(sizeof(mime_t));
219
    msg_state = (mime_t *) xmalloc(sizeof(mime_t));
223
220
224
    if (parent == NULL) {
221
    if (parent == NULL)
225
	mime_stack_top = msg_state;
222
	mime_stack_top = msg_state;
226
    }
227
223
228
    mime_stack_bot = msg_state;
224
    mime_stack_bot = msg_state;
229
225
Lines 458-467 Link Here
458
	    break;
454
	    break;
459
	}
455
	}
460
    }
456
    }
457
461
    if (DEBUG_MIME(0)
458
    if (DEBUG_MIME(0)
462
	&& msg_state->mime_disposition == MIME_DISPOSITION_UNKNOWN)
459
	&& msg_state->mime_disposition == MIME_DISPOSITION_UNKNOWN)
463
	fprintf(stderr, "Unknown mime disposition - '%s'\n", w);
460
	fprintf(stderr, "Unknown mime disposition - '%s'\n", w);
461
464
    xfree(w);
462
    xfree(w);
463
465
    return;
464
    return;
466
}
465
}
467
466
Lines 496-505 Link Here
496
	    break;
495
	    break;
497
	}
496
	}
498
    }
497
    }
498
499
    if (DEBUG_MIME(0)
499
    if (DEBUG_MIME(0)
500
	&& msg_state->mime_encoding == MIME_ENCODING_UNKNOWN)
500
	&& msg_state->mime_encoding == MIME_ENCODING_UNKNOWN)
501
	fprintf(stderr, "Unknown mime encoding - '%s'\n", w);
501
	fprintf(stderr, "Unknown mime encoding - '%s'\n", w);
502
502
    xfree(w);
503
    xfree(w);
504
503
    return;
505
    return;
504
}
506
}
505
507
Lines 527-595 Link Here
527
    xfree(w);
529
    xfree(w);
528
530
529
    switch (msg_state->mime_type) {
531
    switch (msg_state->mime_type) {
530
    case MIME_TEXT:
532
    case MIME_TEXT:		return;	/* XXX: read charset */
531
    case MIME_TEXT_PLAIN:
533
    case MIME_TEXT_PLAIN:	return;	/* XXX: read charset */
532
	/* XXX: read charset */
534
    case MIME_TEXT_HTML:	return;
533
    case MIME_TEXT_HTML:
535
    case MIME_TYPE_UNKNOWN:	return;
534
	return;
536
    case MIME_MULTIPART:	return;	/* XXX: read boundary */
535
    case MIME_TYPE_UNKNOWN:
537
    case MIME_MESSAGE:		return;
536
	return;
537
    case MIME_MULTIPART:
538
	/* XXX: read boundary */
539
	return;
540
    case MIME_MESSAGE:
541
	return;
542
    case MIME_APPLICATION:
538
    case MIME_APPLICATION:
543
	return;
544
    case MIME_IMAGE:
539
    case MIME_IMAGE:
545
	return;
540
    case MIME_AUDIO:
541
    case MIME_VIDEO:		msg_state->mime_dont_decode = true;	return;
546
    }
542
    }
547
    return;
548
}
549
550
/* to be removed. Used only by bogus hacks in collect.c::collect_words */
551
void mime_type2(word_t * text)
552
{
553
    byte *w = text->text;
554
    struct type_s *typ;
555
543
556
    if (!w)
557
	return;
558
559
    msg_state->mime_type = MIME_TYPE_UNKNOWN;
560
    for (typ = mime_type_table;
561
	 typ < mime_type_table + COUNTOF(mime_type_table); typ += 1) {
562
	if (strncasecmp((const char *)w, typ->name, typ->len) == 0) {
563
	    msg_state->mime_type = typ->type;
564
	    if (DEBUG_MIME(1) || DEBUG_LEXER(1))
565
		fprintf(dbgout, "*** mime_type: %s\n", text->text);
566
	    break;
567
	}
568
    }
569
    if (DEBUG_MIME(0) && msg_state->mime_type == MIME_TYPE_UNKNOWN)
570
	fprintf(stderr, "Unknown mime type - '%s'\n", w);
571
#if	0
572
    switch (msg_state->mime_type) {
573
    case MIME_TEXT:
574
    case MIME_TEXT_HTML:
575
    case MIME_TEXT_PLAIN:
576
	/* XXX: read charset */
577
	return;
578
    case MIME_TYPE_UNKNOWN:
579
	return;
580
    case MIME_MULTIPART:
581
	return;
582
    case MIME_MESSAGE:
583
	/* XXX: read boundary */
584
	return;
585
    case MIME_APPLICATION:
586
	/* XXX: read boundary */
587
	return;
588
    case MIME_IMAGE:
589
	/* XXX: read boundary */
590
	return;
591
    }
592
#endif
593
    return;
544
    return;
594
}
545
}
595
546
(-)bogofilter-0.96.2/src/mime.h (-2 / +5 lines)
Lines 1-4 Link Here
1
/* $Id: mime.h,v 1.24 2005/09/06 02:01:22 relson Exp $ */
1
/* $Id: mime.h,v 1.26 2005/10/25 23:48:03 relson Exp $ */
2
2
3
/** \file mime.h
3
/** \file mime.h
4
 * prototypes and definitions for mime.c
4
 * prototypes and definitions for mime.c
Lines 18-24 Link Here
18
    MIME_TEXT_PLAIN,
18
    MIME_TEXT_PLAIN,
19
    MIME_TEXT_HTML,
19
    MIME_TEXT_HTML,
20
    MIME_APPLICATION,
20
    MIME_APPLICATION,
21
    MIME_IMAGE
21
    MIME_IMAGE,
22
    MIME_AUDIO,
23
    MIME_VIDEO
22
};
24
};
23
25
24
enum mimeencoding {
26
enum mimeencoding {
Lines 47-52 Link Here
47
			  MIME_MULTIPART or MIME_MESSAGE */
49
			  MIME_MULTIPART or MIME_MESSAGE */
48
    size_t boundary_len;
50
    size_t boundary_len;
49
    enum mimetype mime_type;
51
    enum mimetype mime_type;
52
    bool mime_dont_decode;
50
    enum mimeencoding mime_encoding;
53
    enum mimeencoding mime_encoding;
51
    enum mimedisposition mime_disposition;
54
    enum mimedisposition mime_disposition;
52
    mime_t *parent;
55
    mime_t *parent;

Return to bug 142490