diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-27 04:37:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:05 -0500 |
commit | 2cdce8d1aac1e2bf96016a7ccd51071c0e8f4767 (patch) | |
tree | 58689e81c9fa8c092d720d11ab5e33dd3203d38c /source4/web_server/http.c | |
parent | da817b1550c64dbfa581514169637a68b0bc2499 (diff) | |
download | samba-2cdce8d1aac1e2bf96016a7ccd51071c0e8f4767.tar.gz samba-2cdce8d1aac1e2bf96016a7ccd51071c0e8f4767.tar.bz2 samba-2cdce8d1aac1e2bf96016a7ccd51071c0e8f4767.zip |
r7004: 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.
(This used to be commit 2614ace175a51cfb4b1e0e3ca3db405a19f7ab18)
Diffstat (limited to 'source4/web_server/http.c')
-rw-r--r-- | source4/web_server/http.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source4/web_server/http.c b/source4/web_server/http.c index d9d441f765..6687ab7d16 100644 --- a/source4/web_server/http.c +++ b/source4/web_server/http.c @@ -455,6 +455,28 @@ static void http_setup_arrays(struct esp_state *esp) 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 @@ static void esp_request(struct esp_state *esp) 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)); |