aboutsummaryrefslogtreecommitdiffstats
path: root/pop3.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2002-03-09 04:17:15 +0000
committerEric S. Raymond <esr@thyrsus.com>2002-03-09 04:17:15 +0000
commit59600d8b6d22683c2b5cd79ee7bfe31596d038b2 (patch)
treedabac9d0732e3ef5eccf1f64d1c9175b4379de2b /pop3.c
parent018f610b96ae9d39e95452beb6639afbd6d9c8a3 (diff)
downloadfetchmail-59600d8b6d22683c2b5cd79ee7bfe31596d038b2.tar.gz
fetchmail-59600d8b6d22683c2b5cd79ee7bfe31596d038b2.tar.bz2
fetchmail-59600d8b6d22683c2b5cd79ee7bfe31596d038b2.zip
Minor fixes.
svn path=/trunk/; revision=3584
Diffstat (limited to 'pop3.c')
-rw-r--r--pop3.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/pop3.c b/pop3.c
index fac2b185..41723b48 100644
--- a/pop3.c
+++ b/pop3.c
@@ -141,6 +141,9 @@ static int pop3_getauth(int sock, struct query *ctl, char *greeting)
#ifdef OPIE_ENABLE
flag has_otp = FALSE;
#endif /* OPIE_ENABLE */
+#ifdef SSL_ENABLE
+ flag has_ssl = FALSE;
+#endif /* SSL_ENABLE */
#ifdef SDPS_ENABLE
/*
@@ -207,6 +210,10 @@ static int pop3_getauth(int sock, struct query *ctl, char *greeting)
{
if (DOTLINE(buffer))
break;
+#ifdef SSL_ENABLE
+ if (strstr(buffer, "STLS"))
+ has_ssl = TRUE;
+#endif /* SSL_ENABLE */
#if defined(GSSAPI)
if (strstr(buffer, "GSSAPI"))
has_gssapi = TRUE;
@@ -224,6 +231,27 @@ static int pop3_getauth(int sock, struct query *ctl, char *greeting)
}
}
+#ifdef SSL_ENABLE
+ if (has_ssl &&
+#if INET6_ENABLE
+ ctl->server.service && (strcmp(ctl->server.service, "pop3s"))
+#else /* INET6_ENABLE */
+ ctl->server.port != 995
+#endif /* INET6_ENABLE */
+ )
+ {
+ char *realhost;
+
+ realhost = ctl->server.via ? ctl->server.via : ctl->server.pollname; gen_transact(sock, "STLS");
+ if (SSLOpen(sock,ctl->sslcert,ctl->sslkey,ctl->sslproto,ctl->sslcertck, ctl->sslcertpath,ctl->sslfingerprint,realhost,ctl->server.pollname) == -1)
+ {
+ report(stderr,
+ GT_("SSL connection failed.\n"));
+ return(PS_AUTHFAIL);
+ }
+ }
+#endif /* SSL_ENABLE */
+
/*
* OK, we have an authentication type now.
*/