ENH: dynamicCode.C: check for permission even when restarting

This commit is contained in:
mattijs
2011-05-26 12:09:22 +01:00
parent 3ac90128f2
commit 00760b736e

View File

@ -71,6 +71,27 @@ void Foam::dynamicCode::checkSecurity
<< "using dlopen)" << "using dlopen)"
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (!allowSystemOperations)
{
FatalIOErrorIn
(
title,
dict
) << "Loading a shared library using case-supplied code is not"
<< " enabled by default" << nl
<< "because of security issues. If you trust the code you can"
<< " enable this" << nl
<< "facility be adding to the InfoSwitches setting in the system"
<< " controlDict:" << nl << nl
<< " allowSystemOperations 1" << nl << nl
<< "The system controlDict is either" << nl << nl
<< " ~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict" << nl << nl
<< "or" << nl << nl
<< " $WM_PROJECT_DIR/etc/controlDict" << nl
<< endl
<< exit(FatalIOError);
}
} }
@ -400,26 +421,6 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
Info<< "Creating new library in " << this->libRelPath() << endl; Info<< "Creating new library in " << this->libRelPath() << endl;
} }
if (!allowSystemOperations)
{
FatalErrorIn
(
"dynamicCode::copyOrCreateFiles() const"
) << "Loading a shared library using case-supplied code is not"
<< " enabled by default" << nl
<< "because of security issues. If you trust the code you can"
<< " enable this" << nl
<< "facility be adding to the InfoSwitches setting in the system"
<< " controlDict:" << nl << nl
<< " allowSystemOperations 1" << nl << nl
<< "The system controlDict is either" << nl << nl
<< " ~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict" << nl << nl
<< "or" << nl << nl
<< " $WM_PROJECT_DIR/etc/controlDict" << nl
<< endl
<< exit(FatalError);
}
const label nFiles = compileFiles_.size() + copyFiles_.size(); const label nFiles = compileFiles_.size() + copyFiles_.size();
DynamicList<fileName> resolvedFiles(nFiles); DynamicList<fileName> resolvedFiles(nFiles);