ENH: systemCall: added allowSystemOperations checking. Added to argList.
This commit is contained in:
parent
0ffe4c0fd9
commit
fcfca9106c
@ -131,7 +131,7 @@ bool Foam::codeStreamTools::copyFilesContents(const fileName& dir) const
|
|||||||
<< "because of security issues. If you trust the code you can"
|
<< "because of security issues. If you trust the code you can"
|
||||||
<< " enable this" << endl
|
<< " enable this" << endl
|
||||||
<< "facility be adding to the InfoSwitches setting in the system"
|
<< "facility be adding to the InfoSwitches setting in the system"
|
||||||
<< " controlDict" << endl
|
<< " controlDict:" << endl
|
||||||
<< endl
|
<< endl
|
||||||
<< " allowSystemOperations 1" << endl
|
<< " allowSystemOperations 1" << endl
|
||||||
<< endl
|
<< endl
|
||||||
|
@ -32,6 +32,7 @@ License
|
|||||||
#include "JobInfo.H"
|
#include "JobInfo.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "regIOobject.H"
|
#include "regIOobject.H"
|
||||||
|
#include "codeStreamTools.H"
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
@ -787,6 +788,16 @@ Foam::argList::argList
|
|||||||
regIOobject::fileModificationChecking
|
regIOobject::fileModificationChecking
|
||||||
]
|
]
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
Info<< "allowSystemOperations : ";
|
||||||
|
if (codeStreamTools::allowSystemOperations)
|
||||||
|
{
|
||||||
|
Info<< "Allowing user-supplied system call operations" << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Disallowing user-supplied system call operations" << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master() && bannerEnabled)
|
if (Pstream::master() && bannerEnabled)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,8 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "systemCall.H"
|
#include "systemCall.H"
|
||||||
#include "dictionary.H"
|
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "codeStreamTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -71,6 +71,30 @@ void Foam::systemCall::read(const dictionary& dict)
|
|||||||
<< "no executeCalls, endCalls or writeCalls defined."
|
<< "no executeCalls, endCalls or writeCalls defined."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
else if (!codeStreamTools::allowSystemOperations)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"systemCall::read(const dictionary&)"
|
||||||
|
) << "Executing user-supplied system calls is not"
|
||||||
|
<< " enabled by default" << endl
|
||||||
|
<< "because of security issues. If you trust the case you can"
|
||||||
|
<< " enable this" << endl
|
||||||
|
<< "facility be adding to the InfoSwitches setting in the system"
|
||||||
|
<< " controlDict:" << endl
|
||||||
|
<< endl
|
||||||
|
<< " allowSystemOperations 1" << endl
|
||||||
|
<< endl
|
||||||
|
<< "The system controlDict is either" << endl
|
||||||
|
<< endl
|
||||||
|
<< " ~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict" << endl
|
||||||
|
<< endl
|
||||||
|
<< "or" << endl
|
||||||
|
<< endl
|
||||||
|
<< " $WM_PROJECT_DIR/etc/controlDict" << endl
|
||||||
|
<< endl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +102,7 @@ void Foam::systemCall::execute()
|
|||||||
{
|
{
|
||||||
forAll(executeCalls_, callI)
|
forAll(executeCalls_, callI)
|
||||||
{
|
{
|
||||||
::system(executeCalls_[callI].c_str());
|
Foam::system(executeCalls_[callI].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +111,7 @@ void Foam::systemCall::end()
|
|||||||
{
|
{
|
||||||
forAll(endCalls_, callI)
|
forAll(endCalls_, callI)
|
||||||
{
|
{
|
||||||
::system(endCalls_[callI].c_str());
|
Foam::system(endCalls_[callI].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +120,7 @@ void Foam::systemCall::write()
|
|||||||
{
|
{
|
||||||
forAll(writeCalls_, callI)
|
forAll(writeCalls_, callI)
|
||||||
{
|
{
|
||||||
::system(writeCalls_[callI].c_str());
|
Foam::system(writeCalls_[callI].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user