"Fossies" - the Fresh Open Source Software Archive 
Member "cgiwrap-4.1/cgiwrap.h" (16 Jun 2008, 3828 Bytes) of package /linux/www/old/cgiwrap-4.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /*
2 * CGIWrap is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * CGIWrap is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with CGIWrap; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * Copyright 2003-2005, Nathan Neulinger <nneul@neulinger.org>
17 *
18 */
19
20 /* rcsid: $Id: cgiwrap.h 306 2008-06-13 14:02:02Z nneul $ */
21
22 /*
23 * Quiet warning about rcsid
24 */
25 #define RCSID(msg) \
26 static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
27
28 #include "config.h" /* Generated by Configure */
29
30 #include <stdio.h> /* For passing data into called script */
31
32 #if defined(HAVE_CTYPE_H)
33 #include <ctype.h>
34 #endif
35
36 #if defined(HAVE_SYS_STAT_H)
37 #include <sys/stat.h> /* For file stating */
38 #endif
39
40 #if defined(HAVE_SIGNAL_H)
41 #include <signal.h> /* For signals stuff */
42 #endif
43
44 #if defined(HAVE_SYS_SIGNAL_H)
45 #include <sys/signal.h> /* For signals stuff */
46 #endif
47
48 #if defined(HAVE_ERRNO_H)
49 #include <errno.h> /* Error numbers for functions */
50 #endif
51
52 #if defined(HAVE_SYS_ERRNO_H)
53 #include <sys/errno.h> /* Error numbers for functions */
54 #endif
55
56 #if defined(HAVE_STDLIB_H)
57 #include <stdlib.h> /* Standard library functions */
58 #endif
59
60 #if defined(HAVE_PWD_H)
61 #include <pwd.h> /* For getting uids from username */
62 #endif
63
64 #if defined(HAVE_UNISTD_H)
65 #include <unistd.h> /* Stuff for setting uid */
66 #endif
67
68 #if defined(HAVE_SYS_TYPES_H)
69 #include <sys/types.h> /* Types for uid and stuff */
70 #endif
71
72 #if defined(HAVE_LIMITS_H)
73 #include <limits.h> /* Limit on directory length and stuff */
74 #endif
75
76 #if defined(HAVE_STRING_H) /* string routines */
77 #include <string.h>
78 #elif defined(HAVE_STRINGS_H)
79 #include <strings.h>
80 #endif
81
82 #if defined(HAVE_SYS_TIME_H)
83 #include <sys/time.h> /* Time for logging stuff */
84 #endif
85
86 #if defined(HAVE_TIME_H)
87 #include <time.h> /* Time for logging stuff */
88 #endif
89
90 #if defined(HAVE_SYS_RESOURCE_H) /* For rlimit use */
91 #include <sys/resource.h>
92 #endif
93
94 #if defined(HAVE_SYSLOG_H)
95 #include <syslog.h>
96 #endif
97
98 #if defined(HAVE_FCNTL_H)
99 #include <fcntl.h>
100 #endif
101
102 #if defined(HAVE_GRP_H)
103 #include <grp.h>
104 #endif
105
106 #if defined(HAVE_SYS_WAIT_H) && defined(CONF_REPORT_RUSAGE)
107 #include <sys/wait.h>
108 #endif
109
110 #if defined(HUGE_STRING_LEN)
111 #undef HUGE_STRING_LEN
112 #endif
113 #define HUGE_STRING_LEN 2500
114
115 /*
116 * Global context structure
117 */
118 struct cgiwrap_context
119 {
120 /* User data retrieved from password file */
121 struct passwd user;
122
123 /* Path of script relative to file system root */
124 char *scriptFullPath;
125
126 /* Path of script relative to user cgi directory */
127 char *scriptRelativePath;
128
129 /* Path info */
130 char *origPathInfo;
131 char *newPathInfo;
132
133 /* Previously opened log file */
134 FILE *logFile;
135
136 /* Is this script executing out of the multiuser cgi dir */
137 int multiuser_cgi_script;
138
139 /* Is this an interpreted script with special handling? ie php */
140 int interpreted_script;
141
142 /* Is this script executable - used for checking if we should invoke interpreter */
143 int script_is_executable;
144
145 /* The path to execute; distinct from the script path if using an
146 interpreter. */
147 char *execPath;
148
149 /* The argument array with which to call the executable. */
150 char **execArgv;
151 };
152 extern struct cgiwrap_context Context;
153
154 /*
155 * Local headers for prototypes and defines
156 */
157 #include "util.h"
158 #include "debug.h"
159 #include "fetch.h"
160 #include "stdutil.h"
161 #include "msgs.h"