From 675c4cd3c2c58641ee25212cd429a0b25d7e6c44 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sun, 30 Oct 2005 15:24:33 +0000 Subject: [PATCH] Fixed problem with 'no_auth_information' exception when SASL support is disabled. --- src/exception.cpp | 39 ++++++++++++++++++++++++------------- vmime/exception.hpp | 47 ++++++++++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 29 deletions(-) diff --git a/src/exception.cpp b/src/exception.cpp index bc599c76..9cfd2201 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -677,6 +677,30 @@ const char* file_not_found::name() const throw() { return "file_not_found"; } #endif // VMIME_HAVE_FILESYSTEM_FEATURES +// +// authentication_exception +// + +authentication_exception::~authentication_exception() throw() {} +authentication_exception::authentication_exception(const string& what, const exception& other) + : exception(what, other) {} + +exception* authentication_exception::clone() const { return new authentication_exception(*this); } +const char* authentication_exception::name() const throw() { return "authentication_exception"; } + + +// +// no_auth_information +// + +no_auth_information::~no_auth_information() throw() {} +no_auth_information::no_auth_information(const exception& other) + : authentication_exception("Information cannot be provided.", other) {} + +exception* no_auth_information::clone() const { return new no_auth_information(*this); } +const char* no_auth_information::name() const throw() { return "no_auth_information"; } + + #if VMIME_HAVE_SASL_SUPPORT @@ -686,7 +710,7 @@ const char* file_not_found::name() const throw() { return "file_not_found"; } sasl_exception::~sasl_exception() throw() {} sasl_exception::sasl_exception(const string& what, const exception& other) - : exception(what, other) {} + : authentication_exception(what, other) {} exception* sasl_exception::clone() const { return new sasl_exception(*this); } const char* sasl_exception::name() const throw() { return "sasl_exception"; } @@ -704,18 +728,6 @@ exception* no_such_mechanism::clone() const { return new no_such_mechanism(*this const char* no_such_mechanism::name() const throw() { return "no_such_mechanism"; } -// -// no_auth_information -// - -no_auth_information::~no_auth_information() throw() {} -no_auth_information::no_auth_information(const exception& other) - : sasl_exception("Information cannot be provided.", other) {} - -exception* no_auth_information::clone() const { return new no_auth_information(*this); } -const char* no_auth_information::name() const throw() { return "no_auth_information"; } - - #endif // VMIME_HAVE_SASL_SUPPORT @@ -777,3 +789,4 @@ const char* unsupported_certificate_type::name() const throw() { return "unsuppo } // vmime + diff --git a/vmime/exception.hpp b/vmime/exception.hpp index 451fcfc8..04aa9d5a 100644 --- a/vmime/exception.hpp +++ b/vmime/exception.hpp @@ -819,13 +819,43 @@ public: #endif // VMIME_HAVE_FILESYSTEM_FEATURES +/** Authentication exception. + */ + +class authentication_exception : public vmime::exception +{ +public: + + authentication_exception(const string& what, const exception& other = NO_EXCEPTION); + ~authentication_exception() throw(); + + exception* clone() const; + const char* name() const throw(); +}; + + +/** The requested information cannot be provided. + */ + +class no_auth_information : public authentication_exception +{ +public: + + no_auth_information(const exception& other = NO_EXCEPTION); + ~no_auth_information() throw(); + + exception* clone() const; + const char* name() const throw(); +}; + + #if VMIME_HAVE_SASL_SUPPORT /** Base class for exceptions thrown by SASL module. */ -class sasl_exception : public vmime::exception +class sasl_exception : public authentication_exception { public: @@ -852,21 +882,6 @@ public: }; -/** The requested information cannot be provided. - */ - -class no_auth_information : public sasl_exception -{ -public: - - no_auth_information(const exception& other = NO_EXCEPTION); - ~no_auth_information() throw(); - - exception* clone() const; - const char* name() const throw(); -}; - - #endif // VMIME_HAVE_SASL_SUPPORT