MCPcopy Create free account
hub / github.com/apache/httpd / create_argv

Function create_argv

modules/generators/mod_cgid.c:234–279  ·  view source on GitHub ↗

This routine is called to create the argument list to be passed * to the CGI script. When suexec is enabled, the suexec path, user, and * group are the first three arguments to be passed; if not, all three * must be NULL. The query info is split into separate arguments, where * "+" is the separator between keyword arguments. * * Do not process the args if they containing an '=' assignment.

Source from the content-addressed store, hash-verified

232 * Do not process the args if they containing an '=' assignment.
233 */
234static char **create_argv(apr_pool_t *p, char *path, char *user, char *group,
235 char *av0, const char *args)
236{
237 int x, numwords;
238 char **av;
239 char *w;
240 int idx = 0;
241
242 if (!args || !(*args) || ap_strchr_c(args, '=')) {
243 numwords = 0;
244 }
245 else {
246 /* count the number of keywords */
247
248 for (x = 0, numwords = 1; args[x]; x++) {
249 if (args[x] == '+') {
250 ++numwords;
251 }
252 }
253 }
254
255 if (numwords > APACHE_ARG_MAX - 5) {
256 numwords = APACHE_ARG_MAX - 5; /* Truncate args to prevent overrun */
257 }
258 av = (char **) apr_pcalloc(p, (numwords + 5) * sizeof(char *));
259
260 if (path) {
261 av[idx++] = path;
262 }
263 if (user) {
264 av[idx++] = user;
265 }
266 if (group) {
267 av[idx++] = group;
268 }
269
270 av[idx++] = apr_pstrdup(p, av0);
271
272 for (x = 1; x <= numwords; x++) {
273 w = ap_getword_nulls(p, &args, '+');
274 ap_unescape_url(w);
275 av[idx++] = ap_escape_shell_cmd(p, w);
276 }
277 av[idx] = NULL;
278 return av;
279}
280
281#if APR_HAS_OTHER_CHILD
282static void cgid_maint(int reason, void *data, apr_wait_t status)

Callers 1

cgid_serverFunction · 0.85

Calls 4

ap_strchr_cFunction · 0.85
ap_getword_nullsFunction · 0.85
ap_unescape_urlFunction · 0.85
ap_escape_shell_cmdFunction · 0.85

Tested by

no test coverage detected