~mailman-coders/mailman/2.1

1 by
This commit was manufactured by cvs2svn to create branch
1
/* cgi-wrapper.c --- Generic wrapper that will take info from a environment
2
 * variable, and pass it to two commands.
3
 *
4
 * Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
749 by tkikuchi
FSF office has moved to 51 Franklin Street.
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1 by
This commit was manufactured by cvs2svn to create branch
19
 *
20
 */
21
22
#include "common.h"
23
24
/* passed in by configure */
25
#define SCRIPTNAME  SCRIPT
26
#define LOG_IDENT   "Mailman cgi-wrapper (" SCRIPT ")"
27
28
/* Group name that CGI scripts run as.  See your web server's documentation
29
 * for details.
30
 */
31
#define LEGAL_PARENT_GROUP CGI_GROUP
32
33
const char* logident = LOG_IDENT;
34
char* script = SCRIPTNAME;
35
const char* parentgroup = LEGAL_PARENT_GROUP;
36
37
38
int
39
main(int argc, char** argv, char** env)
40
{
41
        int status;
42
        char* fake_argv[3];
43
44
        running_as_cgi = 1;
45
        check_caller(logident, parentgroup);
46
47
        /* For these CGI programs, we can ignore argc and argv since they
48
         * don't contain anything useful.  `script' will always be the driver
49
         * program and argv will always just contain the name of the real
50
         * script for the driver to import and execute (padded with two dummy
51
         * values in argv[0] and argv[1] that are ignored by run_script().
52
         */
53
        fake_argv[0] = NULL;
54
        fake_argv[1] = NULL;
55
        fake_argv[2] = script;
56
57
        status = run_script("driver", 3, fake_argv, env);
58
        fatal(logident, status, "%s", strerror(errno));
59
        return status;
60
}
61
62
63

64
/*
65
 * Local Variables:
66
 * c-file-style: "python"
67
 * End:
68
 */