Programs for facilitating CGI programs in
teaching |
© Mike Smith M.A.Smith at brighton dot ac dot uk
University of Brighton UK.
The following has security implications
System programming
|
I have found the following CGI scripts useful in
teaching
Running a CGI script
|
The following is a CGI script which will run a
user's CGI script from their own home directory
~user/public_html/cgi-bin.
This was created to allow students to run their own CGI scripts without
having to write into the system cgi-bin directory. There are however
security implications in allowing this on your machine.
The main benefits of using this approach are:
- Students do not need to write into the system cgi-bin directory.
- A time limit can be set for running the program.
As a CGI script runs
by default as nobody the system manager must intervene to kill the
program.
The program mas_run.cpp
with ( mas_cvo.cpp,
parse.h,
parse.cpp,
t99_type.h
) implements this action. ( For example: if this compiled program is put in the
cgi-bin directory then a user user can put their own CGI
script into ~user/public_html/cgi-bin.
To run their CGI program they use a normal anchor tag as follows:
<A HREF="http://machine/cgi-bin/mas_run?user=mas&file=cgi&options=op1">
Run my CGI script
</A>
|
The extra components are:
- user=mas
Identifies the user, in this case mas.
- file=cgi
Identifies the file to be run, in this case
cgi who's full path name is ~mas/public_html/cgi-bin.
- options=op1
Identifies any options that are to be sent to the
CGI program. These can be decoded by using the class parse.
This CGI program is run as normal except that there is an execution limit of
20 seconds on the program.
Try out this program here.