summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3dd1581)
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 8.59
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 8.60
-static char sccsid[] = "@(#)savemail.c 8.58 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 8.59 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
p = e->e_parent->e_from.q_mailer->m_mtatype;
if (p == NULL)
p = "dns";
p = e->e_parent->e_from.q_mailer->m_mtatype;
if (p == NULL)
p = "dns";
- (void) sprintf(buf, "Reporting-MTA: %s; %s", p, MyHostName);
+ (void) sprintf(buf, "Reporting-MTA: %s; %s", p,
+ xtextify(MyHostName));
putline(buf, mci);
/* Received-From-MTA: shows where we got this message from */
putline(buf, mci);
/* Received-From-MTA: shows where we got this message from */
if (p == NULL)
p = "dns";
(void) sprintf(buf, "Received-From-MTA: %s; %s",
if (p == NULL)
p = "dns";
(void) sprintf(buf, "Received-From-MTA: %s; %s",
+ p, xtextify(RealHostName));
for (r = q; r->q_alias != NULL; r = r->q_alias)
continue;
if (strchr(r->q_user, '@') == NULL)
for (r = q; r->q_alias != NULL; r = r->q_alias)
continue;
if (strchr(r->q_user, '@') == NULL)
- (void) sprintf(buf, "Final-Recipient: %s; %s@%s",
- p, xtextify(r->q_user), MyHostName);
+ {
+ (void) sprintf(buf, "Final-Recipient: %s; %s@",
+ p, xtextify(r->q_user));
+ strcat(buf, xtextify(MyHostName));
+ }
(void) sprintf(buf, "Final-Recipient: %s; %s",
p, xtextify(r->q_user));
(void) sprintf(buf, "Final-Recipient: %s; %s",
p, xtextify(r->q_user));
putline(buf, mci);
/* Action: -- what happened? */
putline(buf, mci);
/* Action: -- what happened? */
if (p == NULL)
p = "smtp";
(void) sprintf(buf, "Diagnostic-Code: %s; %s",
if (p == NULL)
p = "smtp";
(void) sprintf(buf, "Diagnostic-Code: %s; %s",
+ p, xtextify(q->q_rstatus));
+** XTEXTOK -- check if a string is legal xtext
+**
+** Xtext is used in Delivery Status Notifications. The spec was
+** taken from draft-ietf-notary-mime-delivery-04.txt.
+**
+** Parameters:
+** s -- the string to check.
+**
+** Returns:
+** TRUE -- if 's' is legal xtext.
+** FALSE -- if it has any illegal characters in it.
+*/
+
+bool
+xtextok(s)
+ char *s;
+{
+ int c;
+
+ while ((c = *s++) != '\0')
+ {
+ if (c == '+')
+ {
+ c = *s++;
+ if (!isascii(c) || !isxdigit(c))
+ return FALSE;
+ c = *s++;
+ if (!isascii(c) || !isxdigit(c))
+ return FALSE;
+ }
+ else if (c < '!' || c > '~' || c == '\\' || c == '(')
+ return FALSE;
+ }
+ return TRUE;
+}
+\f/*
** PRUNEROUTE -- prune an RFC-822 source route
**
** Trims down a source route to the last internet-registered hop.
** PRUNEROUTE -- prune an RFC-822 source route
**
** Trims down a source route to the last internet-registered hop.
-static char sccsid[] = "@(#)srvrsmtp.c 8.59 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.60 (Berkeley) %G% (with SMTP)";
-static char sccsid[] = "@(#)srvrsmtp.c 8.59 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.60 (Berkeley) %G% (without SMTP)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
usrerr("501 ENVID requires a value");
/* NOTREACHED */
}
usrerr("501 ENVID requires a value");
/* NOTREACHED */
}
+ if (!xtextok(vp))
+ {
+ usrerr("501 Syntax error in ENVID parameter value");
+ /* NOTREACHED */
+ }
+ if (e->e_envid != NULL)
+ {
+ usrerr("501 Duplicate ENVID parameter");
+ /* NOTREACHED */
+ }
e->e_envid = newstr(vp);
}
else if (strcasecmp(kp, "ret") == 0)
e->e_envid = newstr(vp);
}
else if (strcasecmp(kp, "ret") == 0)
usrerr("501 RET requires a value");
/* NOTREACHED */
}
usrerr("501 RET requires a value");
/* NOTREACHED */
}
+ if (bitset(EF_RET_PARAM, e->e_flags))
+ {
+ usrerr("501 Duplicate RET parameter");
+ /* NOTREACHED */
+ }
e->e_flags |= EF_RET_PARAM;
if (strcasecmp(vp, "hdrs") == 0)
e->e_flags |= EF_NO_BODY_RETN;
e->e_flags |= EF_RET_PARAM;
if (strcasecmp(vp, "hdrs") == 0)
e->e_flags |= EF_NO_BODY_RETN;
usrerr("501 ORCPT requires a value");
/* NOTREACHED */
}
usrerr("501 ORCPT requires a value");
/* NOTREACHED */
}
+ if (!xtextok(vp))
+ {
+ usrerr("501 Syntax error in ORCPT parameter value");
+ /* NOTREACHED */
+ }
+ if (a->q_orcpt != NULL)
+ {
+ usrerr("501 Duplicate ORCPT parameter");
+ /* NOTREACHED */
+ }
a->q_orcpt = newstr(vp);
}
else
a->q_orcpt = newstr(vp);
}
else