diff options
author | McCabe Maxsted | 2011-04-12 17:41:10 -0700 |
---|---|---|
committer | McCabe Maxsted | 2011-04-12 17:41:10 -0700 |
commit | 809de77034c5956a95f35c90024e62b02b439164 (patch) | |
tree | 69beeac02b6c37b38c881d702ede4b7b83642a31 /linden/indra/newview | |
parent | Partial revert of a47ebd78. This caused issues with selection and alt-camming... (diff) | |
download | meta-impy-809de77034c5956a95f35c90024e62b02b439164.zip meta-impy-809de77034c5956a95f35c90024e62b02b439164.tar.gz meta-impy-809de77034c5956a95f35c90024e62b02b439164.tar.bz2 meta-impy-809de77034c5956a95f35c90024e62b02b439164.tar.xz |
Ported SOCKS5 proxy support from Snowglobe 1.5
Diffstat (limited to 'linden/indra/newview')
-rw-r--r-- | linden/indra/newview/app_settings/settings.xml | 99 | ||||
-rw-r--r-- | linden/indra/newview/llpanelnetwork.cpp | 126 | ||||
-rw-r--r-- | linden/indra/newview/llpanelnetwork.h | 8 | ||||
-rw-r--r-- | linden/indra/newview/llstartup.cpp | 125 | ||||
-rw-r--r-- | linden/indra/newview/llstartup.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/llxmlrpctransaction.cpp | 17 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/notifications.xml | 56 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml | 115 |
8 files changed, 528 insertions, 21 deletions
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 00c30c1..3523c7f 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml | |||
@@ -2,7 +2,9 @@ | |||
2 | <llsd> | 2 | <llsd> |
3 | <map> | 3 | <map> |
4 | 4 | ||
5 | <!-- for Aurora Sim --> | 5 | <!-- BEGIN IMPRUDENCE-SPECIFIC SETTINGS --> |
6 | |||
7 | <!-- begin Aurora-specific settings --> | ||
6 | 8 | ||
7 | <key>TimeOffset</key> | 9 | <key>TimeOffset</key> |
8 | <map> | 10 | <map> |
@@ -48,7 +50,8 @@ | |||
48 | <key>Value</key> | 50 | <key>Value</key> |
49 | <string>SLVoice</string> | 51 | <string>SLVoice</string> |
50 | </map> | 52 | </map> |
51 | <!-- Imprudence-specific settings --> | 53 | |
54 | <!-- end Aurora-specific settings --> | ||
52 | 55 | ||
53 | <key>AllowEditingOfTrees</key> | 56 | <key>AllowEditingOfTrees</key> |
54 | <map> | 57 | <map> |
@@ -1689,6 +1692,7 @@ | |||
1689 | </map> | 1692 | </map> |
1690 | 1693 | ||
1691 | <!-- Begin: Client Name Tag --> | 1694 | <!-- Begin: Client Name Tag --> |
1695 | |||
1692 | <key>ShowClientColor</key> | 1696 | <key>ShowClientColor</key> |
1693 | <map> | 1697 | <map> |
1694 | <key>Comment</key> | 1698 | <key>Comment</key> |
@@ -2091,6 +2095,8 @@ | |||
2091 | </map> | 2095 | </map> |
2092 | 2096 | ||
2093 | <!-- End: Spellcheck & Translation --> | 2097 | <!-- End: Spellcheck & Translation --> |
2098 | |||
2099 | <!-- Begin: RLVa --> | ||
2094 | 2100 | ||
2095 | <key>RestrainedLove</key> | 2101 | <key>RestrainedLove</key> |
2096 | <map> | 2102 | <map> |
@@ -2268,6 +2274,93 @@ | |||
2268 | <key>Value</key> | 2274 | <key>Value</key> |
2269 | <integer>1</integer> | 2275 | <integer>1</integer> |
2270 | </map> | 2276 | </map> |
2277 | |||
2278 | <!-- End: RLVa --> | ||
2279 | |||
2280 | <!-- Begin: socks5 --> | ||
2281 | |||
2282 | <key>Socks5ProxyEnabled</key> | ||
2283 | <map> | ||
2284 | <key>Comment</key> | ||
2285 | <string>Use Socks5 Proxy</string> | ||
2286 | <key>Persist</key> | ||
2287 | <integer>1</integer> | ||
2288 | <key>Type</key> | ||
2289 | <string>Boolean</string> | ||
2290 | <key>Value</key> | ||
2291 | <integer>0</integer> | ||
2292 | </map> | ||
2293 | <key>Socks5HttpProxyType</key> | ||
2294 | <map> | ||
2295 | <key>Comment</key> | ||
2296 | <string>Proxy type to use for HTTP operations</string> | ||
2297 | <key>Persist</key> | ||
2298 | <integer>1</integer> | ||
2299 | <key>Type</key> | ||
2300 | <string>String</string> | ||
2301 | <key>Value</key> | ||
2302 | <integer>None</integer> | ||
2303 | </map> | ||
2304 | <key>Socks5ProxyHost</key> | ||
2305 | <map> | ||
2306 | <key>Comment</key> | ||
2307 | <string>Socks 5 Proxy Host</string> | ||
2308 | <key>Persist</key> | ||
2309 | <integer>1</integer> | ||
2310 | <key>Type</key> | ||
2311 | <string>String</string> | ||
2312 | <key>Value</key> | ||
2313 | <string /> | ||
2314 | </map> | ||
2315 | <key>Socks5ProxyPort</key> | ||
2316 | <map> | ||
2317 | <key>Comment</key> | ||
2318 | <string>Socks 5 Proxy Port</string> | ||
2319 | <key>Persist</key> | ||
2320 | <integer>1</integer> | ||
2321 | <key>Type</key> | ||
2322 | <string>U32</string> | ||
2323 | <key>Value</key> | ||
2324 | <integer>1080</integer> | ||
2325 | </map> | ||
2326 | <key>Socks5Username</key> | ||
2327 | <map> | ||
2328 | <key>Comment</key> | ||
2329 | <string>Socks 5 Username</string> | ||
2330 | <key>Persist</key> | ||
2331 | <integer>1</integer> | ||
2332 | <key>Type</key> | ||
2333 | <string>String</string> | ||
2334 | <key>Value</key> | ||
2335 | <string></string> | ||
2336 | </map> | ||
2337 | <key>Socks5Password</key> | ||
2338 | <map> | ||
2339 | <key>Comment</key> | ||
2340 | <string>Socks 5 Password</string> | ||
2341 | <key>Persist</key> | ||
2342 | <integer>1</integer> | ||
2343 | <key>Type</key> | ||
2344 | <string>String</string> | ||
2345 | <key>Value</key> | ||
2346 | <string></string> | ||
2347 | </map> | ||
2348 | <key>Socks5AuthType</key> | ||
2349 | <map> | ||
2350 | <key>Comment</key> | ||
2351 | <string>Selected Auth mechanism for Socks5</string> | ||
2352 | <key>Persist</key> | ||
2353 | <integer>1</integer> | ||
2354 | <key>Type</key> | ||
2355 | <string>String</string> | ||
2356 | <key>Value</key> | ||
2357 | <string>None</string> | ||
2358 | </map> | ||
2359 | |||
2360 | <!-- End: socks5 --> | ||
2361 | |||
2362 | <!-- END IMPRUDENCE-SPECIFIC SETTINGS --> | ||
2363 | |||
2271 | <key>AFKTimeout</key> | 2364 | <key>AFKTimeout</key> |
2272 | <map> | 2365 | <map> |
2273 | <key>Comment</key> | 2366 | <key>Comment</key> |
@@ -3024,7 +3117,7 @@ | |||
3024 | <key>BrowserProxyAddress</key> | 3117 | <key>BrowserProxyAddress</key> |
3025 | <map> | 3118 | <map> |
3026 | <key>Comment</key> | 3119 | <key>Comment</key> |
3027 | <string>Address for the Web Proxy]</string> | 3120 | <string>Address for the Web Proxy</string> |
3028 | <key>Persist</key> | 3121 | <key>Persist</key> |
3029 | <integer>1</integer> | 3122 | <integer>1</integer> |
3030 | <key>Type</key> | 3123 | <key>Type</key> |
diff --git a/linden/indra/newview/llpanelnetwork.cpp b/linden/indra/newview/llpanelnetwork.cpp index 16b9a76..a371962 100644 --- a/linden/indra/newview/llpanelnetwork.cpp +++ b/linden/indra/newview/llpanelnetwork.cpp | |||
@@ -34,14 +34,18 @@ | |||
34 | 34 | ||
35 | //file include | 35 | //file include |
36 | #include "llpanelnetwork.h" | 36 | #include "llpanelnetwork.h" |
37 | #include "llstartup.h" | ||
37 | 38 | ||
38 | // project includes | 39 | // project includes |
39 | #include "llcheckboxctrl.h" | 40 | #include "llcheckboxctrl.h" |
41 | #include "llradiogroup.h" | ||
40 | #include "lldirpicker.h" | 42 | #include "lldirpicker.h" |
41 | #include "lluictrlfactory.h" | 43 | #include "lluictrlfactory.h" |
42 | #include "llviewercontrol.h" | 44 | #include "llviewercontrol.h" |
43 | #include "llviewerwindow.h" | 45 | #include "llviewerwindow.h" |
44 | 46 | ||
47 | bool LLPanelNetwork::sSocksSettingsChanged; | ||
48 | |||
45 | LLPanelNetwork::LLPanelNetwork() | 49 | LLPanelNetwork::LLPanelNetwork() |
46 | { | 50 | { |
47 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_network.xml"); | 51 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_network.xml"); |
@@ -72,6 +76,31 @@ BOOL LLPanelNetwork::postBuild() | |||
72 | childSetEnabled("xmlrpc_proxy_editor", gSavedSettings.getBOOL("XMLRPCProxyEnabled")); | 76 | childSetEnabled("xmlrpc_proxy_editor", gSavedSettings.getBOOL("XMLRPCProxyEnabled")); |
73 | childSetEnabled("xmlrpc_proxy_port", gSavedSettings.getBOOL("XMLRPCProxyEnabled")); | 77 | childSetEnabled("xmlrpc_proxy_port", gSavedSettings.getBOOL("XMLRPCProxyEnabled")); |
74 | 78 | ||
79 | // Socks 5 proxy settings, commit callbacks | ||
80 | childSetCommitCallback("socks5_proxy_enabled", onCommitSocks5ProxyEnabled, this); | ||
81 | childSetCommitCallback("socks5_auth", onSocksAuthChanged, this); | ||
82 | |||
83 | //Socks 5 proxy settings, saved data | ||
84 | childSetValue("socks5_proxy_enabled", gSavedSettings.getBOOL("Socks5ProxyEnabled")); | ||
85 | childSetValue("socks5_http_proxy_type", gSavedSettings.getString("Socks5HttpProxyType")); | ||
86 | |||
87 | childSetValue("socks5_proxy_host", gSavedSettings.getString("Socks5ProxyHost")); | ||
88 | childSetValue("socks5_proxy_port", (F32)gSavedSettings.getU32("Socks5ProxyPort")); | ||
89 | childSetValue("socks5_proxy_username", gSavedSettings.getString("Socks5Username")); | ||
90 | childSetValue("socks5_proxy_password", gSavedSettings.getString("Socks5Password")); | ||
91 | childSetValue("socks5_auth", gSavedSettings.getString("Socks5AuthType")); | ||
92 | |||
93 | // Socks 5 proxy settings, check if settings modified callbacks | ||
94 | childSetCommitCallback("socks5_proxy_host", onSocksSettingsModified,this); | ||
95 | childSetCommitCallback("socks5_proxy_port", onSocksSettingsModified,this); | ||
96 | childSetCommitCallback("socks5_proxy_username", onSocksSettingsModified,this); | ||
97 | childSetCommitCallback("socks5_proxy_password", onSocksSettingsModified,this); | ||
98 | |||
99 | // Socks 5 settings, Set all controls and labels enabled state | ||
100 | updateProxyEnabled(this, gSavedSettings.getBOOL("Socks5ProxyEnabled"), gSavedSettings.getString("Socks5AuthType")); | ||
101 | |||
102 | sSocksSettingsChanged = false; | ||
103 | |||
75 | return TRUE; | 104 | return TRUE; |
76 | } | 105 | } |
77 | 106 | ||
@@ -91,6 +120,28 @@ void LLPanelNetwork::apply() | |||
91 | gSavedSettings.setBOOL("XMLRPCProxyEnabled", childGetValue("xmlrpc_proxy_enabled")); | 120 | gSavedSettings.setBOOL("XMLRPCProxyEnabled", childGetValue("xmlrpc_proxy_enabled")); |
92 | gSavedSettings.setString("XMLRPCProxyAddress", childGetValue("xmlrpc_proxy_editor")); | 121 | gSavedSettings.setString("XMLRPCProxyAddress", childGetValue("xmlrpc_proxy_editor")); |
93 | gSavedSettings.setS32("XMLRPCProxyPort", childGetValue("xmlrpc_proxy_port")); | 122 | gSavedSettings.setS32("XMLRPCProxyPort", childGetValue("xmlrpc_proxy_port")); |
123 | |||
124 | gSavedSettings.setBOOL("Socks5ProxyEnabled", childGetValue("socks5_proxy_enabled")); | ||
125 | gSavedSettings.setString("Socks5HttpProxyType", childGetValue("socks5_http_proxy_type")); | ||
126 | gSavedSettings.setString("Socks5ProxyHost", childGetValue("socks5_proxy_host")); | ||
127 | gSavedSettings.setU32("Socks5ProxyPort", childGetValue("socks5_proxy_port").asInteger()); | ||
128 | |||
129 | gSavedSettings.setString("Socks5AuthType", childGetValue("socks5_auth")); | ||
130 | gSavedSettings.setString("Socks5Username", childGetValue("socks5_proxy_username")); | ||
131 | gSavedSettings.setString("Socks5Password", childGetValue("socks5_proxy_password")); | ||
132 | |||
133 | if (sSocksSettingsChanged) | ||
134 | { | ||
135 | if (LLStartUp::getStartupState() != STATE_LOGIN_WAIT) | ||
136 | { | ||
137 | LLNotifications::instance().add("ProxyNeedRestart"); | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | // Mark the socks class that it needs to update its connection | ||
142 | LLSocks::getInstance()->updated(); | ||
143 | } | ||
144 | } | ||
94 | } | 145 | } |
95 | 146 | ||
96 | void LLPanelNetwork::cancel() | 147 | void LLPanelNetwork::cancel() |
@@ -167,4 +218,77 @@ void LLPanelNetwork::onCommitXMLRPCProxyEnabled(LLUICtrl* ctrl, void* data) | |||
167 | self->childSetEnabled("xmlrpc_proxy_editor", check->get()); | 218 | self->childSetEnabled("xmlrpc_proxy_editor", check->get()); |
168 | self->childSetEnabled("xmlrpc_proxy_port", check->get()); | 219 | self->childSetEnabled("xmlrpc_proxy_port", check->get()); |
169 | self->childSetEnabled("xmlrpc_proxy_text_label", check->get()); | 220 | self->childSetEnabled("xmlrpc_proxy_text_label", check->get()); |
170 | } \ No newline at end of file | 221 | } |
222 | |||
223 | // static | ||
224 | void LLPanelNetwork::onCommitSocks5ProxyEnabled(LLUICtrl* ctrl, void* data) | ||
225 | { | ||
226 | LLPanelNetwork* self = (LLPanelNetwork*)data; | ||
227 | LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; | ||
228 | |||
229 | if (!self || !check) return; | ||
230 | |||
231 | sSocksSettingsChanged = true; | ||
232 | |||
233 | updateProxyEnabled(self, check->get(), self->childGetValue("socks5_auth")); | ||
234 | } | ||
235 | |||
236 | // static | ||
237 | void LLPanelNetwork::onSocksSettingsModified(LLUICtrl* ctrl, void* data) | ||
238 | { | ||
239 | sSocksSettingsChanged = true; | ||
240 | } | ||
241 | |||
242 | // static | ||
243 | void LLPanelNetwork::onSocksAuthChanged(LLUICtrl* ctrl, void* data) | ||
244 | { | ||
245 | LLRadioGroup* radio = static_cast<LLRadioGroup*>(ctrl); | ||
246 | LLPanelNetwork* self = static_cast<LLPanelNetwork*>(data); | ||
247 | |||
248 | sSocksSettingsChanged = true; | ||
249 | |||
250 | std::string selection = radio->getValue().asString(); | ||
251 | updateProxyEnabled(self, true, selection); | ||
252 | } | ||
253 | |||
254 | // static | ||
255 | void LLPanelNetwork::updateProxyEnabled(LLPanelNetwork * self, bool enabled, std::string authtype) | ||
256 | { | ||
257 | // Manage all the enable/disable of the socks5 options from this single function | ||
258 | // to avoid code duplication | ||
259 | |||
260 | // Update all socks labels and controls except auth specific ones | ||
261 | self->childSetEnabled("socks5_proxy_port", enabled); | ||
262 | self->childSetEnabled("socks5_proxy_host", enabled); | ||
263 | self->childSetEnabled("socks5_host_label", enabled); | ||
264 | self->childSetEnabled("socks5_proxy_label", enabled); | ||
265 | self->childSetEnabled("socks5_proxy_port", enabled); | ||
266 | self->childSetEnabled("socks5_auth_label", enabled); | ||
267 | self->childSetEnabled("socks5_auth", enabled); | ||
268 | |||
269 | // disable the web option if the web proxy has not been configured | ||
270 | // this is still not ideal as apply or ok is needed for this to be saved to the preferences | ||
271 | self->childSetEnabled("Web", gSavedSettings.getBOOL("BrowserProxyEnabled")); | ||
272 | |||
273 | self->childSetEnabled("Socks", enabled); | ||
274 | |||
275 | // Hide the auth specific lables if authtype is none or | ||
276 | // we are not enabled. | ||
277 | if ((authtype.compare("None") == 0) || (enabled == false)) | ||
278 | { | ||
279 | self->childSetEnabled("socks5_username_label", false); | ||
280 | self->childSetEnabled("socks5_password_label", false); | ||
281 | self->childSetEnabled("socks5_proxy_username", false); | ||
282 | self->childSetEnabled("socks5_proxy_password", false); | ||
283 | } | ||
284 | |||
285 | // Only show the username and password boxes if we are enabled | ||
286 | // and authtype is username pasword. | ||
287 | if ((authtype.compare("UserPass") == 0) && (enabled == true)) | ||
288 | { | ||
289 | self->childSetEnabled("socks5_username_label", true); | ||
290 | self->childSetEnabled("socks5_password_label", true); | ||
291 | self->childSetEnabled("socks5_proxy_username", true); | ||
292 | self->childSetEnabled("socks5_proxy_password", true); | ||
293 | } | ||
294 | } | ||
diff --git a/linden/indra/newview/llpanelnetwork.h b/linden/indra/newview/llpanelnetwork.h index 900158a..628f713 100644 --- a/linden/indra/newview/llpanelnetwork.h +++ b/linden/indra/newview/llpanelnetwork.h | |||
@@ -52,6 +52,14 @@ private: | |||
52 | static void onClickResetCache(void*); | 52 | static void onClickResetCache(void*); |
53 | static void onCommitPort(LLUICtrl* ctrl, void*); | 53 | static void onCommitPort(LLUICtrl* ctrl, void*); |
54 | static void onCommitXMLRPCProxyEnabled(LLUICtrl* ctrl, void* data); | 54 | static void onCommitXMLRPCProxyEnabled(LLUICtrl* ctrl, void* data); |
55 | static void onCommitSocks5ProxyEnabled(LLUICtrl* ctrl, void* data); | ||
56 | static void onClickTestProxy(void* user_data); | ||
57 | static void onSocksSettingsModified(LLUICtrl* ctrl, void* data); | ||
58 | static void onSocksAuthChanged(LLUICtrl* ctrl, void* data); | ||
59 | static void updateProxyEnabled(LLPanelNetwork * self, bool enabled, std::string authtype); | ||
60 | |||
61 | static bool sSocksSettingsChanged; | ||
62 | |||
55 | }; | 63 | }; |
56 | 64 | ||
57 | #endif | 65 | #endif |
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 8e11d8c..80ddfa4 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp | |||
@@ -189,6 +189,7 @@ | |||
189 | #include "llwlparammanager.h" | 189 | #include "llwlparammanager.h" |
190 | #include "llwaterparammanager.h" | 190 | #include "llwaterparammanager.h" |
191 | #include "llagentlanguage.h" | 191 | #include "llagentlanguage.h" |
192 | #include "llsocks5.h" | ||
192 | #include "viewerversion.h" | 193 | #include "viewerversion.h" |
193 | 194 | ||
194 | #include "lgghunspell_wrapper.h" | 195 | #include "lgghunspell_wrapper.h" |
@@ -635,6 +636,15 @@ bool idle_startup() | |||
635 | LL_INFOS("AppInit") << "Message System Initialized." << LL_ENDL; | 636 | LL_INFOS("AppInit") << "Message System Initialized." << LL_ENDL; |
636 | 637 | ||
637 | //------------------------------------------------- | 638 | //------------------------------------------------- |
639 | // Init the socks 5 proxy and open the control TCP | ||
640 | // connection if the user is using SOCKS5 | ||
641 | // We need to do this early incase the user is using | ||
642 | // socks for http so we get the login screen via socks | ||
643 | //------------------------------------------------- | ||
644 | |||
645 | LLStartUp::handleSocksProxy(false); | ||
646 | |||
647 | //------------------------------------------------- | ||
638 | // Init audio, which may be needed for prefs dialog | 648 | // Init audio, which may be needed for prefs dialog |
639 | // or audio cues in connection UI. | 649 | // or audio cues in connection UI. |
640 | //------------------------------------------------- | 650 | //------------------------------------------------- |
@@ -890,8 +900,31 @@ bool idle_startup() | |||
890 | 900 | ||
891 | if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState()) | 901 | if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState()) |
892 | { | 902 | { |
893 | |||
894 | LL_DEBUGS("AppInitStartupState") << "STATE_LOGIN_CLEANUP" << LL_ENDL; | 903 | LL_DEBUGS("AppInitStartupState") << "STATE_LOGIN_CLEANUP" << LL_ENDL; |
904 | |||
905 | // Post login screen, we should see if any settings have changed that may | ||
906 | // require us to either start/stop or change the socks proxy. As various communications | ||
907 | // past this point may require the proxy to be up. | ||
908 | bool socks_enable_required = gSavedSettings.getBOOL("Socks5ProxyEnabled"); | ||
909 | if ((LLSocks::getInstance()->isEnabled() != socks_enable_required) || LLSocks::getInstance()->needsUpdate()) | ||
910 | { | ||
911 | if (socks_enable_required) | ||
912 | { | ||
913 | if (!LLStartUp::handleSocksProxy(false)) | ||
914 | { | ||
915 | // Proxy start up failed, we should now bail the state machine | ||
916 | // HandleSocksProxy() will have reported an error to the user | ||
917 | // already, so we just go back to the login screen. The user | ||
918 | // could then change the perferences to fix the issue. | ||
919 | LLStartUp::setStartupState(STATE_LOGIN_SHOW); | ||
920 | return FALSE; | ||
921 | } | ||
922 | } | ||
923 | else | ||
924 | { | ||
925 | LLSocks::getInstance()->stopProxy(); | ||
926 | } | ||
927 | } | ||
895 | 928 | ||
896 | gDisconnected = TRUE; | 929 | gDisconnected = TRUE; |
897 | 930 | ||
@@ -4022,3 +4055,93 @@ void apply_udp_blacklist(const std::string& csv) | |||
4022 | 4055 | ||
4023 | } | 4056 | } |
4024 | 4057 | ||
4058 | bool LLStartUp::handleSocksProxy(bool reportOK) | ||
4059 | { | ||
4060 | std::string httpProxyType = gSavedSettings.getString("Socks5HttpProxyType"); | ||
4061 | |||
4062 | // Determine the http proxy type (if any) | ||
4063 | if ((httpProxyType.compare("Web") == 0) && gSavedSettings.getBOOL("BrowserProxyEnabled")) | ||
4064 | { | ||
4065 | LLHost httpHost; | ||
4066 | httpHost.setHostByName(gSavedSettings.getString("BrowserProxyAddress")); | ||
4067 | httpHost.setPort(gSavedSettings.getS32("BrowserProxyPort")); | ||
4068 | LLSocks::getInstance()->EnableHttpProxy(httpHost,LLPROXY_HTTP); | ||
4069 | } | ||
4070 | else if ((httpProxyType.compare("Socks") == 0) && gSavedSettings.getBOOL("Socks5ProxyEnabled")) | ||
4071 | { | ||
4072 | LLHost httpHost; | ||
4073 | httpHost.setHostByName(gSavedSettings.getString("Socks5ProxyHost")); | ||
4074 | httpHost.setPort(gSavedSettings.getU32("Socks5ProxyPort")); | ||
4075 | LLSocks::getInstance()->EnableHttpProxy(httpHost,LLPROXY_SOCKS); | ||
4076 | } | ||
4077 | else | ||
4078 | { | ||
4079 | LLSocks::getInstance()->DisableHttpProxy(); | ||
4080 | } | ||
4081 | |||
4082 | bool use_socks_proxy = gSavedSettings.getBOOL("Socks5ProxyEnabled"); | ||
4083 | if (use_socks_proxy) | ||
4084 | { | ||
4085 | |||
4086 | // Determine and update LLSocks with the saved authentication system | ||
4087 | std::string auth_type = gSavedSettings.getString("Socks5AuthType"); | ||
4088 | |||
4089 | if (auth_type.compare("None") == 0) | ||
4090 | { | ||
4091 | LLSocks::getInstance()->setAuthNone(); | ||
4092 | } | ||
4093 | |||
4094 | if (auth_type.compare("UserPass") == 0) | ||
4095 | { | ||
4096 | LLSocks::getInstance()->setAuthPassword(gSavedSettings.getString("Socks5Username"),gSavedSettings.getString("Socks5Password")); | ||
4097 | } | ||
4098 | |||
4099 | // Start the proxy and check for errors | ||
4100 | int status = LLSocks::getInstance()->startProxy(gSavedSettings.getString("Socks5ProxyHost"), gSavedSettings.getU32("Socks5ProxyPort")); | ||
4101 | LLSD subs; | ||
4102 | subs["PROXY"] = gSavedSettings.getString("Socks5ProxyHost"); | ||
4103 | |||
4104 | switch(status) | ||
4105 | { | ||
4106 | case SOCKS_OK: | ||
4107 | if (reportOK == true) | ||
4108 | { | ||
4109 | LLNotifications::instance().add("SOCKS_CONNECT_OK", subs); | ||
4110 | } | ||
4111 | return true; | ||
4112 | break; | ||
4113 | |||
4114 | case SOCKS_CONNECT_ERROR: // TCP Fail | ||
4115 | LLNotifications::instance().add("SOCKS_CONNECT_ERROR", subs); | ||
4116 | break; | ||
4117 | |||
4118 | case SOCKS_NOT_PERMITTED: // Socks5 server rule set refused connection | ||
4119 | LLNotifications::instance().add("SOCKS_NOT_PERMITTED", subs); | ||
4120 | break; | ||
4121 | |||
4122 | case SOCKS_NOT_ACCEPTABLE: // Selected authentication is not acceptable to server | ||
4123 | LLNotifications::instance().add("SOCKS_NOT_ACCEPTABLE", subs); | ||
4124 | break; | ||
4125 | |||
4126 | case SOCKS_AUTH_FAIL: // Authentication failed | ||
4127 | LLNotifications::instance().add("SOCKS_AUTH_FAIL", subs); | ||
4128 | break; | ||
4129 | |||
4130 | case SOCKS_UDP_FWD_NOT_GRANTED: // UDP forward request failed | ||
4131 | LLNotifications::instance().add("SOCKS_UDP_FWD_NOT_GRANTED", subs); | ||
4132 | break; | ||
4133 | |||
4134 | case SOCKS_HOST_CONNECT_FAILED: // Failed to open a TCP channel to the socks server | ||
4135 | LLNotifications::instance().add("SOCKS_HOST_CONNECT_FAILED", subs); | ||
4136 | break; | ||
4137 | } | ||
4138 | |||
4139 | return false; | ||
4140 | } | ||
4141 | else | ||
4142 | { | ||
4143 | LLSocks::getInstance()->stopProxy(); //ensure no UDP proxy is running and its all cleaned up | ||
4144 | } | ||
4145 | |||
4146 | return true; | ||
4147 | } | ||
diff --git a/linden/indra/newview/llstartup.h b/linden/indra/newview/llstartup.h index 3fe8daa..6dc3946 100644 --- a/linden/indra/newview/llstartup.h +++ b/linden/indra/newview/llstartup.h | |||
@@ -123,6 +123,9 @@ public: | |||
123 | static std::string sSLURLCommand; | 123 | static std::string sSLURLCommand; |
124 | // *HACK: On startup, if we were passed a secondlife://app/do/foo | 124 | // *HACK: On startup, if we were passed a secondlife://app/do/foo |
125 | // command URL, store it for later processing. | 125 | // command URL, store it for later processing. |
126 | |||
127 | static bool handleSocksProxy(bool reportOK = true); | ||
128 | |||
126 | static bool shouldAutoLogin() { return mShouldAutoLogin; }; | 129 | static bool shouldAutoLogin() { return mShouldAutoLogin; }; |
127 | static void setShouldAutoLogin(bool value) { mShouldAutoLogin = value; }; | 130 | static void setShouldAutoLogin(bool value) { mShouldAutoLogin = value; }; |
128 | 131 | ||
diff --git a/linden/indra/newview/llxmlrpctransaction.cpp b/linden/indra/newview/llxmlrpctransaction.cpp index 675ba42..30b0249 100644 --- a/linden/indra/newview/llxmlrpctransaction.cpp +++ b/linden/indra/newview/llxmlrpctransaction.cpp | |||
@@ -236,6 +236,23 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) | |||
236 | mCurlRequest->setopt(CURLOPT_PROXYPORT, port); | 236 | mCurlRequest->setopt(CURLOPT_PROXYPORT, port); |
237 | mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); | 237 | mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
238 | } | 238 | } |
239 | else if (LLSocks::getInstance()->isHttpProxyEnabled()) | ||
240 | { | ||
241 | std::string address = LLSocks::getInstance()->getHTTPProxy().getIPString(); | ||
242 | U16 port = LLSocks::getInstance()->getHTTPProxy().getPort(); | ||
243 | mCurlRequest->setoptString(CURLOPT_PROXY, address.c_str()); | ||
244 | mCurlRequest->setopt(CURLOPT_PROXYPORT, port); | ||
245 | if (LLSocks::getInstance()->getHttpProxyType() == LLPROXY_SOCKS) | ||
246 | { | ||
247 | mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); | ||
248 | if(LLSocks::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) | ||
249 | mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLSocks::getInstance()->getProxyUserPwd()); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); | ||
254 | } | ||
255 | } | ||
239 | 256 | ||
240 | // mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging | 257 | // mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging |
241 | mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1); | 258 | mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1); |
diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml index 306e3b8..ecfc523 100644 --- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml | |||
@@ -7393,6 +7393,62 @@ Media/audio URL blocked for [DOMAIN] | |||
7393 | The media filters have been cleared | 7393 | The media filters have been cleared |
7394 | </notification> | 7394 | </notification> |
7395 | 7395 | ||
7396 | <notification | ||
7397 | icon="alertmodal.tga" | ||
7398 | name="ProxyNeedRestart" | ||
7399 | type="alertmodal"> | ||
7400 | Socks proxy settings will take effect after you restart [VIEWER_NAME]. | ||
7401 | </notification> | ||
7402 | |||
7403 | <notification | ||
7404 | icon="alertmodal.tga" | ||
7405 | name="SOCKS_CONNECT_OK" | ||
7406 | type="alertmodal"> | ||
7407 | Connection to Socks5 proxy [PROXY] was successful. | ||
7408 | </notification> | ||
7409 | |||
7410 | <notification | ||
7411 | icon="alertmodal.tga" | ||
7412 | name="SOCKS_NOT_PERMITTED" | ||
7413 | type="alertmodal"> | ||
7414 | The Socks5 proxy "[PROXY]" refused the connection, not allowed by rule set | ||
7415 | </notification> | ||
7416 | |||
7417 | <notification | ||
7418 | icon="alertmodal.tga" | ||
7419 | name="SOCKS_CONNECT_ERROR" | ||
7420 | type="alertmodal"> | ||
7421 | The Socks5 proxy "[PROXY]" refused the connection, could not open TCP channel | ||
7422 | </notification> | ||
7423 | |||
7424 | <notification | ||
7425 | icon="alertmodal.tga" | ||
7426 | name="SOCKS_NOT_ACCEPTABLE" | ||
7427 | type="alertmodal"> | ||
7428 | The Socks5 proxy "[PROXY]" refused the selected authentication system | ||
7429 | </notification> | ||
7430 | |||
7431 | <notification | ||
7432 | icon="alertmodal.tga" | ||
7433 | name="SOCKS_AUTH_FAIL" | ||
7434 | type="alertmodal"> | ||
7435 | The Socks5 proxy "[PROXY]" reported your credentials are invalid | ||
7436 | </notification> | ||
7437 | |||
7438 | <notification | ||
7439 | icon="alertmodal.tga" | ||
7440 | name="SOCKS_UDP_FWD_NOT_GRANTED" | ||
7441 | type="alertmodal"> | ||
7442 | The Socks5 proxy "[PROXY]" refused the UDP associate request | ||
7443 | </notification> | ||
7444 | |||
7445 | <notification | ||
7446 | icon="alertmodal.tga" | ||
7447 | name="SOCKS_HOST_CONNECT_FAILED" | ||
7448 | type="alertmodal"> | ||
7449 | Could not connect to Socks5 proxy server "[PROXY]" | ||
7450 | </notification> | ||
7451 | |||
7396 | <!--End Imprudence notifications--> | 7452 | <!--End Imprudence notifications--> |
7397 | <!-- [KITTY VIEWER] --> | 7453 | <!-- [KITTY VIEWER] --> |
7398 | <notification | 7454 | <notification |
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml index 7d26ff5..c3f0c22 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml | |||
@@ -63,32 +63,115 @@ | |||
63 | decimal_digits="0" enabled="true" follows="left|top" height="16" | 63 | decimal_digits="0" enabled="true" follows="left|top" height="16" |
64 | increment="1" initial_val="13000" label="Port number:" label_width="75" | 64 | increment="1" initial_val="13000" label="Port number:" label_width="75" |
65 | left_delta="20" max_val="13050" min_val="13000" mouse_opaque="true" | 65 | left_delta="20" max_val="13050" min_val="13000" mouse_opaque="true" |
66 | name="connection_port" width="150" /> | 66 | name="connection_port" width="140" /> |
67 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | 67 | |
68 | bottom_delta="-24" drop_shadow_visible="true" enabled="true" | 68 | <!-- XMLRPC PROXY --> |
69 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" | 69 | |
70 | height="10" left="15" mouse_opaque="false" name="proxy_label" v_pad="0" | 70 | <check_box bottom_delta="-25" enabled="true" |
71 | width="300"> | ||
72 | XMLRPC Proxy (Login, Land- and Money purchase): | ||
73 | </text> | ||
74 | <check_box bottom_delta="-25" enabled="true" | ||
75 | follows="left|top" font="SansSerifSmall" height="16" initial_value="false" | 71 | follows="left|top" font="SansSerifSmall" height="16" initial_value="false" |
76 | label="Enable XMLRPC proxy" left_delta="199" mouse_opaque="true" | 72 | label="Enable XMLRPC proxy (Login, Land, and Money purchases)" left="15" mouse_opaque="true" |
77 | name="xmlrpc_proxy_enabled" radio_style="false" width="256" /> | 73 | name="xmlrpc_proxy_enabled" radio_style="false" width="300" /> |
78 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | 74 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" |
79 | bottom_delta="-25" drop_shadow_visible="true" enabled="true" | 75 | bottom_delta="-18" drop_shadow_visible="true" enabled="true" |
80 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" | 76 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" |
81 | height="10" left="140" mouse_opaque="false" name="xmlrpc_proxy_text_label" | 77 | height="10" left_delta="20" mouse_opaque="false" name="xmlrpc_proxy_text_label" |
82 | v_pad="0" width="128"> | 78 | v_pad="0" width="128"> |
83 | Address: | 79 | Address: |
84 | </text> | 80 | </text> |
85 | <line_editor bottom_delta="-8" enabled="true" follows="left|top" font="SansSerif" | 81 | <line_editor bottom_delta="-8" enabled="true" follows="left|top" font="SansSerif" |
86 | height="20" left="217" name="xmlrpc_proxy_editor" | 82 | height="20" left="112" name="xmlrpc_proxy_editor" |
87 | tool_tip="The name or IP address of the proxy you would like to use" | 83 | tool_tip="The name or IP address of the proxy you would like to use" |
88 | width="200" /> | 84 | width="200" /> |
89 | <spinner bottom_delta="-25" decimal_digits="0" | 85 | <spinner bottom_delta="-20" decimal_digits="0" |
90 | enabled="true" follows="left|top" height="16" increment="1" | 86 | enabled="true" follows="left|top" height="16" increment="1" |
91 | initial_val="80" label="Port number:" label_width="75" left="140" | 87 | initial_val="80" label="Port number:" label_width="75" left="35" |
92 | max_val="12000" min_val="10" mouse_opaque="true" name="xmlrpc_proxy_port" | 88 | max_val="12000" min_val="10" mouse_opaque="true" name="xmlrpc_proxy_port" |
93 | width="140" /> | 89 | width="140" /> |
90 | |||
91 | <!-- SOCKS 5 PROXY --> | ||
92 | |||
93 | <check_box bottom_delta="-24" enabled="true" | ||
94 | follows="left|top" font="SansSerifSmall" height="16" initial_value="false" | ||
95 | label="Enable SOCKS 5 proxy" left="15" mouse_opaque="true" | ||
96 | name="socks5_proxy_enabled" radio_style="false" width="256" /> | ||
97 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
98 | bottom_delta="-18" drop_shadow_visible="true" enabled="true" | ||
99 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" | ||
100 | height="10" left="35" mouse_opaque="false" name="socks5_host_label" | ||
101 | v_pad="0" width="128"> | ||
102 | Socks 5 host: | ||
103 | </text> | ||
104 | <line_editor bottom_delta="-6" enabled="true" follows="left|top" font="SansSerif" | ||
105 | height="20" left="113" name="socks5_proxy_host" | ||
106 | tool_tip="The name or IP address of the SOCKS5 proxy you would like to use" | ||
107 | width="200" /> | ||
108 | <spinner bottom_delta="-20" decimal_digits="0" | ||
109 | enabled="true" follows="left|top" height="16" increment="1" | ||
110 | initial_val="80" label="Port number:" label_width="75" left="35" | ||
111 | max_val="12000" min_val="10" mouse_opaque="true" name="socks5_proxy_port" | ||
112 | width="140" /> | ||
113 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
114 | bottom_delta="-20" drop_shadow_visible="true" enabled="true" | ||
115 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" | ||
116 | height="10" left="35" mouse_opaque="false" name="socks5_auth_label" | ||
117 | v_pad="0" width="128"> | ||
118 | Socks5 authentication: | ||
119 | </text> | ||
120 | <radio_group bottom_delta="-6" draw_border="false" follows="left|top" height="20" left="35" | ||
121 | name="socks5_auth" width="420"> | ||
122 | <radio_item bottom="0" height="20" left_delta="80" name="None" width="50" | ||
123 | tool_tip="No authentication"> | ||
124 | None | ||
125 | </radio_item> | ||
126 | <radio_item bottom="0" height="20" left_delta="50" name="UserPass" width="50" | ||
127 | tool_tip="Username / Password authentication"> | ||
128 | Username / Password | ||
129 | </radio_item> | ||
130 | </radio_group> | ||
131 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
132 | bottom_delta="-16" drop_shadow_visible="true" enabled="true" | ||
133 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" | ||
134 | height="10" left="122" mouse_opaque="false" name="socks5_username_label" | ||
135 | v_pad="0" width="128"> | ||
136 | Username: | ||
137 | </text> | ||
138 | <line_editor bottom_delta="-8" enabled="true" follows="left|top" font="SansSerif" | ||
139 | height="20" left="200" name="socks5_proxy_username" | ||
140 | tool_tip="Username for the Socks5 proxy" | ||
141 | width="200" /> | ||
142 | |||
143 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
144 | bottom_delta="-14" drop_shadow_visible="true" enabled="true" | ||
145 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" | ||
146 | height="10" left="122" mouse_opaque="false" name="socks5_password_label" | ||
147 | v_pad="0" width="128"> | ||
148 | Password: | ||
149 | </text> | ||
150 | <line_editor bottom_delta="-8" enabled="true" follows="left|top" font="SansSerif" | ||
151 | height="20" left="200" name="socks5_proxy_password" | ||
152 | tool_tip="Password for the Socks5 proxy" | ||
153 | width="200" /> | ||
154 | |||
155 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
156 | bottom_delta="-20" drop_shadow_visible="true" enabled="true" | ||
157 | follows="left|top" font="SansSerifSmall" h_pad="0" halign="left" | ||
158 | height="10" left="35" mouse_opaque="false" name="socks5_auth_label" | ||
159 | v_pad="0" width="128"> | ||
160 | HTTP proxy: | ||
161 | </text> | ||
162 | <radio_group bottom_delta="-8" draw_border="false" follows="left|top" height="20" left="35" | ||
163 | name="socks5_http_proxy_type" width="380" > | ||
164 | <radio_item height="20" bottom="0" left="100" name="None" width="50" | ||
165 | tool_tip="No HTTP proxy"> | ||
166 | None | ||
167 | </radio_item> | ||
168 | <radio_item height="20" bottom="0" left="170" name="Socks" width="50" | ||
169 | tool_tip="Use Socks for HTTP proxy"> | ||
170 | Socks | ||
171 | </radio_item> | ||
172 | <radio_item height="20" bottom="0" left="250" name="Web" width="50" | ||
173 | tool_tip="Use web proxy for HTTP proxy"> | ||
174 | Web | ||
175 | </radio_item> | ||
176 | </radio_group> | ||
94 | </panel> | 177 | </panel> |