]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/SslErrorData.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / acl / SslErrorData.cc
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10 #include "acl/Checklist.h"
11 #include "acl/SslErrorData.h"
12 #include "security/CertError.h"
13 #include "ssl/ErrorDetail.h"
14
15 ACLSslErrorData::ACLSslErrorData(ACLSslErrorData const &o) :
16 values(o.values)
17 {}
18
19 bool
20 ACLSslErrorData::match(const Security::CertErrors *toFind)
21 {
22 for (const auto *err = toFind; err; err = err->next) {
23 if (values.count(err->element.code))
24 return true;
25 }
26 return false;
27 }
28
29 SBufList
30 ACLSslErrorData::dump() const
31 {
32 SBufList sl;
33 for (const auto &e : values) {
34 sl.push_back(SBuf(Ssl::GetErrorName(e)));
35 }
36 return sl;
37 }
38
39 void
40 ACLSslErrorData::parse()
41 {
42 while (char *t = ConfigParser::strtokFile()) {
43 Ssl::ParseErrorString(t, values);
44 }
45 }
46
47 ACLSslErrorData *
48 ACLSslErrorData::clone() const
49 {
50 return new ACLSslErrorData(*this);
51 }
52