Using the Server-Subst handler
To configure the server-subst handler, go into the srm.conf file and uncomment the handler lines for server-subst. For example:
AddType text/html .shtml AddHandler server-subst .shtmlAlso, make sure mod_neoscript.o replaces the regular includes module when the webserver program is compiled.
This variation on NeoWebScripts changes to a more native method way of invoking Tcl. Quite simply, the requested file is loaded, and passed to the safe interpreter's subst command. The result is written out to the browser. All facilities normally in NeoWebScripts are available here. There are two major differences:
Note: this implementation does not HTML-decode the source before passing the file into Tcl. This may change in future releases.
The file can contain all of the usual sort of text and HTML directives.
Let's look at a simple webpage:
<! Sample NeoWebScript-tm Webpage using substitution --> <title>Sample NeoWebScript Webpage</title> <h1>Sample NeoWebScript-tm Webpage</h1> This is a sample webpage containing embedded NeoWebScript-tm directives using substitution. <P> The current server time is \[clock format \[clock seconds\]\] <P> Thanks for visiting!
The current server time is [clock format [clock seconds]]
(If you don't see a time here then the MIME type for the server-subst hasn't been set.) Since the page executes as a single Tcl command, there are no continuity issues. The include_file, include_virtual, load_file, load_virtual, and html commands may not be used, and are removed from the interpreter to prevent accidental use. All values are output via command return values or variable substitution.
Unfortunately, CVS tags look like variable references to Tcl. If you have any web pages under CVS control, you may have to abandon your tags in the source file.
Per-directory configuration of the Tcl slave interpreter via .htaccess. The global Tcl array NeoWebUserConf is set according to .htaccess files found by the server. NeoWebUserConf is the only configuration under user control (it may also be set in a per-directory configuration within access.conf). This can be used to customize or modify behaviors of general purpose tcl code called within documents. Standard merging rules are followed. Note that unlike the other configuration commands which set Tcl array variables, the NeoWebUserConf array is set only in the slave (user's) interpreter. If the trusted interpreter wants to know about it, it must interrogate the slave.
This page is a demonstration of an automatic expire based on date and version. The current release level is stored in .htaccess. A Tcl proc is called with the starting day, the number of days of newness, and anticipated release level for this code.
When the next release is made, only the current release presents documentation for new code in one color, and unreleased code (but no longer new to us) in another color.When the next release is made, only the current release (in .htaccess) is updated and this documentation is automatically changes.
Per user and per group UserDir configuration. Configures a UserDir for a specific id or id range.
If id contains a - it is parsed as an id number range. Otherwise, it is translated into a numeric id by looking it up in the appropriate system file (/etc/passwd or /etc/group).
dir is the subdirectory to append to the users home directory just as in UserDir. If dir is disabled then ~user expansion for the given user or user range is disabled, and attempts to access return the FORBIDDEN code. This was primarily implemented to disable access to the system hierarchy via ~root or ~bin for example.
Example:
UidUserDir 0-199 disabled
Provides a means for protecting certain user subdirectories from access. During expansion of ~user, if the subdirectory requested matches path then it is disallowed. Attempts to access return the DECLINED code. If you use UserDir public_html in your srm.conf you may wonder why one needs this. It's useful if you set UserDir to ".", which is likely if you are running a dedicated web server where home directories are primarily web sites and nothing else.
Per-server and Per-directory configuration of the Tcl interpreter. Each command sets a variable of the same name within the trusted interpreter. See Variables for more information.
You must have configured mod_auth_tcl.o in your webserver for these directives to be available. It should be placed in front of mod_auth.o in the Configuration file.
These directives may be used in access.conf or .htaccess files to define a Tcl procedure to be used for authenticating users. Any number of arguments may be specified for the Tcl procedures. The TclAuthBasic proc call is assembled by appending the user name to end of the list of arguments. The proc must return a DES-encrypted string which will be compared with the string entered by the user. If a user is not found in your database, return an empty string.
Two additional arguments are likewise appended to the given TclAuthAccess proc and args for each Require directive given within a <Limit> directive. The procedure is then called. The return value should be one of "OK", "AUTH_REQUIRED", or an empty string. OK accepts the user as valid. AUTH_REQUIRED will deny access. Any other return value will mean to continue checking (possibly) additional Require directives in turn. If the list is exhausted without an "OK", the result is a failure to authenticate access.
Examples of TclAuthBasic and TclAuthAccess can be found in common.tcl in the server configuration directory. The example postgres_auth proc checks a local db file cache for passwords before actually connecting to our Postgres95 server. This is a good idea in any situation when one realizes the enormouse number of hits to such a database can be incurred when authenticating access to a directory. We have not yet had the need for an TclAuthAccess proc beyond simply accepting "Require valid-user" directives.
If an error is caught, it is logged and is treated as an authentication failer.
Color codes:
Brand new features
Features to be included in next release