summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-06-27 18:44:29 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-06-27 18:44:29 +0300
commit03f81254055c487623211aeae330d02980781f67 (patch)
tree07521d45f3bf6af0cda33123628431993665e856 /indra/newview
parentfe7232fd2e0da54ebfe1381e8e615aa94a35a1df (diff)
Backed out changeset: 920a0dbf290a Machine id is needed after singletons die
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llhasheduniqueid.cpp2
-rw-r--r--indra/newview/llmachineid.cpp24
-rw-r--r--indra/newview/llmachineid.h17
-rw-r--r--indra/newview/llmainlooprepeater.cpp2
-rw-r--r--indra/newview/llsechandler_basic.cpp6
6 files changed, 26 insertions, 27 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a574588b1a..151039acce 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -826,7 +826,7 @@ bool LLAppViewer::init()
LL_INFOS("InitInfo") << "LLCore::Http initialized." << LL_ENDL ;
- LLMachineID::getInstance(); //needs to be initialized before threads
+ LLMachineID::init();
{
if (gSavedSettings.getBOOL("QAModeMetrics"))
diff --git a/indra/newview/llhasheduniqueid.cpp b/indra/newview/llhasheduniqueid.cpp
index eca8d0935c..03192d3e61 100644
--- a/indra/newview/llhasheduniqueid.cpp
+++ b/indra/newview/llhasheduniqueid.cpp
@@ -36,7 +36,7 @@ bool llHashedUniqueID(unsigned char id[MD5HEX_STR_SIZE])
LLMD5 hashed_unique_id;
unsigned char unique_id[MAC_ADDRESS_BYTES];
if ( LLUUID::getNodeID(unique_id)
- || LLMachineID::getInstance()->getUniqueID(unique_id, sizeof(unique_id))
+ || LLMachineID::getUniqueID(unique_id, sizeof(unique_id))
)
{
hashed_unique_id.update(unique_id, MAC_ADDRESS_BYTES);
diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp
index 1420161008..b0ee8e7fcb 100644
--- a/indra/newview/llmachineid.cpp
+++ b/indra/newview/llmachineid.cpp
@@ -34,6 +34,8 @@ using namespace std;
#include <comdef.h>
#include <Wbemidl.h>
#endif
+unsigned char static_unique_id[] = {0,0,0,0,0,0};
+bool static has_static_unique_id = false;
#if LL_WINDOWS
@@ -58,22 +60,16 @@ public:
#endif //LL_WINDOWS
// get an unique machine id.
-// NOT THREAD SAFE - do first call before setting up threads.
+// NOT THREAD SAFE - do before setting up threads.
// MAC Address doesn't work for Windows 7 since the first returned hardware MAC address changes with each reboot, Go figure??
-LLMachineID::LLMachineID() :
-mHasStaticUniqueId(false)
-{
- // will set mStaticUniqueId to 0
- requestUniqueID();
-}
-S32 LLMachineID::requestUniqueID()
+S32 LLMachineID::init()
{
- memset(mStaticUniqueId, 0, sizeof(mStaticUniqueId));
+ memset(static_unique_id,0,sizeof(static_unique_id));
S32 ret_code = 0;
#if LL_WINDOWS
# pragma comment(lib, "wbemuuid.lib")
- size_t len = sizeof(mStaticUniqueId);
+ size_t len = sizeof(static_unique_id);
// algorithm to detect BIOS serial number found at:
// http://msdn.microsoft.com/en-us/library/aa394077%28VS.85%29.aspx
@@ -232,7 +228,7 @@ S32 LLMachineID::requestUniqueID()
if (vtProp.bstrVal[j] == 0)
break;
- mStaticUniqueId[i] = (unsigned int)(mStaticUniqueId[i] + serialNumber[j]);
+ static_unique_id[i] = (unsigned int)(static_unique_id[i] + serialNumber[j]);
j++;
}
}
@@ -257,16 +253,16 @@ S32 LLMachineID::requestUniqueID()
unsigned char * staticPtr = (unsigned char *)(&static_unique_id[0]);
ret_code = LLUUID::getNodeID(staticPtr);
#endif
- mHasStaticUniqueId = true;
+ has_static_unique_id = true;
return ret_code;
}
S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len)
{
- if (mHasStaticUniqueId)
+ if (has_static_unique_id)
{
- memcpy(unique_id, &mStaticUniqueId, len);
+ memcpy ( unique_id, &static_unique_id, len);
LL_INFOS_ONCE("AppInit") << "UniqueID: 0x";
// Code between here and LL_ENDL is not executed unless the LL_DEBUGS
// actually produces output
diff --git a/indra/newview/llmachineid.h b/indra/newview/llmachineid.h
index b485910eb8..6ef8c36fdb 100644
--- a/indra/newview/llmachineid.h
+++ b/indra/newview/llmachineid.h
@@ -28,20 +28,23 @@
#define LL_LLMACHINEID_H
-class LLMachineID : public LLSingleton<LLMachineID>
+class LLMachineID
{
- LLSINGLETON(LLMachineID);
public:
- S32 getUniqueID(unsigned char *unique_id, size_t len);
+ LLMachineID();
+ virtual ~LLMachineID();
+ static S32 getUniqueID(unsigned char *unique_id, size_t len);
+ static S32 init();
-private:
- S32 requestUniqueID();
+protected:
private:
- bool mHasStaticUniqueId;
- unsigned char mStaticUniqueId[6];
+
};
+
+
+
#endif // LL_LLMACHINEID_H
diff --git a/indra/newview/llmainlooprepeater.cpp b/indra/newview/llmainlooprepeater.cpp
index 972b1d838f..6736e9a950 100644
--- a/indra/newview/llmainlooprepeater.cpp
+++ b/indra/newview/llmainlooprepeater.cpp
@@ -1,5 +1,5 @@
/**
- * @file llmainlooprepeater.cpp
+ * @file llmachineid.cpp
* @brief retrieves unique machine ids
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 63471ab865..9ab9e4a1a2 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -1310,7 +1310,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
U8 decrypted_buffer[BUFFER_READ_SIZE];
int decrypted_length;
unsigned char unique_id[MAC_ADDRESS_BYTES];
- LLMachineID::getInstance()->getUniqueID(unique_id, sizeof(unique_id));
+ LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
LLXORCipher cipher(unique_id, sizeof(unique_id));
// read in the salt and key
@@ -1395,7 +1395,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
EVP_CIPHER_CTX_init(&ctx);
EVP_EncryptInit(&ctx, EVP_rc4(), salt, NULL);
unsigned char unique_id[MAC_ADDRESS_BYTES];
- LLMachineID::getInstance()->getUniqueID(unique_id, sizeof(unique_id));
+ LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
LLXORCipher cipher(unique_id, sizeof(unique_id));
cipher.encrypt(salt, STORE_SALT_SIZE);
protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);
@@ -1639,7 +1639,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword()
// Decipher with MAC address
unsigned char unique_id[MAC_ADDRESS_BYTES];
- LLMachineID::getInstance()->getUniqueID(unique_id, sizeof(unique_id));
+ LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
LLXORCipher cipher(unique_id, sizeof(unique_id));
cipher.decrypt(&buffer[0], buffer.size());