Evaluate a command string for access control
I need some help!
I will make this feature:
- given a directory name, a "client" can access only in this directory and all the subdirectory in it.
directory name: /home/tmp
The client can access to /home/tmp and all its subdirectory but not in /home or any other directory in the filesystem.
I will make this with C or LINUX shell commands.
NOTE: if the command is ls home/tmp/../../../tmp.txt the client can't access to this directory so a good evaluation of the command string given has to be performed.
I think to evaluate the string given to me expand the path (removing .. or . or symbolic link) and see if it match with the directory name given.
How can I do this? There are another method to do this?
Thanks for all.