1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-27 10:50:10 +03:00

bug #4380: Secure defaults for SAFE_DIRS & RESTRICTED_DIRS.

This commit is contained in:
Ruben S. Montero 2016-05-20 12:22:54 +02:00
parent 9264a56412
commit 1bef231fa5

View File

@ -448,6 +448,9 @@ int Datastore::insert(SqlDB *db, string& error_str)
string s_ds_type;
string datastore_location;
string safe_dirs;
string restricted_dirs;
ostringstream oss;
// -------------------------------------------------------------------------
@ -517,6 +520,18 @@ int Datastore::insert(SqlDB *db, string& error_str)
goto error_empty_tm;
}
//--------------------------------------------------------------------------
// Set default SAFE_DIRS & RESTRICTED_DIRS if not set
//--------------------------------------------------------------------------
get_template_attribute("SAFE_DIRS", safe_dirs);
get_template_attribute("RESTRICTED_DIRS", restricted_dirs);
if ( safe_dirs.empty() && restricted_dirs.empty() )
{
replace_template_attribute("SAFE_DIRS", "/var/tmp");
replace_template_attribute("RESTRICTED_DIRS", "/");
}
//--------------------------------------------------------------------------
// Insert the Datastore
//--------------------------------------------------------------------------