MCPcopy Create free account
hub / github.com/OpenPrinting/cups / pipe_command

Function pipe_command

scheduler/client.c:3296–3651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3294 */
3295
3296static int /* O - Process ID */
3297pipe_command(cupsd_client_t *con, /* I - Client connection */
3298 int infile, /* I - Standard input for command */
3299 int *outfile, /* O - Standard output for command */
3300 char *command, /* I - Command to run */
3301 char *options, /* I - Options for command */
3302 int root) /* I - Run as root? */
3303{
3304 int i; /* Looping var */
3305 int pid; /* Process ID */
3306 char *commptr, /* Command string pointer */
3307 commch; /* Command string character */
3308 char *uriptr; /* URI string pointer */
3309 int fds[2]; /* Pipe FDs */
3310 int argc; /* Number of arguments */
3311 int envc; /* Number of environment variables */
3312 char argbuf[10240], /* Argument buffer */
3313 *argv[100], /* Argument strings */
3314 *envp[MAX_ENV + 20]; /* Environment variables */
3315 char auth_type[256], /* AUTH_TYPE environment variable */
3316 content_length[1024], /* CONTENT_LENGTH environment variable */
3317 content_type[1024], /* CONTENT_TYPE environment variable */
3318 http_cookie[32768], /* HTTP_COOKIE environment variable */
3319 http_referer[1024], /* HTTP_REFERER environment variable */
3320 http_user_agent[1024], /* HTTP_USER_AGENT environment variable */
3321 lang[1024], /* LANG environment variable */
3322 path_info[1024], /* PATH_INFO environment variable */
3323 remote_addr[1024], /* REMOTE_ADDR environment variable */
3324 remote_host[1024], /* REMOTE_HOST environment variable */
3325 remote_user[1024], /* REMOTE_USER environment variable */
3326 script_filename[1024], /* SCRIPT_FILENAME environment variable */
3327 script_name[1024], /* SCRIPT_NAME environment variable */
3328 server_name[1024], /* SERVER_NAME environment variable */
3329 server_port[1024]; /* SERVER_PORT environment variable */
3330 ipp_attribute_t *attr; /* attributes-natural-language attribute */
3331
3332
3333 /*
3334 * Parse a copy of the options string, which is of the form:
3335 *
3336 * argument+argument+argument
3337 * ?argument+argument+argument
3338 * param=value&param=value
3339 * ?param=value&param=value
3340 * /name?argument+argument+argument
3341 * /name?param=value&param=value
3342 *
3343 * If the string contains an "=" character after the initial name,
3344 * then we treat it as a HTTP GET form request and make a copy of
3345 * the remaining string for the environment variable.
3346 *
3347 * The string is always parsed out as command-line arguments, to
3348 * be consistent with Apache...
3349 */
3350
3351 cupsdLogClient(con, CUPSD_LOG_DEBUG2, "pipe_command: infile=%d, outfile=%p, command=\"%s\", options=\"%s\", root=%d", infile, outfile, command, options ? options : "(null)", root);
3352
3353 argv[0] = command;

Callers 1

cupsdSendCommandFunction · 0.85

Calls 15

cupsdLogClientFunction · 0.85
cupsdSetStringfFunction · 0.85
_cups_strcpyFunction · 0.85
httpGetFieldFunction · 0.85
ippFindAttributeFunction · 0.85
cupsLangGetFunction · 0.85
ippGetStringFunction · 0.85
cupsLangFreeFunction · 0.85
httpAddrStringFunction · 0.85
httpGetAddressFunction · 0.85
httpGetHostnameFunction · 0.85
cupsdLoadEnvFunction · 0.85

Tested by

no test coverage detected