]> Pileus Git - ~andy/fetchmail/blob - tls.c
Fix typo repsonsible -> responsible.
[~andy/fetchmail] / tls.c
1 /** \file tls.c - collect common TLS functionality 
2  * \author Matthias Andree
3  * \date 2006
4  */
5
6 #include "fetchmail.h"
7
8 #include <strings.h>
9
10 /** return true if user allowed TLS */
11 int maybe_tls(struct query *ctl) {
12 #ifdef SSL_ENABLE
13          /* opportunistic  or forced TLS */
14     return (!ctl->sslproto || !strcasecmp(ctl->sslproto,"tls1"))
15         && !ctl->use_ssl;
16 #else
17     (void)ctl;
18     return 0;
19 #endif
20 }
21
22 /** return true if user requires TLS, note though that this code must
23  * always use a logical AND with maybe_tls(). */
24 int must_tls(struct query *ctl) {
25 #ifdef SSL_ENABLE
26     return maybe_tls(ctl)
27         && (ctl->sslfingerprint || ctl->sslcertck
28                 || (ctl->sslproto && !strcasecmp(ctl->sslproto, "tls1")));
29 #else
30     (void)ctl;
31     return 0;
32 #endif
33 }