diff options
| -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: |
