1 const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.10 2002/01/17 21:10:37 jongfoster 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.10 2002/01/17 21:10:37 jongfoster
40 * Changes to cgi_show_url_info to use new matching code from urlmatch.c.
41 * Also fixing a problem in the same function with improperly quoted URLs
42 * in output HTML, and adding code to handle https:// URLs correctly.
44 * Revision 1.9 2001/11/30 23:09:15 jongfoster
45 * Now reports on FEATURE_CGI_EDIT_ACTIONS
46 * Removing FEATURE_DENY_GZIP from template
48 * Revision 1.8 2001/11/13 00:14:07 jongfoster
49 * Fixing stupid bug now I've figured out what || means.
50 * (It always returns 0 or 1, not one of it's paramaters.)
52 * Revision 1.7 2001/10/23 21:48:19 jongfoster
53 * Cleaning up error handling in CGI functions - they now send back
54 * a HTML error page and should never cause a FATAL error. (Fixes one
55 * potential source of "denial of service" attacks).
57 * CGI actions file editor that works and is actually useful.
59 * Ability to toggle JunkBuster remotely using a CGI call.
61 * You can turn off both the above features in the main configuration
62 * file, e.g. if you are running a multi-user proxy.
64 * Revision 1.6 2001/10/14 22:00:32 jongfoster
65 * Adding support for a 404 error when an invalid CGI page is requested.
67 * Revision 1.5 2001/10/07 15:30:41 oes
68 * Removed FEATURE_DENY_GZIP
70 * Revision 1.4 2001/10/02 15:31:12 oes
71 * Introduced show-request cgi
73 * Revision 1.3 2001/09/22 16:34:44 jongfoster
74 * Removing unneeded #includes
76 * Revision 1.2 2001/09/19 18:01:11 oes
77 * Fixed comments; cosmetics
79 * Revision 1.1 2001/09/16 17:08:54 jongfoster
80 * Moving simple CGI functions from cgi.c to new file cgisimple.c
83 **********************************************************************/
89 #include <sys/types.h>
96 #define snprintf _snprintf
97 #endif /* def _WIN32 */
101 #include "cgisimple.h"
107 #include "miscutil.h"
110 #include "urlmatch.h"
112 const char cgisimple_h_rcs[] = CGISIMPLE_H_VERSION;
115 static char *show_rcs(void);
116 static jb_err show_defines(struct map *exports);
119 /*********************************************************************
121 * Function : cgi_default
123 * Description : CGI function that is called if no action was given.
124 * Lists menu of available unhidden CGIs.
127 * 1 : csp = Current client state (buffers, headers, etc...)
128 * 2 : rsp = http_response data structure for output
129 * 3 : parameters = map of cgi parameters
131 * CGI Parameters : none
133 * Returns : JB_ERR_OK on success
134 * JB_ERR_MEMORY on out-of-memory
135 * (Problems other than out-of-memory should be
136 * handled by this routine - it should set the
137 * rsp appropriately and return "success")
139 *********************************************************************/
140 jb_err cgi_default(struct client_state *csp,
141 struct http_response *rsp,
142 const struct map *parameters)
151 if (NULL == (exports = default_exports(csp, "")))
153 return JB_ERR_MEMORY;
156 /* If there were other parameters, export a dump as "cgi-parameters" */
157 if (parameters->first)
159 tmp = strdup("<p>What made you think this cgi takes parameters?\n"
160 "Anyway, here they are, in case you're interested:</p>\n");
161 string_join(&tmp, dump_map(parameters));
165 return JB_ERR_MEMORY;
167 if (map(exports, "cgi-parameters", 1, tmp, 0))
169 return JB_ERR_MEMORY;
174 if (map(exports, "cgi-parameters", 1, "", 1))
176 return JB_ERR_MEMORY;
180 return template_fill_for_cgi(csp, "default", exports, rsp);
186 /*********************************************************************
188 * Function : cgi_error_404
190 * Description : CGI function that is called if an unknown action was
194 * 1 : csp = Current client state (buffers, headers, etc...)
195 * 2 : rsp = http_response data structure for output
196 * 3 : parameters = map of cgi parameters
198 * CGI Parameters : none
200 * Returns : JB_ERR_OK on success
201 * JB_ERR_MEMORY on out-of-memory error.
203 *********************************************************************/
204 jb_err cgi_error_404(struct client_state *csp,
205 struct http_response *rsp,
206 const struct map *parameters)
214 if (NULL == (exports = default_exports(csp, NULL)))
216 return JB_ERR_MEMORY;
219 rsp->status = strdup("404 JunkBuster configuration page not found");
220 if (rsp->status == NULL)
223 return JB_ERR_MEMORY;
226 return template_fill_for_cgi(csp, "cgi-error-404", exports, rsp);
230 /*********************************************************************
232 * Function : cgi_show_request
234 * Description : Show the client's request and what sed() would have
238 * 1 : csp = Current client state (buffers, headers, etc...)
239 * 2 : rsp = http_response data structure for output
240 * 3 : parameters = map of cgi parameters
242 * CGI Parameters : none
244 * Returns : JB_ERR_OK on success
245 * JB_ERR_MEMORY on out-of-memory error.
247 *********************************************************************/
248 jb_err cgi_show_request(struct client_state *csp,
249 struct http_response *rsp,
250 const struct map *parameters)
259 if (NULL == (exports = default_exports(csp, "show-request")))
261 return JB_ERR_MEMORY;
265 * Repair the damage done to the IOB by get_header()
267 for (p = csp->iob->buf; p < csp->iob->eod; p++)
269 if (*p == '\0') *p = '\n';
273 * Export the original client's request and the one we would
274 * be sending to the server if this wasn't a CGI call
277 if (map(exports, "client-request", 1, html_encode(csp->iob->buf), 0))
280 return JB_ERR_MEMORY;
283 if (map(exports, "processed-request", 1, html_encode_and_free_original(
284 sed(client_patterns, add_client_headers, csp)), 0))
287 return JB_ERR_MEMORY;
290 return template_fill_for_cgi(csp, "show-request", exports, rsp);
294 /*********************************************************************
296 * Function : cgi_send_banner
298 * Description : CGI function that returns a banner.
301 * 1 : csp = Current client state (buffers, headers, etc...)
302 * 2 : rsp = http_response data structure for output
303 * 3 : parameters = map of cgi parameters
306 * type : Selects the type of banner between "trans" and "jb".
307 * Defaults to "jb" if absent or != "trans".
309 * Returns : JB_ERR_OK on success
310 * JB_ERR_MEMORY on out-of-memory error.
312 *********************************************************************/
313 jb_err cgi_send_banner(struct client_state *csp,
314 struct http_response *rsp,
315 const struct map *parameters)
317 if (strcmp(lookup(parameters, "type"), "trans"))
319 rsp->body = bindup(image_junkbuster_gif_data, image_junkbuster_gif_length);
320 rsp->content_length = image_junkbuster_gif_length;
324 rsp->body = bindup(image_blank_gif_data, image_blank_gif_length);
325 rsp->content_length = image_blank_gif_length;
328 if (rsp->body == NULL)
330 return JB_ERR_MEMORY;
333 if (enlist(rsp->headers, "Content-Type: image/gif"))
335 return JB_ERR_MEMORY;
345 /*********************************************************************
347 * Function : cgi_transparent_gif
349 * Description : CGI function that sends a 1x1 transparent GIF.
352 * 1 : csp = Current client state (buffers, headers, etc...)
353 * 2 : rsp = http_response data structure for output
354 * 3 : parameters = map of cgi parameters
356 * CGI Parameters : None
358 * Returns : JB_ERR_OK on success
359 * JB_ERR_MEMORY on out-of-memory error.
361 *********************************************************************/
362 jb_err cgi_transparent_gif(struct client_state *csp,
363 struct http_response *rsp,
364 const struct map *parameters)
366 rsp->body = bindup(image_blank_gif_data, image_blank_gif_length);
367 rsp->content_length = image_blank_gif_length;
369 if (rsp->body == NULL)
371 return JB_ERR_MEMORY;
374 if (enlist(rsp->headers, "Content-Type: image/gif"))
376 return JB_ERR_MEMORY;
386 /*********************************************************************
388 * Function : cgi_show_version
390 * Description : CGI function that returns a a web page describing the
391 * file versions of IJB.
394 * 1 : csp = Current client state (buffers, headers, etc...)
395 * 2 : rsp = http_response data structure for output
396 * 3 : parameters = map of cgi parameters
398 * CGI Parameters : none
400 * Returns : JB_ERR_OK on success
401 * JB_ERR_MEMORY on out-of-memory error.
403 *********************************************************************/
404 jb_err cgi_show_version(struct client_state *csp,
405 struct http_response *rsp,
406 const struct map *parameters)
414 if (NULL == (exports = default_exports(csp, "show-version")))
416 return JB_ERR_MEMORY;
419 if (map(exports, "sourceversions", 1, show_rcs(), 0))
422 return JB_ERR_MEMORY;
425 return template_fill_for_cgi(csp, "show-version", exports, rsp);
429 /*********************************************************************
431 * Function : cgi_show_status
433 * Description : CGI function that returns a a web page describing the
434 * current status of IJB.
437 * 1 : csp = Current client state (buffers, headers, etc...)
438 * 2 : rsp = http_response data structure for output
439 * 3 : parameters = map of cgi parameters
442 * file : Which file to show. Only first letter is checked,
444 * - "p"ermissions (actions) file
447 * Default is to show menu and other information.
449 * Returns : JB_ERR_OK on success
450 * JB_ERR_MEMORY on out-of-memory error.
452 *********************************************************************/
453 jb_err cgi_show_status(struct client_state *csp,
454 struct http_response *rsp,
455 const struct map *parameters)
461 char buf[BUFFER_SIZE];
462 const char * filename = NULL;
463 char * file_description = NULL;
464 #ifdef FEATURE_STATISTICS
465 float perc_rej; /* Percentage of http requests rejected */
467 int local_urls_rejected;
468 #endif /* ndef FEATURE_STATISTICS */
477 if (NULL == (exports = default_exports(csp, "show-status")))
479 return JB_ERR_MEMORY;
482 switch (*(lookup(parameters, "file")))
485 if (csp->actions_list)
487 filename = csp->actions_list->filename;
488 file_description = "Actions List";
495 filename = csp->rlist->filename;
496 file_description = "Regex Filter List";
504 filename = csp->tlist->filename;
505 file_description = "Trust List";
508 #endif /* def FEATURE_TRUST */
511 if (NULL != filename)
513 if ( map(exports, "file-description", 1, file_description, 1)
514 || map(exports, "filepath", 1, html_encode(filename), 0) )
517 return JB_ERR_MEMORY;
520 if ((fp = fopen(filename, "r")) == NULL)
522 if (map(exports, "content", 1, "<h1>ERROR OPENING FILE!</h1>", 1))
525 return JB_ERR_MEMORY;
531 while ((s != NULL) && fgets(buf, sizeof(buf), fp))
533 string_join (&s, html_encode(buf));
534 string_append(&s, "<br>");
538 if (map(exports, "contents", 1, s, 0))
541 return JB_ERR_MEMORY;
545 return template_fill_for_cgi(csp, "show-status-file", exports, rsp);
548 if (map(exports, "redirect-url", 1, html_encode(REDIRECT_URL), 0))
551 return JB_ERR_MEMORY;
555 for (i = 0; (s != NULL) && (i < Argc); i++)
557 string_join (&s, html_encode(Argv[i]));
558 string_append(&s, " ");
560 if (map(exports, "invocation", 1, s, 0))
563 return JB_ERR_MEMORY;
566 err = map(exports, "options", 1, csp->config->proxy_args, 1);
567 if (!err) err = show_defines(exports);
569 #ifdef FEATURE_STATISTICS
570 local_urls_read = urls_read;
571 local_urls_rejected = urls_rejected;
574 * Need to alter the stats not to include the fetch of this
577 * Can't do following thread safely! doh!
580 * urls_rejected--; * This will be incremented subsequently *
583 if (local_urls_read == 0)
585 if (!err) err = map_block_killer(exports, "have-stats");
589 if (!err) err = map_block_killer(exports, "have-no-stats");
591 perc_rej = (float)local_urls_rejected * 100.0F /
592 (float)local_urls_read;
594 sprintf(buf, "%d", local_urls_read);
595 if (!err) err = map(exports, "requests-received", 1, buf, 1);
597 sprintf(buf, "%d", local_urls_rejected);
598 if (!err) err = map(exports, "requests-blocked", 1, buf, 1);
600 sprintf(buf, "%6.2f", perc_rej);
601 if (!err) err = map(exports, "percent-blocked", 1, buf, 1);
604 #else /* ndef FEATURE_STATISTICS */
605 err = err || map_block_killer(exports, "statistics");
606 #endif /* ndef FEATURE_STATISTICS */
608 if (csp->actions_list)
610 if (!err) err = map(exports, "actions-filename", 1, html_encode(csp->actions_list->filename), 0);
614 if (!err) err = map(exports, "actions-filename", 1, "None specified", 1);
619 if (!err) err = map(exports, "re-filter-filename", 1, html_encode(csp->rlist->filename), 0);
623 if (!err) err = map(exports, "re-filter-filename", 1, "None specified", 1);
629 if (!err) err = map(exports, "trust-filename", 1, html_encode(csp->tlist->filename), 0);
633 if (!err) err = map(exports, "trust-filename", 1, "None specified", 1);
636 if (!err) err = map_block_killer(exports, "trust-support");
637 #endif /* ndef FEATURE_TRUST */
642 return JB_ERR_MEMORY;
645 return template_fill_for_cgi(csp, "show-status", exports, rsp);
649 /*********************************************************************
651 * Function : cgi_show_url_info
653 * Description : CGI function that determines and shows which actions
654 * junkbuster will perform for a given url, and which
655 * matches starting from the defaults have lead to that.
658 * 1 : csp = Current client state (buffers, headers, etc...)
659 * 2 : rsp = http_response data structure for output
660 * 3 : parameters = map of cgi parameters
663 * url : The url whose actions are to be determined.
664 * If url is unset, the url-given conditional will be
665 * set, so that all but the form can be suppressed in
668 * Returns : JB_ERR_OK on success
669 * JB_ERR_MEMORY on out-of-memory error.
671 *********************************************************************/
672 jb_err cgi_show_url_info(struct client_state *csp,
673 struct http_response *rsp,
674 const struct map *parameters)
684 if (NULL == (exports = default_exports(csp, "show-url-info")))
686 return JB_ERR_MEMORY;
690 * Get the url= parameter (if present) and remove any leading/trailing spaces.
692 url_param = strdup(lookup(parameters, "url"));
693 if (url_param == NULL)
696 return JB_ERR_MEMORY;
701 * Handle prefixes. 4 possibilities:
702 * 1) "http://" or "https://" prefix present and followed by URL - OK
703 * 2) Only the "http://" or "https://" part is present, no URL - change
704 * to empty string so it will be detected later as "no URL".
705 * 3) Parameter specified but doesn't contain "http(s?)://" - add a
707 * 4) Parameter not specified or is empty string - let this fall through
708 * for now, next block of code will handle it.
710 if (0 == strncmp(url_param, "http://", 7))
712 if (url_param[7] == '\0')
715 * Empty URL (just prefix).
716 * Make it totally empty so it's caught by the next if()
721 else if (0 == strncmp(url_param, "https://", 8))
723 if (url_param[8] == '\0')
726 * Empty URL (just prefix).
727 * Make it totally empty so it's caught by the next if()
732 else if (url_param[0] != '\0')
735 * Unknown prefix - assume http://
737 char * url_param_prefixed = malloc(7 + 1 + strlen(url_param));
738 if (NULL == url_param_prefixed)
742 return JB_ERR_MEMORY;
744 strcpy(url_param_prefixed, "http://");
745 strcpy(url_param_prefixed + 7, url_param);
747 url_param = url_param_prefixed;
751 if (url_param[0] == '\0')
753 /* URL paramater not specified, display query form only. */
755 if (map_block_killer(exports, "url-given")
756 || map(exports, "url", 1, "", 1))
759 return JB_ERR_MEMORY;
764 /* Given a URL, so query it. */
769 struct file_list *fl;
770 struct url_actions *b;
771 struct http_request url_to_query[1];
772 struct current_action_spec action[1];
774 if (map(exports, "url", 1, html_encode(url_param), 0))
778 return JB_ERR_MEMORY;
781 init_current_action(action);
783 if (map(exports, "default", 1, html_encode_and_free_original(
784 current_action_to_text(action)), 0))
786 free_current_action(action);
789 return JB_ERR_MEMORY;
792 if (((fl = csp->actions_list) == NULL) || ((b = fl->f) == NULL))
794 err = map(exports, "matches", 1, "none" , 1);
795 if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
797 free_current_action(action);
803 return JB_ERR_MEMORY;
806 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
809 err = parse_http_url(url_param, url_to_query, csp);
813 if (err == JB_ERR_MEMORY)
815 free_current_action(action);
817 return JB_ERR_MEMORY;
823 err = map(exports, "matches", 1, "<b>[Invalid URL specified!]</b>" , 1);
824 if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
826 free_current_action(action);
831 return JB_ERR_MEMORY;
834 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
838 * We have a warning about SSL paths. Hide it for insecure sites.
840 if (!url_to_query->ssl)
842 if (map_block_killer(exports, "https"))
844 free_current_action(action);
846 return JB_ERR_MEMORY;
850 matches = strdup("");
852 for (b = b->next; (b != NULL) && (matches != NULL); b = b->next)
854 if (url_match(b->url, url_to_query))
856 string_append(&matches, "<b>{");
857 string_join (&matches, html_encode_and_free_original(
858 actions_to_text(b->action)));
859 string_append(&matches, " }</b><br>\n<code>");
860 string_join (&matches, html_encode(b->url->spec));
861 string_append(&matches, "</code><br>\n<br>\n");
863 if (merge_current_action(action, b->action))
866 free_http_request(url_to_query);
867 free_current_action(action);
869 return JB_ERR_MEMORY;
875 free_http_request(url_to_query);
879 free_current_action(action);
881 return JB_ERR_MEMORY;
887 matches = strdup("none");
889 if (map(exports, "matches", 1, matches , 0))
891 free_current_action(action);
893 return JB_ERR_MEMORY;
896 s = html_encode_and_free_original(current_action_to_text(action));
898 free_current_action(action);
900 if (map(exports, "final", 1, s, 0))
903 return JB_ERR_MEMORY;
907 return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
911 /*********************************************************************
913 * Function : cgi_robots_txt
915 * Description : CGI function to return "/robots.txt".
918 * 1 : csp = Current client state (buffers, headers, etc...)
919 * 2 : rsp = http_response data structure for output
920 * 3 : parameters = map of cgi parameters
922 * CGI Parameters : None
924 * Returns : JB_ERR_OK on success
925 * JB_ERR_MEMORY on out-of-memory error.
927 *********************************************************************/
928 jb_err cgi_robots_txt(struct client_state *csp,
929 struct http_response *rsp,
930 const struct map *parameters)
936 "# This is the Internet Junkbuster control interface.\n"
937 "# It isn't very useful to index it, and you're likely to break stuff.\n"
943 if (rsp->body == NULL)
945 return JB_ERR_MEMORY;
948 err = enlist_unique(rsp->headers, "Content-Type: text/plain", 13);
952 get_http_time(7 * 24 * 60 * 60, buf); /* 7 days into future */
953 if (!err) err = enlist_unique_header(rsp->headers, "Expires", buf);
955 return (err ? JB_ERR_MEMORY : JB_ERR_OK);
959 /*********************************************************************
961 * Function : show_defines
963 * Description : Add to a map the state od all conditional #defines
967 * 1 : exports = map to extend
969 * Returns : JB_ERR_OK on success
970 * JB_ERR_MEMORY on out-of-memory error.
972 *********************************************************************/
973 static jb_err show_defines(struct map *exports)
975 jb_err err = JB_ERR_OK;
978 if (!err) err = map_conditional(exports, "FEATURE_ACL", 1);
979 #else /* ifndef FEATURE_ACL */
980 if (!err) err = map_conditional(exports, "FEATURE_ACL", 0);
981 #endif /* ndef FEATURE_ACL */
983 #ifdef FEATURE_CGI_EDIT_ACTIONS
984 if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 1);
985 #else /* ifndef FEATURE_COOKIE_JAR */
986 if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 0);
987 #endif /* ndef FEATURE_COOKIE_JAR */
989 #ifdef FEATURE_COOKIE_JAR
990 if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 1);
991 #else /* ifndef FEATURE_COOKIE_JAR */
992 if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 0);
993 #endif /* ndef FEATURE_COOKIE_JAR */
995 #ifdef FEATURE_FAST_REDIRECTS
996 if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 1);
997 #else /* ifndef FEATURE_FAST_REDIRECTS */
998 if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 0);
999 #endif /* ndef FEATURE_FAST_REDIRECTS */
1001 #ifdef FEATURE_FORCE_LOAD
1002 if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 1);
1003 #else /* ifndef FEATURE_FORCE_LOAD */
1004 if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 0);
1005 #endif /* ndef FEATURE_FORCE_LOAD */
1007 #ifdef FEATURE_IMAGE_BLOCKING
1008 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 1);
1009 #else /* ifndef FEATURE_IMAGE_BLOCKING */
1010 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 0);
1011 #endif /* ndef FEATURE_IMAGE_BLOCKING */
1013 #ifdef FEATURE_IMAGE_DETECT_MSIE
1014 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 1);
1015 #else /* ifndef FEATURE_IMAGE_DETECT_MSIE */
1016 if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 0);
1017 #endif /* ndef FEATURE_IMAGE_DETECT_MSIE */
1019 #ifdef FEATURE_KILL_POPUPS
1020 if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 1);
1021 #else /* ifndef FEATURE_KILL_POPUPS */
1022 if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 0);
1023 #endif /* ndef FEATURE_KILL_POPUPS */
1025 #ifdef FEATURE_PTHREAD
1026 if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 1);
1027 #else /* ifndef FEATURE_PTHREAD */
1028 if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 0);
1029 #endif /* ndef FEATURE_PTHREAD */
1031 #ifdef FEATURE_STATISTICS
1032 if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 1);
1033 #else /* ifndef FEATURE_STATISTICS */
1034 if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 0);
1035 #endif /* ndef FEATURE_STATISTICS */
1037 #ifdef FEATURE_TOGGLE
1038 if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 1);
1039 #else /* ifndef FEATURE_TOGGLE */
1040 if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 0);
1041 #endif /* ndef FEATURE_TOGGLE */
1043 #ifdef FEATURE_TRUST
1044 if (!err) err = map_conditional(exports, "FEATURE_TRUST", 1);
1045 #else /* ifndef FEATURE_TRUST */
1046 if (!err) err = map_conditional(exports, "FEATURE_TRUST", 0);
1047 #endif /* ndef FEATURE_TRUST */
1050 if (!err) err = map_conditional(exports, "REGEX_GNU", 1);
1051 #else /* ifndef REGEX_GNU */
1052 if (!err) err = map_conditional(exports, "REGEX_GNU", 0);
1053 #endif /* def REGEX_GNU */
1056 if (!err) err = map_conditional(exports, "REGEX_PCRE", 1);
1057 #else /* ifndef REGEX_PCRE */
1058 if (!err) err = map_conditional(exports, "REGEX_PCRE", 0);
1059 #endif /* def REGEX_PCRE */
1062 if (!err) err = map_conditional(exports, "STATIC_PCRE", 1);
1063 #else /* ifndef STATIC_PCRE */
1064 if (!err) err = map_conditional(exports, "STATIC_PCRE", 0);
1065 #endif /* ndef STATIC_PCRE */
1068 if (!err) err = map_conditional(exports, "STATIC_PCRS", 1);
1069 #else /* ifndef STATIC_PCRS */
1070 if (!err) err = map_conditional(exports, "STATIC_PCRS", 0);
1071 #endif /* ndef STATIC_PCRS */
1073 if (!err) err = map(exports, "FORCE_PREFIX", 1, FORCE_PREFIX, 1);
1079 /*********************************************************************
1081 * Function : show_rcs
1083 * Description : Create a string with the rcs info for all sourcefiles
1087 * Returns : A string, or NULL on out-of-memory.
1089 *********************************************************************/
1090 static char *show_rcs(void)
1092 char *result = strdup("");
1093 char buf[BUFFER_SIZE];
1095 /* Instead of including *all* dot h's in the project (thus creating a
1096 * tremendous amount of dependencies), I will concede to declaring them
1097 * as extern's. This forces the developer to add to this list, but oh well.
1100 #define SHOW_RCS(__x) \
1102 extern const char __x[]; \
1103 sprintf(buf, "%s\n", __x); \
1104 string_append(&result, buf); \
1107 /* In alphabetical order */
1108 SHOW_RCS(actions_h_rcs)
1109 SHOW_RCS(actions_rcs)
1112 #ifdef FEATURE_CGI_EDIT_ACTIONS
1113 SHOW_RCS(cgiedit_h_rcs)
1114 SHOW_RCS(cgiedit_rcs)
1115 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
1116 SHOW_RCS(cgisimple_h_rcs)
1117 SHOW_RCS(cgisimple_rcs)
1119 SHOW_RCS(cygwin_h_rcs)
1121 SHOW_RCS(deanimate_h_rcs)
1122 SHOW_RCS(deanimate_rcs)
1123 SHOW_RCS(encode_h_rcs)
1124 SHOW_RCS(encode_rcs)
1125 SHOW_RCS(errlog_h_rcs)
1126 SHOW_RCS(errlog_rcs)
1127 SHOW_RCS(filters_h_rcs)
1128 SHOW_RCS(filters_rcs)
1129 SHOW_RCS(gateway_h_rcs)
1130 SHOW_RCS(gateway_rcs)
1132 SHOW_RCS(gnu_regex_h_rcs)
1133 SHOW_RCS(gnu_regex_rcs)
1134 #endif /* def GNU_REGEX */
1135 SHOW_RCS(jbsockets_h_rcs)
1136 SHOW_RCS(jbsockets_rcs)
1139 #ifdef FEATURE_KILL_POPUPS
1140 SHOW_RCS(killpopup_h_rcs)
1141 SHOW_RCS(killpopup_rcs)
1142 #endif /* def FEATURE_KILL_POPUPS */
1143 SHOW_RCS(list_h_rcs)
1145 SHOW_RCS(loadcfg_h_rcs)
1146 SHOW_RCS(loadcfg_rcs)
1147 SHOW_RCS(loaders_h_rcs)
1148 SHOW_RCS(loaders_rcs)
1149 SHOW_RCS(miscutil_h_rcs)
1150 SHOW_RCS(miscutil_rcs)
1151 SHOW_RCS(parsers_h_rcs)
1152 SHOW_RCS(parsers_rcs)
1154 SHOW_RCS(pcrs_h_rcs)
1155 SHOW_RCS(project_h_rcs)
1156 SHOW_RCS(ssplit_h_rcs)
1157 SHOW_RCS(ssplit_rcs)
1158 SHOW_RCS(urlmatch_h_rcs)
1159 SHOW_RCS(urlmatch_rcs)
1161 #ifndef _WIN_CONSOLE
1162 SHOW_RCS(w32log_h_rcs)
1163 SHOW_RCS(w32log_rcs)
1164 SHOW_RCS(w32res_h_rcs)
1165 SHOW_RCS(w32taskbar_h_rcs)
1166 SHOW_RCS(w32taskbar_rcs)
1167 #endif /* ndef _WIN_CONSOLE */
1168 SHOW_RCS(win32_h_rcs)
1170 #endif /* def _WIN32 */