Branch: Tag:

1998-08-21

1998-08-21 23:00:11 by David Hedbor <david@hedbor.org>

Added support to avoid directory overlapping (or to stop the directory
parsing loop to be exact). If a find_dir in a location module returns
a mapping, ([ "files", ({ ... dir list ... }) ]), the directory
parsing loop will be stopped. Currently used by the user filesystem
in combination with virtual hosting.

Rev: server/base_server/configuration.pike:1.151

1: - string cvs_version = "$Id: configuration.pike,v 1.150 1998/08/18 21:40:05 grubba Exp $"; + string cvs_version = "$Id: configuration.pike,v 1.151 1998/08/21 23:00:11 neotron Exp $";   #include <module.h>   #include <roxen.h>   
1362:   #endif    TRACE_ENTER("Calling find_file()...", 0);    LOCK(tmp[1]); -  fid=tmp[1]( file[ strlen(loc) .. ] + id->extra_extension, id); +  fid=tmp[1]( file[ strlen(loc) .. ], id);    UNLOCK();    TRACE_LEAVE(sprintf("find_file has returned %O", fid));    if(fid)
1528:   public array find_dir(string file, object id)   {    string loc; -  array dir = ({ }), d, tmp; +  array dir = ({ }), tmp; +  array | mapping d;    TRACE_ENTER("List directory "+file, 0);    file=replace(file, "//", "/");   
1594:   #endif    if(d=function_object(tmp[1])->find_dir(file[strlen(loc)..], id))    { +  if(mappingp(d)) +  { +  if(d->files) { +  dir |= d->files; +  TRACE_LEAVE("Got exclusive directory."); +  TRACE_LEAVE("Returning list of "+sizeof(dir)+" files"); +  return dir; +  } else +  TRACE_LEAVE(""); +  } else {    TRACE_LEAVE("Got files");    dir |= d; -  +  }    } else    TRACE_LEAVE("");    } else if((search(loc, file)==0) && (loc[strlen(file)-1]=='/') &&
2995:    + module_file + ").\n" +    describe_backtrace( err ));    return 0; -  } else if (!module_data) { -  // register_module() returns 0 => disabled module. -  report_warning(sprintf("Module %O is disabled.\n", module_file)); -  return 0; +     }       err = "";