Skip to content
Snippets Groups Projects
Commit 8f2df75f authored by Karen Lahey's avatar Karen Lahey
Browse files

Fix build.

parent b90c7d64
No related branches found
No related tags found
No related merge requests found
......@@ -1038,46 +1038,42 @@ LLSecAPIBasicHandler::LLSecAPIBasicHandler()
void LLSecAPIBasicHandler::init()
{
mProtectedDataMap = LLSD::emptyMap();
if (mProtectedDataFilename.length() == 0)
{
mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
"bin_conf.dat");
}
if (mLegacyPasswordPath.length() == 0)
{
mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
}
mProtectedDataMap = LLSD::emptyMap();
mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
"bin_conf.dat");
std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
"CA.pem");
// copy the CA file to a user writable location so we can manipulate it.
// for this provider, by using a user writable file, there is a risk that
// an attacking program can modify the file, but OS dependent providers
// will reduce that risk.
// by using a user file, modifications will be limited to one user if
// we read-only the main file
if (!LLFile::isfile(store_file))
{
std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
"CA.pem");
// copy the CA file to a user writable location so we can manipulate it.
// for this provider, by using a user writable file, there is a risk that
// an attacking program can modify the file, but OS dependent providers
// will reduce that risk.
// by using a user file, modifications will be limited to one user if
// we read-only the main file
if (!LLFile::isfile(store_file))
{
std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
llifstream ca_file(ca_file_path.c_str(), llifstream::binary | llifstream::in);
llofstream copied_store_file(store_file.c_str(), llofstream::binary | llofstream::out);
std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
llifstream ca_file(ca_file_path.c_str(), llifstream::binary | llifstream::in);
llofstream copied_store_file(store_file.c_str(), llofstream::binary | llofstream::out);
while(!ca_file.fail())
{
char buffer[BUFFER_READ_SIZE];
ca_file.read(buffer, sizeof(buffer));
copied_store_file.write(buffer, ca_file.gcount());
while(!ca_file.fail())
{
char buffer[BUFFER_READ_SIZE];
ca_file.read(buffer, sizeof(buffer));
copied_store_file.write(buffer, ca_file.gcount());
}
ca_file.close();
copied_store_file.close();
}
ca_file.close();
copied_store_file.close();
LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
mStore = new LLBasicCertificateStore(store_file);
}
LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
mStore = new LLBasicCertificateStore(store_file);
_readProtectedData(); // initialize mProtectedDataMap
// may throw LLProtectedDataException if saved datamap is not decryptable
}
......
......@@ -340,7 +340,7 @@ namespace tut
LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
"test_password.dat");
handler.init();
handler->init();
// data retrieval for existing data
LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
......@@ -398,7 +398,7 @@ namespace tut
// cause a 'write' by using 'LLPointer' to delete then instantiate a handler
handler = NULL;
handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
handler.init();
handler->init();
data = handler->getProtectedData("test_data_type1", "test_data_id");
ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
......@@ -413,7 +413,7 @@ namespace tut
// cause a 'write'
handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
handler.init();
handler->init();
data = handler->getProtectedData("test_data_type1", "test_data_id");
ensure("not found", data.isUndefined());
......@@ -422,7 +422,7 @@ namespace tut
LLFile::remove("sechandler_settings.tmp");
handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
handler.init();
handler->init();
data = handler->getProtectedData("test_data_type1", "test_data_id");
ensure("not found", data.isUndefined());
handler = NULL;
......@@ -435,7 +435,7 @@ namespace tut
void sechandler_basic_test_object::test<3>()
{
LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
handler.init();
handler->init();
LLSD my_id = LLSD::emptyMap();
LLSD my_authenticator = LLSD::emptyMap();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment