diff options
author | Oz Linden <oz@lindenlab.com> | 2013-02-21 16:47:52 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-02-21 16:47:52 -0500 |
commit | cf1019859def2af4414def7991e95a9020b0688f (patch) | |
tree | 7b3eeec76e65ab0b9ba4f85ca20ef7b18b281528 /indra/newview | |
parent | cf40fc0447606fd3b435a32c5dec7b48565cae4c (diff) |
add use of v1.1 update request protocol, with fallback to v1.0
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 3 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llhasheduniqueid.cpp | 54 | ||||
-rw-r--r-- | indra/newview/llhasheduniqueid.h | 34 | ||||
-rw-r--r-- | indra/newview/lllogininstance.cpp | 21 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_setup.xml | 13 | ||||
-rw-r--r-- | indra/newview/tests/lllogininstance_test.cpp | 19 |
8 files changed, 152 insertions, 23 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e77d888466..19470102e3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -82,6 +82,7 @@ include_directories( ${LIBS_PREBUILD_DIR}/include/hunspell ${OPENAL_LIB_INCLUDE_DIRS} ${LIBS_PREBUILT_DIR}/include/collada/1.4 + ${CMAKE_CURRENT_SOURCE_DIR} ) set(viewer_SOURCE_FILES @@ -278,6 +279,7 @@ set(viewer_SOURCE_FILES llgroupiconctrl.cpp llgrouplist.cpp llgroupmgr.cpp + llhasheduniqueid.cpp llhints.cpp llhomelocationresponder.cpp llhudeffect.cpp @@ -854,6 +856,7 @@ set(viewer_HEADER_FILES llgroupiconctrl.h llgrouplist.h llgroupmgr.h + llhasheduniqueid.h llhints.h llhomelocationresponder.h llhudeffect.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2e91d10cd3..5b73b075a4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12109,6 +12109,17 @@ <key>Value</key> <integer>3</integer> </map> + <key>UpdaterWillingToTest</key> + <map> + <key>Comment</key> + <string>Allow upgrades to release candidate viewers with new features and fixes.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>UpdaterServiceCheckPeriod</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 468a297c2d..ae593daf08 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2936,16 +2936,28 @@ void LLAppViewer::initUpdater() std::string url = gSavedSettings.getString("UpdaterServiceURL"); std::string channel = LLVersionInfo::getChannel(); std::string version = LLVersionInfo::getVersion(); - std::string protocol_version = gSavedSettings.getString("UpdaterServiceProtocolVersion"); std::string service_path = gSavedSettings.getString("UpdaterServicePath"); U32 check_period = gSavedSettings.getU32("UpdaterServiceCheckPeriod"); + bool willing_to_test = gSavedSettings.getBOOL("UpdaterWillingToTest"); + unsigned char unique_id[MD5HEX_STR_SIZE]; + if ( ! llHashedUniqueID(unique_id) ) + { + if ( willing_to_test ) + { + LL_WARNS("UpdaterService") << "Unable to provide a unique id; overriding willing_to_test by sending testno" << LL_ENDL; + } + willing_to_test = false; + } mUpdater->setAppExitCallback(boost::bind(&LLAppViewer::forceQuit, this)); - mUpdater->initialize(protocol_version, - url, + mUpdater->initialize(url, service_path, channel, - version); + version, + getOSInfo().getOSVersionString(), + unique_id, + willing_to_test + ); mUpdater->setCheckPeriod(check_period); mUpdater->setBandwidthLimit((int)gSavedSettings.getF32("UpdaterMaximumBandwidth") * (1024/8)); gSavedSettings.getControl("UpdaterMaximumBandwidth")->getSignal()-> diff --git a/indra/newview/llhasheduniqueid.cpp b/indra/newview/llhasheduniqueid.cpp new file mode 100644 index 0000000000..5db5d22332 --- /dev/null +++ b/indra/newview/llhasheduniqueid.cpp @@ -0,0 +1,54 @@ +/** + * @file llhasheduniqueid.cpp + * @brief retrieves an obfuscated unique id for the system + * + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llhasheduniqueid.h" +#include "llviewernetwork.h" +#include "lluuid.h" +#include "llmachineid.h" + +bool llHashedUniqueID(unsigned char id[MD5HEX_STR_SIZE]) +{ + bool idIsUnique = true; + LLMD5 hashed_unique_id; + unsigned char unique_id[MAC_ADDRESS_BYTES]; + if ( LLUUID::getNodeID(unique_id) + || LLMachineID::getUniqueID(unique_id, sizeof(unique_id)) + ) + { + hashed_unique_id.update(unique_id, MAC_ADDRESS_BYTES); + hashed_unique_id.finalize(); + hashed_unique_id.hex_digest((char*)id); + } + else + { + idIsUnique = false; + memcpy(id,"00000000000000000000000000000000", MD5HEX_STR_SIZE); + llwarns << "Failed to get an id; cannot uniquely identify this machine." << llendl; + } + return idIsUnique; +} + diff --git a/indra/newview/llhasheduniqueid.h b/indra/newview/llhasheduniqueid.h new file mode 100644 index 0000000000..8ef706c1f3 --- /dev/null +++ b/indra/newview/llhasheduniqueid.h @@ -0,0 +1,34 @@ +/** + * @file llhasheduniqueid.h + * @brief retrieves obfuscated but unique id for the system + * + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#ifndef LL_LLHASHEDUNIQUEID_H +#define LL_LLHASHEDUNIQUEID_H +#include "llmd5.h" + +/// Get an obfuscated identifier for this system +bool llHashedUniqueID(unsigned char id[MD5HEX_STR_SIZE]); +///< @returns true if the id is considered valid (if false, the id is all zeros) + +#endif // LL_LLHASHEDUNIQUEID_H diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 419641d23c..12796ca262 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -30,7 +30,6 @@ // llcommon #include "llevents.h" -#include "llmd5.h" #include "stringize.h" // llmessage (!) @@ -40,6 +39,7 @@ #include "lllogin.h" // newview +#include "llhasheduniqueid.h" #include "llviewernetwork.h" #include "llviewercontrol.h" #include "llversioninfo.h" @@ -202,7 +202,7 @@ MandatoryUpdateMachine::MandatoryUpdateMachine(LLLoginInstance & loginInstance, void MandatoryUpdateMachine::start(void) { - llinfos << "starting manditory update machine" << llendl; + llinfos << "starting mandatory update machine" << llendl; if(mUpdaterService.isChecking()) { switch(mUpdaterService.getState()) { @@ -579,24 +579,17 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia // (re)initialize the request params with creds. LLSD request_params = user_credential->getLoginParams(); - char hashed_unique_id_string[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ - LLMD5 hashed_unique_id; - unsigned char unique_id[MAC_ADDRESS_BYTES]; - if(LLUUID::getNodeID(unique_id) == 0) { - if(LLMachineID::getUniqueID(unique_id, sizeof(unique_id)) == 0) { - llerrs << "Failed to get an id; cannot uniquely identify this machine." << llendl; - } + unsigned char hashed_unique_id_string[MD5HEX_STR_SIZE]; + if ( ! llHashedUniqueID(hashed_unique_id_string) ) + { + llwarns << "Not providing a unique id in request params" << llendl; } - hashed_unique_id.update(unique_id, MAC_ADDRESS_BYTES); - hashed_unique_id.finalize(); - hashed_unique_id.hex_digest(hashed_unique_id_string); - request_params["start"] = construct_start_string(); request_params["skipoptional"] = mSkipOptionalUpdate; request_params["agree_to_tos"] = false; // Always false here. Set true in request_params["read_critical"] = false; // handleTOSResponse request_params["last_exec_event"] = mLastExecEvent; - request_params["mac"] = hashed_unique_id_string; + request_params["mac"] = (char*)hashed_unique_id_string; request_params["version"] = LLVersionInfo::getChannelAndVersion(); // Includes channel name request_params["channel"] = LLVersionInfo::getChannel(); request_params["id0"] = mSerialNumber; diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 4aeea8823e..2fb6a9fd40 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -232,6 +232,19 @@ name="Install_manual" value="0" /> </combo_box> + <check_box + top_delta="4" + enabled="true" + follows="left|top" + height="14" + initial_value="true" + control_name="UpdateWillingToTest" + label="Willing to update to release candidates" + left_delta="0" + mouse_opaque="true" + name="update_willing_to_test" + width="400" + top_pad="5"/> <text type="string" length="1" diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 7705b4c567..a86230488b 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -208,11 +208,14 @@ std::string const & LLUpdaterService::pumpName(void) return wakka; } bool LLUpdaterService::updateReadyToInstall(void) { return false; } -void LLUpdaterService::initialize(const std::string& protocol_version, - const std::string& url, - const std::string& path, - const std::string& channel, - const std::string& version) {} +void LLUpdaterService::initialize(const std::string& url, + const std::string& path, + const std::string& channel, + const std::string& version, + const std::string& platform_version, + const unsigned char uniqueid[MD5HEX_STR_SIZE], + const bool& willing_to_test + ) {} void LLUpdaterService::setCheckPeriod(unsigned int seconds) {} void LLUpdaterService::startChecking(bool install_if_ready) {} @@ -221,6 +224,12 @@ bool LLUpdaterService::isChecking() { return false; } LLUpdaterService::eUpdaterState LLUpdaterService::getState() { return INITIAL; } std::string LLUpdaterService::updatedVersion() { return ""; } +bool llHashedUniqueID(unsigned char* id) +{ + memcpy( id, "66666666666666666666666666666666", MD5HEX_STR_SIZE ); + return true; +} + //----------------------------------------------------------------------------- #include "llnotifications.h" #include "llfloaterreg.h" |