Give virtual path instead of real path. - geomyidae - A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log
Files
Refs
README
LICENSE
---
commit cdf260787abd32506e151744c411d0e1057757d8
parent 32c1854864ce91a873e607659294eda9012411e6
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 23 Aug 2023 13:04:52 +0200

Give virtual path instead of real path.

* Fix issue with symlinks to a completely different path.

Diffstat:
  M main.c                              |       7 ++++---

1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/main.c b/main.c
@@ -331,6 +331,7 @@ dothegopher:
                         logentry(clienth, clientp, recvc, "not found");
                 return;
         }
+
         if (stat(rpath, &dir) != -1) {
                 /*
                  * If sticky bit is set, only serve if this is encrypted.
@@ -359,7 +360,7 @@ dothegopher:
                                 }
                                 /*
                                  * The size check for strcat to work is
-                                 * above.
+                                 * calculated above this comment.
                                  *
                                  * Until strlcat isn't properly in all
                                  * linux libcs, we keep to this. OpenBSD
@@ -422,7 +423,7 @@ dothegopher:
                         if (loglvl & FILES)
                                 logentry(clienth, clientp, recvc, "serving");
 
-                        type->f(sock, rpath, port, base, args, sear, ohost,
+                        type->f(sock, path, port, base, args, sear, ohost,
                                 clienth, serverh, istls, recvc, traverse);
                 }
         } else {
@@ -436,7 +437,7 @@ dothegopher:
                 }
 
                 if (!pathfallthrough && S_ISDIR(dir.st_mode)) {
-                        handledir(sock, rpath, port, base, args, sear, ohost,
+                        handledir(sock, path, port, base, args, sear, ohost,
                                 clienth, serverh, istls, recvc, traverse);
                         if (loglvl & DIRS) {
                                 logentry(clienth, clientp, recvc,