IMHO this is not enough.
The motivation for my changes was to provide at least basic security. 

Here path '/tmp/../etc/passwd' will be allowed, wouldn't it?