svn commit: samba r7004 - in branches/SAMBA_4_0/source: .
web_server web_server/ejs
tridge at samba.org
tridge at samba.org
Fri May 27 04:37:07 GMT 2005
Author: tridge
Date: 2005-05-27 04:37:07 +0000 (Fri, 27 May 2005)
New Revision: 7004
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7004
Log:
added support for exceptions generated in the esp library. If the OS
supports setjmp/longjmp then the exception will generate a error in
the web page and the Samba log. If the OS doesn't support setjmp then
we will abort.
Added:
branches/SAMBA_4_0/source/web_server/config.m4
Modified:
branches/SAMBA_4_0/source/configure.in
branches/SAMBA_4_0/source/web_server/ejs/miniMpr.c
branches/SAMBA_4_0/source/web_server/http.c
Changeset:
Modified: branches/SAMBA_4_0/source/configure.in
===================================================================
--- branches/SAMBA_4_0/source/configure.in 2005-05-27 03:59:12 UTC (rev 7003)
+++ branches/SAMBA_4_0/source/configure.in 2005-05-27 04:37:07 UTC (rev 7004)
@@ -28,6 +28,7 @@
SMB_INCLUDE_M4(gtk/config.m4)
SMB_INCLUDE_M4(ntvfs/posix/config.m4)
SMB_INCLUDE_M4(lib/socket_wrapper/config.m4)
+SMB_INCLUDE_M4(web_server/config.m4)
ALLLIBS_LIBS="$LIBS"
ALLLIBS_CFLAGS="$CFLAGS"
Added: branches/SAMBA_4_0/source/web_server/config.m4
===================================================================
--- branches/SAMBA_4_0/source/web_server/config.m4 2005-05-27 03:59:12 UTC (rev 7003)
+++ branches/SAMBA_4_0/source/web_server/config.m4 2005-05-27 04:37:07 UTC (rev 7004)
@@ -0,0 +1 @@
+AC_CHECK_HEADERS(setjmp.h)
Modified: branches/SAMBA_4_0/source/web_server/ejs/miniMpr.c
===================================================================
--- branches/SAMBA_4_0/source/web_server/ejs/miniMpr.c 2005-05-27 03:59:12 UTC (rev 7003)
+++ branches/SAMBA_4_0/source/web_server/ejs/miniMpr.c 2005-05-27 04:37:07 UTC (rev 7004)
@@ -160,10 +160,10 @@
void mprBreakpoint(const char *file, int line, const char *cond)
{
- /*
- * Optionally break into the debugger here
- */
- mprLog(0, "ASSERT at %s:%d, %s\n", file, line, cond);
+ char *buf;
+ mprAllocSprintf(&buf, MPR_MAX_STRING, "esp exception - ASSERT at %s:%d, %s\n",
+ file, line, cond);
+ http_exception(buf);
}
#endif /* !BLD_GOAHEAD_WEBSERVER */
Modified: branches/SAMBA_4_0/source/web_server/http.c
===================================================================
--- branches/SAMBA_4_0/source/web_server/http.c 2005-05-27 03:59:12 UTC (rev 7003)
+++ branches/SAMBA_4_0/source/web_server/http.c 2005-05-27 04:37:07 UTC (rev 7004)
@@ -455,7 +455,29 @@
SETVAR(ESP_REQUEST_OBJ, "SCRIPT_FILENAME", web->input.url);
}
+#if HAVE_SETJMP_H
+/* the esp scripting lirary generates exceptions when
+ it hits a major error. We need to catch these and
+ report a internal server error via http
+*/
+#include <setjmp.h>
+static jmp_buf http_exception_buf;
+static const char *exception_reason;
+void http_exception(const char *reason)
+{
+ exception_reason = reason;
+ DEBUG(0,("%s", reason));
+ longjmp(http_exception_buf, -1);
+}
+#else
+void http_exception(const char *reason)
+{
+ DEBUG(0,("%s", reason));
+ smb_panic(reason);
+}
+#endif
+
/*
process a esp request
*/
@@ -474,6 +496,12 @@
return;
}
+#if HAVE_SETJMP_H
+ if (setjmp(http_exception_buf) != 0) {
+ http_error(web, 500, exception_reason);
+ return;
+ }
+#endif
res = espProcessRequest(esp->req, url, buf, &emsg);
if (res != 0 && emsg) {
http_writeBlock(web, emsg, strlen(emsg));
More information about the samba-cvs
mailing list