ErrorDetail.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 #ifndef _SQUID_SSL_ERROR_DETAIL_H
10 #define _SQUID_SSL_ERROR_DETAIL_H
11 
12 #include "err_detail_type.h"
13 #include "ErrorDetailManager.h"
14 #include "HttpRequest.h"
15 #include "security/forward.h"
16 
17 namespace Ssl
18 {
24 bool ParseErrorString(const char *name, Security::Errors &);
25 
27 Security::ErrorCode GetErrorCode(const char *name);
28 
30 const char *GetErrorName(Security::ErrorCode value);
31 
33 const char *GetErrorDescr(Security::ErrorCode value);
34 
36 bool ErrorIsOptional(const char *name);
37 
43 {
44 public:
45  // if broken certificate is nil, the peer certificate is broken
46  ErrorDetail(Security::ErrorCode err_no, X509 *peer, X509 *broken, const char *aReason = NULL);
47  ErrorDetail(ErrorDetail const &);
48  const String &toString() const;
49  void useRequest(HttpRequest *aRequest) { if (aRequest != NULL) request = aRequest;}
51  const char *errorName() const {return err_code();}
55  void setLibError(unsigned long lib_err_no) {lib_error_no = lib_err_no;}
57  X509 *peerCert() { return peer_cert.get(); }
59  X509 *brokenCert() {return broken_cert.get(); }
60 private:
61  typedef const char * (ErrorDetail::*fmt_action_t)() const;
66  {
67  public:
68  const char *code;
70  };
72 
73  const char *subject() const;
74  const char *ca_name() const;
75  const char *cn() const;
76  const char *notbefore() const;
77  const char *notafter() const;
78  const char *err_code() const;
79  const char *err_descr() const;
80  const char *err_lib_error() const;
81 
82  int convert(const char *code, const char **value) const;
83  void buildDetail() const;
84 
85  mutable String errDetailStr;
87  unsigned long lib_error_no;
88  Security::CertPointer peer_cert;
89  Security::CertPointer broken_cert;
93 };
94 
95 }//namespace Ssl
96 #endif
97 
HttpRequest::Pointer request
Definition: ErrorDetail.h:92
const char * GetErrorName(Security::ErrorCode value)
The string representation of the TLS error "value".
Definition: ErrorDetail.cc:392
const char * GetErrorDescr(Security::ErrorCode value)
A short description of the TLS error "value".
Definition: ErrorDetail.cc:415
const char * ca_name() const
Definition: ErrorDetail.cc:477
X509 * brokenCert()
peer or intermediate certificate that failed validation
Definition: ErrorDetail.h:59
const char * subject() const
Definition: ErrorDetail.cc:435
int convert(const char *code, const char **value) const
Definition: ErrorDetail.cc:578
const char * code
The formating code.
Definition: ErrorDetail.h:68
Security::ErrorCode GetErrorCode(const char *name)
The Security::ErrorCode code of the error described by "name".
Definition: ErrorDetail.cc:345
unsigned long lib_error_no
low-level error returned by OpenSSL ERR_get_error(3SSL)
Definition: ErrorDetail.h:87
X509 * peerCert()
the peer certificate
Definition: ErrorDetail.h:57
bool ErrorIsOptional(const char *name)
Definition: ErrorDetail.cc:405
ErrorDetailEntry detailEntry
Definition: ErrorDetail.h:91
const char * err_descr() const
Definition: ErrorDetail.cc:542
void buildDetail() const
Definition: ErrorDetail.cc:598
const char * cn() const
Definition: ErrorDetail.cc:462
int ErrorCode
Squid defined error code (<0), an error code returned by X.509 API, or SSL_ERROR_NONE.
Definition: forward.h:116
fmt_action_t fmt_action
A pointer to the conversion method.
Definition: ErrorDetail.h:69
const char * err_lib_error() const
Definition: ErrorDetail.cc:551
const String & toString() const
An error detail string to embed in squid error pages.
Definition: ErrorDetail.cc:624
const char * err_code() const
Definition: ErrorDetail.cc:520
const char * errorName() const
The error name to embed in squid error pages.
Definition: ErrorDetail.h:51
String errDetailStr
Caches the error detail message.
Definition: ErrorDetail.h:85
unsigned char code
Definition: html_quote.c:20
Security::CertPointer broken_cert
A pointer to the broken certificate (peer or intermediate)
Definition: ErrorDetail.h:89
void useRequest(HttpRequest *aRequest)
Definition: ErrorDetail.h:49
Security::CertPointer peer_cert
A pointer to the peer certificate.
Definition: ErrorDetail.h:88
Security::ErrorCode error_no
The error code.
Definition: ErrorDetail.h:86
std::unordered_set< Security::ErrorCode > Errors
Definition: forward.h:133
const char * notafter() const
Definition: ErrorDetail.cc:505
String errReason
A custom reason for error, else retrieved from OpenSSL.
Definition: ErrorDetail.h:90
bool ParseErrorString(const char *name, Security::Errors &)
Definition: ErrorDetail.cc:356
Security::ErrorCode errorNo() const
The error no.
Definition: ErrorDetail.h:53
const char * notbefore() const
Definition: ErrorDetail.cc:490
ErrorDetail(Security::ErrorCode err_no, X509 *peer, X509 *broken, const char *aReason=NULL)
Definition: ErrorDetail.cc:631
static err_frm_code ErrorFormatingCodes[]
The supported formating codes.
Definition: ErrorDetail.h:71
void setLibError(unsigned long lib_err_no)
Sets the low-level error returned by OpenSSL ERR_get_error()
Definition: ErrorDetail.h:55
const char *(ErrorDetail::* fmt_action_t)() const
Definition: ErrorDetail.h:61
#define NULL
Definition: types.h:166

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors