[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated
From: |
Ken Hornstein |
Subject: |
[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 15e3d453f414fc1b815ec4895960cad312e78ef9 |
Date: |
Mon, 12 Mar 2012 01:57:12 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".
The branch, master has been updated
via 15e3d453f414fc1b815ec4895960cad312e78ef9 (commit)
via a3558667d8318312591919ec7455ca4935378755 (commit)
via 537e02c38f4bb27e746ef51706d26fe40141c5a6 (commit)
via 40ae9d199d58c85469e3528fc53205143baf29d2 (commit)
from 86e9b55e2984ce54ed9bc99ebfc603e05ab8c2e8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=15e3d453f414fc1b815ec4895960cad312e78ef9
commit 15e3d453f414fc1b815ec4895960cad312e78ef9
Author: Ken Hornstein <address@hidden>
Date: Sun Mar 11 21:47:04 2012 -0400
Require From: header in all outgoing messages.
Allow Sender: header (require if multiple addresses are in From:).
Support new Envelope-From: header for overriding post's choice of
SMTP envelope-from address.
diff --git a/man/mh-mail.man b/man/mh-mail.man
index 69e5fe4..87a0535 100644
--- a/man/mh-mail.man
+++ b/man/mh-mail.man
@@ -99,12 +99,11 @@ profile entry. It
contains the address of the author or authors
(may be more than one if a \*(lqSender:\*(rq field is present). For a
standard reply (using
-.BR repl ,
+.BR repl ),
the reply address is constructed by
checking the following headers (in this order): \*(lqMail-Reply\-To:\*(rq,
\*(lqReply\-To:\*(rq, \*(lqFrom:\*(rq, \*(lqSender:\*(rq.
-A
-.BR From :
+A \*(lqFrom:\*(rq
header MUST exist when the message is sent to
.BR post,
otherwise the message will be rejected.
@@ -145,10 +144,11 @@ constructed by checking the following headers (in this
order):
.PP
.BR Sender :
.RS 5
-Added by
+Required by
.B post
-in the event that the message already has a
-\*(lqFrom:\*(rq line. This line contains the address of the actual
+in the event that the message has multiple addresses on the
+\*(lqFrom:\*(rq line. It is otherwise optional. This line should
+contain the address of the actual
sender.
.RE
.PP
@@ -162,14 +162,24 @@ Contains addresses of primary recipients.
Contains addresses of secondary recipients.
.RE
.PP
-Bcc:
+.BR Bcc :
.RS 5
Still more recipients. However, the \*(lqBcc:\*(rq line is not
copied onto the message as delivered, so these recipients are not
listed.
.B nmh
uses an encapsulation method for blind copies, see
-.BR send .
+.BR send (1).
+.RE
+.PP
+.BR Dcc :
+.RS 5
+Still more recipients. However, the \*(lqDcc:\*(rq line is not
+copied onto the messages as delivered. Recipients on the \*(lqDcc:\*(rq
+line receive the same messsage as recipients on the \*(lqTo:\*(rq and
+\*(lqcc:\*(rq lines. See
+.BR send (1)
+for more details.
.RE
.PP
.BR Fcc :
diff --git a/man/send.man b/man/send.man
index faf4d08..f4fea40 100644
--- a/man/send.man
+++ b/man/send.man
@@ -278,16 +278,7 @@ switch, then
will
use the MIME rules for encapsulation.
.PP
-Prior to sending the message, the fields \*(lqFrom:\ address@hidden(rq,
-and \*(lqDate:\ now\*(rq will be appended to the headers in the message.
-If the environment variable
-.B $SIGNATURE
-is set, then its value
-is used as your personal name when constructing the \*(lqFrom:\*(rq
-line of the message. If this environment variable is not set, then
-.B send
-will consult the profile entry \*(lqSignature\*(rq for
-this information.
+Prior to sending the message, the \*(lqDate:\ now\*(rq field will be appended
to the headers in the message.
If
.B \-msgid
is specified, then a \*(lqMessage\-ID:\*(rq field will also
@@ -299,9 +290,19 @@ is re\-distributing a message (when invoked by
.BR dist ),
then \*(lqResent\-\*(rq will be prepended to each of these
fields: \*(lqFrom:\*(rq, \*(lqDate:\*(rq, and \*(lqMessage\-ID:\*(rq.
-If the message already contains a \*(lqFrom:\*(rq field, then a
-\*(lqSender: address@hidden(rq field will be added as well. (An already
-existing \*(lqSender:\*(rq field is an error!)
+.PP
+A \*(lqFrom:\*(rq field is required for all outgoing messages. Multiple
+addresses are permitted in the \*(lqFrom:\*(rq field, but a \*(lqSender:\*(rq
+field is required in this case. Otherwise a \*(lqSender:\*(rq field
+is optional.
+.PP
+When using SMTP for mail submission, the envelope\-from used for SMTP
+transaction is derived from the \*(lqFrom:\*(rq field. If multiple
+addresses are in the \*(lqFrom:\*(rq field, the address in the
+\*(lqSender\*(rq field is used instead. This behavior can be overridden
+by using the \*(lqEnvelope\-From:\*(rq field. When \*(lqEnvelope\-From\*(rq
+appears in the message, its address will be used as the SMTP envelope\-from
+address and the field will be removed from the message.
.PP
By using the
.B \-format
diff --git a/uip/post.c b/uip/post.c
index 83e008d..79a53aa 100644
--- a/uip/post.c
+++ b/uip/post.c
@@ -158,6 +158,8 @@ struct headers {
#define HNIL 0x0100 /* okay for this header not to have
addrs */
#define HIGN 0x0200 /* ignore this header
*/
#define HDCC 0x0400 /* another undocumented feature
*/
+#define HONE 0x0800 /* Only one address allowed */
+#define HEFM 0x1000 /* Envelope-From: header */
/*
* flags for headers->set
@@ -167,29 +169,33 @@ struct headers {
#define MRFM 0x0004 /* we've seen a Resent-From: */
#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 MEFM 0x0080 /* We've seen Envelope-From: */
static struct headers NHeaders[] = {
- { "Return-Path", HBAD, 0 },
- { "Received", HBAD, 0 },
- { "Reply-To", HADR|HNGR, 0 },
- { "From", HADR|HNGR, MFRM },
- { "Sender", HADR|HBAD, 0 },
- { "Date", HBAD, 0 },
- { "Subject", HSUB, 0 },
- { "To", HADR|HTRY, MVIS },
- { "cc", HADR|HTRY, MVIS },
- { "Bcc", HADR|HTRY|HBCC|HNIL, MINV },
- { "Dcc", HADR|HTRY|HDCC|HNIL, MVIS }, /* sorta cc & bcc
combined */
- { "Message-ID", HBAD, 0 },
- { "Fcc", HFCC, 0 },
- { NULL, 0, 0 }
+ { "Return-Path", HBAD, 0 },
+ { "Received", HBAD, 0 },
+ { "Reply-To", HADR|HNGR, 0 },
+ { "From", HADR|HNGR, MFRM },
+ { "Sender", HADR|HNGR|HONE, MSND },
+ { "Date", HBAD, 0 },
+ { "Subject", HSUB, 0 },
+ { "To", HADR|HTRY, MVIS },
+ { "cc", HADR|HTRY, MVIS },
+ { "Bcc", HADR|HTRY|HBCC|HNIL, MINV },
+ { "Dcc", HADR|HTRY|HDCC|HNIL, MVIS }, /* sorta cc & bcc
combined */
+ { "Message-ID", HBAD, 0 },
+ { "Fcc", HFCC, 0 },
+ { "Envelope-From", HADR|HONE|HEFM, MEFM },
+ { NULL, 0, 0 }
};
static struct headers RHeaders[] = {
{ "Resent-Reply-To", HADR|HNGR, 0 },
{ "Resent-From", HADR|HNGR, MRFM },
- { "Resent-Sender", HADR|HBAD, 0 },
+ { "Resent-Sender", HADR|HNGR, MRSN },
{ "Resent-Date", HBAD, 0 },
{ "Resent-Subject", HSUB, 0 },
{ "Resent-To", HADR|HTRY, MVIS },
@@ -199,12 +205,13 @@ static struct headers RHeaders[] = {
{ "Resent-Fcc", HFCC, 0 },
{ "Reply-To", HADR, 0 },
{ "From", HADR|HNGR, MFRM },
- { "Sender", HADR|HNGR, 0 },
+ { "Sender", HADR|HNGR, MSND },
{ "Date", HNOP, MDAT },
{ "To", HADR|HNIL, 0 },
{ "cc", HADR|HNIL, 0 },
{ "Bcc", HADR|HTRY|HBCC|HNIL, 0 },
{ "Fcc", HIGN, 0 },
+ { "Envelope-From", HADR|HONE|HEFM, MEFM },
{ NULL, 0, 0 }
};
@@ -234,6 +241,8 @@ static char *saslmech=NULL; /* Force use of particular SASL
mech */
static char *user=NULL; /* Authenticate as this user
*/
static char *port="smtp"; /* Name of server port for SMTP */
static int tls=0; /* Use TLS for encryption */
+static int fromcount=0; /* Count of addresses on From: header
*/
+static int seensender=0; /* Have we seen a Sender: header? */
static unsigned msgflags = 0; /* what we've seen */
@@ -249,6 +258,8 @@ static char tmpfil[BUFSIZ];
static char bccfil[BUFSIZ];
static char from[BUFSIZ]; /* my network address */
+static char sender[BUFSIZ]; /* my Sender: header */
+static char efrom[BUFSIZ]; /* my Envelope-From: header */
static char signature[BUFSIZ]; /* my signature */
static char *filter = NULL; /* the filter for BCC'ing */
static char *subject = NULL; /* the subject field for BCC'ing */
@@ -272,8 +283,6 @@ static char prefix[] = "----- =_aaaaaaaaaa";
static char *partno = NULL;
static int queued = 0;
-extern boolean draft_from_masquerading; /* defined in mts.c */
-
/*
* static prototypes
*/
@@ -289,14 +298,14 @@ static void anno (void);
static int annoaux (struct mailname *);
static void insert_fcc (struct headers *, unsigned char *);
static void make_bcc_file (int);
-static void verify_all_addresses (int);
+static void verify_all_addresses (int, char *);
static void chkadr (void);
static void sigon (void);
static void sigoff (void);
static void p_refile (char *);
static void fcc (char *, char *);
static void die (char *, char *, ...);
-static void post (char *, int, int);
+static void post (char *, int, int, char *);
static void do_text (char *file, int fd);
static void do_an_address (struct mailname *, int);
static void do_addresses (int, int);
@@ -307,7 +316,7 @@ int
main (int argc, char **argv)
{
int state, compnum, dashstuff = 0;
- char *cp, *msg = NULL, **argp, **arguments;
+ char *cp, *msg = NULL, **argp, **arguments, *envelope;
char buf[BUFSIZ], name[NAMESZ];
FILE *in, *out;
@@ -608,22 +617,40 @@ main (int argc, char **argv)
fclose (out);
}
+ /*
+ * Here's how we decide which address to use as the envelope-from
+ * address for SMTP.
+ *
+ * - If we were given an Envelope-From header, use that.
+ * - If we were given multiple addresses in the From: header, use
+ * the Sender: address
+ * - Otherwise, use the address on the From: line
+ */
+
+ if (msgflags & MEFM) {
+ envelope = efrom;
+ } else if (fromcount > 1) {
+ envelope = sender;
+ } else {
+ envelope = from;
+ }
+
/* If we are doing a "whom" check */
if (whomsw) {
- verify_all_addresses (1);
+ verify_all_addresses (1, envelope);
done (0);
}
if (msgflags & MINV) {
make_bcc_file (dashstuff);
if (msgflags & MVIS) {
- verify_all_addresses (verbose);
- post (tmpfil, 0, verbose);
+ verify_all_addresses (verbose, envelope);
+ post (tmpfil, 0, verbose, envelope);
}
- post (bccfil, 1, verbose);
+ post (bccfil, 1, verbose, envelope);
unlink (bccfil);
} else {
- post (tmpfil, 0, isatty (1));
+ post (tmpfil, 0, isatty (1), envelope);
}
p_refile (tmpfil);
@@ -720,6 +747,12 @@ putfmt (char *name, char *str, FILE *out)
return;
}
+ if (count > 1 && (hdr->flags & HONE)) {
+ advise (NULL, "%s: field only permits one address", name);
+ badmsg++;
+ return;
+ }
+
nameoutput = linepos = 0;
snprintf (namep, sizeof(namep), "%s%s",
(hdr->flags & HMNG) ? "Original-" : "", name);
@@ -738,17 +771,37 @@ putfmt (char *name, char *str, FILE *out)
continue;
}
- if (draft_from_masquerading && ((msgstate == RESENT)
- ? (hdr->set & MRFM)
- : (hdr->set & MFRM)))
- /* The user manually specified a [Resent-]From: address in
- their draft and the "masquerade:" line in mts.conf
- doesn't contain "draft_from", so we'll set things up to
- use the actual email address embedded in the draft
- [Resent-]From: (after alias substitution, and without the
- GECOS full name or angle brackets) as the envelope
- From:. */
+ /*
+ * If it's a From: or Resent-From: header, save the address
+ * for later possible use (as the envelope address for SMTP)
+ */
+
+ if ((msgstate == RESENT) ? (hdr->set & MRFM)
+ : (hdr->set & MFRM)) {
strncpy(from, auxformat(mp, 0), sizeof(from) - 1);
+ from[sizeof(from) - 1] = '\0';
+ fromcount = count;
+ }
+
+ /*
+ * Also save the Sender: or Resent-Sender: header as well
+ */
+
+ if ((msgstate == RESENT) ? (hdr->set & MRSN)
+ : (hdr->set & MSND)) {
+ strncpy(sender, auxformat(mp, 0), sizeof(sender) - 1);
+ sender[sizeof(sender) - 1] = '\0';
+ seensender++;
+ }
+
+ /*
+ * ALSO ... save Envelope-From
+ */
+
+ if (hdr->set & MEFM) {
+ strncpy(efrom, auxformat(mp, 0), sizeof(efrom) - 1);
+ efrom[sizeof(efrom) - 1] = '\0';
+ }
if (hdr->flags & HBCC)
mp->m_bcc++;
@@ -770,17 +823,37 @@ putfmt (char *name, char *str, FILE *out)
}
else {
/* Address includes a host, so no alias substitution is needed. */
- if (draft_from_masquerading && ((msgstate == RESENT)
- ? (hdr->set & MRFM)
- : (hdr->set & MFRM)))
- /* The user manually specified a [Resent-]From: address in
- their draft and the "masquerade:" line in mts.conf
- doesn't contain "draft_from", so we'll set things up to
- use the actual email address embedded in the draft
- [Resent-]From: (after alias substitution, and without the
- GECOS full name or angle brackets) as the envelope
- From:. */
+
+ /*
+ * If it's a From: or Resent-From header, save the address
+ * for later possible use (as the envelope address for SMTP)
+ */
+
+ if ((msgstate == RESENT) ? (hdr->set & MRFM)
+ : (hdr->set & MFRM)) {
strncpy(from, auxformat(mp, 0), sizeof(from) - 1);
+ fromcount = count;
+ }
+
+ /*
+ * Also save the Sender: header as well
+ */
+
+ if ((msgstate == RESENT) ? (hdr->set & MRSN)
+ : (hdr->set & MSND)) {
+ strncpy(sender, auxformat(mp, 0), sizeof(sender) - 1);
+ sender[sizeof(sender) - 1] = '\0';
+ seensender++;
+ }
+
+ /*
+ * ALSO ... save Envelope-From
+ */
+
+ if (hdr->set & MEFM) {
+ strncpy(efrom, auxformat(mp, 0), sizeof(efrom) - 1);
+ efrom[sizeof(efrom) - 1] = '\0';
+ }
if (hdr->flags & HBCC)
mp->m_bcc++;
@@ -853,6 +926,21 @@ finish_headers (FILE *out)
{
switch (msgstate) {
case NORMAL:
+ if (!(msgflags & MFRM)) {
+ /*
+ * A From: header is now required in the draft.
+ */
+ advise (NULL, "message has no From: header");
+ advise (NULL, "See default components files for examples");
+ badmsg++;
+ }
+
+ if (fromcount > 1 && seensender == 0) {
+ advise (NULL, "A Sender: header is required with multiple "
+ "From: addresses");
+ badmsg++;
+ }
+
if (whomsw)
break;
@@ -860,21 +948,6 @@ finish_headers (FILE *out)
if (msgid)
fprintf (out, "Message-ID: <address@hidden>\n",
(int) getpid (), (long) tclock, LocalName (1));
- if (msgflags & MFRM) {
- /* There was already a From: in the draft. Don't add one. */
- if (!draft_from_masquerading)
- /* mts.conf didn't contain "masquerade:[...]draft_from[...]"
- so we'll reveal the user's actual address@hidden
- address in a Sender: header (and use it as the envelope
- From: later). */
- fprintf (out, "Sender: %s\n", from);
- }
- else
- /* Construct a From: header. */
- fprintf (out, "From: %s\n", signature);
- if (whomsw)
- break;
-
if (!(msgflags & MVIS))
fprintf (out, "Bcc: Blind Distribution List: ;\n");
break;
@@ -888,6 +961,17 @@ finish_headers (FILE *out)
advise (NULL, "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");
+ badmsg++;
+ }
+ if (fromcount > 1 && seensender == 0) {
+ advise (NULL, "A Resent-Sender: header is required with "
+ "multiple Resent-From: addresses");
+ badmsg++;
+ }
+
if (whomsw)
break;
@@ -895,20 +979,6 @@ finish_headers (FILE *out)
if (msgid)
fprintf (out, "Resent-Message-ID: <address@hidden>\n",
(int) getpid (), (long) tclock, LocalName (1));
- if (msgflags & MRFM) {
- /* There was already a Resent-From: in draft. Don't add one. */
- if (!draft_from_masquerading)
- /* mts.conf didn't contain "masquerade:[...]draft_from[...]"
- so we'll reveal the user's actual address@hidden
- address in a Sender: header (and use it as the envelope
- From: later). */
- fprintf (out, "Resent-Sender: %s\n", from);
- }
- else
- /* Construct a Resent-From: header. */
- fprintf (out, "Resent-From: %s\n", signature);
- if (whomsw)
- break;
if (!(msgflags & MVIS))
fprintf (out, "Resent-Bcc: Blind Re-Distribution List: ;\n");
break;
@@ -943,7 +1013,7 @@ putadr (char *name, char *aka, struct mailname *mp, FILE
*out, unsigned int flag
if (mp->m_mbox == NULL || ((flags & HTRY) && !insert (mp)))
return 0;
- if ((flags & (HBCC | HDCC)) || mp->m_ingrp)
+ if ((flags & (HBCC | HDCC | HEFM)) || mp->m_ingrp)
return 1;
if (!nameoutput) {
@@ -1147,18 +1217,6 @@ make_bcc_file (int dashstuff)
if (msgid)
fprintf (out, "Message-ID: <address@hidden>\n",
(int) getpid (), (long) tclock, LocalName (1));
- if (msgflags & MFRM) {
- /* There was already a From: in the draft. Don't add one. */
- if (!draft_from_masquerading)
- /* mts.conf didn't contain "masquerade:[...]draft_from[...]"
- so we'll reveal the user's actual address@hidden
- address in a Sender: header (and use it as the envelope
- From: later). */
- fprintf (out, "Sender: %s\n", from);
- }
- else
- /* Construct a From: header. */
- fprintf (out, "From: %s\n", signature);
if (subject)
fprintf (out, "Subject: %s", subject);
fprintf (out, "BCC:\n");
@@ -1359,7 +1417,7 @@ do_addresses (int bccque, int talk)
*/
static void
-post (char *file, int bccque, int talk)
+post (char *file, int bccque, int talk, char *envelope)
{
int fd, onex;
int retval;
@@ -1378,7 +1436,7 @@ post (char *file, int bccque, int talk)
if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch, verbose,
snoop, onex, queued, sasl, saslssf,
saslmech, user, tls))
- || rp_isbad (retval = sm_winit (from)))
+ || rp_isbad (retval = sm_winit (envelope)))
die (NULL, "problem initializing server; %s", rp_string (retval));
do_addresses (bccque, talk && verbose);
@@ -1406,7 +1464,7 @@ post (char *file, int bccque, int talk)
/* Address Verification */
static void
-verify_all_addresses (int talk)
+verify_all_addresses (int talk, char *envelope)
{
int retval;
struct mailname *lp;
@@ -1417,7 +1475,7 @@ verify_all_addresses (int talk)
if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch,
verbose, snoop, 0, queued, sasl,
saslssf, saslmech, user, tls))
- || rp_isbad (retval = sm_winit (from)))
+ || rp_isbad (retval = sm_winit (envelope)))
die (NULL, "problem initializing server; %s", rp_string (retval));
if (talk && !whomsw)
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=a3558667d8318312591919ec7455ca4935378755
commit a3558667d8318312591919ec7455ca4935378755
Author: Ken Hornstein <address@hidden>
Date: Sun Mar 11 18:08:03 2012 -0400
Add support for a -notls switch, for consistency's sake.
diff --git a/man/post.man b/man/post.man
index f0ab420..460bd81 100644
--- a/man/post.man
+++ b/man/post.man
@@ -33,6 +33,7 @@ post \- deliver a message
.RB [ \-user
.IR username ]
.RB [ \-tls ]
+.RB [ \-notls ]
.I file
.RB [ \-version ]
.RB [ \-help ]
@@ -233,7 +234,10 @@ If
.B nmh
has been compiled with TLS support, the
.B \-tls
-switch will require the negotiation of TLS support when connecting to the
+and
+.B \-notls
+switches will require and disable the negotiation of TLS support when
+connecting to the
SMTP MTA. Encrypted data is labelled with `(tls-encrypted)' and
`(tls-decrypted)' when viewing the SMTP transction with the
.B \-snoop
diff --git a/man/send.man b/man/send.man
index a25c63b..faf4d08 100644
--- a/man/send.man
+++ b/man/send.man
@@ -42,6 +42,7 @@ send \- send a message
.RB [ \-user
.IR username ]
.RB [ \-tls ]
+.RB [ \-notls ]
.RB [ \-width
.IR columns ]
.RB [ file
@@ -374,7 +375,9 @@ If
.B nmh
has been compiled with TLS support, the
.B \-tls
-switch will require the negotiation of TLS support when connecting to the
+and
+.B \-notls
+switches will require and disable the negotiation of TLS support when
connecting to the
SMTP MTA. Encrypted data is labelled with `(tls-encrypted)' and
`(tls-decrypted)' when viewing the SMTP transction with the
.B \-snoop
diff --git a/uip/post.c b/uip/post.c
index b24f571..83e008d 100644
--- a/uip/post.c
+++ b/uip/post.c
@@ -127,9 +127,11 @@ static struct swit switches[] = {
{ "port server port name/number", 4 },
#define TLSSW 36
{ "tls", TLSminc(-3) },
-#define FILEPROCSW 37
+#define NTLSSW 37
+ { "notls", TLSminc(-5) },
+#define FILEPROCSW 38
{ "fileproc", -4 },
-#define MHLPROCSW 38
+#define MHLPROCSW 39
{ "mhlproc", -3 },
{ NULL, 0 }
};
@@ -494,6 +496,10 @@ main (int argc, char **argv)
tls++;
continue;
+ case NTLSSW:
+ tls = 0;
+ continue;
+
case FILEPROCSW:
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
diff --git a/uip/send.c b/uip/send.c
index 9e804bc..9df71d7 100644
--- a/uip/send.c
+++ b/uip/send.c
@@ -118,6 +118,8 @@ static struct swit switches[] = {
{ "port server-port-name/number" , 4 },
#define TLSSW 45
{ "tls", TLSminc(-3) },
+#define NTLSSW 46
+ { "notls", TLSminc(-5) },
{ NULL, 0 }
};
@@ -284,6 +286,7 @@ main (int argc, char **argv)
case SASLSW:
case NOSASLSW:
case TLSSW:
+ case NTLSSW:
vec[vecp++] = --cp;
continue;
diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c
index ac9dc3a..58099f0 100644
--- a/uip/whatnowsbr.c
+++ b/uip/whatnowsbr.c
@@ -1070,6 +1070,8 @@ static struct swit sendswitches[] = {
{ "port server-port-name/number", 4 },
#define TLSSW 44
{ "tls", TLSminc(-3) },
+#define NTLSSW 45
+ { "notls", TLSminc(-5) },
{ NULL, 0 }
};
@@ -1233,6 +1235,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
case SASLSW:
case NOSASLSW:
case TLSSW:
+ case NTLSSW:
vec[vecp++] = --cp;
continue;
diff --git a/uip/whom.c b/uip/whom.c
index 33a6d97..24f09ef 100644
--- a/uip/whom.c
+++ b/uip/whom.c
@@ -58,6 +58,8 @@ static struct swit switches[] = {
{ "port server port name/number", 4 },
#define TLSSW 16
{ "tls", TLSminc(-3) },
+#define NTLSSW 17
+ { "notls", TLSminc(-5) },
{ NULL, 0 }
};
@@ -113,6 +115,7 @@ main (int argc, char **argv)
case SNOOPSW:
case SASLSW:
case TLSSW:
+ case NTLSSW:
vec[vecp++] = --cp;
continue;
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=537e02c38f4bb27e746ef51706d26fe40141c5a6
commit 537e02c38f4bb27e746ef51706d26fe40141c5a6
Author: Ken Hornstein <address@hidden>
Date: Sat Mar 10 22:55:16 2012 -0500
Clean up a bunch of unused code and options. Specifically:
- Remove support for SMTP SEND, SAML, and SOML commands
- Remove -deliver, -fill-in and -fill-up switch for post (and related code)
- Document -server and -port switches better in post man page.
diff --git a/man/post.man b/man/post.man
index 4abef58..f0ab420 100644
--- a/man/post.man
+++ b/man/post.man
@@ -20,6 +20,10 @@ post \- deliver a message
.RB [ \-watch " | " \-nowatch ]
.RB [ \-width
.IR columns ]
+.RB [ \-server
+.IR servername ]
+.RB [ \-port
+.IR portname/number ]
.RB [ \-sasl ]
.RB [ \-nosasl ]
.RB [ \-saslmaxssf
diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c
index 97dd398..b7135f5 100644
--- a/mts/smtp/smtp.c
+++ b/mts/smtp/smtp.c
@@ -639,33 +639,9 @@ rclient (char *server, char *service)
}
int
-sm_winit (int mode, char *from)
+sm_winit (char *from)
{
- char *smtpcom = NULL;
-
- switch (mode) {
- case S_MAIL:
- smtpcom = "MAIL";
- break;
-
- case S_SEND:
- smtpcom = "SEND";
- break;
-
- case S_SOML:
- smtpcom = "SOML";
- break;
-
- case S_SAML:
- smtpcom = "SAML";
- break;
-
- default:
- /* Hopefully, we do not get here. */
- break;
- }
-
- switch (smtalk (SM_MAIL, "%s FROM:<%s>", smtpcom, from)) {
+ switch (smtalk (SM_MAIL, "MAIL FROM:<%s>", from)) {
case 250:
sm_addrs = 0;
return RP_OK;
diff --git a/mts/smtp/smtp.h b/mts/smtp/smtp.h
index 7de0edc..de4abaa 100644
--- a/mts/smtp/smtp.h
+++ b/mts/smtp/smtp.h
@@ -3,12 +3,6 @@
* smtp.h -- definitions for the nmh SMTP Interface
*/
-/* various modes for SMTP */
-#define S_MAIL 0
-#define S_SEND 1
-#define S_SOML 2
-#define S_SAML 3
-
/* length is the length of the string in text[], which is also NUL
* terminated, so s.text[s.length] should always be 0.
*/
@@ -23,7 +17,7 @@ struct smtp {
*/
/* int client (); */
int sm_init (char *, char *, char *, int, int, int, int, int, int, int, char
*, char *, int);
-int sm_winit (int, char *);
+int sm_winit (char *);
int sm_wadr (char *, char *, char *);
int sm_waend (void);
int sm_wtxt (char *, int);
diff --git a/uip/post.c b/uip/post.c
index 15755cf..b24f571 100644
--- a/uip/post.c
+++ b/uip/post.c
@@ -101,49 +101,35 @@ static struct swit switches[] = {
{ "dashstuffing", -12 }, /* should we dashstuff BCC messages? */
#define NBITSTUFFSW 23
{ "nodashstuffing", -14 },
-#define MAILSW 24
- { "mail", -4 }, /* specify MAIL smtp mode */
-#define SAMLSW 25
- { "saml", -4 }, /* specify SAML smtp mode */
-#define SENDSW 26
- { "send", -4 }, /* specify SEND smtp mode */
-#define SOMLSW 27
- { "soml", -4 }, /* specify SOML smtp mode */
-#define ANNOSW 28
+#define ANNOSW 24
{ "idanno number", -6 }, /* interface from send */
-#define DLVRSW 29
- { "deliver address-list", -7 },
-#define CLIESW 30
+#define CLIESW 25
{ "client host", -6 },
-#define SERVSW 31
- { "server host", -6 }, /* specify alternate SMTP server */
-#define SNOOPSW 32
+#define SERVSW 26
+ { "server host", 6 }, /* specify alternate SMTP server */
+#define SNOOPSW 27
{ "snoop", -5 }, /* snoop the SMTP transaction */
-#define FILLSW 33
- { "fill-in file", -7 },
-#define FILLUSW 34
- { "fill-up", -7 },
-#define PARTSW 35
+#define PARTSW 28
{ "partno", -6 },
-#define QUEUESW 36
+#define QUEUESW 29
{ "queued", -6 },
-#define SASLSW 37
+#define SASLSW 30
{ "sasl", SASLminc(-4) },
-#define NOSASLSW 38
+#define NOSASLSW 31
{ "nosasl", SASLminc(-6) },
-#define SASLMXSSFSW 39
+#define SASLMXSSFSW 32
{ "saslmaxssf", SASLminc(-10) },
-#define SASLMECHSW 40
+#define SASLMECHSW 33
{ "saslmech", SASLminc(-5) },
-#define USERSW 41
+#define USERSW 34
{ "user", SASLminc(-4) },
-#define PORTSW 42
+#define PORTSW 35
{ "port server port name/number", 4 },
-#define TLSSW 43
+#define TLSSW 36
{ "tls", TLSminc(-3) },
-#define FILEPROCSW 44
+#define FILEPROCSW 37
{ "fileproc", -4 },
-#define MHLPROCSW 45
+#define MHLPROCSW 38
{ "mhlproc", -3 },
{ NULL, 0 }
};
@@ -274,7 +260,6 @@ static struct mailname uuaddrs; /* uucp
addrs */
static struct mailname tmpaddrs; /* temporary queue */
static int snoop = 0;
-static int smtpmode = S_MAIL;
static char *clientsw = NULL;
static char *serversw = NULL;
@@ -282,8 +267,6 @@ extern struct smtp sm_reply;
static char prefix[] = "----- =_aaaaaaaaaa";
-static int fill_up = 0;
-static char *fill_in = NULL;
static char *partno = NULL;
static int queued = 0;
@@ -457,23 +440,6 @@ main (int argc, char **argv)
adios (NULL, "bad argument %s %s", argp[-2], cp);
continue;
- case DLVRSW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
-
- case MAILSW:
- smtpmode = S_MAIL;
- continue;
- case SAMLSW:
- smtpmode = S_SAML;
- continue;
- case SOMLSW:
- smtpmode = S_SOML;
- continue;
- case SENDSW:
- smtpmode = S_SEND;
- continue;
case CLIESW:
if (!(clientsw = *argp++) || *clientsw == '-')
adios (NULL, "missing argument to %s", argp[-2]);
@@ -486,13 +452,6 @@ main (int argc, char **argv)
snoop++;
continue;
- case FILLSW:
- if (!(fill_in = *argp++) || *fill_in == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case FILLUSW:
- fill_up++;
- continue;
case PARTSW:
if (!(partno = *argp++) || *partno == '-')
adios (NULL, "missing argument to %s", argp[-2]);
@@ -571,7 +530,7 @@ main (int argc, char **argv)
discard (out = stdout); /* XXX: reference discard() to help loader */
} else {
if (whomsw) {
- if ((out = fopen (fill_in ? fill_in : "/dev/null", "w")) == NULL)
+ if ((out = fopen ("/dev/null", "w")) == NULL)
adios ("/dev/null", "unable to open");
} else {
char *cp = m_mktemp(m_maildir(invo_name), NULL, &out);
@@ -609,7 +568,7 @@ main (int argc, char **argv)
case BODY:
case BODYEOF:
finish_headers (out);
- if (whomsw && !fill_in)
+ if (whomsw)
break;
fprintf (out, "\n%s", buf);
while (state == BODY) {
@@ -645,8 +604,7 @@ main (int argc, char **argv)
/* If we are doing a "whom" check */
if (whomsw) {
- if (!fill_up)
- verify_all_addresses (1);
+ verify_all_addresses (1);
done (0);
}
@@ -702,17 +660,11 @@ putfmt (char *name, char *str, FILE *out)
hdr = &hdrtab[i];
if (hdr->flags & HIGN) {
- if (fill_in)
- fprintf (out, "%s: %s", name, str);
return;
}
if (hdr->flags & HBAD) {
- if (fill_in)
- fprintf (out, "%s: %s", name, str);
- else {
- advise (NULL, "illegal header line -- %s:", name);
- badmsg++;
- }
+ advise (NULL, "illegal header line -- %s:", name);
+ badmsg++;
return;
}
msgflags |= (hdr->set & ~(MVIS | MINV));
@@ -720,11 +672,6 @@ putfmt (char *name, char *str, FILE *out)
if (hdr->flags & HSUB)
subject = subject ? add (str, add ("\t", subject)) : getcpy (str);
if (hdr->flags & HFCC) {
- if (fill_in) {
- fprintf (out, "%s: %s", name, str);
- return;
- }
-
if ((cp = strrchr(str, '\n')))
*cp = 0;
for (cp = pp = str; (cp = strchr(pp, ',')); pp = cp) {
@@ -769,7 +716,7 @@ putfmt (char *name, char *str, FILE *out)
nameoutput = linepos = 0;
snprintf (namep, sizeof(namep), "%s%s",
- !fill_in && (hdr->flags & HMNG) ? "Original-" : "", name);
+ (hdr->flags & HMNG) ? "Original-" : "", name);
for (grp = 0, mp = tmpaddrs.m_next; mp; mp = np)
if (mp->m_nohost) { /* also used to test (hdr->flags & HTRY) */
@@ -850,8 +797,6 @@ putfmt (char *name, char *str, FILE *out)
badmsg++;
}
if (linepos) {
- if (fill_in && grp > 0)
- putc (';', out);
putc ('\n', out);
}
}
@@ -902,7 +847,7 @@ finish_headers (FILE *out)
{
switch (msgstate) {
case NORMAL:
- if (whomsw && !fill_up)
+ if (whomsw)
break;
fprintf (out, "Date: %s\n", dtime (&tclock, 0));
@@ -937,7 +882,7 @@ finish_headers (FILE *out)
advise (NULL, "message has no From: header");
badmsg++;
}
- if (whomsw && !fill_up)
+ if (whomsw)
break;
fprintf (out, "Resent-Date: %s\n", dtime (&tclock, 0));
@@ -992,7 +937,7 @@ putadr (char *name, char *aka, struct mailname *mp, FILE
*out, unsigned int flag
if (mp->m_mbox == NULL || ((flags & HTRY) && !insert (mp)))
return 0;
- if ((!fill_in && (flags & (HBCC | HDCC))) || mp->m_ingrp)
+ if ((flags & (HBCC | HDCC)) || mp->m_ingrp)
return 1;
if (!nameoutput) {
@@ -1003,7 +948,7 @@ putadr (char *name, char *aka, struct mailname *mp, FILE
*out, unsigned int flag
if (*aka && mp->m_type != UUCPHOST && !mp->m_pers)
mp->m_pers = getcpy (aka);
if (format) {
- if (mp->m_gname && !fill_in) {
+ if (mp->m_gname) {
snprintf (buffer, sizeof(buffer), "%s;", mp->m_gname);
cp = buffer;
} else {
@@ -1036,17 +981,15 @@ putgrp (char *name, char *group, FILE *out, unsigned int
flags)
int len;
char *cp;
- if (!fill_in && (flags & HBCC))
+ if (flags & HBCC)
return;
if (!nameoutput) {
fprintf (out, "%s: ", name);
linepos += (nameoutput = strlen (name) + 2);
- if (fill_in)
- linepos -= strlen (group);
}
- cp = fill_in ? group : concat (group, ";", NULL);
+ cp = concat (group, ";", NULL);
len = strlen (cp);
if (linepos > nameoutput) {
@@ -1429,7 +1372,7 @@ post (char *file, int bccque, int talk)
if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch, verbose,
snoop, onex, queued, sasl, saslssf,
saslmech, user, tls))
- || rp_isbad (retval = sm_winit (smtpmode, from)))
+ || rp_isbad (retval = sm_winit (from)))
die (NULL, "problem initializing server; %s", rp_string (retval));
do_addresses (bccque, talk && verbose);
@@ -1468,7 +1411,7 @@ verify_all_addresses (int talk)
if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch,
verbose, snoop, 0, queued, sasl,
saslssf, saslmech, user, tls))
- || rp_isbad (retval = sm_winit (smtpmode, from)))
+ || rp_isbad (retval = sm_winit (from)))
die (NULL, "problem initializing server; %s", rp_string (retval));
if (talk && !whomsw)
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=40ae9d199d58c85469e3528fc53205143baf29d2
commit 40ae9d199d58c85469e3528fc53205143baf29d2
Author: Ken Hornstein <address@hidden>
Date: Tue Mar 6 09:25:00 2012 -0500
SMTPMTS has been the default for over a decade, so it's time to get rid of
the #ifdefs to clean up the code a bit.
diff --git a/configure.ac b/configure.ac
index 2e8cbd7..aeed66c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,10 +123,6 @@ AS_IF([test x"$with_mts" = x"smtp"], [MTS="smtp"],
[MTS="smtp"])
AC_SUBST([MTS])dnl
-dnl Both the smtp and sendmail mail transport services use the smtp code
-AC_DEFINE([SMTPMTS], [1],
- [Define if you want SMTP (simple mail transport protocol) support.])dnl
-
dnl What should be the default pager?
AC_ARG_WITH([pager],
AS_HELP_STRING([--with-pager=PAGER],[specify the default pager]))
diff --git a/h/mts.h b/h/mts.h
index 2888c57..6be339a 100644
--- a/h/mts.h
+++ b/h/mts.h
@@ -43,7 +43,6 @@ void mts_init (char *);
/*
* MTS specific variables
*/
-#if defined (SMTPMTS)
/* whether to speak SMTP to localhost:25 or to /usr/sbin/sendmail */
#define MTS_SMTP 0
@@ -52,7 +51,6 @@ extern int sm_mts;
extern char *hostable;
extern char *sendmail;
-#endif
/*
* SMTP/POP stuff
diff --git a/h/rcvmail.h b/h/rcvmail.h
index 275ea74..61dd992 100644
--- a/h/rcvmail.h
+++ b/h/rcvmail.h
@@ -3,19 +3,15 @@
* rcvmail.h -- rcvmail hook definitions
*/
-#if defined(SMTPMTS)
-# include <ctype.h>
-# include <errno.h>
-# include <stdio.h>
-# include <sys/types.h>
-# include <mts/smtp/smtp.h>
-#endif /* SMTPMTS */
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <mts/smtp/smtp.h>
-#if defined(SMTPMTS)
-# define RCV_MOK 0
-# define RCV_MBX 1
-#endif /* SMTPMTS */
+#define RCV_MOK 0
+#define RCV_MBX 1
#ifdef NRTC /* sigh */
diff --git a/sbr/mts.c b/sbr/mts.c
index d298c88..ba7ff07 100644
--- a/sbr/mts.c
+++ b/sbr/mts.c
@@ -68,12 +68,10 @@ static char* masquerade = "";
/*
* MTS specific variables
*/
-#if defined(SMTPMTS)
static char *sm_method = "smtp";
int sm_mts = MTS_SMTP;
char *hostable = nmhetcdir(/hosts);
char *sendmail = SENDMAILPATH;
-#endif
/*
* SMTP/POP stuff
@@ -116,13 +114,9 @@ static struct bind binds[] = {
{ "mmdelim1", &mmdlm1 },
{ "mmdelim2", &mmdlm2 },
{ "masquerade", &masquerade },
-
-#if defined(SMTPMTS)
{ "mts", &sm_method },
{ "hostable", &hostable },
{ "sendmail", &sendmail },
-#endif
-
{ "clientname", &clientname },
{ "servers", &servers },
{ "pophost", &pophost },
@@ -171,7 +165,6 @@ mts_init (char *name)
if (strstr(masquerade, "username_extension") != NULL)
username_extension_masquerading = TRUE;
-#ifdef SMTPMTS
if (strcmp(sm_method, "smtp") == 0)
sm_mts = MTS_SMTP;
else if (strcmp(sm_method, "sendmail") == 0)
@@ -180,7 +173,6 @@ mts_init (char *name)
advise(NULL, "unsupported \"mts\" value in mts.conf: %s", sm_method);
sm_mts = MTS_SMTP;
}
-#endif
}
diff --git a/uip/post.c b/uip/post.c
index 6ce3280..15755cf 100644
--- a/uip/post.c
+++ b/uip/post.c
@@ -27,9 +27,7 @@
#endif
#include <time.h>
-#ifdef SMTPMTS
-# include <mts/smtp/smtp.h>
-#endif
+#include <mts/smtp/smtp.h>
#ifndef CYRUS_SASL
# define SASLminc(a) (a)
@@ -275,14 +273,12 @@ static struct mailname netaddrs; /* network
addrs */
static struct mailname uuaddrs; /* uucp addrs */
static struct mailname tmpaddrs; /* temporary queue */
-#ifdef SMTPMTS
static int snoop = 0;
static int smtpmode = S_MAIL;
static char *clientsw = NULL;
static char *serversw = NULL;
extern struct smtp sm_reply;
-#endif /* SMTPMTS */
static char prefix[] = "----- =_aaaaaaaaaa";
@@ -466,16 +462,6 @@ main (int argc, char **argv)
adios (NULL, "missing argument to %s", argp[-2]);
continue;
-#ifndef SMTPMTS
- case CLIESW:
- case SERVSW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
-
- case SNOOPSW:
- continue;
-#else /* SMTPMTS */
case MAILSW:
smtpmode = S_MAIL;
continue;
@@ -499,7 +485,6 @@ main (int argc, char **argv)
case SNOOPSW:
snoop++;
continue;
-#endif /* SMTPMTS */
case FILLSW:
if (!(fill_in = *argp++) || *fill_in == '-')
@@ -1410,10 +1395,8 @@ do_addresses (int bccque, int talk)
chkadr ();
-#ifdef SMTPMTS
if (rp_isbad (retval = sm_waend ()))
die (NULL, "problem ending addresses; %s", rp_string (retval));
-#endif /* SMTPMTS */
}
@@ -1426,8 +1409,6 @@ do_addresses (int bccque, int talk)
* SENDMAIL/SMTP routines
*/
-#ifdef SMTPMTS
-
static void
post (char *file, int bccque, int talk)
{
@@ -1612,8 +1593,6 @@ do_text (char *file, int fd)
}
}
-#endif /* SMTPMTS */
-
/*
* SIGNAL HANDLING
@@ -1628,10 +1607,8 @@ sigser (int i)
if (msgflags & MINV)
unlink (bccfil);
-#ifdef SMTPMTS
if (!whomsw || checksw)
sm_end (NOTOK);
-#endif /* SMTPMTS */
done (1);
}
@@ -1747,10 +1724,8 @@ die (char *what, char *fmt, ...)
if (msgflags & MINV)
unlink (bccfil);
-#ifdef SMTPMTS
if (!whomsw || checksw)
sm_end (NOTOK);
-#endif /* SMTPMTS */
va_start(ap, fmt);
advertise (what, NULL, fmt, ap);
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 4 -
h/mts.h | 2 -
h/rcvmail.h | 18 +--
man/mh-mail.man | 26 +++-
man/post.man | 10 ++-
man/send.man | 32 +++--
mts/smtp/smtp.c | 28 +----
mts/smtp/smtp.h | 8 +-
sbr/mts.c | 8 -
uip/post.c | 384 ++++++++++++++++++++++++++----------------------------
uip/send.c | 3 +
uip/whatnowsbr.c | 3 +
uip/whom.c | 3 +
13 files changed, 247 insertions(+), 282 deletions(-)
hooks/post-receive
--
The nmh Mail Handling System
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 15e3d453f414fc1b815ec4895960cad312e78ef9,
Ken Hornstein <=