aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tftpd.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tftpd.rs b/src/tftpd.rs
index 6513367..e135d9f 100644
--- a/src/tftpd.rs
+++ b/src/tftpd.rs
@@ -63,6 +63,12 @@ impl Tftpd {
}
fn file_allowed(&self, filename: &Path) -> Option<PathBuf> {
+ if self.conf.dir == PathBuf::from("/") {
+ /* running either chrooted in requested directory,
+ or whole root is being served */
+ return Some(filename.to_path_buf());
+ }
+
/* get parent to check dir where file should be read/written */
let path = self.conf.dir.join(filename)
.parent()?