]> git.ipfire.org Git - thirdparty/squid.git/commit
Fix printing Security::ErrorDetail (#1129)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 2 Sep 2022 11:08:48 +0000 (11:08 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 2 Sep 2022 11:08:55 +0000 (11:08 +0000)
commit1f8dd0b274e2e99394071132a17922bc6cd4488d
treeec21dfede1478cd1beab266e628c9bfef4f7f748
parent23b7963096624f0b49f979e553e74bc040532fcb
Fix printing Security::ErrorDetail (#1129)

Squid dumps RefCount pointer details instead of the intended TLS error
details like "SQUID_TLS_ERR_ACCEPT+TLS_LIB_ERR=14094418":

    ERROR: failure while accepting a TLS connection...: 0x564017165ef0*1

We overload operator "<<" for ErrorDetail::Pointer to report errors, but
the compiler picks our generic operator "<<" overload for RefCount<C>
instead. I believe this happens because the actual type of the
being-printed handshakeResult.errorDetail object (i.e.
Security::IoResult::ErrorDetailPointer) is not ErrorDetail::Pointer but
Security::ErrorDetail::Pointer; there is no overload for the latter.

This simple solution "works" but it does not solve the underlying
problem: Other ErrorDetail kids (existing and future) and other similar
class hierarchies using RefCount pointers (e.g., Http::Message) are or
will be mishandled because of missing kid-specific overloads.

To properly address this XXX, we probably should add traits/interfaces
to all RefCountable classes that want their Pointers to be printed
specially (e.g., ErrorDetail) _and_ teach our generic operator "<<"
overload for RefCount<C> to honor those. Also, an InstanceId data member
might be recognized/printed by default instead of the memory address; it
may even be added to RefCountable.
src/error/Detail.h
src/security/ErrorDetail.h
src/tests/stub_liberror.cc