Skip to content
Snippets Groups Projects
Commit 239282d5 authored by Marco Ratto's avatar Marco Ratto
Browse files

added special checksum security checks before removing remote directory

parent 3fdd8cd7
Branches
Tags
No related merge requests found
......@@ -35,10 +35,28 @@ if nargin ==0,
return
end
% security check of remote folder delete
ok(1)=isempty(strfind(Parallel_info.RemoteTmpFolder,'..'));
tmp1=strfind(Parallel_info.RemoteTmpFolder,'2');
ok(2)=tmp1(1)==1;
ok(3)=~isempty(strfind(Parallel_info.RemoteTmpFolder,'-'));
ok(4)=~isempty(strfind(Parallel_info.RemoteTmpFolder,'h'));
ok(5)=~isempty(strfind(Parallel_info.RemoteTmpFolder,'m'));
ok(6)=~isempty(strfind(Parallel_info.RemoteTmpFolder,'s'));
ok(7)=~isempty(PRCDir);
if sum(ok)<7,
error('The name of the remote tmp folder does not comply the security standards!'),
end
for indPC=1:length(Parallel),
ok(1)=isempty(strfind(Parallel(indPC).RemoteDirectory,'..'));
if sum(ok)<7,
error('The remote folder path structure does not comply the security standards!'),
end
while (1)
if ~ispc
stat = system(['ssh ',Parallel(indPC).UserName,'@',Parallel(indPC).ComputerName,' rm -fr ',Parallel(indPC).RemoteDirectory,'/',PRCDir]);
[stat NonServe] = system(['ssh ',Parallel(indPC).UserName,'@',Parallel(indPC).ComputerName,' rm -fr ',Parallel(indPC).RemoteDirectory,'/',PRCDir]);
break;
else
if exist('OCTAVE_VERSION'), % Patch for peculiar behaviour of rmdir under Windows.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment