tUse an absolute base path for execl. - geomyidae - A small C-based gopherd.
git clone git://r-36.net/geomyidae
Log
Files
Refs
README
LICENSE
---
commit 446537b44a1d6920611306a53d5e2b55cd012216
parent b4c65d77c916d3b13ab4a1239cfb8b60d042ce6d
Author: Quentin Rameau 
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:
  geomyidae.8                         |       1 -
  main.c                              |       3 +++

2 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/geomyidae.8 b/geomyidae.8
t@@ -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)
diff --git a/main.c b/main.c
t@@ -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) {