From: David Levine Date: Tue, 23 Apr 2013 03:00:38 +0000 (-0500) Subject: Completed commit 52a236230220232fd632b5aa88eb9bb31dba346e so X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/af429a902add614e35cd76d15172a4ccb70a3be1?hp=62ab3819f29a419801665c74944d973101c9c466 Completed commit 52a236230220232fd632b5aa88eb9bb31dba346e so that send(1)/post(1) use "credentials" profile entry. post doesn't read the profile so pass the credentials setting to it via a new switch. --- diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index 3e8f3246..231bdaef 100644 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -818,7 +818,7 @@ sm_auth_sasl(char *user, int saslssf, char *mechlist, char *inhost) sasl_security_properties_t secprops; sasl_ssf_t *ssf; int *outbufmax; - char *pass = NULL; + struct nmh_creds creds = { 0, 0, 0 }; /* * Initialize the callback contexts @@ -857,9 +857,11 @@ sm_auth_sasl(char *user, int saslssf, char *mechlist, char *inhost) callbacks[SM_SASL_N_CB_USER].context = user; callbacks[SM_SASL_N_CB_AUTHNAME].context = user; + nmh_get_credentials (host, user, 1, &creds); + sasl_pw_context[0] = host; - sasl_pw_context[1] = user; - sasl_pw_context[2] = pass; + sasl_pw_context[1] = creds.user; + sasl_pw_context[2] = creds.password; callbacks[SM_SASL_N_CB_PASS].context = sasl_pw_context; @@ -960,7 +962,6 @@ sm_auth_sasl(char *user, int saslssf, char *mechlist, char *inhost) } else { result = sasl_decode64(sm_reply.text, sm_reply.length, outbuf, sizeof(outbuf), &outlen); - if (result != SASL_OK) { smtalk(SM_AUTH, "*"); sm_ierror("SASL base64 decode failed: %s", diff --git a/uip/post.c b/uip/post.c index 84bc1418..69f5b821 100644 --- a/uip/post.c +++ b/uip/post.c @@ -89,6 +89,7 @@ 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, @@ -494,6 +495,21 @@ main (int argc, char **argv) save_mts_method (cp); continue; + case CREDENTIALSSW: { + /* post doesn't read the profile, so insert credentials + entry the hard way. */ + struct node *np = (struct node *) mh_xmalloc (sizeof *np); + + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + np->n_name = "credentials"; + np->n_field = cp; + np->n_context = 0; + np->n_next = m_defs; + m_defs = np; + continue; + } + case MESSAGEIDSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); diff --git a/uip/send.c b/uip/send.c index c5c3f91a..cd08bd28 100644 --- a/uip/send.c +++ b/uip/send.c @@ -137,13 +137,19 @@ main (int argc, char **argv) vec[vecp++] = getcpy (m_maildir ("")); if ((cp = context_find ("fileproc"))) { - vec[vecp++] = "-fileproc"; - vec[vecp++] = cp; + vec[vecp++] = "-fileproc"; + vec[vecp++] = cp; } if ((cp = context_find ("mhlproc"))) { - vec[vecp++] = "-mhlproc"; - vec[vecp++] = cp; + vec[vecp++] = "-mhlproc"; + vec[vecp++] = cp; + } + + if ((cp = context_find ("credentials"))) { + /* post doesn't read context so need to pass credentials. */ + vec[vecp++] = "-credentials"; + vec[vecp++] = cp; } while ((cp = *argp++)) {