summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp6
-rw-r--r--indra/newview/llcommandlineparser.cpp25
-rw-r--r--indra/newview/llsecapi.cpp3
-rw-r--r--indra/newview/llsecapi.h10
-rw-r--r--indra/newview/llsechandler_basic.cpp53
5 files changed, 51 insertions, 46 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a812a5e518..fdef556589 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -122,6 +122,7 @@
#include "llleap.h"
#include "stringize.h"
#include "llcoros.h"
+#include "llexception.h"
#if !LL_LINUX
#include "cef/llceflib.h"
#endif
@@ -131,6 +132,7 @@
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/regex.hpp>
+#include <boost/throw_exception.hpp>
#if LL_WINDOWS
# include <share.h> // For _SH_DENYWR in processMarkerFiles
@@ -231,8 +233,6 @@
#include "llcoproceduremanager.h"
#include "llviewereventrecorder.h"
-#include <stdexcept>
-
// *FIX: These extern globals should be cleaned up.
// The globals either represent state/config/resource-storage of either
// this app, or another 'component' of the viewer. App globals should be
@@ -5513,7 +5513,7 @@ void LLAppViewer::forceErrorInfiniteLoop()
void LLAppViewer::forceErrorSoftwareException()
{
LL_WARNS() << "Forcing a deliberate exception" << LL_ENDL;
- throw std::runtime_error("User selected Force Software Exception");
+ BOOST_THROW_EXCEPTION(LLException("User selected Force Software Exception"));
}
void LLAppViewer::forceErrorDriverCrash()
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp
index 1819fc74ee..54f96b8872 100644
--- a/indra/newview/llcommandlineparser.cpp
+++ b/indra/newview/llcommandlineparser.cpp
@@ -26,6 +26,7 @@
#include "llviewerprecompiledheaders.h"
#include "llcommandlineparser.h"
+#include "llexception.h"
// *NOTE: The boost::lexical_cast generates
// the warning C4701(local used with out assignment) in VC7.1.
@@ -42,6 +43,7 @@
#include <boost/bind.hpp>
#include <boost/tokenizer.hpp>
#include <boost/assign/list_of.hpp>
+#include <boost/throw_exception.hpp>
#if _MSC_VER
# pragma warning(pop)
@@ -98,14 +100,14 @@ namespace
bool gPastLastOption = false;
}
-class LLCLPError : public std::logic_error {
+class LLCLPError : public LLException {
public:
- LLCLPError(const std::string& what) : std::logic_error(what) {}
+ LLCLPError(const std::string& what) : LLException(what) {}
};
-class LLCLPLastOption : public std::logic_error {
+class LLCLPLastOption : public LLException {
public:
- LLCLPLastOption(const std::string& what) : std::logic_error(what) {}
+ LLCLPLastOption(const std::string& what) : LLException(what) {}
};
class LLCLPValue : public po::value_semantic_codecvt_helper<char>
@@ -202,17 +204,17 @@ protected:
{
if(gPastLastOption)
{
- throw(LLCLPLastOption("Don't parse no more!"));
+ BOOST_THROW_EXCEPTION(LLCLPLastOption("Don't parse no more!"));
}
// Error checks. Needed?
if (!value_store.empty() && !is_composing())
{
- throw(LLCLPError("Non composing value with multiple occurences."));
+ BOOST_THROW_EXCEPTION(LLCLPError("Non composing value with multiple occurences."));
}
if (new_tokens.size() < min_tokens() || new_tokens.size() > max_tokens())
{
- throw(LLCLPError("Illegal number of tokens specified."));
+ BOOST_THROW_EXCEPTION(LLCLPError("Illegal number of tokens specified."));
}
if(value_store.empty())
@@ -466,7 +468,7 @@ onevalue(const std::string& option,
{
// What does it mean when the user specifies a command-line switch
// that requires a value, but omits the value? Complain.
- throw LLCLPError(STRINGIZE("No value specified for --" << option << "!"));
+ BOOST_THROW_EXCEPTION(LLCLPError(STRINGIZE("No value specified for --" << option << "!")));
}
else if (value.size() > 1)
{
@@ -484,9 +486,10 @@ void badvalue(const std::string& option,
// If the user passes an unusable value for a command-line switch, it
// seems like a really bad idea to just ignore it, even with a log
// warning.
- throw LLCLPError(STRINGIZE("Invalid value specified by command-line switch '" << option
- << "' for variable '" << varname << "' of type " << type
- << ": '" << value << "'"));
+ BOOST_THROW_EXCEPTION(
+ LLCLPError(STRINGIZE("Invalid value specified by command-line switch '" << option
+ << "' for variable '" << varname << "' of type " << type
+ << ": '" << value << "'")));
}
template <typename T>
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index e871570786..bcb9417820 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -29,6 +29,7 @@
#include "llviewerprecompiledheaders.h"
#include "llsecapi.h"
#include "llsechandler_basic.h"
+#include <boost/throw_exception.hpp>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <map>
@@ -69,7 +70,7 @@ void initializeSecHandler()
}
if (!exception_msg.empty()) // an exception was thrown.
{
- throw LLProtectedDataException(exception_msg);
+ BOOST_THROW_EXCEPTION(LLProtectedDataException(exception_msg));
}
}
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index 535a112638..6af5a28fa5 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -32,7 +32,7 @@
#include <openssl/x509.h>
#include <ostream>
#include "llpointer.h"
-#include <stdexcept>
+#include "llexception.h"
#ifdef LL_WINDOWS
#pragma warning(disable:4250)
@@ -117,10 +117,10 @@
-struct LLProtectedDataException: public std::runtime_error
+struct LLProtectedDataException: public LLException
{
LLProtectedDataException(const std::string& msg):
- std::runtime_error(msg)
+ LLException(msg)
{
LL_WARNS("SECAPI") << "Protected Data Error: " << msg << LL_ENDL;
}
@@ -331,11 +331,11 @@ std::ostream& operator <<(std::ostream& s, const LLCredential& cred);
// All error handling is via exceptions.
-class LLCertException: public std::runtime_error
+class LLCertException: public LLException
{
public:
LLCertException(LLPointer<LLCertificate> cert, const std::string& msg):
- std::runtime_error(msg)
+ LLException(msg)
{
mCert = cert;
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 40516f9bbb..39ce64ad0e 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -35,6 +35,7 @@
#include "llfile.h"
#include "lldir.h"
#include "llviewercontrol.h"
+#include <boost/throw_exception.hpp>
#include <vector>
#include <ios>
#include <openssl/ossl_typ.h>
@@ -72,14 +73,14 @@ LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert)
if(pem_bio == NULL)
{
LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
- throw LLInvalidCertificate(this);
+ BOOST_THROW_EXCEPTION(LLInvalidCertificate(this));
}
mCert = NULL;
PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
BIO_free(pem_bio);
if (!mCert)
{
- throw LLInvalidCertificate(this);
+ BOOST_THROW_EXCEPTION(LLInvalidCertificate(this));
}
}
@@ -88,7 +89,7 @@ LLBasicCertificate::LLBasicCertificate(X509* pCert)
{
if (!pCert || !pCert->cert_info)
{
- throw LLInvalidCertificate(this);
+ BOOST_THROW_EXCEPTION(LLInvalidCertificate(this));
}
mCert = X509_dup(pCert);
}
@@ -873,22 +874,22 @@ void _validateCert(int validation_policy,
// check basic properties exist in the cert
if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info.has(CERT_SUBJECT_NAME_STRING))
{
- throw LLCertException(cert, "Cert doesn't have a Subject Name");
+ BOOST_THROW_EXCEPTION(LLCertException(cert, "Cert doesn't have a Subject Name"));
}
if(!current_cert_info.has(CERT_ISSUER_NAME_STRING))
{
- throw LLCertException(cert, "Cert doesn't have an Issuer Name");
+ BOOST_THROW_EXCEPTION(LLCertException(cert, "Cert doesn't have an Issuer Name"));
}
// check basic properties exist in the cert
if(!current_cert_info.has(CERT_VALID_FROM) || !current_cert_info.has(CERT_VALID_TO))
{
- throw LLCertException(cert, "Cert doesn't have an expiration period");
+ BOOST_THROW_EXCEPTION(LLCertException(cert, "Cert doesn't have an expiration period"));
}
if (!current_cert_info.has(CERT_SHA1_DIGEST))
{
- throw LLCertException(cert, "No SHA1 digest");
+ BOOST_THROW_EXCEPTION(LLCertException(cert, "No SHA1 digest"));
}
if (validation_policy & VALIDATION_POLICY_TIME)
@@ -903,7 +904,7 @@ void _validateCert(int validation_policy,
if((validation_date < current_cert_info[CERT_VALID_FROM].asDate()) ||
(validation_date > current_cert_info[CERT_VALID_TO].asDate()))
{
- throw LLCertValidationExpirationException(cert, validation_date);
+ BOOST_THROW_EXCEPTION(LLCertValidationExpirationException(cert, validation_date));
}
}
if (validation_policy & VALIDATION_POLICY_SSL_KU)
@@ -914,14 +915,14 @@ void _validateCert(int validation_policy,
!(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT)))))
{
- throw LLCertKeyUsageValidationException(cert);
+ BOOST_THROW_EXCEPTION(LLCertKeyUsageValidationException(cert));
}
// only validate EKU if the cert has it
if(current_cert_info.has(CERT_EXTENDED_KEY_USAGE) && current_cert_info[CERT_EXTENDED_KEY_USAGE].isArray() &&
(!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE],
LLSD((std::string)CERT_EKU_SERVER_AUTH))))
{
- throw LLCertKeyUsageValidationException(cert);
+ BOOST_THROW_EXCEPTION(LLCertKeyUsageValidationException(cert));
}
}
if (validation_policy & VALIDATION_POLICY_CA_KU)
@@ -930,7 +931,7 @@ void _validateCert(int validation_policy,
(!_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE],
(std::string)CERT_KU_CERT_SIGN)))
{
- throw LLCertKeyUsageValidationException(cert);
+ BOOST_THROW_EXCEPTION(LLCertKeyUsageValidationException(cert));
}
}
@@ -942,13 +943,13 @@ void _validateCert(int validation_policy,
if(!current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_CA) ||
!current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_CA])
{
- throw LLCertBasicConstraintsValidationException(cert);
+ BOOST_THROW_EXCEPTION(LLCertBasicConstraintsValidationException(cert));
}
if (current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_PATHLEN) &&
((current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger() != 0) &&
(depth > current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger())))
{
- throw LLCertBasicConstraintsValidationException(cert);
+ BOOST_THROW_EXCEPTION(LLCertBasicConstraintsValidationException(cert));
}
}
}
@@ -1018,7 +1019,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
if(cert_chain->size() < 1)
{
- throw LLCertException(NULL, "No certs in chain");
+ BOOST_THROW_EXCEPTION(LLCertException(NULL, "No certs in chain"));
}
iterator current_cert = cert_chain->begin();
LLSD current_cert_info;
@@ -1033,11 +1034,11 @@ void LLBasicCertificateStore::validate(int validation_policy,
(*current_cert)->getLLSD(current_cert_info);
if(!validation_params.has(CERT_HOSTNAME))
{
- throw LLCertException((*current_cert), "No hostname passed in for validation");
+ BOOST_THROW_EXCEPTION(LLCertException((*current_cert), "No hostname passed in for validation"));
}
if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
{
- throw LLInvalidCertificate((*current_cert));
+ BOOST_THROW_EXCEPTION(LLInvalidCertificate((*current_cert)));
}
LL_DEBUGS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() <<
@@ -1054,7 +1055,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
X509* cert_x509 = (*current_cert)->getOpenSSLX509();
if(!cert_x509)
{
- throw LLInvalidCertificate((*current_cert));
+ BOOST_THROW_EXCEPTION(LLInvalidCertificate((*current_cert)));
}
std::string sha1_hash((const char *)cert_x509->sha1_hash, SHA_DIGEST_LENGTH);
X509_free( cert_x509 );
@@ -1075,7 +1076,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
if((validation_date < cache_entry->second.first) ||
(validation_date > cache_entry->second.second))
{
- throw LLCertValidationExpirationException((*current_cert), validation_date);
+ BOOST_THROW_EXCEPTION(LLCertValidationExpirationException((*current_cert), validation_date));
}
}
// successfully found in cache
@@ -1107,7 +1108,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
if(!_verify_signature((*current_cert),
previous_cert))
{
- throw LLCertValidationInvalidSignatureException(previous_cert);
+ BOOST_THROW_EXCEPTION(LLCertValidationInvalidSignatureException(previous_cert));
}
}
_validateCert(local_validation_policy,
@@ -1156,7 +1157,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
if(!_verify_signature((*found_store_cert),
(*current_cert)))
{
- throw LLCertValidationInvalidSignatureException(*current_cert);
+ BOOST_THROW_EXCEPTION(LLCertValidationInvalidSignatureException(*current_cert));
}
// successfully validated.
mTrustedCertCache[sha1_hash] = std::pair<LLDate, LLDate>(from_time, to_time);
@@ -1173,7 +1174,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
if (validation_policy & VALIDATION_POLICY_TRUSTED)
{
// we reached the end without finding a trusted cert.
- throw LLCertValidationTrustException((*cert_chain)[cert_chain->size()-1]);
+ BOOST_THROW_EXCEPTION(LLCertValidationTrustException((*cert_chain)[cert_chain->size()-1]));
}
mTrustedCertCache[sha1_hash] = std::pair<LLDate, LLDate>(from_time, to_time);
@@ -1261,7 +1262,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
if (protected_data_stream.gcount() < STORE_SALT_SIZE)
{
- throw LLProtectedDataException("Config file too short.");
+ BOOST_THROW_EXCEPTION(LLProtectedDataException("Config file too short."));
}
cipher.decrypt(salt, STORE_SALT_SIZE);
@@ -1301,7 +1302,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
if (parser->parse(parse_stream, mProtectedDataMap,
LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
{
- throw LLProtectedDataException("Config file cannot be decrypted.");
+ BOOST_THROW_EXCEPTION(LLProtectedDataException("Config file cannot be decrypted."));
}
}
}
@@ -1372,7 +1373,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
// EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
// Decided throwing an exception here was overkill until we figure out why this happens
- //throw LLProtectedDataException("Error writing Protected Data Store");
+ //BOOST_THROW_EXCEPTION(LLProtectedDataException("Error writing Protected Data Store"));
}
try
@@ -1387,7 +1388,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
// EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
// Decided throwing an exception here was overkill until we figure out why this happens
- //throw LLProtectedDataException("Could not overwrite protected data store");
+ //BOOST_THROW_EXCEPTION(LLProtectedDataException("Could not overwrite protected data store"));
}
}
catch (...)
@@ -1401,7 +1402,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
//crash in LLSecAPIBasicHandler::_writeProtectedData()
// Decided throwing an exception here was overkill until we figure out why this happens
- //throw LLProtectedDataException("Error writing Protected Data Store");
+ //BOOST_THROW_EXCEPTION(LLProtectedDataException("Error writing Protected Data Store"));
}
}