1999-01-21
1999-01-21 23:31:24 by Marcus Comstedt <marcus@mc.pp.se>
-
5839c348a0e73a5e42bffe89c08ac290a160dc1f
(340 lines)
(+217/-123)
[
Show
| Annotate
]
Branch: 5.2
Internal module resource mountpoint.
Rev: server/base_server/configuration.pike:1.176
Rev: server/base_server/module.pike:1.38
1:
- string cvs_version = "$Id: configuration.pike,v 1.175 1999/01/14 00:53:17 grubba Exp $";
+ string cvs_version = "$Id: configuration.pike,v 1.176 1999/01/21 23:31:21 marcus Exp $";
#include <module.h>
#include <roxen.h>
153:
return defvar(var, value, "", type, "", 0, 1);
}
+ string query_internal_location(object|void mod)
+ {
+ return QUERY(InternalLoc)+(mod? replace(otomod[mod]||"", "#", "!")+"/":"");
+ }
string query_name()
{
1266:
}
TRACE_LEAVE("");
}
+
+ if(!search(file, QUERY(InternalLoc)))
+ {
+ TRACE_ENTER(LOCALE->magic_internal_module_location(), 0);
+ object module;
+ string name, rest;
+ function find_internal;
+ if(2==sscanf(file[strlen(QUERY(InternalLoc))..], "%s/%s", name, rest) &&
+ (module = find_module(replace(name, "!", "#"))) &&
+ (find_internal = module->find_internal))
+ {
+ #ifdef MODULE_LEVEL_SECURITY
+ if(tmp2 = check_security(find_internal, id, slevel))
+ if(intp(tmp2))
+ {
+ TRACE_LEAVE(LOCALE->module_access_denied());
+ find_internal = 0;
+ } else {
+ TRACE_LEAVE("");
+ TRACE_LEAVE(LOCALE->request_denied());
+ return tmp2;
}
-
+ if(find_internal)
+ #endif
+ {
+ TRACE_ENTER(LOCALE->calling_find_internal(), 0);
+ LOCK(find_internal);
+ fid=find_internal( rest, id );
+ UNLOCK();
+ TRACE_LEAVE(LOCALE->find_internal_returned(fid));
+ if(fid)
+ {
+ if(mappingp(fid))
+ {
+ TRACE_LEAVE("");
+ TRACE_LEAVE(examine_return_mapping(fid));
+ return fid;
+ }
+ else
+ {
+ #ifdef MODULE_LEVEL_SECURITY
+ int oslevel = slevel;
+ slevel = misc_cache[ find_internal ][1];
+ // misc_cache from
+ // check_security
+ id->misc->seclevel = slevel;
+ #endif
+ if(objectp(fid))
+ TRACE_LEAVE(LOCALE->returned_fd()
+ #ifdef MODULE_LEVEL_SECURITY
+ +(slevel != oslevel?
+ LOCALE->seclevel_is_now(slevel):"")
+ #endif
+ +".");
+ else
+ TRACE_LEAVE(LOCALE->returned_directory_indicator()
+ #ifdef MODULE_LEVEL_SECURITY
+ +(oslevel != slevel?
+ LOCALE->seclevel_is_now(slevel):"")
+ #endif
+ );
+ }
+ } else
+ TRACE_LEAVE("");
+ } else
+ TRACE_LEAVE("");
+ } else
+ TRACE_LEAVE("");
+ }
+ }
// Well, this just _might_ be somewhat over-optimized, since it is
// quite unreadable, but, you cannot win them all..
-
+ if(!fid)
+ {
#ifdef URL_MODULES
// Map URL-modules
foreach(url_modules(id), funp)
1358: Inside #if defined(MODULE_LEVEL_SECURITY)
TRACE_LEAVE(LOCALE->module_access_denied());
continue;
} else {
+ TRACE_LEAVE("");
TRACE_LEAVE(LOCALE->request_denied());
return tmp2;
}
1424:
}
}
}
+ }
if(fid == -1)
{
2385:
}
}
+ me->set_configuration(this_object());
#ifdef MODULE_DEBUG
// perror("Initializing ");
#endif
3112:
return 0;
}
+ obj->set_configuration(this_object());
if (err = catch (module_data = obj->register_module(this_object()))) {
#ifdef MODULE_DEBUG
perror("FAILED\n" + describe_backtrace( err ));
3653:
skal. (normalt sett /etc/shells). Används för icke-anonym ftp. Ange
tomma strängen för att stänga av verifieringen av användarskal");
+ defvar("InternalLoc", "/_internal/",
+ "Internal module resource mountpoint", TYPE_LOCATION|VAR_MORE,
+ "Some modules may want to create links to internal resources. "
+ "This setting configures an internally handled location that can "
+ "be used for such purposes. Simply select a location that you are "
+ "not likely to use for regular resources.");
+ deflocaledoc("svenska", "InternalLoc",
+ "Intern modulresursmountpoint",
+ #"Somliga moduler kan vilja skapa länkar till interna resurser.
+ Denna inställning konfigurerar en internt hanterad location som kan användas
+ för sådana ändamål. Välj bara en location som du förmodligen inte kommer
+ behöva för vanliga resurser.");
+
setvars(retrieve("spider#0", this));
}
-
+