*** suexec.c.old Sat Nov 15 03:46:11 1997 --- suexec.c Sat Nov 15 03:45:57 1997 *************** *** 63,70 **** * *********************************************************************** * * ! */ #include "suexec.h" --- 63,73 ---- * *********************************************************************** * + * Added ability for programs and parameters in suexec. *Keeps the + * security model!* - Theo Van Dinter * ! * ! * */ #include "suexec.h" *************** *** 237,246 **** char *target_uname; /* target user name */ char *target_gname; /* target group name */ char *target_homedir; /* target home directory */ ! char *actual_uname; /* actual user name */ ! char *actual_gname; /* actual group name */ char *prog; /* name of this program */ ! char *cmd; /* command to be executed */ char cwd[AP_MAXPATH]; /* current working directory */ char dwd[AP_MAXPATH]; /* docroot working directory */ struct passwd *pw; /* password entry holder */ --- 240,252 ---- char *target_uname; /* target user name */ char *target_gname; /* target group name */ char *target_homedir; /* target home directory */ ! char *actual_uname; /* actual user name */ ! char *actual_gname; /* actual group name */ char *prog; /* name of this program */ ! char *cmd; /* command to be executed */ ! char **param; /* ARGV for execv below */ ! int param_count = 1; /* ARGC count for execv */ ! char **param_tmp; /* temporary dual param pntr */ char cwd[AP_MAXPATH]; /* current working directory */ char dwd[AP_MAXPATH]; /* docroot working directory */ struct passwd *pw; /* password entry holder */ *************** *** 261,267 **** } target_uname = argv[1]; target_gname = argv[2]; ! cmd = argv[3]; /* * Check existence/validity of the UID of the user --- 267,305 ---- } target_uname = argv[1]; target_gname = argv[2]; ! ! ! /* ! * This section of code was added to support commandline parameters. ! * ! */ ! param = (char **) malloc(sizeof(char *) * 12); ! if ( param == NULL ) { /* malloc failed. */ ! log_err("malloc() call failed.\n"); ! exit(100); /* Error number? */ ! } ! ! cmd = param[0] = strtok( argv[3], " " ); ! ! do { ! if ( param_count % 10 == 0 ) /* Out of space */ ! { ! param_tmp = (char **) realloc(param, sizeof(char *) * ! (param_count+12)); ! if ( param_tmp == NULL ) /* Realloc failed */ ! { ! log_err("realloc() call failed.\n"); ! exit(100); /* What error to fail with? */ ! } ! ! if ( param_tmp != param ) { /* If we got a new addr. space, free the old one. */ ! free(param); ! param = param_tmp; ! } ! ! } ! } while ( (param[param_count++] = strtok( NULL, " " )) != NULL ); ! /* * Check existence/validity of the UID of the user *************** *** 486,492 **** /* * Execute the command, replacing our image with its own. */ ! execv(cmd, &argv[3]); /* * (I can't help myself...sorry.) --- 524,530 ---- /* * Execute the command, replacing our image with its own. */ ! execv(cmd, param); /* * (I can't help myself...sorry.)