diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-04-24 21:13:00 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-04-24 21:13:00 +0000 |
commit | 5409c1ecef0f226dedc77721c0d2fc8dfe9e85de (patch) | |
tree | 97ba75bc47a143726d6d8382be3a462e51716700 /cpp/src/IceSSL/ConfigParserErrorReporter.cpp | |
parent | cleaning up sample impls (diff) | |
download | ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.bz2 ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.xz ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.zip |
merging from plugins branch
Diffstat (limited to 'cpp/src/IceSSL/ConfigParserErrorReporter.cpp')
-rw-r--r-- | cpp/src/IceSSL/ConfigParserErrorReporter.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/cpp/src/IceSSL/ConfigParserErrorReporter.cpp b/cpp/src/IceSSL/ConfigParserErrorReporter.cpp new file mode 100644 index 00000000000..99f0ffd7630 --- /dev/null +++ b/cpp/src/IceSSL/ConfigParserErrorReporter.cpp @@ -0,0 +1,103 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/TraceLevels.h> +#include <Ice/Logger.h> +#include <IceSSL/ConfigParserErrorReporter.h> +#include <IceSSL/OpenSSL.h> + +#include <sax/SAXParseException.hpp> + +#include <sstream> + +using namespace std; + +void ::IceInternal::incRef(::IceSSL::ConfigParserErrorReporter* p) { p->__incRef(); } +void ::IceInternal::decRef(::IceSSL::ConfigParserErrorReporter* p) { p->__decRef(); } + +IceSSL::ConfigParserErrorReporter::ConfigParserErrorReporter(const IceInternal::TraceLevelsPtr& traceLevels, + const Ice::LoggerPtr& logger) : + _traceLevels(traceLevels), + _logger(logger) +{ + _errorCount = 0; +} + +IceSSL::ConfigParserErrorReporter::~ConfigParserErrorReporter() +{ +} + +void +IceSSL::ConfigParserErrorReporter::warning(const SAXParseException& toCatch) +{ + if (_traceLevels->security >= IceSSL::SECURITY_PARSE_WARNINGS) + { + ostringstream s; + + s << "ssl configuration file parse error" << endl; + s << DOMString(toCatch.getSystemId()); + s << ", line " << toCatch.getLineNumber(); + s << ", column " << toCatch.getColumnNumber() << endl; + s << "Message " << DOMString(toCatch.getMessage()) << endl; + + _logger->trace(_traceLevels->securityCat, "PWN " + s.str()); + } +} + +void +IceSSL::ConfigParserErrorReporter::error(const SAXParseException& toCatch) +{ + _errorCount++; + + _errors << "ssl configuration file parse error" << endl; + _errors << " " << DOMString(toCatch.getSystemId()); + _errors << ", line " << toCatch.getLineNumber(); + _errors << ", column " << toCatch.getColumnNumber() << endl; + _errors << " " << "Message " << DOMString(toCatch.getMessage()) << endl; +} + +void +IceSSL::ConfigParserErrorReporter::fatalError(const SAXParseException& toCatch) +{ + _errorCount++; + + _errors << "ssl configuration file parse error" << endl; + _errors << " " << DOMString(toCatch.getSystemId()); + _errors << ", line " << toCatch.getLineNumber(); + _errors << ", column " << toCatch.getColumnNumber() << endl; + _errors << " " << "Message " << DOMString(toCatch.getMessage()) << endl; +} + +void +IceSSL::ConfigParserErrorReporter::resetErrors() +{ + // No-op in this case +} + +bool +IceSSL::ConfigParserErrorReporter::getSawErrors() const +{ + return (_errorCount == 0 ? false : true); +} + +string +IceSSL::ConfigParserErrorReporter::getErrors() const +{ + return _errors.str(); +} + +std::ostream& +IceSSL::operator << (std::ostream& target, const DOMString& s) +{ + char *p = s.transcode(); + target << p; + delete [] p; + return target; +} |