rejetto forum

Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: Mars on February 02, 2010, 06:57:12 PM

Title: inherited flags
Post by: Mars on February 02, 2010, 06:57:12 PM
Quote
procedure TmainFrm.appEventsShowHint
  ...
  s:=flag('Invisible', FA_HIDDENTREE, TRUE);
  if s = '' then s:=flag('Invisible', FA_HIDDEN);
  result:=result+s
    +flag('Download forbidden', FA_DL_FORBIDDEN)
    +flagR('Don''t log', FA_DONT_LOG);

'Invisible' and 'Download forbidden' are inherited flags

Quote
procedure TmainFrm.appEventsShowHint
  ...
  s:=flagR('Invisible', FA_HIDDENTREE, TRUE);
  if s = '' then s:=flag('Invisible', FA_HIDDEN);
  result:=result+s
    +flagR('Download forbidden', FA_DL_FORBIDDEN)
    +flagR('Don''t log', FA_DONT_LOG);

Title: Re: inherited flags
Post by: rejetto on February 09, 2010, 05:15:49 PM
ok for hiddentree.
dl_forbidden is a bitter one. it is NOT recursive by design, but i see some strange recursion in the code. i fear there's an inconsistent behavior. it will take a while to study it, i cannot do it right now.
Title: Re: inherited flags
Post by: rejetto on February 18, 2010, 05:35:04 PM
ok. i did my best with the short time i had.
i made some changes to the way "no download" is handled, to reflect its designed nature.
my purpose was not to improve it, but to make it coherent with how it was thinked and documented (was "let download").
if you have time, please check the changes in the source (build 255) and report if there's a possibility to break the security.
Title: Re: inherited flags
Post by: Mars on February 18, 2010, 07:44:34 PM
Quote
dl_forbidden is a bitter one. it is NOT recursive by design

Quote
function Tfile.accessFor(username, password:string):boolean;
var
  a: Paccount;
  f: Tfile;
  list: TStringDynArray;
begin
result:=FALSE;
if isFile() and hasRecursive(FA_DL_FORBIDDEN)  then exit;
result:=FALSE;
f:=self;

Title: Re: inherited flags
Post by: rejetto on February 18, 2010, 11:49:01 PM
that's what i meant when i said

but i see some strange recursion in the code.

what i found is that most of times that recursion was a simple way to make it work, since there's a form of single-step inheriting for real folders.
it's the GUI that prevents you from applying it to virtual folders.
i decided to change it, because it's confusing.
if you want to check my changes i can send you a preview.