summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLogan Dethrow <log@lindenlab.com>2011-07-13 16:46:36 -0400
committerLogan Dethrow <log@lindenlab.com>2011-07-13 16:46:36 -0400
commitcb24dff9e36a963af280be1aead9424be8a678b6 (patch)
tree921bcf6a9fc3478c62d37df4518f7a230bc57593 /indra
parentcfce3686dea74dfa2a6c92dbd1e8e1ae8518f259 (diff)
Code cleanup for the SOCKS 5 proxy viewer.
Diffstat (limited to 'indra')
-rw-r--r--indra/llmessage/llcurl.cpp10
-rw-r--r--indra/llmessage/llpacketring.cpp2
-rw-r--r--indra/llmessage/llproxy.cpp6
-rw-r--r--indra/llmessage/llproxy.h2
-rw-r--r--indra/llmessage/net.cpp2
-rw-r--r--indra/newview/app_settings/settings.xml22
-rwxr-xr-xindra/newview/llfloaterpreference.cpp81
-rw-r--r--indra/newview/llstartup.cpp1
-rw-r--r--indra/newview/llxmlrpctransaction.cpp2
9 files changed, 52 insertions, 76 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 25249e9444..a7ce4310c1 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -206,7 +206,7 @@ namespace boost
void intrusive_ptr_release(LLCurl::Responder* p)
{
- if(p && 0 == --p->mReferenceCount)
+ if (p && 0 == --p->mReferenceCount)
{
delete p;
}
@@ -406,11 +406,11 @@ const char* LLCurl::Easy::getErrorBuffer()
void LLCurl::Easy::setCA()
{
- if(!sCAPath.empty())
+ if (!sCAPath.empty())
{
setoptString(CURLOPT_CAPATH, sCAPath);
}
- if(!sCAFile.empty())
+ if (!sCAFile.empty())
{
setoptString(CURLOPT_CAINFO, sCAFile);
}
@@ -546,7 +546,7 @@ void LLCurl::Easy::prepRequest(const std::string& url,
if (LLProxy::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS)
{
setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
- if(LLProxy::getInstance()->getSelectedAuthMethod() == METHOD_PASSWORD)
+ if (LLProxy::getInstance()->getSelectedAuthMethod() == METHOD_PASSWORD)
{
setoptString(CURLOPT_PROXYUSERPWD, LLProxy::getInstance()->getProxyUserPwdCURL());
}
@@ -568,7 +568,7 @@ void LLCurl::Easy::prepRequest(const std::string& url,
setopt(CURLOPT_HEADERDATA, (void*)this);
// Allow up to five redirects
- if(responder && responder->followRedir())
+ if (responder && responder->followRedir())
{
setopt(CURLOPT_FOLLOWLOCATION, 1);
setopt(CURLOPT_MAXREDIRS, MAX_REDIRECTS);
diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp
index a86b7b4370..ba82957b47 100644
--- a/indra/llmessage/llpacketring.cpp
+++ b/indra/llmessage/llpacketring.cpp
@@ -237,6 +237,8 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
proxywrap_t * header = reinterpret_cast<proxywrap_t *>(buffer);
mLastSender.setAddress(header->addr);
mLastSender.setPort(ntohs(header->port));
+
+ packet_size -= SOCKS_HEADER_SIZE; // The unwrapped packet size
}
else
{
diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp
index 0143803f2b..11a5c480f0 100644
--- a/indra/llmessage/llproxy.cpp
+++ b/indra/llmessage/llproxy.cpp
@@ -110,7 +110,7 @@ S32 LLProxy::proxyHandshake(LLHost proxy, U32 message_port)
authmethod_password_reply_t password_reply;
- result = tcp_handshake(mProxyControlChannel, password_auth, request_size, (char*)&password_reply, sizeof(authmethod_password_reply_t));
+ result = tcp_handshake(mProxyControlChannel, password_auth, request_size, (char*)&password_reply, sizeof(password_reply));
delete[] password_auth;
if (result != 0)
@@ -142,7 +142,7 @@ S32 LLProxy::proxyHandshake(LLHost proxy, U32 message_port)
// "If the client is not in possession of the information at the time of the UDP ASSOCIATE,
// the client MUST use a port number and address of all zeros. RFC 1928"
- result = tcp_handshake(mProxyControlChannel, (char*)&connect_request, sizeof(socks_command_request_t), (char*)&connect_reply, sizeof(socks_command_response_t));
+ result = tcp_handshake(mProxyControlChannel, (char*)&connect_request, sizeof(connect_request), (char*)&connect_reply, sizeof(connect_reply));
if (result != 0)
{
LL_WARNS("Proxy") << "SOCKS connect request failed, error on TCP control channel : " << result << LL_ENDL;
@@ -202,7 +202,7 @@ void LLProxy::stopProxy()
// then we must shut down any HTTP proxy operations. But it is allowable if web
// proxy is being used to continue proxying HTTP.
- if(LLPROXY_SOCKS == mProxyType)
+ if (LLPROXY_SOCKS == mProxyType)
{
sHTTPProxyEnabled = false;
}
diff --git a/indra/llmessage/llproxy.h b/indra/llmessage/llproxy.h
index 7893545b9d..cf2dfdc60e 100644
--- a/indra/llmessage/llproxy.h
+++ b/indra/llmessage/llproxy.h
@@ -191,7 +191,7 @@ public:
void enableHTTPProxy(LLHost httpHost, LLHttpProxyType type);
// Stop proxying HTTP packets
- void disableHTTPProxy() { sHTTPProxyEnabled = false; };
+ void disableHTTPProxy() { sHTTPProxyEnabled = false; }
// Get the UDP proxy address and port
LLHost getUDPProxy() const { return mUDPProxy; }
diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp
index f8ab55143c..85aef5da00 100644
--- a/indra/llmessage/net.cpp
+++ b/indra/llmessage/net.cpp
@@ -50,8 +50,6 @@
#include "lltimer.h"
#include "indra_constants.h"
-#include "llproxy.h"
-
// Globals
#if LL_WINDOWS
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index f8b3001aa5..55bab3064f 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -840,28 +840,6 @@
<key>Value</key>
<integer>1080</integer>
</map>
- <key>Socks5Username</key>
- <map>
- <key>Comment</key>
- <string>Socks 5 Username</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>String</string>
- <key>Value</key>
- <string></string>
- </map>
- <key>Socks5Password</key>
- <map>
- <key>Comment</key>
- <string>Socks 5 Password</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>String</string>
- <key>Value</key>
- <string></string>
- </map>
<key>Socks5AuthType</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index ebdef8e38f..c49191748e 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -159,7 +159,7 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
{
BOOL result = TRUE;
- if(key == 'Q' && mask == MASK_CONTROL)
+ if (key == 'Q' && mask == MASK_CONTROL)
{
result = FALSE;
}
@@ -459,7 +459,7 @@ BOOL LLFloaterPreference::postBuild()
void LLFloaterPreference::onBusyResponseChanged()
{
// set "BusyResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
- if(LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString())
+ if (LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString())
{
gSavedPerAccountSettings.setBOOL("BusyResponseChanged", TRUE );
}
@@ -541,7 +541,7 @@ void LLFloaterPreference::apply()
LLViewerMedia::setCookiesEnabled(getChild<LLUICtrl>("cookies_enabled")->getValue());
- if(hasChild("web_proxy_enabled") &&hasChild("web_proxy_editor") && hasChild("web_proxy_port"))
+ if (hasChild("web_proxy_enabled") &&hasChild("web_proxy_editor") && hasChild("web_proxy_port"))
{
bool proxy_enable = getChild<LLUICtrl>("web_proxy_enabled")->getValue();
std::string proxy_address = getChild<LLUICtrl>("web_proxy_editor")->getValue();
@@ -554,13 +554,13 @@ void LLFloaterPreference::apply()
gSavedSettings.setBOOL("PlainTextChatHistory", getChild<LLUICtrl>("plain_text_chat_history")->getValue().asBoolean());
- if(mGotPersonalInfo)
+ if (mGotPersonalInfo)
{
// gSavedSettings.setString("BusyModeResponse2", std::string(wstring_to_utf8str(busy_response)));
bool new_im_via_email = getChild<LLUICtrl>("send_im_to_email")->getValue().asBoolean();
bool new_hide_online = getChild<LLUICtrl>("online_visibility")->getValue().asBoolean();
- if((new_im_via_email != mOriginalIMViaEmail)
+ if ((new_im_via_email != mOriginalIMViaEmail)
||(new_hide_online != mOriginalHideOnlineStatus))
{
// This hack is because we are representing several different
@@ -568,13 +568,13 @@ void LLFloaterPreference::apply()
// can only select between 2 values, we represent it as a
// checkbox. This breaks down a little bit for liaisons, but
// works out in the end.
- if(new_hide_online != mOriginalHideOnlineStatus)
- {
- if(new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN;
+ if (new_hide_online != mOriginalHideOnlineStatus)
+ {
+ if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN;
else mDirectoryVisibility = VISIBILITY_DEFAULT;
//Update showonline value, otherwise multiple applys won't work
mOriginalHideOnlineStatus = new_hide_online;
- }
+ }
gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility);
}
}
@@ -618,12 +618,11 @@ void LLFloaterPreference::cancel()
updateDoubleClickControls();
mDoubleClickActionDirty = false;
}
- LLFloaterPreferenceProxy * advanced_socks_settings = LLFloaterReg::findTypedInstance<LLFloaterPreferenceProxy>("prefs_socks5_advanced");
- if(advanced_socks_settings)
- {
- advanced_socks_settings->cancel();
- }
-
+ LLFloaterPreferenceProxy * advanced_socks_settings = LLFloaterReg::findTypedInstance<LLFloaterPreferenceProxy>("prefs_socks5_advanced");
+ if (advanced_socks_settings)
+ {
+ advanced_socks_settings->cancel();
+ }
}
void LLFloaterPreference::onOpen(const LLSD& key)
@@ -810,7 +809,7 @@ void LLFloaterPreference::onBtnCancel()
void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email)
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if(instance)
+ if (instance)
{
instance->setPersonalInfo(visibility, im_via_email, email);
}
@@ -820,7 +819,7 @@ void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_
void LLFloaterPreference::refreshEnabledGraphics()
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if(instance)
+ if (instance)
{
instance->refresh();
//instance->refreshEnabledState();
@@ -1107,7 +1106,7 @@ void LLFloaterPreference::disableUnavailableSettings()
LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF");
// if vertex shaders off, disable all shader related products
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"))
{
ctrl_shader_enable->setEnabled(FALSE);
ctrl_shader_enable->setValue(FALSE);
@@ -1138,7 +1137,7 @@ void LLFloaterPreference::disableUnavailableSettings()
}
// disabled windlight
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"))
{
ctrl_wind_light->setEnabled(FALSE);
ctrl_wind_light->setValue(FALSE);
@@ -1175,28 +1174,28 @@ void LLFloaterPreference::disableUnavailableSettings()
}
// disabled deferred SSAO
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO"))
{
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
}
// disabled deferred shadows
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"))
{
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
}
// disabled reflections
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail"))
{
ctrl_reflections->setEnabled(FALSE);
ctrl_reflections->setValue(FALSE);
}
// disabled av
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP"))
{
ctrl_avatar_vp->setEnabled(FALSE);
ctrl_avatar_vp->setValue(FALSE);
@@ -1219,14 +1218,14 @@ void LLFloaterPreference::disableUnavailableSettings()
}
// disabled cloth
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth"))
{
ctrl_avatar_cloth->setEnabled(FALSE);
ctrl_avatar_cloth->setValue(FALSE);
}
// disabled impostors
- if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors"))
+ if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors"))
{
ctrl_avatar_impostors->setEnabled(FALSE);
ctrl_avatar_impostors->setValue(FALSE);
@@ -1392,12 +1391,12 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
mOriginalIMViaEmail = im_via_email;
mDirectoryVisibility = visibility;
- if(visibility == VISIBILITY_DEFAULT)
+ if (visibility == VISIBILITY_DEFAULT)
{
mOriginalHideOnlineStatus = false;
getChildView("online_visibility")->setEnabled(TRUE);
}
- else if(visibility == VISIBILITY_HIDDEN)
+ else if (visibility == VISIBILITY_HIDDEN)
{
mOriginalHideOnlineStatus = true;
getChildView("online_visibility")->setEnabled(TRUE);
@@ -1445,7 +1444,7 @@ void LLFloaterPreference::onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name)
{
std::string ctrl_name = name.asString();
- if((ctrl_name =="" )|| !hasChild(ctrl_name, true))
+ if ((ctrl_name =="" )|| !hasChild(ctrl_name, true))
return;
LLTextBox* text_box = getChild<LLTextBox>(name.asString());
@@ -1455,7 +1454,7 @@ void LLFloaterPreference::onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name)
void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box)
{
- if(text_box == NULL || ctrl== NULL)
+ if (text_box == NULL || ctrl== NULL)
return;
// get range and points when text should change
@@ -1468,7 +1467,7 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b
F32 highPoint = min + (2.0f * range / 3.0f);
// choose the right text
- if(value < midPoint)
+ if (value < midPoint)
{
text_box->setText(LLTrans::getString("GraphicsQualityLow"));
}
@@ -1653,7 +1652,7 @@ BOOL LLPanelPreference::postBuild()
{
////////////////////// PanelVoice ///////////////////
- if(hasChild("voice_unavailable"))
+ if (hasChild("voice_unavailable"))
{
BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
getChildView("voice_unavailable")->setVisible( voice_disabled);
@@ -1675,7 +1674,7 @@ BOOL LLPanelPreference::postBuild()
}
- if(hasChild("online_visibility") && hasChild("send_im_to_email"))
+ if (hasChild("online_visibility") && hasChild("send_im_to_email"))
{
getChild<LLUICtrl>("email_address")->setValue(getString("log_in_to_change") );
// getChild<LLUICtrl>("busy_response")->setValue(getString("log_in_to_change"));
@@ -1804,7 +1803,7 @@ void LLPanelPreference::cancel()
iter != mSavedColors.end(); ++iter)
{
LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>(iter->first);
- if(color_swatch)
+ if (color_swatch)
{
color_swatch->set(iter->second);
color_swatch->onCommit();
@@ -1848,7 +1847,7 @@ void LLPanelPreferenceGraphics::draw()
LLButton* button_apply = findChild<LLButton>("Apply");
- if(button_apply && button_apply->getVisible())
+ if (button_apply && button_apply->getVisible())
{
bool enable = hasDirtyChilds();
@@ -1868,7 +1867,7 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds()
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
{
- if(ctrl->isDirty())
+ if (ctrl->isDirty())
return true;
}
// Push children onto the end of the work stack
@@ -1941,7 +1940,7 @@ LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy()
BOOL LLFloaterPreferenceProxy::postBuild()
{
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
- if(socksAuth->getSelectedValue().asString() == "None")
+ if (socksAuth->getSelectedValue().asString() == "None")
{
getChild<LLLineEditor>("socks5_username")->setEnabled(false);
getChild<LLLineEditor>("socks5_password")->setEnabled(false);
@@ -1965,12 +1964,12 @@ void LLFloaterPreferenceProxy::onOpen(const LLSD& key)
void LLFloaterPreferenceProxy::onClose(bool app_quitting)
{
- if(mSocksSettingsDirty)
+ if (mSocksSettingsDirty)
{
// If the user plays with the Socks proxy settings after login, it's only fair we let them know
// it will not be updated until next restart.
- if(LLStartUp::getStartupState()>STATE_LOGIN_WAIT)
+ if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT)
{
LLNotifications::instance().add("ChangeSocks5Settings", LLSD(), LLSD());
mSocksSettingsDirty = false; // we have notified the user now be quiet again
@@ -2023,7 +2022,7 @@ void LLFloaterPreferenceProxy::onBtnOk()
// Save SOCKS proxy credentials securely if password auth is enabled
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
- if(socksAuth->getSelectedValue().asString() == "UserPass")
+ if (socksAuth->getSelectedValue().asString() == "UserPass")
{
LLSD socks_id = LLSD::emptyMap();
socks_id["type"] = "SOCKS5";
@@ -2080,7 +2079,7 @@ void LLFloaterPreferenceProxy::onChangeSocksSettings()
mSocksSettingsDirty = true;
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
- if(socksAuth->getSelectedValue().asString() == "None")
+ if (socksAuth->getSelectedValue().asString() == "None")
{
getChild<LLLineEditor>("socks5_username")->setEnabled(false);
getChild<LLLineEditor>("socks5_password")->setEnabled(false);
@@ -2093,7 +2092,7 @@ void LLFloaterPreferenceProxy::onChangeSocksSettings()
// Check for invalid states for the other HTTP proxy radio
LLRadioGroup* otherHttpProxy = getChild<LLRadioGroup>("other_http_proxy_selection");
- if( (otherHttpProxy->getSelectedValue().asString() == "Socks" &&
+ if ((otherHttpProxy->getSelectedValue().asString() == "Socks" &&
getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get() == FALSE )||(
otherHttpProxy->getSelectedValue().asString() == "Web" &&
getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get() == FALSE ) )
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 3661155e88..1fe241a8ce 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2827,7 +2827,6 @@ bool LLStartUp::handleSocksProxy()
// If status != SOCKS_OK, stopProxy() will already have been called when startProxy() returns.
int status = LLProxy::getInstance()->startProxy(gSavedSettings.getString("Socks5ProxyHost"), gSavedSettings.getU32("Socks5ProxyPort"));
LLSD subs;
- LLSD payload;
subs["HOST"] = gSavedSettings.getString("Socks5ProxyHost");
subs["PORT"] = (S32)gSavedSettings.getU32("Socks5ProxyPort");
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index ef6763a5d1..c88e829527 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -318,7 +318,7 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
if (LLProxy::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS)
{
mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
- if(LLProxy::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD)
+ if (LLProxy::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD)
{
mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLProxy::getInstance()->getProxyUserPwdCURL());
}