diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2006-11-26 10:11:39 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2006-11-26 10:11:39 +0000 |
commit | 250f0ed84ac892ea85654790cb83331dcbd8d44f (patch) | |
tree | 3dafcc1b4ad19134898eb3c917a9bc4773477a47 /tls.c | |
parent | 4f86b804ced0aaccc581393862b13ddcb077dd2c (diff) | |
download | fetchmail-250f0ed84ac892ea85654790cb83331dcbd8d44f.tar.gz fetchmail-250f0ed84ac892ea85654790cb83331dcbd8d44f.tar.bz2 fetchmail-250f0ed84ac892ea85654790cb83331dcbd8d44f.zip |
First step towards really fixing TLS vuln, CVE-2006-5867, still incomplete.
svn path=/branches/BRANCH_6-3/; revision=4962
Diffstat (limited to 'tls.c')
-rw-r--r-- | tls.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +/** \file tls.c - collect common TLS functionality + * \author Matthias Andree + * \year 2006 + */ + +#include "fetchmail.h" + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +/** return true if user allowed TLS */ +int maybe_tls(struct query *ctl) { +#ifdef SSL_ENABLE + /* opportunistic or forced TLS */ + return (!ctl->sslproto || !strcasecmp(ctl->sslproto,"tls1")) + && !ctl->use_ssl; +#else + return 0; +#endif +} + +/** return true if user requires TLS, note though that this code must + * always use a logical AND with maybe_tls(). */ +int must_tls(struct query *ctl) { +#ifdef SSL_ENABLE + return maybe_tls(ctl) + && (ctl->sslfingerprint || ctl->sslcertck + || (ctl->sslproto && !strcasecmp(ctl->sslproto, "tls1"))); +#else + return 0; +#endif +} |