Wholesale update of llmessage to V3.2
Note that this removes message logger for now.
This commit is contained in:
@@ -204,7 +204,7 @@
|
||||
#include "llwlparammanager.h"
|
||||
#include "llwaterparammanager.h"
|
||||
#include "llagentlanguage.h"
|
||||
#include "llsocks5.h"
|
||||
#include "llproxy.h"
|
||||
#include "jcfloaterareasearch.h"
|
||||
|
||||
// <edit>
|
||||
@@ -440,6 +440,14 @@ bool idle_startup()
|
||||
{
|
||||
LLNotifications::instance().add(gViewerWindow->getInitAlert());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Init the SOCKS 5 proxy if the user has configured
|
||||
// one. We need to do this early in case the user
|
||||
// is using SOCKS for HTTP so we get the login
|
||||
// screen and HTTP tables via SOCKS.
|
||||
//-------------------------------------------------
|
||||
LLStartUp::startLLProxy();
|
||||
|
||||
gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
|
||||
|
||||
@@ -634,15 +642,6 @@ bool idle_startup()
|
||||
|
||||
LL_INFOS("AppInit") << "Message System Initialized." << LL_ENDL;
|
||||
|
||||
//-------------------------------------------------
|
||||
// Init the socks 5 proxy and open the control TCP
|
||||
// connection if the user is using SOCKS5
|
||||
// We need to do this early incase the user is using
|
||||
// socks for http so we get the login screen via socks
|
||||
//-------------------------------------------------
|
||||
|
||||
LLStartUp::handleSocksProxy(false);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Load file- and dirpicker {context, default path} map.
|
||||
//-------------------------------------------------
|
||||
@@ -944,25 +943,15 @@ bool idle_startup()
|
||||
// Post login screen, we should see if any settings have changed that may
|
||||
// require us to either start/stop or change the socks proxy. As various communications
|
||||
// past this point may require the proxy to be up.
|
||||
bool socks_enable_required = gSavedSettings.getBOOL("Socks5ProxyEnabled");
|
||||
if ((LLSocks::getInstance()->isEnabled() != socks_enable_required) || LLSocks::getInstance()->needsUpdate())
|
||||
if (!LLStartUp::startLLProxy())
|
||||
{
|
||||
if (socks_enable_required)
|
||||
{
|
||||
if (!LLStartUp::handleSocksProxy(false))
|
||||
{
|
||||
// Proxy start up failed, we should now bail the state machine
|
||||
// HandleSocksProxy() will have reported an error to the user
|
||||
// already, so we just go back to the login screen. The user
|
||||
// could then change the perferences to fix the issue.
|
||||
LLStartUp::setStartupState(STATE_LOGIN_SHOW);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSocks::getInstance()->stopProxy();
|
||||
}
|
||||
// Proxy start up failed, we should now bail the state machine
|
||||
// startLLProxy() will have reported an error to the user
|
||||
// already, so we just go back to the login screen. The user
|
||||
// could then change the preferences to fix the issue.
|
||||
|
||||
LLStartUp::setStartupState(STATE_LOGIN_SHOW);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//reset the values that could have come in from a slurl
|
||||
@@ -4067,6 +4056,7 @@ void apply_udp_blacklist(const std::string& csv)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
bool LLStartUp::handleSocksProxy(bool reportOK)
|
||||
{
|
||||
std::string httpProxyType = gSavedSettings.getString("Socks5HttpProxyType");
|
||||
@@ -4157,3 +4147,164 @@ bool LLStartUp::handleSocksProxy(bool reportOK)
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Read all proxy configuration settings and set up both the HTTP proxy and
|
||||
* SOCKS proxy as needed.
|
||||
*
|
||||
* Any errors that are encountered will result in showing the user a notification.
|
||||
* When an error is encountered,
|
||||
*
|
||||
* @return Returns true if setup was successful, false if an error was encountered.
|
||||
*/
|
||||
bool LLStartUp::startLLProxy()
|
||||
{
|
||||
bool proxy_ok = true;
|
||||
std::string httpProxyType = gSavedSettings.getString("Socks5HttpProxyType");
|
||||
|
||||
// Set up SOCKS proxy (if needed)
|
||||
if (gSavedSettings.getBOOL("Socks5ProxyEnabled"))
|
||||
{
|
||||
// Determine and update LLProxy with the saved authentication system
|
||||
std::string auth_type = gSavedSettings.getString("Socks5AuthType");
|
||||
|
||||
if (auth_type.compare("UserPass") == 0)
|
||||
{
|
||||
std::string socks_user = gSavedSettings.getString("Socks5Username");
|
||||
std::string socks_password = gSavedSettings.getString("Socks5Password");
|
||||
|
||||
bool ok = LLProxy::getInstance()->setAuthPassword(socks_user, socks_password);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
LLNotificationsUtil::add("SOCKS_BAD_CREDS");
|
||||
proxy_ok = false;
|
||||
}
|
||||
}
|
||||
else if (auth_type.compare("None") == 0)
|
||||
{
|
||||
LLProxy::getInstance()->setAuthNone();
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Proxy") << "Invalid SOCKS 5 authentication type."<< LL_ENDL;
|
||||
|
||||
// Unknown or missing setting.
|
||||
gSavedSettings.setString("Socks5AuthType", "None");
|
||||
|
||||
LLProxy::getInstance()->setAuthNone();
|
||||
}
|
||||
|
||||
if (proxy_ok)
|
||||
{
|
||||
// Start the proxy and check for errors
|
||||
// If status != SOCKS_OK, stopSOCKSProxy() will already have been called when startSOCKSProxy() returns.
|
||||
LLHost socks_host;
|
||||
socks_host.setHostByName(gSavedSettings.getString("Socks5ProxyHost"));
|
||||
socks_host.setPort(gSavedSettings.getU32("Socks5ProxyPort"));
|
||||
int status = LLProxy::getInstance()->startSOCKSProxy(socks_host);
|
||||
|
||||
if (status != SOCKS_OK)
|
||||
{
|
||||
LLSD subs;
|
||||
subs["HOST"] = gSavedSettings.getString("Socks5ProxyHost");
|
||||
subs["PORT"] = (S32)gSavedSettings.getU32("Socks5ProxyPort");
|
||||
|
||||
std::string error_string;
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case SOCKS_CONNECT_ERROR: // TCP Fail
|
||||
error_string = "SOCKS_CONNECT_ERROR";
|
||||
break;
|
||||
|
||||
case SOCKS_NOT_PERMITTED: // SOCKS 5 server rule set refused connection
|
||||
error_string = "SOCKS_NOT_PERMITTED";
|
||||
break;
|
||||
|
||||
case SOCKS_NOT_ACCEPTABLE: // Selected authentication is not acceptable to server
|
||||
error_string = "SOCKS_NOT_ACCEPTABLE";
|
||||
break;
|
||||
|
||||
case SOCKS_AUTH_FAIL: // Authentication failed
|
||||
error_string = "SOCKS_AUTH_FAIL";
|
||||
break;
|
||||
|
||||
case SOCKS_UDP_FWD_NOT_GRANTED: // UDP forward request failed
|
||||
error_string = "SOCKS_UDP_FWD_NOT_GRANTED";
|
||||
break;
|
||||
|
||||
case SOCKS_HOST_CONNECT_FAILED: // Failed to open a TCP channel to the socks server
|
||||
error_string = "SOCKS_HOST_CONNECT_FAILED";
|
||||
break;
|
||||
|
||||
case SOCKS_INVALID_HOST: // Improperly formatted host address or port.
|
||||
error_string = "SOCKS_INVALID_HOST";
|
||||
break;
|
||||
|
||||
default:
|
||||
error_string = "SOCKS_UNKNOWN_STATUS"; // Something strange happened,
|
||||
LL_WARNS("Proxy") << "Unknown return from LLProxy::startProxy(): " << status << LL_ENDL;
|
||||
break;
|
||||
}
|
||||
|
||||
LLNotificationsUtil::add(error_string, subs);
|
||||
proxy_ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LLProxy::getInstance()->stopSOCKSProxy(); // ensure no UDP proxy is running and it's all cleaned up
|
||||
}
|
||||
|
||||
if (proxy_ok)
|
||||
{
|
||||
// Determine the HTTP proxy type (if any)
|
||||
if ((httpProxyType.compare("Web") == 0) && gSavedSettings.getBOOL("BrowserProxyEnabled"))
|
||||
{
|
||||
LLHost http_host;
|
||||
http_host.setHostByName(gSavedSettings.getString("BrowserProxyAddress"));
|
||||
http_host.setPort(gSavedSettings.getS32("BrowserProxyPort"));
|
||||
if (!LLProxy::getInstance()->enableHTTPProxy(http_host, LLPROXY_HTTP))
|
||||
{
|
||||
LLSD subs;
|
||||
subs["HOST"] = http_host.getIPString();
|
||||
subs["PORT"] = (S32)http_host.getPort();
|
||||
LLNotificationsUtil::add("PROXY_INVALID_HTTP_HOST", subs);
|
||||
proxy_ok = false;
|
||||
}
|
||||
}
|
||||
else if ((httpProxyType.compare("Socks") == 0) && gSavedSettings.getBOOL("Socks5ProxyEnabled"))
|
||||
{
|
||||
LLHost socks_host;
|
||||
socks_host.setHostByName(gSavedSettings.getString("Socks5ProxyHost"));
|
||||
socks_host.setPort(gSavedSettings.getU32("Socks5ProxyPort"));
|
||||
if (!LLProxy::getInstance()->enableHTTPProxy(socks_host, LLPROXY_SOCKS))
|
||||
{
|
||||
LLSD subs;
|
||||
subs["HOST"] = socks_host.getIPString();
|
||||
subs["PORT"] = (S32)socks_host.getPort();
|
||||
LLNotificationsUtil::add("PROXY_INVALID_SOCKS_HOST", subs);
|
||||
proxy_ok = false;
|
||||
}
|
||||
}
|
||||
else if (httpProxyType.compare("None") == 0)
|
||||
{
|
||||
LLProxy::getInstance()->disableHTTPProxy();
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Proxy") << "Invalid other HTTP proxy configuration."<< LL_ENDL;
|
||||
|
||||
// Set the missing or wrong configuration back to something valid.
|
||||
gSavedSettings.setString("HttpProxyType", "None");
|
||||
LLProxy::getInstance()->disableHTTPProxy();
|
||||
|
||||
// Leave proxy_ok alone, since this isn't necessarily fatal.
|
||||
}
|
||||
}
|
||||
|
||||
return proxy_ok;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user