From 97de1f42a22147e0e8d4ff15f0bcaa60b56b248e Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Fri, 19 Jun 1998 19:40:06 +0000 Subject: Change to the way the `real' (i.e Python) CGI program gets invoked. Now the wrapper simply calls the Python written scripts/driver program and passes the module name as argv[1]. Eliminates the (unchecked in) need for symbolic links. This file still gets compiled into a number of different executables, each named after the module that gets imported. This could be changed to use symlinks later. --- src/cgi-wrapper.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/cgi-wrapper.c') diff --git a/src/cgi-wrapper.c b/src/cgi-wrapper.c index 3ff2543b7..301ede3a8 100644 --- a/src/cgi-wrapper.c +++ b/src/cgi-wrapper.c @@ -29,7 +29,7 @@ #define LEGAL_PARENT_GID CGI_GID const char* logident = LOG_IDENT; -const char* script = SCRIPTNAME; +char* script = SCRIPTNAME; const int parentgid = LEGAL_PARENT_GID; @@ -37,6 +37,7 @@ int main(int argc, char** argv, char** env) { int status; + char* fake_argv[3]; check_caller(logident, parentgid); @@ -45,7 +46,17 @@ main(int argc, char** argv, char** env) if (status) fatal(logident, "%s", strerror(errno)); - status = run_script(script, argc, argv, env); + /* for these CGI programs, we can ignore argc and argv since they + * don't contain anything useful. `script' will always be the driver + * program and argv will always just contain the name of the real + * script for the driver to import and execute (padded with two dummy + * values in argv[0] and argv[1] that are ignored by run_script(). + */ + fake_argv[0] = NULL; + fake_argv[1] = NULL; + fake_argv[2] = script; + + status = run_script("driver", 3, fake_argv, env); fatal(logident, "%s", strerror(errno)); return status; } -- cgit v1.2.3-70-g09d2