fix: ipv6 support for forwarded-mask

This commit is contained in:
Massimo Melina 2020-05-28 15:19:36 +02:00
parent 1546a41fb9
commit 5fa867e194

View File

@ -5077,8 +5077,6 @@ var
function accessGranted(forceFile:Tfile=NIL):boolean; function accessGranted(forceFile:Tfile=NIL):boolean;
resourcestring resourcestring
FAILED = 'Login failed'; FAILED = 'Login failed';
var
m: TStringDynArray;
begin begin
result:=FALSE; result:=FALSE;
if assigned(forceFile) then f:=forceFile; if assigned(forceFile) then f:=forceFile;
@ -5089,11 +5087,9 @@ var
exit; exit;
end; end;
result:=f.accessFor(data); result:=f.accessFor(data);
// ok, you are referring a section of the template, which virtually resides in the root because of the url starting with /~ // sections are accessible. You can implement protection in place, if needed.
// but you don't have access rights to the root. We'll let you pass if it's actually a section and you are using it from a folder that you have access to.
if not result and (f = rootFile) if not result and (f = rootFile)
and ((mode='section') or ansiStartsStr('~', urlCmd) and tpl.sectionExist(copy(urlCmd,2,MAXINT))) and ((mode='section') or startsStr('~', urlCmd) and tpl.sectionExist(copy(urlCmd,2,MAXINT))) then
and (0 < reMatch(conn.getHeader('Referer'), '://([^@]*@)?'+getSafeHost(data)+'(/.*)', 'i', 1, @m)) then
begin begin
result:=TRUE; result:=TRUE;
specialGrant:=TRUE; specialGrant:=TRUE;
@ -7074,7 +7070,7 @@ while cfg > '' do
if h = 'only-1-instance' then only1instanceChk.checked:=yes; if h = 'only-1-instance' then only1instanceChk.checked:=yes;
if h = 'graph-rate' then setGraphRate(int); if h = 'graph-rate' then setGraphRate(int);
if h = 'graph-size' then graph.size:=int; if h = 'graph-size' then graph.size:=int;
if h = 'forwarded-mask' then forwardedMask:=l; if h = 'forwarded-mask' then forwardedMask:=ifThen(l='127.0.0.1','::1;127.0.0.1',l);
if h = 'delete-partial-uploads' then deletePartialUploadsChk.checked:=yes; if h = 'delete-partial-uploads' then deletePartialUploadsChk.checked:=yes;
if h = 'rename-partial-uploads' then renamePartialUploads:=l; if h = 'rename-partial-uploads' then renamePartialUploads:=l;
if h = 'do-not-log-address' then dontLogAddressMask:=l; if h = 'do-not-log-address' then dontLogAddressMask:=l;
@ -12541,7 +12537,7 @@ ipsEverConnected.delimiter:=';';
logMaxLines:=2000; logMaxLines:=2000;
trayShows:='downloads'; trayShows:='downloads';
flashOn:='download'; flashOn:='download';
forwardedMask:='127.0.0.1'; forwardedMask:='::1;127.0.0.1';
runningOnRemovable:=DRIVE_REMOVABLE = GetDriveType(Pchar(exePath[1]+':\')); runningOnRemovable:=DRIVE_REMOVABLE = GetDriveType(Pchar(exePath[1]+':\'));
etags.values['exe']:=strMD5(dateToHTTP(getMtimeUTC(paramStr(0)))); etags.values['exe']:=strMD5(dateToHTTP(getMtimeUTC(paramStr(0))));