couling / WebDAV-Daemon

MIT License
34 stars 7 forks source link

Allow using a subdirectory of the user's home dir as chroot #20

Closed xyzzy42 closed 3 years ago

xyzzy42 commented 3 years ago

Let chroot-path to contain additional path components after the '\~'. E.g., a path like "~/html" will cause webdavd to chroot into the specified subdirectory of the user's home dir.

This way just a user specific website can be served and not the entire home directory tree.

xyzzy42 commented 3 years ago

The shell would match ~a to the home directory of user a. It didn't seem like anyone needed that, since they could just use the static path it would produce directly.

One could use a pattern like ~-dav and expect to produce a path like /home/user-dav. I didn't think rejecting that would be helpful to someone who tries it.

couling commented 3 years ago

Not quite. The shell matches ~a if user "a" exists, otherwise it leaves it as literally ~a, ie: './~a'. I wouldn't bother supporting references to another user's home directory, but for the sake of a more complex if statement I'd prefer to support the edge case where it's interpreted literally.

xyzzy42 commented 3 years ago

Good point, I didn't think about that. I've changed it so only ~ or a path prefixed with ~/ will be cause a substitution of ~.