Use an absolute base path for execl. - geomyidae - A small C-based gopherd.
(HTM) git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit 446537b44a1d6920611306a53d5e2b55cd012216
(DIR) parent b4c65d77c916d3b13ab4a1239cfb8b60d042ce6d
(HTM) Author: Quentin Rameau <quinq@fifth.space>
Date: Sun, 9 Jul 2017 19:59:10 +0200
Use an absolute base path for execl.
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
M geomyidae.8 | 1 -
M main.c | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/geomyidae.8 b/geomyidae.8
@@ -118,7 +118,6 @@ Loglevels:
.
.It Fl b Ar base
Root directory to serve (default: /var/gopher).
-This directory should be specified as an absolute path.
.
.It Fl p Ar port
Port geomyidae should listen on (default: 70)
(DIR) diff --git a/main.c b/main.c
@@ -458,6 +458,9 @@ main(int argc, char *argv[])
perror("chroot");
return 1;
}
+ } else if(*base != '/' && !(base = realpath(base, NULL))) {
+ perror("realpath");
+ return 1;
}
if(dropprivileges(gr, us) < 0) {