]> Pileus Git - ~andy/fetchmail/blob - tls.c
Doxygen-related comment fixes.
[~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 #ifdef HAVE_STRINGS_H
9 #include <strings.h>
10 #endif
11
12 /** return true if user allowed TLS */
13 int maybe_tls(struct query *ctl) {
14 #ifdef SSL_ENABLE
15          /* opportunistic  or forced TLS */
16     return (!ctl->sslproto || !strcasecmp(ctl->sslproto,"tls1"))
17         && !ctl->use_ssl;
18 #else
19     return 0;
20 #endif
21 }
22
23 /** return true if user requires TLS, note though that this code must
24  * always use a logical AND with maybe_tls(). */
25 int must_tls(struct query *ctl) {
26 #ifdef SSL_ENABLE
27     return maybe_tls(ctl)
28         && (ctl->sslfingerprint || ctl->sslcertck
29                 || (ctl->sslproto && !strcasecmp(ctl->sslproto, "tls1")));
30 #else
31     return 0;
32 #endif
33 }