#include <ErrorDetail.h>

Collaboration diagram for Ssl::ErrorDetail:

Classes

class  err_frm_code
 

Public Member Functions

 ErrorDetail (Security::ErrorCode err_no, X509 *peer, X509 *broken, const char *aReason=NULL)
 
 ErrorDetail (ErrorDetail const &)
 
const StringtoString () const
 An error detail string to embed in squid error pages. More...
 
void useRequest (HttpRequest *aRequest)
 
const char * errorName () const
 The error name to embed in squid error pages. More...
 
Security::ErrorCode errorNo () const
 The error no. More...
 
void setLibError (unsigned long lib_err_no)
 Sets the low-level error returned by OpenSSL ERR_get_error() More...
 
X509 * peerCert ()
 the peer certificate More...
 
X509 * brokenCert ()
 peer or intermediate certificate that failed validation More...
 

Private Types

typedef const char *(ErrorDetail::* fmt_action_t )() const
 

Private Member Functions

const char * subject () const
 
const char * ca_name () const
 
const char * cn () const
 
const char * notbefore () const
 
const char * notafter () const
 
const char * err_code () const
 
const char * err_descr () const
 
const char * err_lib_error () const
 
int convert (const char *code, const char **value) const
 
void buildDetail () const
 

Private Attributes

String errDetailStr
 Caches the error detail message. More...
 
Security::ErrorCode error_no
 The error code. More...
 
unsigned long lib_error_no
 low-level error returned by OpenSSL ERR_get_error(3SSL) More...
 
Security::CertPointer peer_cert
 A pointer to the peer certificate. More...
 
Security::CertPointer broken_cert
 A pointer to the broken certificate (peer or intermediate) More...
 
String errReason
 A custom reason for error, else retrieved from OpenSSL. More...
 
ErrorDetailEntry detailEntry
 
HttpRequest::Pointer request
 

Static Private Attributes

static err_frm_code ErrorFormatingCodes []
 The supported formating codes. More...
 

Detailed Description

Used to pass SSL error details to the error pages returned to the end user.

Definition at line 42 of file ErrorDetail.h.

Member Typedef Documentation

typedef const char*(ErrorDetail::* Ssl::ErrorDetail::fmt_action_t)() const
private

Definition at line 61 of file ErrorDetail.h.

Constructor & Destructor Documentation

Ssl::ErrorDetail::ErrorDetail ( Security::ErrorCode  err_no,
X509 *  peer,
X509 *  broken,
const char *  aReason = NULL 
)

Definition at line 631 of file ErrorDetail.cc.

References broken_cert, detailEntry, Ssl::ErrorDetailEntry::error_no, and peer_cert.

Ssl::ErrorDetail::ErrorDetail ( Ssl::ErrorDetail const &  anErrDetail)

Definition at line 644 of file ErrorDetail.cc.

References broken_cert, detailEntry, error_no, lib_error_no, peer_cert, request, and request().

Member Function Documentation

X509* Ssl::ErrorDetail::brokenCert ( )
inline

Definition at line 59 of file ErrorDetail.h.

References broken_cert.

void Ssl::ErrorDetail::buildDetail ( ) const
private

It uses the convert method to build the string errDetailStr using a template message for the current SSL error. The template messages can also contain normal error pages formating codes. Currently the error template messages are hard-coded

Definition at line 598 of file ErrorDetail.cc.

References assert, Ssl::ErrorDetailsManager::GetInstance(), NULL, p, request(), and SslErrorDetailDefaultStr.

const char * Ssl::ErrorDetail::ca_name ( ) const
private

The issuer name

Definition at line 477 of file ErrorDetail.cc.

const char * Ssl::ErrorDetail::cn ( ) const
private

The list with certificates cn and alternate names

< A temporary string buffer

Definition at line 462 of file ErrorDetail.cc.

References String::clean(), copy_cn(), Ssl::matchX509CommonNames(), String::size(), and String::termedBuf().

int Ssl::ErrorDetail::convert ( const char *  code,
const char **  value 
) const
private

Converts the code to a string value. Supported formating codes are:

Error meta information: err_name: The name of a high-level SSL error (e.g., X509_V_ERR_*) ssl_error_descr: A short description of the SSL error ssl_lib_error: human-readable low-level error string by Security::ErrorString()

Certificate information extracted from broken (not necessarily peer!) cert ssl_cn: The comma-separated list of common and alternate names ssl_subject: The certificate subject ssl_ca_name: The certificate issuer name ssl_notbefore: The certificate "not before" field ssl_notafter: The certificate "not after" field

Return values
thelength of the code (the number of characters will be replaced by value)

Definition at line 578 of file ErrorDetail.cc.

References action(), i, len, and NULL.

const char * Ssl::ErrorDetail::err_code ( ) const
private

The string representation of the error_no

Definition at line 520 of file ErrorDetail.cc.

References Ssl::GetErrorName().

Referenced by errorName().

const char * Ssl::ErrorDetail::err_descr ( ) const
private

A short description of the error_no

Definition at line 542 of file ErrorDetail.cc.

const char * Ssl::ErrorDetail::err_lib_error ( ) const
private

Definition at line 551 of file ErrorDetail.cc.

References Security::ErrorString().

const char* Ssl::ErrorDetail::errorName ( ) const
inline

Definition at line 51 of file ErrorDetail.h.

References err_code().

Referenced by ErrorState::Convert().

Security::ErrorCode Ssl::ErrorDetail::errorNo ( ) const
inline

Definition at line 53 of file ErrorDetail.h.

References error_no.

Referenced by ErrorState::BuildHttpReply().

const char * Ssl::ErrorDetail::notafter ( ) const
private

The certificate "not after" field

Definition at line 505 of file ErrorDetail.cc.

References Ssl::asn1timeToString().

const char * Ssl::ErrorDetail::notbefore ( ) const
private

The certificate "not before" field

Definition at line 490 of file ErrorDetail.cc.

References Ssl::asn1timeToString().

X509* Ssl::ErrorDetail::peerCert ( )
inline

Definition at line 57 of file ErrorDetail.h.

References peer_cert.

Referenced by Ssl::PeekingPeerConnector::noteNegotiationDone().

void Ssl::ErrorDetail::setLibError ( unsigned long  lib_err_no)
inline

Definition at line 55 of file ErrorDetail.h.

References lib_error_no.

Referenced by Security::PeerConnector::noteNegotiationError().

const char * Ssl::ErrorDetail::subject ( ) const
private

The subject of the current certification in text form

Definition at line 435 of file ErrorDetail.cc.

References broken_cert.

const String & Ssl::ErrorDetail::toString ( ) const

Definition at line 624 of file ErrorDetail.cc.

Referenced by ErrorState::Convert().

void Ssl::ErrorDetail::useRequest ( HttpRequest aRequest)
inline

Definition at line 49 of file ErrorDetail.h.

References NULL, and request.

Referenced by ErrorState::Convert().

Member Data Documentation

Security::CertPointer Ssl::ErrorDetail::broken_cert
private

Definition at line 89 of file ErrorDetail.h.

Referenced by brokenCert(), ErrorDetail(), and subject().

ErrorDetailEntry Ssl::ErrorDetail::detailEntry
mutableprivate

Definition at line 91 of file ErrorDetail.h.

Referenced by ErrorDetail().

String Ssl::ErrorDetail::errDetailStr
mutableprivate

Definition at line 85 of file ErrorDetail.h.

Security::ErrorCode Ssl::ErrorDetail::error_no
private

Definition at line 86 of file ErrorDetail.h.

Referenced by ErrorDetail(), and errorNo().

Ssl::ErrorDetail::err_frm_code Ssl::ErrorDetail::ErrorFormatingCodes
staticprivate
Initial value:
= {
{"ssl_subject", &Ssl::ErrorDetail::subject},
{"ssl_ca_name", &Ssl::ErrorDetail::ca_name},
{"ssl_cn", &Ssl::ErrorDetail::cn},
{"ssl_notbefore", &Ssl::ErrorDetail::notbefore},
{"ssl_notafter", &Ssl::ErrorDetail::notafter},
{"ssl_error_descr", &Ssl::ErrorDetail::err_descr},
{"ssl_lib_error", &Ssl::ErrorDetail::err_lib_error},
}

Definition at line 71 of file ErrorDetail.h.

String Ssl::ErrorDetail::errReason
private

Definition at line 90 of file ErrorDetail.h.

unsigned long Ssl::ErrorDetail::lib_error_no
private

Definition at line 87 of file ErrorDetail.h.

Referenced by ErrorDetail(), and setLibError().

Security::CertPointer Ssl::ErrorDetail::peer_cert
private

Definition at line 88 of file ErrorDetail.h.

Referenced by ErrorDetail(), and peerCert().

HttpRequest::Pointer Ssl::ErrorDetail::request
private

Definition at line 92 of file ErrorDetail.h.

Referenced by ErrorDetail(), and useRequest().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors