]> diplodocus.org Git - nmh/blobdiff - uip/inc.c
m_getfld: Shuffle `delim' assignments slightly.
[nmh] / uip / inc.c
index 62c56eb17f5ef749df7f807190aae405f9ac5b8c..b32b3e1f1f1eff0c6cb3f64dd7432fb72d6309a8 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -75,6 +75,8 @@
     X("saslmech", 0, SASLMECHSW) \
     X("initialtls", TLSminc(-10), INITTLSSW) \
     X("notls", TLSminc(-5), NOTLSSW) \
+    X("certverify", TLSminc(-10), CERTVERSW) \
+    X("nocertverify", TLSminc(-12), NOCERTVERSW) \
     X("authservice", 0, AUTHSERVICESW) \
     X("proxy command", 0, PROXYSW) \
 
@@ -176,10 +178,9 @@ maildir_srt(const void *va, const void *vb)
     const struct Maildir_entry *a = va, *b = vb;
     if (a->mtime > b->mtime)
       return 1;
-    else if (a->mtime < b->mtime)
+    if (a->mtime < b->mtime)
       return -1;
-    else
-      return 0;
+    return 0;
 }
 
 int
@@ -188,7 +189,7 @@ main (int argc, char **argv)
     int chgflag = 1, trnflag = 1;
     int noisy = 1, width = -1;
     int hghnum = 0, msgnum = 0;
-    int sasl = 0, tls = 0;
+    int sasl = 0, tls = 0, noverify = 1;
     int incerr = 0; /* <0 if inc hits an error which means it should not truncate mailspool */
     char *cp, *maildir = NULL, *folder = NULL;
     char *format = NULL, *form = NULL;
@@ -364,6 +365,14 @@ main (int argc, char **argv)
                tls = 0;
                continue;
 
+           case CERTVERSW:
+               noverify = 0;
+               continue;
+
+           case NOCERTVERSW:
+               noverify++;
+               continue;
+
            case AUTHSERVICESW:
 #ifdef OAUTH_SUPPORT
                 if (!(auth_svc = *argp++) || *auth_svc == '-')
@@ -413,25 +422,29 @@ main (int argc, char **argv)
      * a POP server?
      */
     if (inc_type == INC_POP) {
-       struct nmh_creds creds = { 0, 0, 0 };
+       int tlsflag = 0;
 
        if (auth_svc == NULL) {
            if (saslmech  &&  ! strcasecmp(saslmech, "xoauth2")) {
                adios (NULL, "must specify -authservice with -saslmech xoauth2");
            }
-           nmh_get_credentials (host, user, sasl, &creds);
        } else {
            if (user == NULL) {
                adios (NULL, "must specify -user with -saslmech xoauth2");
            }
-           creds.user = user;
        }
 
+       if (tls)
+           tlsflag |= P_INITTLS;
+
+       if (noverify)
+           tlsflag |= P_NOVERIFY;
+
        /*
         * initialize POP connection
         */
-       if (pop_init (host, port, creds.user, creds.password, proxy, snoop,
-                     sasl, saslmech, tls, auth_svc) == NOTOK)
+       if (pop_init (host, port, user, proxy, snoop, sasl, saslmech,
+                     tlsflag, auth_svc) == NOTOK)
            adios (NULL, "%s", response);
 
        /* Check if there are any messages */
@@ -511,7 +524,7 @@ main (int argc, char **argv)
            qsort (Maildir, num_maildir_entries, sizeof(*Maildir), maildir_srt);
        }
 
-       if ((cp = strdup(newmail)) == (char *)0)
+       if ((cp = strdup(newmail)) == NULL)
            adios (NULL, "error allocating memory to copy newmail");
 
        newmail = cp;
@@ -527,7 +540,7 @@ main (int argc, char **argv)
        folder = getfolder (0);
     maildir = m_maildir (folder);
 
-    if ((maildir_copy = strdup(maildir)) == (char *)0)
+    if ((maildir_copy = strdup(maildir)) == NULL)
         adios (maildir, "error allocating memory to copy maildir");
 
     if (!folder_exists(maildir)) {
@@ -771,7 +784,7 @@ go_to_it:
                 */
 
                (void)snprintf(b, sizeof (b), "%s/%d", maildir_copy, msgnum + 1);
-               (void)ext_hook("add-hook", b, (char *)0);
+               (void)ext_hook("add-hook", b, NULL);
 
                if (aud)
                    fputs (charstring_buffer (scanl), aud);
@@ -852,7 +865,7 @@ go_to_it:
                 */
 
                (void)snprintf(b, sizeof (b), "%s/%d", maildir_copy, msgnum + 1);
-               (void)ext_hook("add-hook", b, (char *)0);
+               (void)ext_hook("add-hook", b, NULL);
 
                if (aud)
                    fputs (charstring_buffer (scanl), aud);