diff options
author | Anthony Neal <aneal@zeroc.com> | 2002-03-18 17:51:29 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2002-03-18 17:51:29 +0000 |
commit | 0e943ab6c7159ac053a9d4da4ff6ac37c801ff38 (patch) | |
tree | 07b6189539cfd40c9c6bbf579d0e4b0bb205dbe3 /cpp/src/Ice/ConfigParserErrorReporter.cpp | |
parent | bug fix: create copy of Identity (diff) | |
download | ice-0e943ab6c7159ac053a9d4da4ff6ac37c801ff38.tar.bz2 ice-0e943ab6c7159ac053a9d4da4ff6ac37c801ff38.tar.xz ice-0e943ab6c7159ac053a9d4da4ff6ac37c801ff38.zip |
Renamed all the Ssl* files. Modified the config/TestUtil.py file to include
a clientServerHybridTest - handles the test case that client and server
are BOTH client and server roles.
Diffstat (limited to 'cpp/src/Ice/ConfigParserErrorReporter.cpp')
-rw-r--r-- | cpp/src/Ice/ConfigParserErrorReporter.cpp | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/cpp/src/Ice/ConfigParserErrorReporter.cpp b/cpp/src/Ice/ConfigParserErrorReporter.cpp new file mode 100644 index 00000000000..fdbe17eebd3 --- /dev/null +++ b/cpp/src/Ice/ConfigParserErrorReporter.cpp @@ -0,0 +1,116 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <iostream> +#include <sstream> + +#include <sax/SAXParseException.hpp> +#include <Ice/ConfigParserErrorReporter.h> +#include <stdlib.h> +#include <string.h> +#include <Ice/TraceLevels.h> +#include <Ice/Logger.h> +#include <Ice/OpenSSL.h> + +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) : + _sawErrors(false), + _traceLevels(traceLevels), + _logger(logger) +{ +} + +IceSSL::ConfigParserErrorReporter::~ConfigParserErrorReporter() +{ +} + +void +IceSSL::ConfigParserErrorReporter::warning(const SAXParseException& toCatch) +{ + if (_traceLevels->security >= IceSSL::SECURITY_PARSE_WARNINGS) + { + ostringstream s; + + s << "SSL configuration file parse warning." << endl; + s << "Xerces-c Init Exception: Warning at file \"" << flush; + s << DOMString(toCatch.getSystemId()) << flush; + s << "\", line " << toCatch.getLineNumber() << flush; + s << ", column " << toCatch.getColumnNumber() << flush; + s << "\n Message: " << DOMString(toCatch.getMessage()) << endl; + + _logger->trace(_traceLevels->securityCat, "PWN " + s.str()); + } +} + +void +IceSSL::ConfigParserErrorReporter::error(const SAXParseException& toCatch) +{ + _sawErrors = true; + + if (_traceLevels->security >= IceSSL::SECURITY_PARSE_WARNINGS) + { + ostringstream s; + + s << "SSL configuration file parse error." << endl; + s << "Xerces-c Init Exception: Error at file \"" << flush; + s << DOMString(toCatch.getSystemId()) << flush; + s << "\", line " << toCatch.getLineNumber() << flush; + s << ", column " << toCatch.getColumnNumber() << flush; + s << "\n Message: " << DOMString(toCatch.getMessage()) << endl; + + _logger->trace(_traceLevels->securityCat, "PWN " + s.str()); + } +} + +void +IceSSL::ConfigParserErrorReporter::fatalError(const SAXParseException& toCatch) +{ + _sawErrors = true; + + if (_traceLevels->security >= IceSSL::SECURITY_PARSE_WARNINGS) + { + ostringstream s; + + s << "SSL configuration file parse error." << endl; + s << "Xerces-c Init Exception: Fatal error at file \"" << flush; + s << DOMString(toCatch.getSystemId()) << flush; + s << "\", line " << toCatch.getLineNumber() << flush; + s << ", column " << toCatch.getColumnNumber() << flush; + s << "\n Message: " << DOMString(toCatch.getMessage()) << endl; + + _logger->trace(_traceLevels->securityCat, "PWN " + s.str()); + } +} + +void +IceSSL::ConfigParserErrorReporter::resetErrors() +{ + // No-op in this case +} + +bool +IceSSL::ConfigParserErrorReporter::getSawErrors() const +{ + return _sawErrors; +} + +std::ostream& +IceSSL::operator << (std::ostream& target, const DOMString& s) +{ + char *p = s.transcode(); + target << p; + delete [] p; + return target; +} |