]> diplodocus.org Git - nmh/blobdiff - uip/post.c
If format_datetime() returns null, store a copy of node->value on c->c_text
[nmh] / uip / post.c
index ef9c88032b50de1cba18571346edafdb9ae8b8e4..65526d231d397b587fae7287caea2a22857d5a02 100644 (file)
@@ -87,6 +87,7 @@
     X("notls", TLSminc(-5), NTLSSW) \
     X("fileproc", -4, FILEPROCSW) \
     X("mhlproc", -3, MHLPROCSW) \
+    X("sendmail program", 0, MTSSM) \
     X("mts smtp|sendmail/smtp|sendmail/pipe", 2, MTSSW) \
     X("credentials legacy|file:filename", 0, CREDENTIALSSW) \
     X("messageid localname|random", 2, MESSAGEIDSW) \
@@ -201,7 +202,7 @@ static int saslssf=-1;              /* Our maximum SSF for SASL              */
 static char *saslmech=NULL;    /* Force use of particular SASL mech     */
 static char *user=NULL;                /* Authenticate as this user             */
 static char *port="submission";        /* Name of server port for SMTP submission */
-static int tls=0;              /* Use TLS for encryption                */
+static int tls=-1;             /* Use TLS for encryption                */
 static int fromcount=0;                /* Count of addresses on From: header    */
 static int seensender=0;       /* Have we seen a Sender: header?        */
 
@@ -473,6 +474,12 @@ main (int argc, char **argv)
                    mhlproc = cp;
                    continue;
 
+               case MTSSM:
+                   if (!(cp = *argp++) || *cp == '-')
+                       adios (NULL, "missing argument to %s", argp[-2]);
+                    sendmail = cp;
+                   continue;
+
                case MTSSW:
                    if (!(cp = *argp++) || *cp == '-')
                        adios (NULL, "missing argument to %s", argp[-2]);
@@ -602,6 +609,21 @@ main (int argc, char **argv)
        envelope = from;
     }
 
+    if (tls == -1) {
+#ifdef TLS_SUPPORT
+       /*
+        * The user didn't specify any of the tls switches.  Try to
+        * help them by implying -initialtls if they're using port 465
+        * (smtps, until IANA revoked that registration in 1998).
+        */
+       tls = ! strcmp (port, "465")  ||  ! strcasecmp (port, "smtps")
+           ?  2
+           :  0;
+#else  /* ! TLS_SUPPORT */
+       tls = 0;
+#endif /* ! TLS_SUPPORT */
+    }
+
     /* If we are doing a "whom" check */
     if (whomsw) {
        /* This won't work with MTS_SENDMAIL_PIPE. */
@@ -699,7 +721,7 @@ putfmt (char *name, char *str, FILE *out)
     if (hdr->flags & HFCC) {
        if ((cp = strrchr(str, '\n')))
            *cp = 0;
-       for (cp = pp = str; (cp = strchr(pp, ',')); pp = cp) {
+       for (pp = str; (cp = strchr(pp, ',')); pp = cp) {
            *cp++ = 0;
            insert_fcc (hdr, pp);
        }