]> git.ipfire.org Git - thirdparty/squid.git/blame - src/acl/SslErrorData.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / acl / SslErrorData.cc
CommitLineData
1b26be8f 1/*
f70aedc4 2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
06390e4b 3 *
bbc27441
AJ
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.
1b26be8f 7 */
8
582c2af2 9#include "squid.h"
3ad63615 10#include "acl/Checklist.h"
602d9612 11#include "acl/SslErrorData.h"
92e3827b 12#include "security/CertError.h"
3d547d18 13#include "ssl/ErrorDetail.h"
1b26be8f 14
83f8d8f9
AJ
15ACLSslErrorData::ACLSslErrorData(ACLSslErrorData const &o) :
16 values(o.values)
1b26be8f 17{}
18
1b26be8f 19bool
92e3827b 20ACLSslErrorData::match(const Security::CertErrors *toFind)
1b26be8f 21{
83f8d8f9
AJ
22 for (const auto *err = toFind; err; err = err->next) {
23 if (values.count(err->element.code))
fb2178bb
CT
24 return true;
25 }
26 return false;
1b26be8f 27}
28
2cb8d372
FC
29SBufList
30ACLSslErrorData::dump() const
1b26be8f 31{
2cb8d372 32 SBufList sl;
83f8d8f9
AJ
33 for (const auto &e : values) {
34 sl.push_back(SBuf(Ssl::GetErrorName(e)));
1b26be8f 35 }
2cb8d372 36 return sl;
1b26be8f 37}
38
39void
40ACLSslErrorData::parse()
41{
16c5ad96 42 while (char *t = ConfigParser::strtokFile()) {
83f8d8f9 43 Ssl::ParseErrorString(t, values);
1b26be8f 44 }
45}
46
fb2178bb 47ACLSslErrorData *
1b26be8f 48ACLSslErrorData::clone() const
49{
1b26be8f 50 return new ACLSslErrorData(*this);
51}
f53969cc 52