Original-From: line if redundant with the generated From: line, uses
the Original-From: line for the From: line if possible, and a host of
other such trivialities.
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.42
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.44
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)deliver.c 3.43 %G%";
+static char SccsId[] = "@(#)deliver.c 3.44 %G%";
/*
** DELIVER -- Deliver a message to a list of addresses.
/*
** DELIVER -- Deliver a message to a list of addresses.
extern char *capitalize();
extern char *hvalue();
extern bool samefrom();
extern char *capitalize();
extern char *hvalue();
extern bool samefrom();
extern char SentDate[];
/*
extern char SentDate[];
/*
** Output all header lines
*/
** Output all header lines
*/
+ of_line = hvalue("original-from");
for (h = Header; h != NULL; h = h->h_link)
{
register char *p;
char *origfrom = OrigFrom;
for (h = Header; h != NULL; h = h->h_link)
{
register char *p;
char *origfrom = OrigFrom;
if (bitset(H_CHECK|H_ACHECK, h->h_flags) && !bitset(h->h_mflags, m->m_flags))
{
p = ")><("; /* can't happen (I hope) */
if (bitset(H_CHECK|H_ACHECK, h->h_flags) && !bitset(h->h_mflags, m->m_flags))
{
p = ")><("; /* can't happen (I hope) */
+
+ /* use From: line from message if generated is the same */
if (strcmp(h->h_field, "from") == 0 && origfrom != NULL &&
if (strcmp(h->h_field, "from") == 0 && origfrom != NULL &&
- strcmp(m->m_from, "$f") == 0)
+ strcmp(m->m_from, "$f") == 0 && of_line == NULL)
{
p = origfrom;
origfrom = NULL;
{
p = origfrom;
origfrom = NULL;
+ if (p == NULL || *p == '\0')
- fprintf(fp, "%s: %s\n", capitalize(h->h_field), p);
- h->h_flags |= H_USED;
- anyheader = TRUE;
/* hack, hack -- output Original-From field if different */
/* hack, hack -- output Original-From field if different */
- checkfrom:
- if (strcmp(h->h_field, "from") == 0 && origfrom != NULL &&
- !samefrom(p, origfrom) && hvalue("original-from") == NULL)
+ if (strcmp(h->h_field, "from") == 0 && origfrom != NULL)
+ {
+ /* output new Original-From line if needed */
+ if (of_line == NULL && !samefrom(p, origfrom))
+ {
+ fprintf(fp, "Original-From: %s\n", origfrom);
+ anyheader = TRUE;
+ }
+ if (of_line != NULL && !nooutput && samefrom(p, of_line))
+ {
+ /* delete Original-From: line if redundant */
+ p = of_line;
+ of_line = NULL;
+ }
+ }
+ else if (strcmp(h->h_field, "original-from") == 0 && of_line == NULL)
+ nooutput = TRUE;
+
+ /* finally, output the header line */
+ if (!nooutput)
- fprintf(fp, "Original-From: %s\n", origfrom);
+ fprintf(fp, "%s: %s\n", capitalize(h->h_field), p);
+ h->h_flags |= H_USED;
char *ifrom;
char *efrom;
{
char *ifrom;
char *efrom;
{
- return (strcmp(ifrom, efrom) == 0);
+ register char *p;
+ char buf[MAXNAME + 4];
+
+# ifdef DEBUG
+ if (Debug > 7)
+ printf("samefrom(%s,%s)-->", ifrom, efrom);
+# endif DEBUG
+ if (strcmp(ifrom, efrom) == 0)
+ goto success;
+ p = index(ifrom, '@');
+ if (p == NULL)
+ goto failure;
+ *p = '\0';
+ strcpy(buf, ifrom);
+ strcat(buf, " at ");
+ *p++ = '@';
+ strcat(buf, p);
+ if (strcmp(buf, efrom) == 0)
+ goto success;
+
+ failure:
+# ifdef DEBUG
+ if (Debug > 7)
+ printf("FALSE\n");
+# endif DEBUG
+ return (FALSE);
+
+ success:
+# ifdef DEBUG
+ if (Debug > 7)
+ printf("TRUE\n");
+# endif DEBUG
+ return (TRUE);
}
\f/*
** MAILFILE -- Send a message to a file.
}
\f/*
** MAILFILE -- Send a message to a file.
-static char SccsId[] = "@(#)SendMail version 3.41 of %G%";
+static char SccsId[] = "@(#)SendMail version 3.42 of %G%";
-char Version[] = "3.41 [%G%]";
+char Version[] = "3.42 [%G%]";