1 const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.14 2002/03/02 04:14:50 david__schmidt Exp $";
2 /*********************************************************************
4 * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
6 * Purpose : Simple CGIs to get information about JunkBuster's
9 * Functions declared include:
12 * Copyright : Written by and Copyright (C) 2001 the SourceForge
13 * IJBSWA team. http://ijbswa.sourceforge.net
15 * Based on the Internet Junkbuster originally written
16 * by and Copyright (C) 1997 Anonymous Coders and
17 * Junkbusters Corporation. http://www.junkbusters.com
19 * This program is free software; you can redistribute it
20 * and/or modify it under the terms of the GNU General
21 * Public License as published by the Free Software
22 * Foundation; either version 2 of the License, or (at
23 * your option) any later version.
25 * This program is distributed in the hope that it will
26 * be useful, but WITHOUT ANY WARRANTY; without even the
27 * implied warranty of MERCHANTABILITY or FITNESS FOR A
28 * PARTICULAR PURPOSE. See the GNU General Public
29 * License for more details.
31 * The GNU General Public License should be included with
32 * this file. If not, you can view it at
33 * http://www.gnu.org/copyleft/gpl.html
34 * or write to the Free Software Foundation, Inc., 59
35 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 * $Log: cgisimple.c,v $
39 * Revision 1.14 2002/03/02 04:14:50 david__schmidt
40 * Clean up a little CRLF unpleasantness that suddenly appeared
42 * Revision 1.13 2002/02/21 00:10:37 jongfoster
43 * Adding send-banner?type=auto option
45 * Revision 1.12 2002/01/23 01:03:32 jongfoster
46 * Fixing gcc [CygWin] compiler warnings
48 * Revision 1.11 2002/01/23 00:01:04 jongfoster
49 * Adding cgi_transparent_gif() for http://i.j.b/t
50 * Adding missing html_encode() to many CGI functions.
51 * Adding urlmatch.[ch] to http://i.j.b/show-version
53 * Revision 1.10 2002/01/17 21:10:37 jongfoster
54 * Changes to cgi_show_url_info to use new matching code from urlmatch.c.
55 * Also fixing a problem in the same function with improperly quoted URLs
56 * in output HTML, and adding code to handle https:// URLs correctly.
58 * Revision 1.9 2001/11/30 23:09:15 jongfoster
59 * Now reports on FEATURE_CGI_EDIT_ACTIONS
60 * Removing FEATURE_DENY_GZIP from template
62 * Revision 1.8 2001/11/13 00:14:07 jongfoster
63 * Fixing stupid bug now I've figured out what || means.
64 * (It always returns 0 or 1, not one of it's paramaters.)
66 * Revision 1.7 2001/10/23 21:48:19 jongfoster
67 * Cleaning up error handling in CGI functions - they now send back
68 * a HTML error page and should never cause a FATAL error. (Fixes one
69 * potential source of "denial of service" attacks).
71 * CGI actions file editor that works and is actually useful.
73 * Ability to toggle JunkBuster remotely using a CGI call.
75 * You can turn off both the above features in the main configuration
76 * file, e.g. if you are running a multi-user proxy.
78 * Revision 1.6 2001/10/14 22:00:32 jongfoster
79 * Adding support for a 404 error when an invalid CGI page is requested.
81 * Revision 1.5 2001/10/07 15:30:41 oes
82 * Removed FEATURE_DENY_GZIP
84 * Revision 1.4 2001/10/02 15:31:12 oes
85 * Introduced show-request cgi
87 * Revision 1.3 2001/09/22 16:34:44 jongfoster
88 * Removing unneeded #includes
90 * Revision 1.2 2001/09/19 18:01:11 oes
91 * Fixed comments; cosmetics
93 * Revision 1.1 2001/09/16 17:08:54 jongfoster
94 * Moving simple CGI functions from cgi.c to new file cgisimple.c
97 **********************************************************************/
103 #include <sys/types.h>
110 #define snprintf _snprintf
111 #endif /* def _WIN32 */
115 #include "cgisimple.h"
121 #include "miscutil.h"
124 #include "urlmatch.h"
126 const char cgisimple_h_rcs[] = CGISIMPLE_H_VERSION;
129 static char *show_rcs(void);
130 static jb_err show_defines(struct map *exports);
133 /*********************************************************************
135 * Function : cgi_default
137 * Description : CGI function that is called if no action was given.
138 * Lists menu of available unhidden CGIs.
141 * 1 : csp = Current client state (buffers, headers, etc...)
142 * 2 : rsp = http_response data structure for output
143 * 3 : parameters = map of cgi parameters
145 * CGI Parameters : none
147 * Returns : JB_ERR_OK on success
148 * JB_ERR_MEMORY on out-of-memory
149 * (Problems other than out-of-memory should be
150 * handled by this routine - it should set the
151 * rsp appropriately and return "success")
153 *********************************************************************/
154 jb_err cgi_default(struct client_state *csp,
155 struct http_response *rsp,
156 const struct map *parameters)
165 if (NULL == (exports = default_exports(csp, "")))
167 return JB_ERR_MEMORY;
170 /* If there were other parameters, export a dump as "cgi-parameters" */
171 if (parameters->first)
173 tmp = strdup("<p>What made you think this cgi takes parameters?\n"
174 "Anyway, here they are, in case you're interested:</p>\n");
175 string_join(&tmp, dump_map(parameters));
179 return JB_ERR_MEMORY;
181 if (map(exports, "cgi-parameters", 1, tmp, 0))
183 return JB_ERR_MEMORY;
188 if (map(exports, "cgi-parameters", 1, "", 1))
190 return JB_ERR_MEMORY;
194 return template_fill_for_cgi(csp, "default", exports, rsp);
200 /*********************************************************************
202 * Function : cgi_error_404
204 * Description : CGI function that is called if an unknown action was
208 * 1 : csp = Current client state (buffers, headers, etc...)
209 * 2 : rsp = http_response data structure for output
210 * 3 : parameters = map of cgi parameters
212 * CGI Parameters : none
214 * Returns : JB_ERR_OK on success
215 * JB_ERR_MEMORY on out-of-memory error.
217 *********************************************************************/
218 jb_err cgi_error_404(struct client_state *csp,
219 struct http_response *rsp,
220 const struct map *parameters)
228 if (NULL == (exports = default_exports(csp, NULL)))
230 return JB_ERR_MEMORY;
233 rsp->status = strdup("404 JunkBuster configuration page not found");
234 if (rsp->status == NULL)
237 return JB_ERR_MEMORY;
240 return template_fill_for_cgi(csp, "cgi-error-404", exports, rsp);
244 /*********************************************************************
246 * Function : cgi_show_request
248 * Description : Show the client's request and what sed() would have
252 * 1 : csp = Current client state (buffers, headers, etc...)
253 * 2 : rsp = http_response data structure for output
254 * 3 : parameters = map of cgi parameters
256 * CGI Parameters : none
258 * Returns : JB_ERR_OK on success
259 * JB_ERR_MEMORY on out-of-memory error.
261 *********************************************************************/
262 jb_err cgi_show_request(struct client_state *csp,
263 struct http_response *rsp,
264 const struct map *parameters)
273 if (NULL == (exports = default_exports(csp, "show-request")))
275 return JB_ERR_MEMORY;
279 * Repair the damage done to the IOB by get_header()
281 for (p = csp->iob->buf; p < csp->iob->eod; p++)
283 if (*p == '\0') *p = '\n';
287 * Export the original client's request and the one we would
288 * be sending to the server if this wasn't a CGI call
291 if (map(exports, "client-request", 1, html_encode(csp->iob->buf), 0))
294 return JB_ERR_MEMORY;
297 if (map(exports, "processed-request", 1, html_encode_and_free_original(
298 sed(client_patterns, add_client_headers, csp)), 0))
301 return JB_ERR_MEMORY;
304 return template_fill_for_cgi(csp, "show-request", exports, rsp);
308 /*********************************************************************
310 * Function : cgi_send_banner
312 * Description : CGI function that returns a banner.
315 * 1 : csp = Current client state (buffers, headers, etc...)
316 * 2 : rsp = http_response data structure for output
317 * 3 : parameters = map of cgi parameters
320 * type : Selects the type of banner between "trans", "logo",
321 * and "auto". Defaults to "logo" if absent or invalid.
322 * "auto" means to select as if we were image-blocking.
323 * (Only the first character really counts).
325 * Returns : JB_ERR_OK on success
326 * JB_ERR_MEMORY on out-of-memory error.
328 *********************************************************************/
329 jb_err cgi_send_banner(struct client_state *csp,
330 struct http_response *rsp,
331 const struct map *parameters)
333 char imagetype = lookup(parameters, "type")[0];
335 if (imagetype == 'a') /* auto */
337 /* Default to logo */
339 #ifdef FEATURE_IMAGE_BLOCKING
340 if ((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0)
342 /* determine HOW images should be blocked */
343 const char * p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];
345 /* and handle accordingly: */
346 if ((p != NULL) && (0 == strcmpic(p, "blank")))
351 #endif /* def FEATURE_IMAGE_BLOCKING */
354 if ((imagetype != 't') && (imagetype != 'b')) /* transparant/blank */
356 rsp->body = bindup(image_junkbuster_gif_data, image_junkbuster_gif_length);
357 rsp->content_length = image_junkbuster_gif_length;
361 rsp->body = bindup(image_blank_gif_data, image_blank_gif_length);
362 rsp->content_length = image_blank_gif_length;
365 if (rsp->body == NULL)
367 return JB_ERR_MEMORY;
370 if (enlist(rsp->headers, "Content-Type: image/gif"))
372 return JB_ERR_MEMORY;
382 /*********************************************************************
384 * Function : cgi_transparent_gif
386 * Description : CGI function that sends a 1x1 transparent GIF.
389 * 1 : csp = Current client state (buffers, headers, etc...)
390 * 2 : rsp = http_response data structure for output
391 * 3 : parameters = map of cgi parameters
393 * CGI Parameters : None
395 * Returns : JB_ERR_OK on success
396 * JB_ERR_MEMORY on out-of-memory error.
398 *********************************************************************/
399 jb_err cgi_transparent_gif(struct client_state *csp,
400 struct http_response *rsp,
401 const struct map *parameters)
403 rsp->body = bindup(image_blank_gif_data, image_blank_gif_length);
404 rsp->content_length = image_blank_gif_length;
406 if (rsp->body == NULL)
408 return JB_ERR_MEMORY;
411 if (enlist(rsp->headers, "Content-Type: image/gif"))
413 return JB_ERR_MEMORY;
423 /*********************************************************************
425 * Function : cgi_show_version
427 * Description : CGI function that returns a a web page describing the
428 * file versions of IJB.
431 * 1 : csp = Current client state (buffers, headers, etc...)
432 * 2 : rsp = http_response data structure for output
433 * 3 : parameters = map of cgi parameters
435 * CGI Parameters : none
437 * Returns : JB_ERR_OK on success
438 * JB_ERR_MEMORY on out-of-memory error.
440 *********************************************************************/
441 jb_err cgi_show_version(struct client_state *csp,
442 struct http_response *rsp,
443 const struct map *parameters)
451 if (NULL == (exports = default_exports(csp, "show-version")))
453 return JB_ERR_MEMORY;
456 if (map(exports, "sourceversions", 1, show_rcs(), 0))
459 return JB_ERR_MEMORY;
462 return template_fill_for_cgi(csp, "show-version", exports, rsp);
466 /*********************************************************************
468 * Function : cgi_show_status
470 * Description : CGI function that returns a a web page describing the
471 * current status of IJB.
474 * 1 : csp = Current client state (buffers, headers, etc...)
475 * 2 : rsp = http_response data structure for output
476 * 3 : parameters = map of cgi parameters
479 * file : Which file to show. Only first letter is checked,
481 * - "p"ermissions (actions) file
484 * Default is to show menu and other information.
486 * Returns : JB_ERR_OK on success
487 * JB_ERR_MEMORY on out-of-memory error.
489 *********************************************************************/
490 jb_err cgi_show_status(struct client_state *csp,
491 struct http_response *rsp,
492 const struct map *parameters)
498 char buf[BUFFER_SIZE];
499 const char * filename = NULL;
500 char * file_description = NULL;
501 #ifdef FEATURE_STATISTICS
502 float perc_rej; /* Percentage of http requests rejected */
504 int local_urls_rejected;
505 #endif /* ndef FEATURE_STATISTICS */
514 if (NULL == (exports = default_exports(csp, "show-status")))
516 return JB_ERR_MEMORY;
519 switch (*(lookup(parameters, "file")))
522 if (csp->actions_list)
524 filename = csp->actions_list->filename;
525 file_description = "Actions List";
532 filename = csp->rlist->filename;
533 file_description = "Regex Filter List";
541 filename = csp->tlist->filename;
542 file_description = "Trust List";
545 #endif /* def FEATURE_TRUST */
548 if (NULL != filename)
550 if ( map(exports, "file-description", 1, file_description, 1)
551 || map(exports, "filepath", 1, html_encode(filename), 0) )
554 return JB_ERR_MEMORY;
557 if ((fp = fopen(filename, "r")) == NULL)
559 if (map(exports, "content", 1, "<h1>ERROR OPENING FILE!</h1>", 1))
562 return JB_ERR_MEMORY;
568 while ((s != NULL) && fgets(buf, sizeof(buf), fp))
570 string_join (&s, html_encode(buf));
571 string_append(&s, "<br>");
575 if (map(exports, "contents", 1, s, 0))
578 return JB_ERR_MEMORY;
582 return template_fill_for_cgi(csp, "show-status-file", exports, rsp);
585 if (map(exports, "redirect-url", 1, html_encode(REDIRECT_URL), 0))
588 return JB_ERR_MEMORY;
592 for (i = 0; (s != NULL) && (i < Argc); i++)
594 string_join (&s, html_encode(Argv[i]));
595 string_append(&s, " ");
597 if (map(exports, "invocation", 1, s, 0))
600 return JB_ERR_MEMORY;
603 err = map(exports, "options", 1, csp->config->proxy_args, 1);
604 if (!err) err = show_defines(exports);
606 #ifdef FEATURE_STATISTICS
607 local_urls_read = urls_read;
608 local_urls_rejected = urls_rejected;
611 * Need to alter the stats not to include the fetch of this
614 * Can't do following thread safely! doh!
617 * urls_rejected--; * This will be incremented subsequently *
620 if (local_urls_read == 0)
622 if (!err) err = map_block_killer(exports, "have-stats");
626 if (!err) err = map_block_killer(exports, "have-no-stats");
628 perc_rej = (float)local_urls_rejected * 100.0F /
629 (float)local_urls_read;
631 sprintf(buf, "%d", local_urls_read);
632 if (!err) err = map(exports, "requests-received", 1, buf, 1);
634 sprintf(buf, "%d", local_urls_rejected);
635 if (!err) err = map(exports, "requests-blocked", 1, buf, 1);
637 sprintf(buf, "%6.2f", perc_rej);
638 if (!err) err = map(exports, "percent-blocked", 1, buf, 1);
641 #else /* ndef FEATURE_STATISTICS */
642 err = err || map_block_killer(exports, "statistics");
643 #endif /* ndef FEATURE_STATISTICS */
645 if (csp->actions_list)
647 if (!err) err = map(exports, "actions-filename", 1, html_encode(csp->actions_list->filename), 0);
651 if (!err) err = map(exports, "actions-filename", 1, "None specified", 1);
656 if (!err) err = map(exports, "re-filter-filename", 1, html_encode(csp->rlist->filename), 0);
660 if (!err) err = map(exports, "re-filter-filename", 1, "None specified", 1);
666 if (!err) err = map(exports, "trust-filename", 1, html_encode(csp->tlist->filename), 0);
670 if (!err) err = map(exports, "trust-filename", 1, "None specified", 1);
673 if (!err) err = map_block_killer(exports, "trust-support");
674 #endif /* ndef FEATURE_TRUST */
679 return JB_ERR_MEMORY;
682 return template_fill_for_cgi(csp, "show-status", exports, rsp);
686 /*********************************************************************
688 * Function : cgi_show_url_info
690 * Description : CGI function that determines and shows which actions
691 * junkbuster will perform for a given url, and which
692 * matches starting from the defaults have lead to that.
695 * 1 : csp = Current client state (buffers, headers, etc...)
696 * 2 : rsp = http_response data structure for output
697 * 3 : parameters = map of cgi parameters
700 * url : The url whose actions are to be determined.
701 * If url is unset, the url-given conditional will be
702 * set, so that all but the form can be suppressed in
705 * Returns : JB_ERR_OK on success
706 * JB_ERR_MEMORY on out-of-memory error.
708 *********************************************************************/
709 jb_err cgi_show_url_info(struct client_state *csp,
710 struct http_response *rsp,
711 const struct map *parameters)
720 if (NULL == (exports = default_exports(csp, "show-url-info")))
722 return JB_ERR_MEMORY;
726 * Get the url= parameter (if present) and remove any leading/trailing spaces.
728 url_param = strdup(lookup(parameters, "url"));
729 if (url_param == NULL)
732 return JB_ERR_MEMORY;
737 * Handle prefixes. 4 possibilities:
738 * 1) "http://" or "https://" prefix present and followed by URL - OK
739 * 2) Only the "http://" or "https://" part is present, no URL - change
740 * to empty string so it will be detected later as "no URL".
741 * 3) Parameter specified but doesn't contain "http(s?)://" - add a
743 * 4) Parameter not specified or is empty string - let this fall through
744 * for now, next block of code will handle it.
746 if (0 == strncmp(url_param, "http://", 7))
748 if (url_param[7] == '\0')
751 * Empty URL (just prefix).
752 * Make it totally empty so it's caught by the next if()
757 else if (0 == strncmp(url_param, "https://", 8))
759 if (url_param[8] == '\0')
762 * Empty URL (just prefix).
763 * Make it totally empty so it's caught by the next if()
768 else if (url_param[0] != '\0')
771 * Unknown prefix - assume http://
773 char * url_param_prefixed = malloc(7 + 1 + strlen(url_param));
774 if (NULL == url_param_prefixed)
778 return JB_ERR_MEMORY;
780 strcpy(url_param_prefixed, "http://");
781 strcpy(url_param_prefixed + 7, url_param);
783 url_param = url_param_prefixed;
787 if (url_param[0] == '\0')
789 /* URL paramater not specified, display query form only. */
791 if (map_block_killer(exports, "url-given")
792 || map(exports, "url", 1, "", 1))
795 return JB_ERR_MEMORY;
800 /* Given a URL, so query it. */
805 struct file_list *fl;
806 struct url_actions *b;
807 struct http_request url_to_query[1];
808 struct current_action_spec action[1];
810 if (map(exports, "url", 1, html_encode(url_param), 0))
814 return JB_ERR_MEMORY;
817 init_current_action(action);
819 if (map(exports, "default", 1, html_encode_and_free_original(
820 current_action_to_text(action)), 0))
822 free_current_action(action);
825 return JB_ERR_MEMORY;
828 if (((fl = csp->actions_list) == NULL) || ((b = fl->f) == NULL))
830 err = map(exports, "matches", 1, "none" , 1);
831 if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
833 free_current_action(action);
839 return JB_ERR_MEMORY;
842 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
845 err = parse_http_url(url_param, url_to_query, csp);
849 if (err == JB_ERR_MEMORY)
851 free_current_action(action);
853 return JB_ERR_MEMORY;
859 err = map(exports, "matches", 1, "<b>[Invalid URL specified!]</b>" , 1);
860 if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
862 free_current_action(action);
867 return JB_ERR_MEMORY;
870 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
874 * We have a warning about SSL paths. Hide it for insecure sites.
876 if (!url_to_query->ssl)
878 if (map_block_killer(exports, "https"))
880 free_current_action(action);
882 return JB_ERR_MEMORY;
886 matches = strdup("");
888 for (b = b->next; (b != NULL) && (matches != NULL); b = b->next)
890 if (url_match(b->url, url_to_query))
892 string_append(&matches, "<b>{");
893 string_join (&matches, html_encode_and_free_original(
894 actions_to_text(b->action)));
895 string_append(&matches, " }</b><br>\n<code>");
896 string_join (&matches, html_encode(b->url->spec));
897 string_append(&matches, "</code><br>\n<br>\n");
899 if (merge_current_action(action, b->action))
902 free_http_request(url_to_query);
903 free_current_action(action);
905 return JB_ERR_MEMORY;
911 free_http_request(url_to_query);
915 free_current_action(action);
917 return JB_ERR_MEMORY;
923 matches = strdup("none");
925 if (map(exports, "matches", 1, matches , 0))
927 free_current_action(action);
929 return JB_ERR_MEMORY;
932 s = html_encode_and_free_original(current_action_to_text(action));
934 free_current_action(action);
936 if (map(exports, "final", 1, s, 0))
939 return JB_ERR_MEMORY;
943 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
947 /*********************************************************************
949 * Function : cgi_robots_txt
951 * Description : CGI function to return "/robots.txt".
954 * 1 : csp = Current client state (buffers, headers, etc...)
955 * 2 : rsp = http_response data structure for output
956 * 3 : parameters = map of cgi parameters
958 * CGI Parameters : None
960 * Returns : JB_ERR_OK on success
961 * JB_ERR_MEMORY on out-of-memory error.
963 *********************************************************************/
964 jb_err cgi_robots_txt(struct client_state *csp,
965 struct http_response *rsp,
966 const struct map *parameters)
972 "# This is the Internet Junkbuster control interface.\n"
973 "# It isn't very useful to index it, and you're likely to break stuff.\n"
979 if (rsp->body == NULL)
981 return JB_ERR_MEMORY;
984 err = enlist_unique(rsp->headers, "Content-Type: text/plain", 13);
988 get_http_time(7 * 24 * 60 * 60, buf); /* 7 days into future */
989 if (!err) err = enlist_unique_header(rsp->headers, "Expires", buf);
991 return (err ? JB_ERR_MEMORY : JB_ERR_OK);
995 /*********************************************************************
997 * Function : show_defines
999 * Description : Add to a map the state od all conditional #defines
1000 * used when building
1003 * 1 : exports = map to extend
1005 * Returns : JB_ERR_OK on success
1006 * JB_ERR_MEMORY on out-of-memory error.
1008 *********************************************************************/
1009 static jb_err show_defines(struct map *exports)
1011 jb_err err = JB_ERR_OK;
1014 if (!err) err = map_conditional(exports, "FEATURE_ACL", 1);
1015 #else /* ifndef FEATURE_ACL */
1016 if (!err) err = map_conditional(exports, "FEATURE_ACL", 0);
1017 #endif /* ndef FEATURE_ACL */
1019 #ifdef FEATURE_CGI_EDIT_ACTIONS
1020 if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 1);
1021 #else /* ifndef FEATURE_COOKIE_JAR */
1022 if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 0);
1023 #endif /* ndef FEATURE_COOKIE_JAR */
1025 #ifdef FEATURE_COOKIE_JAR
1026 if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 1);
1027 #else /* ifndef FEATURE_COOKIE_JAR */
1028 if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 0);
1029 #endif /* ndef FEATURE_COOKIE_JAR */
1031 #ifdef FEATURE_FAST_REDIRECTS
1032 if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 1);
1033 #else /* ifndef FEATURE_FAST_REDIRECTS */
1034 if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 0);
1035 #endif /* ndef FEATURE_FAST_REDIRECTS */
1037 #ifdef FEATURE_FORCE_LOAD
1038 if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 1);
1039 #else /* ifndef FEATURE_FORCE_LOAD */
1040 if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 0);
1041 #endif /* ndef FEATURE_FORCE_LOAD */
1043 #ifdef FEATURE_IMAGE_BLOCKING
1044 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 1);
1045 #else /* ifndef FEATURE_IMAGE_BLOCKING */
1046 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 0);
1047 #endif /* ndef FEATURE_IMAGE_BLOCKING */
1049 #ifdef FEATURE_IMAGE_DETECT_MSIE
1050 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 1);
1051 #else /* ifndef FEATURE_IMAGE_DETECT_MSIE */
1052 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 0);
1053 #endif /* ndef FEATURE_IMAGE_DETECT_MSIE */
1055 #ifdef FEATURE_KILL_POPUPS
1056 if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 1);
1057 #else /* ifndef FEATURE_KILL_POPUPS */
1058 if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 0);
1059 #endif /* ndef FEATURE_KILL_POPUPS */
1061 #ifdef FEATURE_PTHREAD
1062 if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 1);
1063 #else /* ifndef FEATURE_PTHREAD */
1064 if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 0);
1065 #endif /* ndef FEATURE_PTHREAD */
1067 #ifdef FEATURE_STATISTICS
1068 if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 1);
1069 #else /* ifndef FEATURE_STATISTICS */
1070 if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 0);
1071 #endif /* ndef FEATURE_STATISTICS */
1073 #ifdef FEATURE_TOGGLE
1074 if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 1);
1075 #else /* ifndef FEATURE_TOGGLE */
1076 if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 0);
1077 #endif /* ndef FEATURE_TOGGLE */
1079 #ifdef FEATURE_TRUST
1080 if (!err) err = map_conditional(exports, "FEATURE_TRUST", 1);
1081 #else /* ifndef FEATURE_TRUST */
1082 if (!err) err = map_conditional(exports, "FEATURE_TRUST", 0);
1083 #endif /* ndef FEATURE_TRUST */
1086 if (!err) err = map_conditional(exports, "REGEX_GNU", 1);
1087 #else /* ifndef REGEX_GNU */
1088 if (!err) err = map_conditional(exports, "REGEX_GNU", 0);
1089 #endif /* def REGEX_GNU */
1092 if (!err) err = map_conditional(exports, "REGEX_PCRE", 1);
1093 #else /* ifndef REGEX_PCRE */
1094 if (!err) err = map_conditional(exports, "REGEX_PCRE", 0);
1095 #endif /* def REGEX_PCRE */
1098 if (!err) err = map_conditional(exports, "STATIC_PCRE", 1);
1099 #else /* ifndef STATIC_PCRE */
1100 if (!err) err = map_conditional(exports, "STATIC_PCRE", 0);
1101 #endif /* ndef STATIC_PCRE */
1104 if (!err) err = map_conditional(exports, "STATIC_PCRS", 1);
1105 #else /* ifndef STATIC_PCRS */
1106 if (!err) err = map_conditional(exports, "STATIC_PCRS", 0);
1107 #endif /* ndef STATIC_PCRS */
1109 if (!err) err = map(exports, "FORCE_PREFIX", 1, FORCE_PREFIX, 1);
1115 /*********************************************************************
1117 * Function : show_rcs
1119 * Description : Create a string with the rcs info for all sourcefiles
1123 * Returns : A string, or NULL on out-of-memory.
1125 *********************************************************************/
1126 static char *show_rcs(void)
1128 char *result = strdup("");
1129 char buf[BUFFER_SIZE];
1131 /* Instead of including *all* dot h's in the project (thus creating a
1132 * tremendous amount of dependencies), I will concede to declaring them
1133 * as extern's. This forces the developer to add to this list, but oh well.
1136 #define SHOW_RCS(__x) \
1138 extern const char __x[]; \
1139 sprintf(buf, "%s\n", __x); \
1140 string_append(&result, buf); \
1143 /* In alphabetical order */
1144 SHOW_RCS(actions_h_rcs)
1145 SHOW_RCS(actions_rcs)
1148 #ifdef FEATURE_CGI_EDIT_ACTIONS
1149 SHOW_RCS(cgiedit_h_rcs)
1150 SHOW_RCS(cgiedit_rcs)
1151 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
1152 SHOW_RCS(cgisimple_h_rcs)
1153 SHOW_RCS(cgisimple_rcs)
1155 SHOW_RCS(cygwin_h_rcs)
1157 SHOW_RCS(deanimate_h_rcs)
1158 SHOW_RCS(deanimate_rcs)
1159 SHOW_RCS(encode_h_rcs)
1160 SHOW_RCS(encode_rcs)
1161 SHOW_RCS(errlog_h_rcs)
1162 SHOW_RCS(errlog_rcs)
1163 SHOW_RCS(filters_h_rcs)
1164 SHOW_RCS(filters_rcs)
1165 SHOW_RCS(gateway_h_rcs)
1166 SHOW_RCS(gateway_rcs)
1168 SHOW_RCS(gnu_regex_h_rcs)
1169 SHOW_RCS(gnu_regex_rcs)
1170 #endif /* def GNU_REGEX */
1171 SHOW_RCS(jbsockets_h_rcs)
1172 SHOW_RCS(jbsockets_rcs)
1175 #ifdef FEATURE_KILL_POPUPS
1176 SHOW_RCS(killpopup_h_rcs)
1177 SHOW_RCS(killpopup_rcs)
1178 #endif /* def FEATURE_KILL_POPUPS */
1179 SHOW_RCS(list_h_rcs)
1181 SHOW_RCS(loadcfg_h_rcs)
1182 SHOW_RCS(loadcfg_rcs)
1183 SHOW_RCS(loaders_h_rcs)
1184 SHOW_RCS(loaders_rcs)
1185 SHOW_RCS(miscutil_h_rcs)
1186 SHOW_RCS(miscutil_rcs)
1187 SHOW_RCS(parsers_h_rcs)
1188 SHOW_RCS(parsers_rcs)
1190 SHOW_RCS(pcrs_h_rcs)
1191 SHOW_RCS(project_h_rcs)
1192 SHOW_RCS(ssplit_h_rcs)
1193 SHOW_RCS(ssplit_rcs)
1194 SHOW_RCS(urlmatch_h_rcs)
1195 SHOW_RCS(urlmatch_rcs)
1197 #ifndef _WIN_CONSOLE
1198 SHOW_RCS(w32log_h_rcs)
1199 SHOW_RCS(w32log_rcs)
1200 SHOW_RCS(w32res_h_rcs)
1201 SHOW_RCS(w32taskbar_h_rcs)
1202 SHOW_RCS(w32taskbar_rcs)
1203 #endif /* ndef _WIN_CONSOLE */
1204 SHOW_RCS(win32_h_rcs)
1206 #endif /* def _WIN32 */