diff options
| author | bwarsaw | 1999-01-07 00:01:26 +0000 |
|---|---|---|
| committer | bwarsaw | 1999-01-07 00:01:26 +0000 |
| commit | 5196e8f0df045be91e3fb77febf3ca7e5a263ae4 (patch) | |
| tree | a43eee199b49b17143768c44605677bb20b7f5b7 /src | |
| parent | b0c0f6c93d00fd94e4a84cb5f24c556811fb7b5d (diff) | |
| download | mailman-5196e8f0df045be91e3fb77febf3ca7e5a263ae4.tar.gz mailman-5196e8f0df045be91e3fb77febf3ca7e5a263ae4.tar.zst mailman-5196e8f0df045be91e3fb77febf3ca7e5a263ae4.zip | |
Somewhat kludgy changes to make debugging mismatching CGI gid's easier
to figure out.
common.c now sports a global variable running_as_cgi which, when true
causes fatal() to output some mildly more helpful HTML in addition to
the syslog entry. Since this usually only occurs when the site admin
is installing Mailman, this helpful HTML should give a better clue as
to what's going wrong, rather than an unhelpful Web server message and
syslog entry alone.
Naturally, main() in cgi-wrapper.c sets running_as_cgi to 1; it is
initialized to 0 so as to not upset mail-wrapper.c.
Finally, because I think this is a kludge, I've wrapped this all in an
#ifdef HELPFUL, and set Makefile.in to turn this on by default. My
thought is that for some future version, if the site admin specifies
--with-cgi-gid to configure, that proves they're somewhat clueful, and
we'd default the HELPFUL macro to "off".
Diffstat (limited to '')
| -rw-r--r-- | src/Makefile.in | 5 | ||||
| -rw-r--r-- | src/cgi-wrapper.c | 1 | ||||
| -rw-r--r-- | src/common.c | 27 | ||||
| -rw-r--r-- | src/common.h | 4 |
4 files changed, 36 insertions, 1 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 267bf57a0..c6af9cafa 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -58,8 +58,11 @@ CGI_FLAGS= -DCGI_GID=$(CGI_GID) #ALIAS_FLAGS= -DALIAS_UID=$(ALIAS_UID) \ # -DALIAS_GID=$(ALIAS_GID) +HELPFUL= -DHELPFUL + COMMON_FLAGS= -DPREFIX="\"$(prefix)\"" \ - -DPYTHON="\"$(PYTHON)\"" + -DPYTHON="\"$(PYTHON)\"" \ + $(HELPFUL) # Modes for directories and executables created by the install diff --git a/src/cgi-wrapper.c b/src/cgi-wrapper.c index fa9f02af5..841ef0730 100644 --- a/src/cgi-wrapper.c +++ b/src/cgi-wrapper.c @@ -39,6 +39,7 @@ main(int argc, char** argv, char** env) int status; char* fake_argv[3]; + running_as_cgi = 1; check_caller(logident, parentgid); /* if we get here, the caller is OK */ diff --git a/src/common.c b/src/common.c index 1080bf86f..0163e521e 100644 --- a/src/common.c +++ b/src/common.c @@ -27,6 +27,9 @@ const char* scriptdir = SCRIPTDIR; const char* moduledir = MODULEDIR; char* python = PYTHON; +/* bogus global variable used as a flag */ +int running_as_cgi = 0; + /* Some older systems don't define strerror(). Provide a replacement that is @@ -68,6 +71,30 @@ fatal(const char* ident, const char* format, ...) openlog(ident, LOG_CONS, LOG_MAIL); syslog(LOG_ERR, "%s", log_entry); closelog(); + +#ifdef HELPFUL + /* If we're running as a CGI script, we also want to write the log + * file out as HTML, so the admin who is probably trying to debug his + * installation will have a better clue as to what's going on. + */ + if (running_as_cgi) { + printf("Content-type: text/html\n\n"); + printf("<head>\n"); + printf("<title>Mailman CGI error!!!</title>\n"); + printf("</head><body>\n"); + printf("<h1>Mailman CGI error!!!</h1>\n"); + printf("The expected gid of the Mailman CGI wrapper did "); + printf("not match the gid as set by the Web server."); + printf("<p>The most likely cause is that Mailman was "); + printf("configured and installed incorrectly. Please "); + printf("read the INSTALL instructions again, paying close "); + printf("attention to the <tt>--with-cgi-gid</tt> configure "); + printf("option. This entry is being stored in your syslog:"); + printf("\n<pre>\n"); + printf(log_entry); + printf("</pre>\n"); + } +#endif /* HELPFUL */ exit(1); } diff --git a/src/common.h b/src/common.h index e9470d239..15ac3b304 100644 --- a/src/common.h +++ b/src/common.h @@ -30,6 +30,10 @@ void fatal(const char*, const char*, ...); void check_caller(const char*, gid_t); int run_script(const char*, int, char**, char**); +/* bogus global variable used as a flag */ +extern int running_as_cgi; + + /* * Local Variables: |
