summaryrefslogtreecommitdiff
path: root/rc/bin
diff options
context:
space:
mode:
authorglenda <glenda@9front.local>2022-04-01 01:59:47 +0000
committerglenda <glenda@9front.local>2022-04-01 01:59:47 +0000
commit241667b933ff5bacb9a3974f6877fb8aad78bed3 (patch)
treeba89cf361e49ddc1efddaa89a3bc42e642ec2f87 /rc/bin
parent60ef662b98f05ae84a7e111eb5c0dee9b6be1d9a (diff)
/rc/bin/rc-httpd/handlers/{dir-index, serve-static}: commit the correct files this time (thanks, igor)
Diffstat (limited to 'rc/bin')
-rwxr-xr-xrc/bin/rc-httpd/handlers/dir-index7
-rwxr-xr-xrc/bin/rc-httpd/handlers/serve-static4
2 files changed, 9 insertions, 2 deletions
diff --git a/rc/bin/rc-httpd/handlers/dir-index b/rc/bin/rc-httpd/handlers/dir-index
index 5f1897cd5..6e3964a00 100755
--- a/rc/bin/rc-httpd/handlers/dir-index
+++ b/rc/bin/rc-httpd/handlers/dir-index
@@ -2,6 +2,10 @@
PATH_INFO=`{echo $PATH_INFO | urlencode -d}
full_path=$"FS_ROOT^$"PATH_INFO
full_path=$"full_path
+if(! ~ `{cleanname -d$FS_ROOT $full_path} `{cleanname $FS_ROOT}^*){
+ error 503
+ exit
+}
if(! test -d $full_path){
error 404
exit
@@ -14,8 +18,7 @@ builtin cd $full_path
if(~ $"NOINDEXFILE ^ $"NOINDEX ''){
ifile=index.htm*
if(! ~ $ifile(1) *'*'){
- PATH_INFO=$ifile(1)
- FS_ROOT=''
+ PATH_INFO=$PATH_INFO^$ifile(1)
exec serve-static
}
}
diff --git a/rc/bin/rc-httpd/handlers/serve-static b/rc/bin/rc-httpd/handlers/serve-static
index 119665ee3..a8fd0959b 100755
--- a/rc/bin/rc-httpd/handlers/serve-static
+++ b/rc/bin/rc-httpd/handlers/serve-static
@@ -1,6 +1,10 @@
#!/bin/rc
full_path=`{echo $"FS_ROOT^$"PATH_INFO | urlencode -d}
full_path=$"full_path
+if(! ~ `{cleanname -d$FS_ROOT $full_path} `{cleanname $FS_ROOT}^*){
+ error 503
+ exit
+}
if(~ $full_path */)
error 503
if(test -d $full_path){