Deleted Added
full compact
2c2
< * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
---
> * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
12c12
< * $FreeBSD: head/contrib/sendmail/src/headers.c 125823 2004-02-14 21:58:08Z gshapiro $
---
> * $FreeBSD: head/contrib/sendmail/src/headers.c 132946 2004-08-01 01:16:16Z gshapiro $
17c17
< SM_RCSID("@(#)$Id: headers.c,v 8.266.4.9 2003/10/30 00:17:22 gshapiro Exp $")
---
> SM_RCSID("@(#)$Id: headers.c,v 8.286 2004/07/08 17:57:32 ca Exp $")
18a19
> static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *));
91c92
< xputs(line);
---
> xputs(sm_debug_file(), line);
295,296d295
< /* no ruleset? look for default */
< rs = hi->hi_ruleset;
299a299,301
>
> /* no ruleset? look for default */
> rs = hi->hi_ruleset;
361,368c363
< /*
< ** XXX: h isn't set yet
< ** If we really want to be precise then we have
< ** to lookup the header (see below).
< ** It's probably not worth the effort.
< */
<
< if (bitset(H_FROM, h->h_flags))
---
> if (bitset(H_FROM, hi->hi_flags))
371c366
< else if (bitset(H_RCPT, h->h_flags))
---
> else if (bitset(H_RCPT, hi->hi_flags))
469a465,502
> ** ALLOCHEADER -- allocate a header entry
> **
> ** Parameters:
> ** field -- the name of the header field.
> ** value -- the value of the field.
> ** flags -- flags to add to h_flags.
> ** rp -- resource pool for allocations
> **
> ** Returns:
> ** Pointer to a newly allocated and populated HDR.
> */
>
> static HDR *
> allocheader(field, value, flags, rp)
> char *field;
> char *value;
> int flags;
> SM_RPOOL_T *rp;
> {
> HDR *h;
> STAB *s;
>
> /* find info struct */
> s = stab(field, ST_HEADER, ST_FIND);
>
> /* allocate space for new header */
> h = (HDR *) sm_rpool_malloc_x(rp, sizeof *h);
> h->h_field = field;
> h->h_value = sm_rpool_strdup_x(rp, value);
> h->h_flags = flags;
> if (s != NULL)
> h->h_flags |= s->s_header.hi_flags;
> clrbitmap(h->h_mflags);
> h->h_macro = '\0';
>
> return h;
> }
> /*
495d527
< STAB *s;
499,501d530
< /* find info struct */
< s = stab(field, ST_HEADER, ST_FIND);
<
510,512c539
< h = (HDR *) sm_rpool_malloc_x(e->e_rpool, sizeof *h);
< h->h_field = field;
< h->h_value = sm_rpool_strdup_x(e->e_rpool, value);
---
> h = allocheader(field, value, flags, e->e_rpool);
514,518d540
< h->h_flags = flags;
< if (s != NULL)
< h->h_flags |= s->s_header.hi_flags;
< clrbitmap(h->h_mflags);
< h->h_macro = '\0';
521a544,597
> ** INSHEADER -- insert a header entry at the specified index
> **
> ** This bypasses the special checking of chompheader.
> **
> ** Parameters:
> ** idx -- index into the header list at which to insert
> ** field -- the name of the header field.
> ** value -- the value of the field.
> ** flags -- flags to add to h_flags.
> ** e -- envelope.
> **
> ** Returns:
> ** none.
> **
> ** Side Effects:
> ** inserts the field on the list of headers for this envelope.
> */
>
> void
> insheader(idx, field, value, flags, e)
> int idx;
> char *field;
> char *value;
> int flags;
> ENVELOPE *e;
> {
> HDR *h, *srch, *last = NULL;
>
> /* allocate space for new header */
> h = allocheader(field, value, flags, e->e_rpool);
>
> /* find insertion position */
> for (srch = e->e_header; srch != NULL && idx > 0;
> srch = srch->h_link, idx--)
> last = srch;
>
> if (e->e_header == NULL)
> {
> e->e_header = h;
> h->h_link = NULL;
> }
> else if (srch == NULL)
> {
> SM_ASSERT(last != NULL);
> last->h_link = h;
> h->h_link = NULL;
> }
> else
> {
> h->h_link = srch->h_link;
> srch->h_link = h;
> }
> }
> /*
677c753
< xputs(h->h_value);
---
> xputs(sm_debug_file(), h->h_value);
692c768
< xputs(h->h_value);
---
> xputs(sm_debug_file(), h->h_value);
734d809
< #if _FFR_MESSAGEID_MACRO
736,737c811
< e->e_msgid);
< #endif /* _FFR_MESSAGEID_MACRO */
---
> e->e_msgid);
769a844,897
> /* check for DSN to properly set e_timeoutclass */
> p = hvalue("content-type", e->e_header);
> if (p != NULL)
> {
> bool oldsupr;
> char **pvp;
> char pvpbuf[MAXLINE];
> extern unsigned char MimeTokenTab[256];
>
> /* tokenize header */
> oldsupr = SuprErrs;
> SuprErrs = true;
> pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL,
> MimeTokenTab, false);
> SuprErrs = oldsupr;
>
> /* Check if multipart/report */
> if (pvp != NULL && pvp[0] != NULL &&
> pvp[1] != NULL && pvp[2] != NULL &&
> sm_strcasecmp(*pvp++, "multipart") == 0 &&
> strcmp(*pvp++, "/") == 0 &&
> sm_strcasecmp(*pvp++, "report") == 0)
> {
> /* Look for report-type=delivery-status */
> while (*pvp != NULL)
> {
> /* skip to semicolon separator */
> while (*pvp != NULL && strcmp(*pvp, ";") != 0)
> pvp++;
>
> /* skip semicolon */
> if (*pvp++ == NULL || *pvp == NULL)
> break;
>
> /* look for report-type */
> if (sm_strcasecmp(*pvp++, "report-type") != 0)
> continue;
>
> /* skip equal */
> if (*pvp == NULL || strcmp(*pvp, "=") != 0)
> continue;
>
> /* check value */
> if (*++pvp != NULL &&
> sm_strcasecmp(*pvp,
> "delivery-status") == 0)
> e->e_timeoutclass = TOC_DSN;
>
> /* found report-type, no need to continue */
> break;
> }
> }
> }
>
781d908
< #if _FFR_QUEUERETURN_DSN
784d910
< #endif /* _FFR_QUEUERETURN_DSN */
786d911
< #if _FFR_QUEUERETURN_DSN
789d913
< #endif /* _FFR_QUEUERETURN_DSN */
1243d1366
< {
1245,1248c1368
< SM_APPEND_CHAR(c);
< }
< else
< SM_APPEND_CHAR(c);
---
> SM_APPEND_CHAR(c);
1410c1530
< xputs(buf);
---
> xputs(sm_debug_file(), buf);
1463c1583
< xputs(p);
---
> xputs(sm_debug_file(), p);
1817c1937
< sizeof pvpbuf, &oldp, NULL);
---
> sizeof pvpbuf, &oldp, NULL, false);