Add:
[privoxy.git] / cgisimple.c
1 const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.35.2.1 2002/07/04 15:02:38 oes Exp $";
2 /*********************************************************************
3  *
4  * File        :  $Source: /cvsroot/ijbswa/current/Attic/cgisimple.c,v $
5  *
6  * Purpose     :  Simple CGIs to get information about Privoxy's
7  *                status.
8  *                
9  *                Functions declared include:
10  * 
11  *
12  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
13  *                Privoxy team. http://www.privoxy.org/
14  *
15  *                Based on the Internet Junkbuster originally written
16  *                by and Copyright (C) 1997 Anonymous Coders and 
17  *                Junkbusters Corporation.  http://www.junkbusters.com
18  *
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.
24  *
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.
30  *
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.
36  *
37  * Revisions   :
38  *    $Log: cgisimple.c,v $
39  *    Revision 1.35.2.1  2002/07/04 15:02:38  oes
40  *    Added ability to send redirects to send-banner CGI, so that it can completely mimic the image blocking action if called with type=auto
41  *
42  *    Revision 1.35.2.1  2002/07/01 17:32:04  morcego
43  *    Applying patch from Andreas as provided by Hal on the list.
44  *    Message-ID: <20020701121218.V1606@feenix.burgiss.net>
45  *
46  *    Revision 1.35  2002/05/12 21:44:44  jongfoster
47  *    Adding amiga.[ch] revision information, if on an amiga.
48  *
49  *    Revision 1.34  2002/04/30 12:06:12  oes
50  *    Deleted unused code from default_cgi
51  *
52  *    Revision 1.33  2002/04/30 11:14:52  oes
53  *    Made csp the first parameter in *action_to_html
54  *
55  *    Revision 1.32  2002/04/26 18:29:13  jongfoster
56  *    Fixing this Visual C++ warning:
57  *    cgisimple.c(775) : warning C4018: '<' : signed/unsigned mismatch
58  *
59  *    Revision 1.31  2002/04/26 12:54:36  oes
60  *     - Kill obsolete REDIRECT_URL code
61  *     - Error handling fixes
62  *     - Style sheet related HTML snipplet changes
63  *     - cgi_show_url_info:
64  *       - Matches now in table, actions on single lines,
65  *         linked to help
66  *       - standard.action suppressed
67  *       - Buttons to View and Edit AFs
68  *
69  *    Revision 1.30  2002/04/24 02:18:08  oes
70  *     - show-status is now the starting point for editing
71  *       the actions files, generate list of all AFs with buttons
72  *       for viewing and editing, new look for file list (Jon:
73  *       buttons now aligned ;-P ), view mode now supports multiple
74  *       AFs, name changes, no view links for unspecified files,
75  *       no edit link for standard.action.
76  *
77  *     - Jon's multiple AF patch: cgi_show_url_info now uses all
78  *       AFs and marks the output accordingly
79  *
80  *    Revision 1.29  2002/04/10 13:38:35  oes
81  *    load_template signature changed
82  *
83  *    Revision 1.28  2002/04/07 15:42:12  jongfoster
84  *    Fixing send-banner?type=auto when the image-blocker is
85  *    a redirect to send-banner
86  *
87  *    Revision 1.27  2002/04/05 15:50:48  oes
88  *    added send-stylesheet CGI
89  *
90  *    Revision 1.26  2002/04/04 00:36:36  gliptak
91  *    always use pcre for matching
92  *
93  *    Revision 1.25  2002/04/03 22:28:03  gliptak
94  *    Removed references to gnu_regex
95  *
96  *    Revision 1.24  2002/04/02 16:12:47  oes
97  *    Fix: moving misplaced lines into #ifdef FEATURE_FORCE
98  *
99  *    Revision 1.23  2002/03/26 22:29:54  swa
100  *    we have a new homepage!
101  *
102  *    Revision 1.22  2002/03/24 16:18:15  jongfoster
103  *    Removing old logo
104  *
105  *    Revision 1.21  2002/03/24 15:23:33  jongfoster
106  *    Name changes
107  *
108  *    Revision 1.20  2002/03/24 13:25:43  swa
109  *    name change related issues
110  *
111  *    Revision 1.19  2002/03/16 23:54:06  jongfoster
112  *    Adding graceful termination feature, to help look for memory leaks.
113  *    If you enable this (which, by design, has to be done by hand
114  *    editing config.h) and then go to http://i.j.b/die, then the program
115  *    will exit cleanly after the *next* request.  It should free all the
116  *    memory that was used.
117  *
118  *    Revision 1.18  2002/03/12 01:44:49  oes
119  *    Changed default for "blocked" image from jb logo to checkboard pattern
120  *
121  *    Revision 1.17  2002/03/08 16:43:18  oes
122  *    Added choice beween GIF and PNG built-in images
123  *
124  *    Revision 1.16  2002/03/07 03:48:38  oes
125  *     - Changed built-in images from GIF to PNG
126  *       (with regard to Unisys patent issue)
127  *     - Added a 4x4 pattern PNG which is less intrusive
128  *       than the logo but also clearly marks the deleted banners
129  *
130  *    Revision 1.15  2002/03/06 22:54:35  jongfoster
131  *    Automated function-comment nitpicking.
132  *
133  *    Revision 1.14  2002/03/02 04:14:50  david__schmidt
134  *    Clean up a little CRLF unpleasantness that suddenly appeared
135  *
136  *    Revision 1.13  2002/02/21 00:10:37  jongfoster
137  *    Adding send-banner?type=auto option
138  *
139  *    Revision 1.12  2002/01/23 01:03:32  jongfoster
140  *    Fixing gcc [CygWin] compiler warnings
141  *
142  *    Revision 1.11  2002/01/23 00:01:04  jongfoster
143  *    Adding cgi_transparent_gif() for http://i.j.b/t
144  *    Adding missing html_encode() to many CGI functions.
145  *    Adding urlmatch.[ch] to http://i.j.b/show-version
146  *
147  *    Revision 1.10  2002/01/17 21:10:37  jongfoster
148  *    Changes to cgi_show_url_info to use new matching code from urlmatch.c.
149  *    Also fixing a problem in the same function with improperly quoted URLs
150  *    in output HTML, and adding code to handle https:// URLs correctly.
151  *
152  *    Revision 1.9  2001/11/30 23:09:15  jongfoster
153  *    Now reports on FEATURE_CGI_EDIT_ACTIONS
154  *    Removing FEATURE_DENY_GZIP from template
155  *
156  *    Revision 1.8  2001/11/13 00:14:07  jongfoster
157  *    Fixing stupid bug now I've figured out what || means.
158  *    (It always returns 0 or 1, not one of it's paramaters.)
159  *
160  *    Revision 1.7  2001/10/23 21:48:19  jongfoster
161  *    Cleaning up error handling in CGI functions - they now send back
162  *    a HTML error page and should never cause a FATAL error.  (Fixes one
163  *    potential source of "denial of service" attacks).
164  *
165  *    CGI actions file editor that works and is actually useful.
166  *
167  *    Ability to toggle JunkBuster remotely using a CGI call.
168  *
169  *    You can turn off both the above features in the main configuration
170  *    file, e.g. if you are running a multi-user proxy.
171  *
172  *    Revision 1.6  2001/10/14 22:00:32  jongfoster
173  *    Adding support for a 404 error when an invalid CGI page is requested.
174  *
175  *    Revision 1.5  2001/10/07 15:30:41  oes
176  *    Removed FEATURE_DENY_GZIP
177  *
178  *    Revision 1.4  2001/10/02 15:31:12  oes
179  *    Introduced show-request cgi
180  *
181  *    Revision 1.3  2001/09/22 16:34:44  jongfoster
182  *    Removing unneeded #includes
183  *
184  *    Revision 1.2  2001/09/19 18:01:11  oes
185  *    Fixed comments; cosmetics
186  *
187  *    Revision 1.1  2001/09/16 17:08:54  jongfoster
188  *    Moving simple CGI functions from cgi.c to new file cgisimple.c
189  *
190  *
191  **********************************************************************/
192 \f
193
194 #include "config.h"
195
196 #include <stdio.h>
197 #include <sys/types.h>
198 #include <stdlib.h>
199 #include <ctype.h>
200 #include <string.h>
201 #include <assert.h>
202
203 #ifdef _WIN32
204 #define snprintf _snprintf
205 #endif /* def _WIN32 */
206
207 #include "project.h"
208 #include "cgi.h"
209 #include "cgisimple.h"
210 #include "list.h"
211 #include "encode.h"
212 #include "jcc.h"
213 #include "filters.h"
214 #include "actions.h"
215 #include "miscutil.h"
216 #include "loadcfg.h"
217 #include "parsers.h"
218 #include "urlmatch.h"
219 #include "errlog.h"
220
221 const char cgisimple_h_rcs[] = CGISIMPLE_H_VERSION;
222
223
224 static char *show_rcs(void);
225 static jb_err show_defines(struct map *exports);
226
227
228 /*********************************************************************
229  *
230  * Function    :  cgi_default
231  *
232  * Description :  CGI function that is called for the CGI_SITE_1_HOST
233  *                and CGI_SITE_2_HOST/CGI_SITE_2_PATH base URLs.
234  *                Boring - only exports the default exports.
235  *               
236  * Parameters  :
237  *          1  :  csp = Current client state (buffers, headers, etc...)
238  *          2  :  rsp = http_response data structure for output
239  *          3  :  parameters = map of cgi parameters
240  *
241  * CGI Parameters : none
242  *
243  * Returns     :  JB_ERR_OK on success
244  *                JB_ERR_MEMORY on out-of-memory
245  *
246  *********************************************************************/
247 jb_err cgi_default(struct client_state *csp,
248                    struct http_response *rsp,
249                    const struct map *parameters)
250 {
251    struct map *exports;
252
253    assert(csp);
254    assert(rsp);
255
256    if (NULL == (exports = default_exports(csp, "")))
257    {
258       return JB_ERR_MEMORY;
259    }
260
261    return template_fill_for_cgi(csp, "default", exports, rsp);
262 }
263
264
265 /*********************************************************************
266  *
267  * Function    :  cgi_error_404
268  *
269  * Description :  CGI function that is called if an unknown action was
270  *                given.
271  *               
272  * Parameters  :
273  *          1  :  csp = Current client state (buffers, headers, etc...)
274  *          2  :  rsp = http_response data structure for output
275  *          3  :  parameters = map of cgi parameters
276  *
277  * CGI Parameters : none
278  *
279  * Returns     :  JB_ERR_OK on success
280  *                JB_ERR_MEMORY on out-of-memory error.  
281  *
282  *********************************************************************/
283 jb_err cgi_error_404(struct client_state *csp,
284                      struct http_response *rsp,
285                      const struct map *parameters)
286 {
287    struct map *exports;
288
289    assert(csp);
290    assert(rsp);
291    assert(parameters);
292
293    if (NULL == (exports = default_exports(csp, NULL)))
294    {
295       return JB_ERR_MEMORY;
296    }
297
298    rsp->status = strdup("404 Privoxy configuration page not found");
299    if (rsp->status == NULL)
300    {
301       free_map(exports);
302       return JB_ERR_MEMORY;
303    }
304
305    return template_fill_for_cgi(csp, "cgi-error-404", exports, rsp);
306 }
307
308
309 #ifdef FEATURE_GRACEFUL_TERMINATION
310 /*********************************************************************
311  *
312  * Function    :  cgi_die
313  *
314  * Description :  CGI function to shut down Privoxy.
315  *                NOTE: Turning this on in a production build
316  *                would be a BAD idea.  An EXTREMELY BAD idea.
317  *                In short, don't do it.
318  *               
319  * Parameters  :
320  *          1  :  csp = Current client state (buffers, headers, etc...)
321  *          2  :  rsp = http_response data structure for output
322  *          3  :  parameters = map of cgi parameters
323  *
324  * CGI Parameters : none
325  *
326  * Returns     :  JB_ERR_OK on success
327  *                JB_ERR_MEMORY on out-of-memory error.  
328  *
329  *********************************************************************/
330 jb_err cgi_die (struct client_state *csp,
331                 struct http_response *rsp,
332                 const struct map *parameters)
333 {
334    assert(csp);
335    assert(rsp);
336    assert(parameters);
337
338    /* quit */
339    g_terminate = 1;
340
341    /*
342     * I don't really care what gets sent back to the browser.
343     * Take the easy option - "out of memory" page.
344     */
345
346    return JB_ERR_MEMORY;
347 }
348 #endif /* def FEATURE_GRACEFUL_TERMINATION */
349
350
351 /*********************************************************************
352  *
353  * Function    :  cgi_show_request
354  *
355  * Description :  Show the client's request and what sed() would have
356  *                made of it.
357  *               
358  * Parameters  :
359  *          1  :  csp = Current client state (buffers, headers, etc...)
360  *          2  :  rsp = http_response data structure for output
361  *          3  :  parameters = map of cgi parameters
362  *
363  * CGI Parameters : none
364  *
365  * Returns     :  JB_ERR_OK on success
366  *                JB_ERR_MEMORY on out-of-memory error.  
367  *
368  *********************************************************************/
369 jb_err cgi_show_request(struct client_state *csp,
370                         struct http_response *rsp,
371                         const struct map *parameters)
372 {
373    char *p;
374    struct map *exports;
375
376    assert(csp);
377    assert(rsp);
378    assert(parameters);
379
380    if (NULL == (exports = default_exports(csp, "show-request")))
381    {
382       return JB_ERR_MEMORY;
383    }
384    
385    /*
386     * Repair the damage done to the IOB by get_header()
387     */
388    for (p = csp->iob->buf; p < csp->iob->eod; p++)
389    {
390       if (*p == '\0') *p = '\n';
391    }
392
393    /*
394     * Export the original client's request and the one we would
395     * be sending to the server if this wasn't a CGI call
396     */
397
398    if (map(exports, "client-request", 1, html_encode(csp->iob->buf), 0))
399    {
400       free_map(exports);
401       return JB_ERR_MEMORY;
402    }
403
404    if (map(exports, "processed-request", 1, html_encode_and_free_original(
405       sed(client_patterns, add_client_headers, csp)), 0))
406    {
407       free_map(exports);
408       return JB_ERR_MEMORY;
409    }
410
411    return template_fill_for_cgi(csp, "show-request", exports, rsp);
412 }
413
414
415 /*********************************************************************
416  *
417  * Function    :  cgi_send_banner
418  *
419  * Description :  CGI function that returns a banner. 
420  *
421  * Parameters  :
422  *          1  :  csp = Current client state (buffers, headers, etc...)
423  *          2  :  rsp = http_response data structure for output
424  *          3  :  parameters = map of cgi parameters
425  *
426  * CGI Parameters :
427  *           type : Selects the type of banner between "trans", "logo",
428  *                  and "auto". Defaults to "logo" if absent or invalid.
429  *                  "auto" means to select as if we were image-blocking.
430  *                  (Only the first character really counts; b and t are
431  *                  equivalent).
432  *
433  * Returns     :  JB_ERR_OK on success
434  *                JB_ERR_MEMORY on out-of-memory error.  
435  *
436  *********************************************************************/
437 jb_err cgi_send_banner(struct client_state *csp,
438                        struct http_response *rsp,
439                        const struct map *parameters)
440 {
441    char imagetype = lookup(parameters, "type")[0];
442
443    /*
444     * If type is auto, then determine the right thing
445     * to do from the set-image-blocker action
446     */
447    if (imagetype == 'a') 
448    {
449       /*
450        * Default to pattern
451        */
452       imagetype = 'p';
453
454 #ifdef FEATURE_IMAGE_BLOCKING
455       if ((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0)
456       {
457          static const char prefix1[] = CGI_PREFIX "send-banner?type=";
458          static const char prefix2[] = "http://" CGI_SITE_1_HOST "/send-banner?type=";
459          const char *p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];
460
461          if (p == NULL)
462          {
463             /* Use default - nothing to do here. */
464          }
465          else if (0 == strcmpic(p, "blank"))
466          {
467             imagetype = 'b';
468          }
469          else if (0 == strcmpic(p, "pattern"))
470          {
471             imagetype = 'p';
472          }
473
474          /*
475           * If the action is to call this CGI, determine
476           * the argument:
477           */
478          else if (0 == strncmpic(p, prefix1, sizeof(prefix1) - 1))
479          {
480             imagetype = p[sizeof(prefix1) - 1];
481          }
482          else if (0 == strncmpic(p, prefix2, sizeof(prefix2) - 1))
483          {
484             imagetype = p[sizeof(prefix2) - 1];
485          }
486
487          /*
488           * Everything else must (should) be a URL to
489           * redirect to.
490           */
491          else
492          {
493             imagetype = 'r';
494          }
495       }
496 #endif /* def FEATURE_IMAGE_BLOCKING */
497    }
498       
499    /*
500     * Now imagetype is either the non-auto type we were called with,
501     * or it was auto and has since been determined. In any case, we
502     * can proceed to actually answering the request by sending a redirect
503     * or an image as appropriate:
504     */
505    if (imagetype == 'r') 
506    {
507       rsp->status = strdup("302 Local Redirect from Privoxy");
508       if (rsp->status == NULL)
509       {
510          return JB_ERR_MEMORY;
511       }
512       if (enlist_unique_header(rsp->headers, "Location",
513                                csp->action->string[ACTION_STRING_IMAGE_BLOCKER]))
514       {
515          return JB_ERR_MEMORY;
516       }
517    }
518    else
519    {
520       if ((imagetype == 'b') || (imagetype == 't')) 
521       {
522          rsp->body = bindup(image_blank_data, image_blank_length);
523          rsp->content_length = image_blank_length;
524       }
525       else
526       {
527          rsp->body = bindup(image_pattern_data, image_pattern_length);
528          rsp->content_length = image_pattern_length;
529       }
530
531       if (rsp->body == NULL)
532       {
533          return JB_ERR_MEMORY;
534       }
535       if (enlist(rsp->headers, "Content-Type: " BUILTIN_IMAGE_MIMETYPE))
536       {
537          return JB_ERR_MEMORY;
538       }
539
540       rsp->is_static = 1;
541    }
542
543    return JB_ERR_OK;
544
545 }
546
547
548 /*********************************************************************
549  *
550  * Function    :  cgi_transparent_image
551  *
552  * Description :  CGI function that sends a 1x1 transparent image.
553  *
554  * Parameters  :
555  *          1  :  csp = Current client state (buffers, headers, etc...)
556  *          2  :  rsp = http_response data structure for output
557  *          3  :  parameters = map of cgi parameters
558  *
559  * CGI Parameters : None
560  *
561  * Returns     :  JB_ERR_OK on success
562  *                JB_ERR_MEMORY on out-of-memory error.  
563  *
564  *********************************************************************/
565 jb_err cgi_transparent_image(struct client_state *csp,
566                              struct http_response *rsp,
567                              const struct map *parameters)
568 {
569    rsp->body = bindup(image_blank_data, image_blank_length);
570    rsp->content_length = image_blank_length;
571
572    if (rsp->body == NULL)
573    {
574       return JB_ERR_MEMORY;
575    }
576
577    if (enlist(rsp->headers, "Content-Type: " BUILTIN_IMAGE_MIMETYPE))
578    {
579       return JB_ERR_MEMORY;
580    }
581
582    rsp->is_static = 1;
583
584    return JB_ERR_OK;
585
586 }
587
588
589 /*********************************************************************
590  *
591  * Function    :  cgi_send_stylesheet
592  *
593  * Description :  CGI function that sends a css stylesheet found
594  *                in the cgi-style.css template
595  *
596  * Parameters  :
597  *          1  :  csp = Current client state (buffers, headers, etc...)
598  *          2  :  rsp = http_response data structure for output
599  *          3  :  parameters = map of cgi parameters
600  *
601  * CGI Parameters : None
602  *
603  * Returns     :  JB_ERR_OK on success
604  *                JB_ERR_MEMORY on out-of-memory error.  
605  *
606  *********************************************************************/
607 jb_err cgi_send_stylesheet(struct client_state *csp,
608                            struct http_response *rsp,
609                            const struct map *parameters)
610 {
611    jb_err err;
612    
613    assert(csp);
614    assert(rsp);
615
616    err = template_load(csp, &rsp->body, "cgi-style.css", 0);
617
618    if (err == JB_ERR_FILE)
619    {
620       /*
621        * No way to tell user; send empty stylesheet
622        */
623       log_error(LOG_LEVEL_ERROR, "Could not find cgi-style.css template");
624    }
625    else if (err)
626    {
627       return err; /* JB_ERR_MEMORY */
628    }
629
630    if (enlist(rsp->headers, "Content-Type: text/css"))
631    {
632       return JB_ERR_MEMORY;
633    }
634
635    return JB_ERR_OK;
636
637 }
638
639
640 /*********************************************************************
641  *
642  * Function    :  cgi_show_version
643  *
644  * Description :  CGI function that returns a a web page describing the
645  *                file versions of Privoxy.
646  *
647  * Parameters  :
648  *          1  :  csp = Current client state (buffers, headers, etc...)
649  *          2  :  rsp = http_response data structure for output
650  *          3  :  parameters = map of cgi parameters
651  *
652  * CGI Parameters : none
653  *
654  * Returns     :  JB_ERR_OK on success
655  *                JB_ERR_MEMORY on out-of-memory error.  
656  *
657  *********************************************************************/
658 jb_err cgi_show_version(struct client_state *csp,
659                         struct http_response *rsp,
660                         const struct map *parameters)
661 {
662    struct map *exports;
663
664    assert(csp);
665    assert(rsp);
666    assert(parameters);
667
668    if (NULL == (exports = default_exports(csp, "show-version")))
669    {
670       return JB_ERR_MEMORY;
671    }
672
673    if (map(exports, "sourceversions", 1, show_rcs(), 0))
674    {
675       free_map(exports);
676       return JB_ERR_MEMORY;
677    }
678
679    return template_fill_for_cgi(csp, "show-version", exports, rsp);
680 }
681
682  
683 /*********************************************************************
684  *
685  * Function    :  cgi_show_status
686  *
687  * Description :  CGI function that returns a a web page describing the
688  *                current status of Privoxy.
689  *
690  * Parameters  :
691  *          1  :  csp = Current client state (buffers, headers, etc...)
692  *          2  :  rsp = http_response data structure for output
693  *          3  :  parameters = map of cgi parameters
694  *
695  * CGI Parameters :
696  *        file :  Which file to show.  Only first letter is checked,
697  *                valid values are:
698  *                - "p"ermissions (actions) file
699  *                - "r"egex
700  *                - "t"rust
701  *                Default is to show menu and other information.
702  *
703  * Returns     :  JB_ERR_OK on success
704  *                JB_ERR_MEMORY on out-of-memory error.  
705  *
706  *********************************************************************/
707 jb_err cgi_show_status(struct client_state *csp,
708                        struct http_response *rsp,
709                        const struct map *parameters)
710 {
711    char *s = NULL;
712    unsigned i;
713    int j;
714
715    FILE * fp;
716    char buf[BUFFER_SIZE];
717    const char * filename = NULL;
718    char * file_description = NULL;
719 #ifdef FEATURE_STATISTICS
720    float perc_rej;   /* Percentage of http requests rejected */
721    int local_urls_read;
722    int local_urls_rejected;
723 #endif /* ndef FEATURE_STATISTICS */
724    struct file_list * fl;
725    struct url_actions * b;
726    jb_err err = JB_ERR_OK;
727
728    struct map *exports;
729
730    assert(csp);
731    assert(rsp);
732    assert(parameters);
733
734    if (NULL == (exports = default_exports(csp, "show-status")))
735    {
736       return JB_ERR_MEMORY;
737    }
738
739    switch (*(lookup(parameters, "file")))
740    {
741    case 'a':
742       if (!get_number_param(csp, parameters, "index", &i) && i < MAX_ACTION_FILES && csp->actions_list[i])
743       {
744          filename = csp->actions_list[i]->filename;
745          file_description = "Actions File";
746       }
747       break;
748
749    case 'f':
750       if (csp->rlist)
751       {
752          filename = csp->rlist->filename;
753          file_description = "Filter File";
754       }
755       break;
756
757 #ifdef FEATURE_TRUST
758    case 't':
759       if (csp->tlist)
760       {
761          filename = csp->tlist->filename;
762          file_description = "Trust File";
763       }
764       break;
765 #endif /* def FEATURE_TRUST */
766    }
767
768    if (NULL != filename)
769    {
770       if ( map(exports, "file-description", 1, file_description, 1)
771         || map(exports, "filepath", 1, html_encode(filename), 0) )
772       {
773          free_map(exports);
774          return JB_ERR_MEMORY;
775       }
776
777       if ((fp = fopen(filename, "r")) == NULL)
778       {
779          if (map(exports, "content", 1, "<h1>ERROR OPENING FILE!</h1>", 1))
780          {
781             free_map(exports);
782             return JB_ERR_MEMORY;
783          }
784       }
785       else
786       {
787          s = strdup("");
788          while ((s != NULL) && fgets(buf, sizeof(buf), fp))
789          {
790             string_join  (&s, html_encode(buf));
791          }
792          fclose(fp);
793
794          if (map(exports, "contents", 1, s, 0))
795          {
796             free_map(exports);
797             return JB_ERR_MEMORY;
798          }
799       }
800
801       return template_fill_for_cgi(csp, "show-status-file", exports, rsp);
802    }
803
804    s = strdup("");
805    for (j = 0; (s != NULL) && (j < Argc); j++)
806    {
807       if (!err) err = string_join  (&s, html_encode(Argv[j]));
808       if (!err) err = string_append(&s, " ");
809    }
810    if (!err) err = map(exports, "invocation", 1, s, 0);
811
812    if (!err) err = map(exports, "options", 1, csp->config->proxy_args, 1);
813    if (!err) err = show_defines(exports);
814
815    if (err) 
816    {
817       free_map(exports);
818       return JB_ERR_MEMORY;
819    }
820
821 #ifdef FEATURE_STATISTICS
822    local_urls_read     = urls_read;
823    local_urls_rejected = urls_rejected;
824
825    /*
826     * Need to alter the stats not to include the fetch of this
827     * page.
828     *
829     * Can't do following thread safely! doh!
830     *
831     * urls_read--;
832     * urls_rejected--; * This will be incremented subsequently *
833     */
834
835    if (local_urls_read == 0)
836    {
837       if (!err) err = map_block_killer(exports, "have-stats");
838    }
839    else
840    {
841       if (!err) err = map_block_killer(exports, "have-no-stats");
842
843       perc_rej = (float)local_urls_rejected * 100.0F /
844             (float)local_urls_read;
845
846       sprintf(buf, "%d", local_urls_read);
847       if (!err) err = map(exports, "requests-received", 1, buf, 1);
848
849       sprintf(buf, "%d", local_urls_rejected);
850       if (!err) err = map(exports, "requests-blocked", 1, buf, 1);
851
852       sprintf(buf, "%6.2f", perc_rej);
853       if (!err) err = map(exports, "percent-blocked", 1, buf, 1);
854    }
855
856 #else /* ndef FEATURE_STATISTICS */
857    err = err || map_block_killer(exports, "statistics");
858 #endif /* ndef FEATURE_STATISTICS */
859    
860    /* 
861     * List all action files in use, together with view and edit links,
862     * except for standard.action, which should only be viewable. (Not
863     * enforced in the editor itself)
864     * FIXME: Shouldn't include hardwired HTML here, use line template instead!
865     */
866    s = strdup("");
867    for (i = 0; i < MAX_ACTION_FILES; i++)
868    {
869       if (((fl = csp->actions_list[i]) != NULL) && ((b = fl->f) != NULL))
870       {
871          if (!err) err = string_append(&s, "<tr><td>");
872          if (!err) err = string_join(&s, html_encode(csp->actions_list[i]->filename));
873          snprintf(buf, 100, "</td><td class=\"buttons\"><a href=\"/show-status?file=actions&index=%d\">View</a> ", i);
874          if (!err) err = string_append(&s, buf);
875
876 #ifdef FEATURE_CGI_EDIT_ACTIONS
877          if (NULL == strstr(csp->actions_list[i]->filename, "standard.action") && NULL != csp->config->actions_file_short[i])
878          {
879             snprintf(buf, 100, "<a href=\"/edit-actions-list?f=%s\">Edit</a>", csp->config->actions_file_short[i]);
880             if (!err) err = string_append(&s, buf);
881          }
882 #endif
883
884          if (!err) err = string_append(&s, "</td></tr>\n");
885       }
886    }
887    if (*s != '\0')   
888    {
889       if (!err) err = map(exports, "actions-filenames", 1, s, 0);
890    }
891    else
892    {
893       if (!err) err = map(exports, "actions-filenames", 1, "<tr><td>None specified</td></tr>", 1);
894    }
895
896    if (csp->rlist)
897    {
898       if (!err) err = map(exports, "re-filter-filename", 1, html_encode(csp->rlist->filename), 0);
899    }
900    else
901    {
902       if (!err) err = map(exports, "re-filter-filename", 1, "None specified", 1);
903       if (!err) err = map_block_killer(exports, "have-filterfile");
904    }
905
906 #ifdef FEATURE_TRUST
907    if (csp->tlist)
908    {
909       if (!err) err = map(exports, "trust-filename", 1, html_encode(csp->tlist->filename), 0);
910    }
911    else
912    {
913       if (!err) err = map(exports, "trust-filename", 1, "None specified", 1);
914       if (!err) err = map_block_killer(exports, "have-trustfile");
915    }
916 #else
917    if (!err) err = map_block_killer(exports, "trust-support");
918 #endif /* ndef FEATURE_TRUST */
919
920    if (err)
921    {
922       free_map(exports);
923       return JB_ERR_MEMORY;
924    }
925
926    return template_fill_for_cgi(csp, "show-status", exports, rsp);
927 }
928
929  
930 /*********************************************************************
931  *
932  * Function    :  cgi_show_url_info
933  *
934  * Description :  CGI function that determines and shows which actions
935  *                Privoxy will perform for a given url, and which
936  *                matches starting from the defaults have lead to that.
937  *
938  * Parameters  :
939  *          1  :  csp = Current client state (buffers, headers, etc...)
940  *          2  :  rsp = http_response data structure for output
941  *          3  :  parameters = map of cgi parameters
942  *
943  * CGI Parameters :
944  *            url : The url whose actions are to be determined.
945  *                  If url is unset, the url-given conditional will be
946  *                  set, so that all but the form can be suppressed in
947  *                  the template.
948  *
949  * Returns     :  JB_ERR_OK on success
950  *                JB_ERR_MEMORY on out-of-memory error.  
951  *
952  *********************************************************************/
953 jb_err cgi_show_url_info(struct client_state *csp,
954                          struct http_response *rsp,
955                          const struct map *parameters)
956 {
957    char *url_param;
958    struct map *exports;
959    char buf[150];
960
961    assert(csp);
962    assert(rsp);
963    assert(parameters);
964
965    if (NULL == (exports = default_exports(csp, "show-url-info")))
966    {
967       return JB_ERR_MEMORY;
968    }
969
970    /*
971     * Get the url= parameter (if present) and remove any leading/trailing spaces.
972     */
973    url_param = strdup(lookup(parameters, "url"));
974    if (url_param == NULL)
975    {
976       free_map(exports);
977       return JB_ERR_MEMORY;
978    }
979    chomp(url_param);
980
981    /*
982     * Handle prefixes.  4 possibilities:
983     * 1) "http://" or "https://" prefix present and followed by URL - OK
984     * 2) Only the "http://" or "https://" part is present, no URL - change
985     *    to empty string so it will be detected later as "no URL".
986     * 3) Parameter specified but doesn't contain "http(s?)://" - add a
987     *    "http://" prefix.
988     * 4) Parameter not specified or is empty string - let this fall through
989     *    for now, next block of code will handle it.
990     */
991    if (0 == strncmp(url_param, "http://", 7))
992    {
993       if (url_param[7] == '\0')
994       {
995          /*
996           * Empty URL (just prefix).
997           * Make it totally empty so it's caught by the next if()
998           */
999          url_param[0] = '\0';
1000       }
1001    }
1002    else if (0 == strncmp(url_param, "https://", 8))
1003    {
1004       if (url_param[8] == '\0')
1005       {
1006          /*
1007           * Empty URL (just prefix).
1008           * Make it totally empty so it's caught by the next if()
1009           */
1010          url_param[0] = '\0';
1011       }
1012    }
1013    else if (url_param[0] != '\0')
1014    {
1015       /*
1016        * Unknown prefix - assume http://
1017        */
1018       char * url_param_prefixed = malloc(7 + 1 + strlen(url_param));
1019       if (NULL == url_param_prefixed)
1020       {
1021          free(url_param);
1022          free_map(exports);
1023          return JB_ERR_MEMORY;
1024       }
1025       strcpy(url_param_prefixed, "http://");
1026       strcpy(url_param_prefixed + 7, url_param);
1027       free(url_param);
1028       url_param = url_param_prefixed;
1029    }
1030
1031
1032    if (url_param[0] == '\0')
1033    {
1034       /* URL paramater not specified, display query form only. */
1035       free(url_param);
1036       if (map_block_killer(exports, "url-given")
1037         || map(exports, "url", 1, "", 1))
1038       {
1039          free_map(exports);
1040          return JB_ERR_MEMORY;
1041       }
1042    }
1043    else
1044    {
1045       /* Given a URL, so query it. */
1046       jb_err err;
1047       char *matches;
1048       char *s;
1049       int hits = 0;
1050       struct file_list *fl;
1051       struct url_actions *b;
1052       struct http_request url_to_query[1];
1053       struct current_action_spec action[1];
1054       int i;
1055       
1056       if (map(exports, "url", 1, html_encode(url_param), 0))
1057       {
1058          free(url_param);
1059          free_map(exports);
1060          return JB_ERR_MEMORY;
1061       }
1062
1063       init_current_action(action);
1064
1065       if (map(exports, "default", 1, current_action_to_html(csp, action), 0))
1066       {
1067          free_current_action(action);
1068          free(url_param);
1069          free_map(exports);
1070          return JB_ERR_MEMORY;
1071       }
1072
1073       err = parse_http_url(url_param, url_to_query, csp);
1074
1075       free(url_param);
1076
1077       if (err == JB_ERR_MEMORY)
1078       {
1079          free_current_action(action);
1080          free_map(exports);
1081          return JB_ERR_MEMORY;
1082       }
1083       else if (err)
1084       {
1085          /* Invalid URL */
1086
1087          err = map(exports, "matches", 1, "<b>[Invalid URL specified!]</b>" , 1);
1088          if (!err) err = map(exports, "final", 1, lookup(exports, "default"), 1);
1089
1090          free_current_action(action);
1091
1092          if (err)
1093          {
1094             free_map(exports);
1095             return JB_ERR_MEMORY;
1096          }
1097
1098          return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
1099       }
1100
1101       /*
1102        * We have a warning about SSL paths.  Hide it for insecure sites.
1103        */
1104       if (!url_to_query->ssl)
1105       {
1106          if (map_block_killer(exports, "https"))
1107          {
1108             free_current_action(action);
1109             free_map(exports);
1110             return JB_ERR_MEMORY;
1111          }
1112       }
1113
1114       matches = strdup("<table class=\"transparent\">");
1115
1116       for (i = 0; i < MAX_ACTION_FILES; i++)
1117       {
1118          if (NULL == csp->config->actions_file_short[i]
1119              || !strcmp(csp->config->actions_file_short[i], "standard")) continue;
1120
1121          b = NULL;
1122          hits = 1;
1123          if ((fl = csp->actions_list[i]) != NULL)
1124          {
1125             if ((b = fl->f) != NULL)
1126             {
1127                /* FIXME: Hardcoded HTML! */
1128                string_append(&matches, "<tr><th>In file: ");
1129                string_join  (&matches, html_encode(csp->config->actions_file_short[i]));
1130                snprintf(buf, 150, ".action <a class=\"cmd\" href=\"/show-status?file=actions&index=%d\">", i);
1131                string_append(&matches, buf);
1132                string_append(&matches, "View</a> <a class=\"cmd\" href=\"/edit-actions-list?f=");
1133                string_join  (&matches, html_encode(csp->config->actions_file_short[i]));
1134                string_append(&matches, "\">Edit</a></th></tr>\n");
1135
1136                hits = 0;
1137                b = b->next;
1138             }
1139          }
1140
1141          for (; (b != NULL) && (matches != NULL); b = b->next)
1142          {
1143             if (url_match(b->url, url_to_query))
1144             {
1145                string_append(&matches, "<tr><td>{");
1146                string_join  (&matches, actions_to_html(csp, b->action));
1147                string_append(&matches, " }</b><br>\n<code>");
1148                string_join  (&matches, html_encode(b->url->spec));
1149                string_append(&matches, "</code></td></tr>\n");
1150
1151                if (merge_current_action(action, b->action))
1152                {
1153                   freez(matches);
1154                   free_http_request(url_to_query);
1155                   free_current_action(action);
1156                   free_map(exports);
1157                   return JB_ERR_MEMORY;
1158                }
1159                hits++;
1160             }
1161          }
1162
1163          if (!hits)
1164          {
1165             string_append(&matches, "<tr><td>(no matches in this file)</td></tr>\n");
1166          }
1167       }
1168       string_append(&matches, "</table>\n");
1169
1170       free_http_request(url_to_query);
1171
1172       if (matches == NULL)
1173       {
1174          free_current_action(action);
1175          free_map(exports);
1176          return JB_ERR_MEMORY;
1177       }
1178
1179       if (map(exports, "matches", 1, matches , 0))
1180       {
1181          free_current_action(action);
1182          free_map(exports);
1183          return JB_ERR_MEMORY;
1184       }
1185
1186       s = current_action_to_html(csp, action);
1187
1188       free_current_action(action);
1189
1190       if (map(exports, "final", 1, s, 0))
1191       {
1192          free_map(exports);
1193          return JB_ERR_MEMORY;
1194       }
1195    }
1196
1197    return template_fill_for_cgi(csp, "show-url-info", exports, rsp);
1198 }
1199
1200
1201 /*********************************************************************
1202  *
1203  * Function    :  cgi_robots_txt
1204  *
1205  * Description :  CGI function to return "/robots.txt".
1206  *
1207  * Parameters  :
1208  *          1  :  csp = Current client state (buffers, headers, etc...)
1209  *          2  :  rsp = http_response data structure for output
1210  *          3  :  parameters = map of cgi parameters
1211  *
1212  * CGI Parameters : None
1213  *
1214  * Returns     :  JB_ERR_OK on success
1215  *                JB_ERR_MEMORY on out-of-memory error.  
1216  *
1217  *********************************************************************/
1218 jb_err cgi_robots_txt(struct client_state *csp,
1219                       struct http_response *rsp,
1220                       const struct map *parameters)
1221 {
1222    char buf[100];
1223    jb_err err;
1224
1225    rsp->body = strdup(
1226       "# This is the Privoxy control interface.\n"
1227       "# It isn't very useful to index it, and you're likely to break stuff.\n"
1228       "# So go away!\n"
1229       "\n"
1230       "User-agent: *\n"
1231       "Disallow: /\n"
1232       "\n");
1233    if (rsp->body == NULL)
1234    {
1235       return JB_ERR_MEMORY;
1236    }
1237
1238    err = enlist_unique(rsp->headers, "Content-Type: text/plain", 13);
1239
1240    rsp->is_static = 1;
1241
1242    get_http_time(7 * 24 * 60 * 60, buf); /* 7 days into future */
1243    if (!err) err = enlist_unique_header(rsp->headers, "Expires", buf);
1244
1245    return (err ? JB_ERR_MEMORY : JB_ERR_OK);
1246 }
1247
1248
1249 /*********************************************************************
1250  *
1251  * Function    :  show_defines
1252  *
1253  * Description :  Add to a map the state od all conditional #defines
1254  *                used when building
1255  *
1256  * Parameters  :
1257  *          1  :  exports = map to extend
1258  *
1259  * Returns     :  JB_ERR_OK on success
1260  *                JB_ERR_MEMORY on out-of-memory error.  
1261  *
1262  *********************************************************************/
1263 static jb_err show_defines(struct map *exports)
1264 {
1265    jb_err err = JB_ERR_OK;
1266
1267 #ifdef FEATURE_ACL
1268    if (!err) err = map_conditional(exports, "FEATURE_ACL", 1);
1269 #else /* ifndef FEATURE_ACL */
1270    if (!err) err = map_conditional(exports, "FEATURE_ACL", 0);
1271 #endif /* ndef FEATURE_ACL */
1272
1273 #ifdef FEATURE_CGI_EDIT_ACTIONS
1274    if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 1);
1275 #else /* ifndef FEATURE_COOKIE_JAR */
1276    if (!err) err = map_conditional(exports, "FEATURE_CGI_EDIT_ACTIONS", 0);
1277 #endif /* ndef FEATURE_COOKIE_JAR */
1278
1279 #ifdef FEATURE_COOKIE_JAR
1280    if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 1);
1281 #else /* ifndef FEATURE_COOKIE_JAR */
1282    if (!err) err = map_conditional(exports, "FEATURE_COOKIE_JAR", 0);
1283 #endif /* ndef FEATURE_COOKIE_JAR */
1284
1285 #ifdef FEATURE_FAST_REDIRECTS
1286    if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 1);
1287 #else /* ifndef FEATURE_FAST_REDIRECTS */
1288    if (!err) err = map_conditional(exports, "FEATURE_FAST_REDIRECTS", 0);
1289 #endif /* ndef FEATURE_FAST_REDIRECTS */
1290
1291 #ifdef FEATURE_FORCE_LOAD
1292    if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 1);
1293    if (!err) err = map(exports, "FORCE_PREFIX", 1, FORCE_PREFIX, 1);
1294 #else /* ifndef FEATURE_FORCE_LOAD */
1295    if (!err) err = map_conditional(exports, "FEATURE_FORCE_LOAD", 0);
1296    if (!err) err = map(exports, "FORCE_PREFIX", 1, "(none - disabled)", 1);
1297 #endif /* ndef FEATURE_FORCE_LOAD */
1298
1299 #ifdef FEATURE_IMAGE_BLOCKING
1300    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 1);
1301 #else /* ifndef FEATURE_IMAGE_BLOCKING */
1302    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_BLOCKING", 0);
1303 #endif /* ndef FEATURE_IMAGE_BLOCKING */
1304
1305 #ifdef FEATURE_IMAGE_DETECT_MSIE
1306    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 1);
1307 #else /* ifndef FEATURE_IMAGE_DETECT_MSIE */
1308    if (!err) err = map_conditional(exports, "FEATURE_IMAGE_DETECT_MSIE", 0);
1309 #endif /* ndef FEATURE_IMAGE_DETECT_MSIE */
1310
1311 #ifdef FEATURE_KILL_POPUPS
1312    if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 1);
1313 #else /* ifndef FEATURE_KILL_POPUPS */
1314    if (!err) err = map_conditional(exports, "FEATURE_KILL_POPUPS", 0);
1315 #endif /* ndef FEATURE_KILL_POPUPS */
1316
1317 #ifdef FEATURE_NO_GIFS
1318    if (!err) err = map_conditional(exports, "FEATURE_NO_GIFS", 1);
1319 #else /* ifndef FEATURE_NO_GIFS */
1320    if (!err) err = map_conditional(exports, "FEATURE_NO_GIFS", 0);
1321 #endif /* ndef FEATURE_NO_GIFS */
1322
1323 #ifdef FEATURE_PTHREAD
1324    if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 1);
1325 #else /* ifndef FEATURE_PTHREAD */
1326    if (!err) err = map_conditional(exports, "FEATURE_PTHREAD", 0);
1327 #endif /* ndef FEATURE_PTHREAD */
1328
1329 #ifdef FEATURE_STATISTICS
1330    if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 1);
1331 #else /* ifndef FEATURE_STATISTICS */
1332    if (!err) err = map_conditional(exports, "FEATURE_STATISTICS", 0);
1333 #endif /* ndef FEATURE_STATISTICS */
1334
1335 #ifdef FEATURE_TOGGLE
1336    if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 1);
1337 #else /* ifndef FEATURE_TOGGLE */
1338    if (!err) err = map_conditional(exports, "FEATURE_TOGGLE", 0);
1339 #endif /* ndef FEATURE_TOGGLE */
1340
1341 #ifdef FEATURE_TRUST
1342    if (!err) err = map_conditional(exports, "FEATURE_TRUST", 1);
1343 #else /* ifndef FEATURE_TRUST */
1344    if (!err) err = map_conditional(exports, "FEATURE_TRUST", 0);
1345 #endif /* ndef FEATURE_TRUST */
1346
1347 #ifdef STATIC_PCRE
1348    if (!err) err = map_conditional(exports, "STATIC_PCRE", 1);
1349 #else /* ifndef STATIC_PCRE */
1350    if (!err) err = map_conditional(exports, "STATIC_PCRE", 0);
1351 #endif /* ndef STATIC_PCRE */
1352
1353 #ifdef STATIC_PCRS
1354    if (!err) err = map_conditional(exports, "STATIC_PCRS", 1);
1355 #else /* ifndef STATIC_PCRS */
1356    if (!err) err = map_conditional(exports, "STATIC_PCRS", 0);
1357 #endif /* ndef STATIC_PCRS */
1358
1359    return err;
1360 }
1361
1362
1363 /*********************************************************************
1364  *
1365  * Function    :  show_rcs
1366  *
1367  * Description :  Create a string with the rcs info for all sourcefiles
1368  *
1369  * Parameters  :  None
1370  *
1371  * Returns     :  A string, or NULL on out-of-memory.
1372  *
1373  *********************************************************************/
1374 static char *show_rcs(void)
1375 {
1376    char *result = strdup("");
1377    char buf[BUFFER_SIZE];
1378
1379    /* Instead of including *all* dot h's in the project (thus creating a
1380     * tremendous amount of dependencies), I will concede to declaring them
1381     * as extern's.  This forces the developer to add to this list, but oh well.
1382     */
1383
1384 #define SHOW_RCS(__x)              \
1385    {                               \
1386       extern const char __x[];     \
1387       sprintf(buf, "%s\n", __x);   \
1388       string_append(&result, buf); \
1389    }
1390
1391    /* In alphabetical order */
1392    SHOW_RCS(actions_h_rcs)
1393    SHOW_RCS(actions_rcs)
1394 #ifdef AMIGA
1395    SHOW_RCS(amiga_h_rcs)
1396    SHOW_RCS(amiga_rcs)
1397 #endif /* def AMIGA */
1398    SHOW_RCS(cgi_h_rcs)
1399    SHOW_RCS(cgi_rcs)
1400 #ifdef FEATURE_CGI_EDIT_ACTIONS
1401    SHOW_RCS(cgiedit_h_rcs)
1402    SHOW_RCS(cgiedit_rcs)
1403 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
1404    SHOW_RCS(cgisimple_h_rcs)
1405    SHOW_RCS(cgisimple_rcs)
1406 #ifdef __MINGW32__
1407    SHOW_RCS(cygwin_h_rcs)
1408 #endif
1409    SHOW_RCS(deanimate_h_rcs)
1410    SHOW_RCS(deanimate_rcs)
1411    SHOW_RCS(encode_h_rcs)
1412    SHOW_RCS(encode_rcs)
1413    SHOW_RCS(errlog_h_rcs)
1414    SHOW_RCS(errlog_rcs)
1415    SHOW_RCS(filters_h_rcs)
1416    SHOW_RCS(filters_rcs)
1417    SHOW_RCS(gateway_h_rcs)
1418    SHOW_RCS(gateway_rcs)
1419    SHOW_RCS(jbsockets_h_rcs)
1420    SHOW_RCS(jbsockets_rcs)
1421    SHOW_RCS(jcc_h_rcs)
1422    SHOW_RCS(jcc_rcs)
1423 #ifdef FEATURE_KILL_POPUPS
1424    SHOW_RCS(killpopup_h_rcs)
1425    SHOW_RCS(killpopup_rcs)
1426 #endif /* def FEATURE_KILL_POPUPS */
1427    SHOW_RCS(list_h_rcs)
1428    SHOW_RCS(list_rcs)
1429    SHOW_RCS(loadcfg_h_rcs)
1430    SHOW_RCS(loadcfg_rcs)
1431    SHOW_RCS(loaders_h_rcs)
1432    SHOW_RCS(loaders_rcs)
1433    SHOW_RCS(miscutil_h_rcs)
1434    SHOW_RCS(miscutil_rcs)
1435    SHOW_RCS(parsers_h_rcs)
1436    SHOW_RCS(parsers_rcs)
1437    SHOW_RCS(pcrs_rcs)
1438    SHOW_RCS(pcrs_h_rcs)
1439    SHOW_RCS(project_h_rcs)
1440    SHOW_RCS(ssplit_h_rcs)
1441    SHOW_RCS(ssplit_rcs)
1442    SHOW_RCS(urlmatch_h_rcs)
1443    SHOW_RCS(urlmatch_rcs)
1444 #ifdef _WIN32
1445 #ifndef _WIN_CONSOLE
1446    SHOW_RCS(w32log_h_rcs)
1447    SHOW_RCS(w32log_rcs)
1448    SHOW_RCS(w32res_h_rcs)
1449    SHOW_RCS(w32taskbar_h_rcs)
1450    SHOW_RCS(w32taskbar_rcs)
1451 #endif /* ndef _WIN_CONSOLE */
1452    SHOW_RCS(win32_h_rcs)
1453    SHOW_RCS(win32_rcs)
1454 #endif /* def _WIN32 */
1455
1456 #undef SHOW_RCS
1457
1458    return result;
1459
1460 }
1461
1462
1463 /*
1464   Local Variables:
1465   tab-width: 3
1466   end:
1467 */