-/*
- * post.c -- enter messages into the mail transport system
+/* post.c -- enter messages into the mail transport system
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* from 'send'. We use a service name of 'post' internally.
*/
-static struct oauth_profile {
+static struct {
const char *profname;
int switchnum;
const char *value;
#define MVIS 0x0008 /* we've seen sighted addrs */
#define MINV 0x0010 /* we've seen blind addrs */
#define MSND 0x0020 /* we've seen a Sender: */
-#define MRSN 0x0040 /* We've seen a Resent-Sendr:*/
+#define MRSN 0x0040 /* We've seen a Resent-Sender: */
#define MEFM 0x0080 /* We've seen Envelope-From: */
#define MMIM 0x0100 /* We've seen Mime-Version: */
int noverify = 0;
int eai = 0; /* use Email Address Internationalization (EAI) (SMTPUTF8) */
char *cp, *msg = NULL, **argp, **arguments, *envelope;
- char buf[BUFSIZ], name[NAMESZ], *auth_svc = NULL;
+ char buf[NMH_BUFSIZ], name[NAMESZ], *auth_svc = NULL;
FILE *in, *out;
m_getfld_state_t gstate = 0;
str++;
if (msgstate == NORMAL && uprf (name, "resent")) {
- advise (NULL, "illegal header line -- %s:", name);
+ inform("illegal header line -- %s:", name);
badmsg++;
return;
}
if (strcmp (str, "\n")) {
trim_suffix_c(str, '\n');
if (! whomsw) {
- advise (NULL, "ignoring header line -- %s: %s", name, str);
+ inform("ignoring header line -- %s: %s", name, str);
}
}
}
return;
}
if (hdr->flags & HBAD) {
- advise (NULL, "illegal header line -- %s:", name);
+ inform("illegal header line -- %s:", name);
badmsg++;
return;
}
*/
if ((msgstate == RESENT) ? (hdr->set & MRSN)
: (hdr->set & MSND)) {
- advise (NULL, "%s: field requires one address", name);
+ inform("%s: field requires one address", name);
badmsg++;
}
#ifdef notdef
- advise (NULL, "%s: field requires at least one address", name);
+ inform("%s: field requires at least one address", name);
badmsg++;
#endif /* notdef */
}
}
if (count > 1 && (hdr->flags & HONE)) {
- advise (NULL, "%s: field only permits one address", name);
+ inform("%s: field only permits one address", name);
badmsg++;
return;
}
}
if (grp > 0 && (hdr->flags & HNGR)) {
- advise (NULL, "%s: field does not allow groups", name);
+ inform("%s: field does not allow groups", name);
badmsg++;
}
if (linepos) {
/*
* A From: header is now required in the draft.
*/
- advise (NULL, "message has no From: header");
- advise (NULL, "See default components files for examples");
+ inform("message has no From: header");
+ inform("See default components files for examples");
badmsg++;
break;
}
if (fromcount > 1 && (seensender == 0 && !(msgflags & MEFM))) {
- advise (NULL, "A Sender: or Envelope-From: header is required "
+ inform("A Sender: or Envelope-From: header is required "
"with multiple\nFrom: addresses");
badmsg++;
break;
if (fromcount > 1 && seensender == 0) {
if (efrom[0] == '\0') {
- advise (NULL, "Envelope-From cannot be blank when there "
+ inform("Envelope-From cannot be blank when there "
"is multiple From: addresses\nand no Sender: "
"header");
badmsg++;
case RESENT:
if (!(msgflags & MDAT)) {
- advise (NULL, "message has no Date: header");
+ inform("message has no Date: header");
badmsg++;
}
if (!(msgflags & MFRM)) {
- advise (NULL, "message has no From: header");
+ inform("message has no From: header");
badmsg++;
}
if (!(msgflags & MRFM)) {
- advise (NULL, "message has no Resent-From: header");
- advise (NULL, "See default components files for examples");
+ inform("message has no Resent-From: header");
+ inform("See default components files for examples");
badmsg++;
break;
}
if (fromcount > 1 && (seensender == 0 && !(msgflags & MEFM))) {
- advise (NULL, "A Resent-Sender: or Envelope-From: header is "
+ inform("A Resent-Sender: or Envelope-From: header is "
"required with multiple\nResent-From: addresses");
badmsg++;
break;
if (fromcount > 1 && seensender == 0) {
if (efrom[0] == '\0') {
- advise (NULL, "Envelope-From cannot be blank when there "
+ inform("Envelope-From cannot be blank when there "
"is multiple Resent-From: addresses and no "
"Resent-Sender: header");
badmsg++;
struct headers *h;
for (h = table; h->value; h++)
- if (!strcasecmp (header ? header : "", h->value ? h->value : ""))
+ if (!strcasecmp (FENDNULL(header), FENDNULL(h->value)))
return (h - table);
return NOTOK;
: &netaddrs;
mp->m_next;
mp = mp->m_next)
- if (!strcasecmp (np->m_host ? np->m_host : "",
- mp->m_next->m_host ? mp->m_next->m_host : "") &&
- !strcasecmp (np->m_mbox ? np->m_mbox : "",
- mp->m_next->m_mbox ? mp->m_next->m_mbox : "") &&
+ if (!strcasecmp (FENDNULL(np->m_host),
+ FENDNULL(mp->m_next->m_host)) &&
+ !strcasecmp (FENDNULL(np->m_mbox),
+ FENDNULL(mp->m_next->m_mbox)) &&
np->m_bcc == mp->m_next->m_bcc)
return 0;
printf ("\nnet:\t");
for (mp = netaddrs.m_next; mp; mp = mp->m_next)
- printf ("%s%s@%s%s%s", mp->m_path ? mp->m_path : "",
+ printf ("%s%s@%s%s%s", FENDNULL(mp->m_path),
mp->m_mbox, mp->m_host,
mp->m_bcc ? "[BCC]" : "",
mp->m_next ? ",\n\t" : "");
static void
die (char *what, char *fmt, ...)
{
+ int err;
va_list ap;
+ err = errno;
+
(void) m_unlink (tmpfil);
if (msgflags & MINV)
(void) m_unlink (bccfil);
sm_end (NOTOK);
va_start(ap, fmt);
+ errno = err;
advertise (what, NULL, fmt, ap);
va_end(ap);
done (1);