View | Details | Raw Unified | Return to bug 208261 | Differences between
and this patch

Collapse All | Expand All

(-)dma.h (+1 lines)
Lines 60-65 Link Here
60
#endif
60
#endif
61
#define	SMTP_PORT	25		/* Default SMTP port */
61
#define	SMTP_PORT	25		/* Default SMTP port */
62
#define CON_TIMEOUT	(5*60)		/* Connection timeout per RFC5321 */
62
#define CON_TIMEOUT	(5*60)		/* Connection timeout per RFC5321 */
63
#define MAX_LINE_RFC2822 999		/* Max line length per RFC2822 plus \n */
63
64
64
#define STARTTLS	0x002		/* StartTLS support */
65
#define STARTTLS	0x002		/* StartTLS support */
65
#define SECURETRANS	0x004		/* SSL/TLS in general */
66
#define SECURETRANS	0x004		/* SSL/TLS in general */
(-)local.c (-1 / +1 lines)
Lines 126-132 Link Here
126
deliver_local(struct qitem *it)
126
deliver_local(struct qitem *it)
127
{
127
{
128
	char fn[PATH_MAX+1];
128
	char fn[PATH_MAX+1];
129
	char line[1000];
129
	char line[MAX_LINE_RFC2822+1];
130
	const char *sender;
130
	const char *sender;
131
	const char *newline = "\n";
131
	const char *newline = "\n";
132
	size_t linelen;
132
	size_t linelen;
(-)mail.c (-8 / +6 lines)
Lines 41-48 Link Here
41
41
42
#include "dma.h"
42
#include "dma.h"
43
43
44
#define MAX_LINE_RFC822	1000
45
46
void
44
void
47
bounce(struct qitem *it, const char *reason)
45
bounce(struct qitem *it, const char *reason)
48
{
46
{
Lines 350-369 Link Here
350
348
351
	while (linelen > 0) {
349
	while (linelen > 0) {
352
		len = linelen;
350
		len = linelen;
353
		if (linelen > MAX_LINE_RFC822) {
351
		if (linelen > MAX_LINE_RFC2822) {
354
			len = MAX_LINE_RFC822 - 10;
352
			len = MAX_LINE_RFC2822 - 1;
355
		}
353
		}
356
354
357
		if (fwrite(line, len, 1, queue->mailf) != 1)
355
		if (fwrite(line, len, 1, queue->mailf) != 1)
358
			return (-1);
356
			return (-1);
359
357
360
		if (linelen <= MAX_LINE_RFC822)
358
		if (linelen <= MAX_LINE_RFC2822)
361
			break;
359
			break;
362
360
363
		if (fwrite("\n", 1, 1, queue->mailf) != 1)
361
		if (fwrite("\n", 1, 1, queue->mailf) != 1)
364
			return (-1);
362
			return (-1);
365
363
366
		line += MAX_LINE_RFC822 - 10;
364
		line += MAX_LINE_RFC2822 - 1;
367
		linelen = strlen(line);
365
		linelen = strlen(line);
368
	}
366
	}
369
	return (0);
367
	return (0);
Lines 376-382 Link Here
376
	char *line = NULL;
374
	char *line = NULL;
377
	ssize_t linelen;
375
	ssize_t linelen;
378
	size_t linecap = 0;
376
	size_t linecap = 0;
379
	char newline[MAX_LINE_RFC822];
377
	char newline[MAX_LINE_RFC2822];
380
	size_t error;
378
	size_t error;
381
	int had_headers = 0;
379
	int had_headers = 0;
382
	int had_from = 0;
380
	int had_from = 0;
Lines 407-413 Link Here
407
			break;
405
			break;
408
406
409
		if (!had_headers) {
407
		if (!had_headers) {
410
			if (linelen > MAX_LINE_RFC822) {
408
			if (linelen > MAX_LINE_RFC2822) {
411
				/* XXX also split headers */
409
				/* XXX also split headers */
412
				errlogx(EX_DATAERR, "bad mail input format:"
410
				errlogx(EX_DATAERR, "bad mail input format:"
413
				    " from %s (uid %d) (envelope-from %s)",
411
				    " from %s (uid %d) (envelope-from %s)",
(-)net.c (-1 / +1 lines)
Lines 352-358 Link Here
352
deliver_to_host(struct qitem *it, struct mx_hostentry *host)
352
deliver_to_host(struct qitem *it, struct mx_hostentry *host)
353
{
353
{
354
	struct authuser *a;
354
	struct authuser *a;
355
	char line[1000];
355
	char line[MAX_LINE_RFC2822+1];
356
	size_t linelen;
356
	size_t linelen;
357
	int fd, error = 0, do_auth = 0, res = 0;
357
	int fd, error = 0, do_auth = 0, res = 0;
358
358

Return to bug 208261