X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/49c748c77f3c9b9ea024c4eb5d1d83855d7e7201..81661ad29fa62d2bbf7bdb4b499d65efb07954dc:/uip/post.c diff --git a/uip/post.c b/uip/post.c index 9b8bcbef..85894635 100644 --- a/uip/post.c +++ b/uip/post.c @@ -15,13 +15,9 @@ #include #include #include - #include #include -#include -#include - #ifdef HAVE_SYS_TIME_H # include #endif @@ -88,10 +84,12 @@ X("user", SASLminc(-4), USERSW) \ X("port server port name/number", 4, PORTSW) \ X("tls", TLSminc(-3), TLSSW) \ + X("initialtls", TLSminc(-10), INITTLSSW) \ X("notls", TLSminc(-5), NTLSSW) \ X("fileproc", -4, FILEPROCSW) \ X("mhlproc", -3, MHLPROCSW) \ X("mts smtp|sendmail/smtp|sendmail/pipe", 2, MTSSW) \ + X("credentials legacy|file:filename", 0, CREDENTIALSSW) \ X("messageid localname|random", 2, MESSAGEIDSW) \ #define X(sw, minchars, id) id, @@ -225,7 +223,6 @@ static char from[BUFSIZ]; /* my network address */ static char sender[BUFSIZ]; /* my Sender: header */ static char efrom[BUFSIZ]; /* my Envelope-From: header */ static char fullfrom[BUFSIZ]; /* full contents of 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 */ static char *fccfold[FCCS]; /* foldernames for FCC'ing */ @@ -468,7 +465,11 @@ main (int argc, char **argv) continue; case TLSSW: - tls++; + tls = 1; + continue; + + case INITTLSSW: + tls = 2; continue; case NTLSSW: @@ -493,6 +494,13 @@ main (int argc, char **argv) save_mts_method (cp); continue; + case CREDENTIALSSW: { + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + add_profile_entry ("credentials", cp); + continue; + } + case MESSAGEIDSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); @@ -640,9 +648,13 @@ main (int argc, char **argv) p_refile (tmpfil); unlink (tmpfil); - if (verbose) - printf (partno ? "Partial Message #%s Processed\n" : "Message Processed\n", - partno); + if (verbose) { + if (partno) + printf ("Partial Message #%s Processed\n", partno); + else + printf ("Message Processed\n"); + } + done (0); return 1; } @@ -657,7 +669,7 @@ putfmt (char *name, char *str, FILE *out) { int count, grp, i, keep; char *cp, *pp, *qp; - char namep[BUFSIZ]; + char namep[BUFSIZ], error[BUFSIZ]; struct mailname *mp = NULL, *np = NULL; struct headers *hdr; @@ -720,18 +732,20 @@ putfmt (char *name, char *str, FILE *out) tmpaddrs.m_next = NULL; for (count = 0; (cp = getname (str)); count++) - if ((mp = getm (cp, NULL, 0, AD_HOST, NULL))) { + if ((mp = getm (cp, NULL, 0, error, sizeof(error)))) { if (tmpaddrs.m_next) np->m_next = mp; else tmpaddrs.m_next = mp; np = mp; } - else + else { + admonish(cp, "%s", error); if (hdr->flags & HTRY) badadr++; else badmsg++; + } if (count < 1) { if (hdr->flags & HNIL) @@ -772,7 +786,8 @@ putfmt (char *name, char *str, FILE *out) if (np->m_gname) putgrp (namep, np->m_gname, out, hdr->flags); while ((cp = getname (pp))) { - if (!(mp = getm (cp, NULL, 0, AD_HOST, NULL))) { + if (!(mp = getm (cp, NULL, 0, error, sizeof(error)))) { + admonish(cp, "%s", error); badadr++; continue; } @@ -921,9 +936,6 @@ putfmt (char *name, char *str, FILE *out) static void start_headers (void) { - char *cp, sigbuf[BUFSIZ]; - struct mailname *mp; - time (&tclock); /* @@ -934,21 +946,6 @@ start_headers (void) efrom[0] = '\0'; sender[0] = '\0'; fullfrom[0] = '\0'; - - if ((cp = getfullname ()) && *cp) { - strncpy (sigbuf, cp, sizeof(sigbuf)); - snprintf (signature, sizeof(signature), "%s <%s>", - sigbuf, getlocaladdr()); - if ((cp = getname (signature)) == NULL) - adios (NULL, "getname () failed -- you lose extraordinarily big"); - if ((mp = getm (cp, NULL, 0, AD_HOST, NULL)) == NULL) - adios (NULL, "bad signature '%s'", sigbuf); - mnfree (mp); - while (getname ("")) - continue; - } else { - strncpy (signature, getlocaladdr(), sizeof(signature)); - } } @@ -1071,7 +1068,7 @@ get_header (char *header, struct headers *table) struct headers *h; for (h = table; h->value; h++) - if (!mh_strcasecmp (header, h->value)) + if (!strcasecmp (header ? header : "", h->value ? h->value : "")) return (h - table); return NOTOK; @@ -1172,9 +1169,11 @@ insert (struct mailname *np) : &netaddrs; mp->m_next; mp = mp->m_next) - if (!mh_strcasecmp (np->m_host, mp->m_next->m_host) - && !mh_strcasecmp (np->m_mbox, mp->m_next->m_mbox) - && np->m_bcc == mp->m_next->m_bcc) + 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 : "") && + np->m_bcc == mp->m_next->m_bcc) return 0; mp->m_next = np;