From: Ken Hornstein Date: Tue, 23 Apr 2019 00:30:24 +0000 (-0400) Subject: Final cleanup of POP STLS support X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/9ffc9180ae03e7cd4b334f665a43133e2ec91a37 Final cleanup of POP STLS support Perform final cleanup for support for the STLS command in POP. Add necessary switches to msgchk and add information to man pages. --- diff --git a/man/inc.man b/man/inc.man index 56764a31..eb1b3911 100644 --- a/man/inc.man +++ b/man/inc.man @@ -38,6 +38,7 @@ inc \- incorporate new mail to an nmh folder .IR mechanism ] .RB [ \-authservice .IR service ] +.RB [ \-tls ] .RB [ \-initialtls ] .RB [ \-notls ] .RB [ \-certverify " | " \-nocertverify ] @@ -286,11 +287,20 @@ for more details. If .B nmh has been compiled with TLS support, the +.B \-tls +and +.B \-initialtls +switches will require the negotiation of TLS when connecting +to the remote POP server. The +.B \-tls +switch will direct +.B inc +to negotiate TLS as part of the normal POP protocol using +the STLS command. The .B \-initialtls -switch will require the negotiation of TLS when connecting -to the remote POP server. +switch will direct .B inc -will negotiate TLS immediately after the connection has taken place, +to negotiate TLS immediately after the connection has taken place, before any POP commands are sent or received. Data encrypted by TLS is labeled `(tls-encrypted)' and `(tls-decrypted)' when viewing the POP transaction with the diff --git a/man/msgchk.man b/man/msgchk.man index 84a40ca9..7669f7a1 100644 --- a/man/msgchk.man +++ b/man/msgchk.man @@ -22,6 +22,7 @@ all/mail/nomail ] .RB [ \-sasl " | " \-nosasl ] .RB [ \-saslmech .IR mechanism ] +.RB [ \-tls ] .RB [ \-initialtls ] .RB [ \-notls ] .RB [ \-certverify " | " \-nocertverify ] @@ -155,9 +156,14 @@ for more details. If .B nmh has been compiled with TLS support, the +.B \-tls +and .B \-initialtls -switch will require the negotiation of TLS when connecting +switches will require the negotiation of TLS when connecting to the remote POP server. The +.B \-tls +switch will negotiate TLS as part of the normal POP protocol using +the STLS command. The .B \-initialtls switch will negotiate TLS immediately after the connection has taken place, before any POP commands are sent or received. Data encrypted by TLS is diff --git a/uip/msgchk.c b/uip/msgchk.c index ca3e3826..82541ec5 100644 --- a/uip/msgchk.c +++ b/uip/msgchk.c @@ -48,6 +48,7 @@ X("nosasl", SASLminc(6), NOSASLSW) \ X("saslmech", SASLminc(5), SASLMECHSW) \ X("authservice", SASLminc(0), AUTHSERVICESW) \ + X("tls", TLSminc(-3), TLSSW) \ X("initialtls", TLSminc(-10), INITTLSSW) \ X("notls", TLSminc(-5), NOTLSSW) \ X("certverify", TLSminc(-10), CERTVERSW) \ @@ -89,7 +90,7 @@ main (int argc, char **argv) int notifysw = NT_ALL; int status = 0; bool sasl = false; - bool tls = false; + int tls = 0; bool noverify = false; bool snoop = false; int vecp = 0; @@ -176,12 +177,16 @@ main (int argc, char **argv) die("missing argument to %s", argp[-2]); continue; + case TLSSW: + tls = 1; + continue; + case INITTLSSW: - tls = true; + tls = 2; continue; case NOTLSSW: - tls = false; + tls = 0; continue; case CERTVERSW: @@ -232,8 +237,10 @@ main (int argc, char **argv) if (host) { int tlsflag = 0; - if (tls) - tlsflag |= P_INITTLS; + if (tls == 1) + tlsflag = P_STARTTLS; + else if (tls == 2) + tlsflag = P_INITTLS; if (noverify) tlsflag |= P_NOVERIFY;