]> diplodocus.org Git - nmh/commitdiff
Completed commit 52a236230220232fd632b5aa88eb9bb31dba346e so
authorDavid Levine <levinedl@acm.org>
Tue, 23 Apr 2013 03:00:38 +0000 (22:00 -0500)
committerDavid Levine <levinedl@acm.org>
Tue, 23 Apr 2013 03:00:38 +0000 (22:00 -0500)
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.

mts/smtp/smtp.c
uip/post.c
uip/send.c

index 3e8f324..231bdae 100644 (file)
@@ -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;
     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
 
     /*
      * 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;
 
     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[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;
 
 
     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);
        } 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",
            if (result != SASL_OK) {
                smtalk(SM_AUTH, "*");
                sm_ierror("SASL base64 decode failed: %s",
index 84bc141..69f5b82 100644 (file)
@@ -89,6 +89,7 @@
     X("fileproc", -4, FILEPROCSW) \
     X("mhlproc", -3, MHLPROCSW) \
     X("mts smtp|sendmail/smtp|sendmail/pipe", 2, MTSSW) \
     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,
     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;
 
                     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]);
                case MESSAGEIDSW:
                    if (!(cp = *argp++) || *cp == '-')
                        adios (NULL, "missing argument to %s", argp[-2]);
index c5c3f91..cd08bd2 100644 (file)
@@ -137,13 +137,19 @@ main (int argc, char **argv)
     vec[vecp++] = getcpy (m_maildir (""));
 
     if ((cp = context_find ("fileproc"))) {
     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"))) {
     }
 
     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++)) {
     }
 
     while ((cp = *argp++)) {