1 diff -ur cgiwrap-4.1/config.h.in cgiwrap-4.1-bs/config.h.in
2 --- cgiwrap-4.1/config.h.in 2008-06-16 16:34:37.000000000 +0200
3 +++ cgiwrap-4.1-bs/config.h.in 2010-04-08 03:06:39.605240484 +0200
5 /* support a shared multi-user cgi directory */
6 #undef CONF_MULTIUSER_CGI_DIR
8 +/* custom html error pages */
9 +#undef CONF_CUSTOMHTMLERR
11 /* pass script to php interpreter if suffix */
12 #undef CONF_PHP_INTERPRETER
14 diff -ur cgiwrap-4.1/configure.in cgiwrap-4.1-bs/configure.in
15 --- cgiwrap-4.1/configure.in 2008-06-16 16:34:37.000000000 +0200
16 +++ cgiwrap-4.1-bs/configure.in 2010-04-07 22:56:50.905243224 +0200
18 AC_DEFINE_UNQUOTED(CONF_CGIDIR,"public_html/cgi-bin", [cgi dir relative to user home dir])
21 +AC_MSG_CHECKING(for path to html error pages)
22 +AC_ARG_WITH( custom-html-errors,
23 + [ --with-custom-html-errors=PATH (disabled)]
24 + [ path where you want to store your custom error pages],
26 + if test "x$withval" = xyes; then
27 + AC_MSG_RESULT([must specify path, disabled.])
28 + elif test "x$withval" = xno; then
29 + AC_MSG_RESULT([must specify path, disabled.])
30 + elif test "x$withval" = x; then
31 + AC_MSG_RESULT([must specify path, disabled.])
33 + AC_MSG_RESULT([$withval])
34 + AC_DEFINE_UNQUOTED(CONF_CUSTOMHTMLERR, "$withval", [path to custom html error pages])
38 + AC_MSG_RESULT([disabled.])
42 dnl Checking for what server userid cgiwrap will run as
43 diff -ur cgiwrap-4.1/msgs.c cgiwrap-4.1-bs/msgs.c
44 --- cgiwrap-4.1/msgs.c 2008-06-16 16:34:37.000000000 +0200
45 +++ cgiwrap-4.1-bs/msgs.c 2010-04-08 03:14:14.343509137 +0200
50 +#if defined(CONF_CUSTOMHTMLERR)
51 +void Show_Custom_Html_Error(char *page)
56 + //char *path = "/etc/cgiwrap/";
57 + char *filename = BuildScriptPath(CONF_CUSTOMHTMLERR,page);
58 + //char *filename = BuildScriptPath(path,page);
59 + MSG_ContentType("text/html");
60 + file = fopen(filename, "r");
62 + printf("Error: can't open file.\n");
65 + while ((ch = getc(file)) != EOF)
67 + //printf("%s", read);
76 char *prefix_html = "<DD><B>";
79 void MSG_Error_CGIWrapNotSetUID(void)
81 +#if defined(CONF_CUSTOMHTMLERR)
82 + Show_Custom_Html_Error("CGIWrapNotSetUID.html");
84 if ( MSG_QuietErrors )
86 MSG_Error_ServerConfigError();
95 void MSG_Error_ServerUserMismatch(void)
97 +#if defined(CONF_CUSTOMHTMLERR)
98 + Show_Custom_Html_Error("ServerUserMismatch.html");
100 if ( MSG_QuietErrors )
102 MSG_Error_ServerConfigError();
103 @@ -399,11 +430,15 @@
111 void MSG_Error_ServerUserNotFound(void)
113 +#if defined(CONF_CUSTOMHTMLERR)
114 + Show_Custom_Html_Error("ServerUserNotFound.html");
116 if ( MSG_QuietErrors )
118 MSG_Error_ServerConfigError();
119 @@ -452,11 +487,15 @@
127 void MSG_Error_ExecutionNotPermitted(char *path, char *reason)
129 +#if defined(CONF_CUSTOMHTMLERR)
130 + Show_Custom_Html_Error("ExecutionNotPermitted.html");
132 MSG_Header("CGIWrap Error", "Execution of this script not permitted");
134 if ( MSG_QuietErrors )
135 @@ -487,10 +526,14 @@
142 void MSG_Error_AccessControl(char *why, char *allowfile, char *denyfile)
144 +#if defined(CONF_CUSTOMHTMLERR)
145 + Show_Custom_Html_Error("AccessControl.html");
148 if ( MSG_QuietErrors )
150 @@ -526,10 +569,14 @@
157 void MSG_Error_SystemError(char *when)
159 +#if defined(CONF_CUSTOMHTMLERR)
160 + Show_Custom_Html_Error("SystemError.html");
162 MSG_Header("CGIWrap Error", "System Error");
163 printf("CGIWrap encountered a system error.\n");
165 @@ -561,11 +608,15 @@
173 void MSG_Error_ExecFailed(void)
175 +#if defined(CONF_CUSTOMHTMLERR)
176 + Show_Custom_Html_Error("ExecFailed.html");
178 MSG_Header("CGIWrap Error", "Script Execution Failed");
180 printf("CGIWrap encountered an error while attempting to execute\n");
181 @@ -621,10 +672,14 @@
188 void MSG_Error_NoSuchUser(char *user)
190 +#if defined(CONF_CUSTOMHTMLERR)
191 + Show_Custom_Html_Error("NoSuchUser.html");
193 if ( MSG_QuietErrors )
195 MSG_Error_RequestError();
196 @@ -645,10 +700,14 @@
203 void MSG_Error_NoScriptDir(void)
205 +#if defined(CONF_CUSTOMHTMLERR)
206 + Show_Custom_Html_Error("NoScriptDir.html");
208 if ( MSG_QuietErrors )
210 MSG_Error_RequestError();
218 void MSG_Error_ServerConfigError(void)
219 diff -ur cgiwrap-4.1/msgs.h cgiwrap-4.1-bs/msgs.h
220 --- cgiwrap-4.1/msgs.h 2008-06-16 16:34:37.000000000 +0200
221 +++ cgiwrap-4.1-bs/msgs.h 2010-04-07 22:56:50.905243224 +0200
223 extern int MSG_QuietErrors;
224 extern int MSG_Need_NPH_Header;
226 +void Show_Custom_Html_Error(char *page);
227 void MSG_ContentType(char *typestring);
228 void MSG_Header(char *title, char *msg);
229 void MSG_Footer(void);