Skip to content

Commit

Permalink
fix for vpath directory traversals
Browse files Browse the repository at this point in the history
  • Loading branch information
Root User committed Apr 24, 2020
1 parent 08af945 commit 0ab1cf3
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 458 deletions.
1 change: 0 additions & 1 deletion ChrootHelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ const char *ptr;
{
Value=UnQuoteStr(Value,Tempstr);


if (strcmp(Name,"User")==0) Response->UserName=CopyStr(Response->UserName,Value);
else if (strcmp(Name,"Password")==0) Response->Password=CopyStr(Response->Password,Value);
else if (strcmp(Name,"RealUser")==0) Response->RealUser=CopyStr(Response->RealUser,Value);
Expand Down
4 changes: 4 additions & 0 deletions VPath.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ int result=FALSE, Flags=0;
//Document name here is whatever part of the Path is *beyond* the VPath component
DocName=VPathSubstituteArgs(DocName, Session->Path + StrLen(VPath->URL), Session);

//search through all paths that the vpath applies to to see if the document exists in any of them
//this allows us to have a vpath map to more than one directory
ptr=GetToken(VPath->Path,":",&Tempstr,0);
while (ptr)
{
Expand All @@ -180,9 +182,11 @@ while (ptr)
ptr=GetToken(ptr,":",&Tempstr,0);
}


Tempstr=CopyStr(Tempstr,"");
if (StrValid(LocalPath)) Tempstr=FindFileInPath(Tempstr,DocName,LocalPath);

//if we found a file matching the request, handle it
if (StrValid(Tempstr))
{
Flags = HEADERS_SENDFILE|HEADERS_USECACHE|HEADERS_KEEPALIVE;
Expand Down
2 changes: 1 addition & 1 deletion common.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Authenticate.h"

TSettings Settings;
char *Version="3.1";
char *Version="3.2";

void SetTimezoneEnv()
{
Expand Down
Loading

0 comments on commit 0ab1cf3

Please # to comment.