X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a2c417d3e1641ba4ab151b7945b90f55176705b1..4d0110006d4e72f82fb597f170c7d9991f2ca0bf:/uip/whom.c diff --git a/uip/whom.c b/uip/whom.c index 081978a5..145190b7 100644 --- a/uip/whom.c +++ b/uip/whom.c @@ -1,6 +1,4 @@ - -/* - * whom.c -- report to whom a message would be sent +/* whom.c -- report to whom a message would be sent * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -8,7 +6,10 @@ */ #include +#include #include +#include "sbr/m_maildir.h" +#include "sbr/m_mktemp.h" #ifndef CYRUS_SASL # define SASLminc(a) (a) @@ -42,8 +43,6 @@ X("tls", TLSminc(-3), TLSSW) \ X("initialtls", TLSminc(-10), INITTLSSW) \ X("notls", TLSminc(-5), NTLSSW) \ - X("eai", 0, EAISW) \ - X("noeai", 0, NEAISW) \ X("mts smtp|sendmail/smtp|sendmail/pipe", 0, MTSSW) \ #define X(sw, minchars, id) id, @@ -59,13 +58,13 @@ int main (int argc, char **argv) { pid_t child_id = OK; - int i, status, isdf = 0; + int status, isdf = 0; int distsw = 0, vecp = 0; char *cp, *dfolder = NULL, *dmsg = NULL; char *msg = NULL, **ap, **argp, backup[BUFSIZ]; char buf[BUFSIZ], **arguments, *vec[MAXARGS]; - if (nmh_init(argv[0], 1)) { return 1; } + if (nmh_init(argv[0], 2)) { return 1; } arguments = getarguments (invo_name, argc, argv, 1); argp = arguments; @@ -75,6 +74,12 @@ main (int argc, char **argv) vec[vecp++] = "-library"; vec[vecp++] = getcpy (m_maildir ("")); + if ((cp = context_find ("credentials"))) { + /* post doesn't read context so need to pass credentials. */ + vec[vecp++] = "-credentials"; + vec[vecp++] = cp; + } + /* Don't need to feed fileproc or mhlproc to post because it doesn't use them when used for whom. */ @@ -102,8 +107,6 @@ main (int argc, char **argv) case TLSSW: case INITTLSSW: case NTLSSW: - case EAISW: - case NEAISW: vec[vecp++] = --cp; continue; @@ -146,15 +149,14 @@ main (int argc, char **argv) } if (msg) adios (NULL, "only one draft at a time!"); - else - vec[vecp++] = msg = cp; + vec[vecp++] = msg = cp; } /* allow Aliasfile: profile entry */ if ((cp = context_find ("Aliasfile"))) { char *dp = NULL; - for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++) { + for (ap = brkstring(dp = mh_xstrdup(cp), " ", "\n"); ap && *ap; ap++) { vec[vecp++] = "-alias"; vec[vecp++] = *ap; } @@ -178,14 +180,13 @@ main (int argc, char **argv) closefds (3); - if (distsw) { - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep (5); - } + if (distsw) + child_id = fork(); switch (distsw ? child_id : OK) { case NOTOK: - advise (NULL, "unable to fork, so checking directly..."); + inform("unable to fork, so checking directly..."); + /* FALLTHRU */ case OK: execvp (postproc, vec); fprintf (stderr, "unable to exec ");