haskell-hvr / missingh

Utility library [Haskell]
https://hackage.haskell.org/package/MissingH
Other
87 stars 40 forks source link

Change behaviour for ".." in chrooted dir #37

Closed Ofenhed closed 2 years ago

Ofenhed commented 8 years ago

In the root directory ".." is the same as ".". This is currently not reflected in the missingh chroot functions, instead it throws an error. This breaks ftphs when running in a chrooted directory.

This change removes the error when trying to exit the chroot prison and simply returns the root of the prison.

jgoerzen commented 8 years ago

Isn't this patch too broad? In other words, it could disguse some real errors.

Ofenhed commented 8 years ago

According to the documentation of secureAbsNormPath it only returns Nothing if it's not a subpath. The only way to reach higher paths in a chrooted directory are '..', and in the file system those act like '.' in the same directory. If the documentation for secureAbsNormPath is wrong, then this conclusion is wrong, but otherwise this patch should only make MissingH act more like the Linux file structure.

andreasabel commented 2 years ago

This PR was rejected (by not merging it).