version 1.1.1.1.2.7, 2011/05/20 17:56:49
|
version 1.3, 2013/04/09 07:37:50
|
Line 72 Usage()
|
Line 72 Usage()
|
"\t-g <group>\t\t\tGroup for suID\n" |
"\t-g <group>\t\t\tGroup for suID\n" |
"\t-p <priority (-20..20)>\t\tExecute with priority\n" |
"\t-p <priority (-20..20)>\t\tExecute with priority\n" |
"\t-d <directory>\t\t\tDirectory for suID\n" |
"\t-d <directory>\t\t\tDirectory for suID\n" |
|
"\t-C <directory>\t\t\tChroot to directory\n" |
|
"\t-c <cfgfile>\t\t\tConfig file\n" |
"\t-l <logfile>\t\t\tLog file path (default:/var/log/suX.log)\n" |
"\t-l <logfile>\t\t\tLog file path (default:/var/log/suX.log)\n" |
"\t-v\t\t\t\tVerbose, (more -v, more verbosity)\n" |
"\t-v\t\t\t\tVerbose, (more -v, more verbosity)\n" |
"\t-h\t\t\t\tThis help screen!\n\n", PACKAGE_NAME); |
"\t-h\t\t\t\tThis help screen!\n\n", PACKAGE_NAME); |
Line 249 Run(char **argv)
|
Line 251 Run(char **argv)
|
} |
} |
*/ |
*/ |
|
|
Log(0, "UID:GID=%d:%d Prio=%d Class=%s Name=%s Dir=%s Cmd=%s", proc.proc_uid, proc.proc_gid, | Log(0, "UID:GID=%d:%d Prio=%d Class=%s Name=%s Dir=%s Cmd=%s Script=%s", |
proc.proc_prio, proc.proc_class, proc.proc_name, proc.proc_dir, proc.proc_cmd); | proc.proc_uid, proc.proc_gid, proc.proc_prio, proc.proc_class, |
| proc.proc_name, proc.proc_dir, proc.proc_cmd, getenv("PATH_TRANSLATED")); |
|
|
if (3 <= Verbose) { |
if (3 <= Verbose) { |
char **el = args - 1; |
char **el = args - 1; |
Line 271 Run(char **argv)
|
Line 274 Run(char **argv)
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
char ch, *str, szCfg[MAXPATHLEN], flg = 0; | char ch, *str, *wrk, szCfg[MAXPATHLEN], **pp, flg = 0; |
struct passwd *pass; |
struct passwd *pass; |
struct group *grp; |
struct group *grp; |
FILE *f; |
FILE *f; |
Line 279 main(int argc, char **argv)
|
Line 282 main(int argc, char **argv)
|
initProg(); |
initProg(); |
strlcpy(szCfg, DEFAULT_CONFIG, sizeof szCfg); |
strlcpy(szCfg, DEFAULT_CONFIG, sizeof szCfg); |
|
|
while ((ch = getopt(argc, argv, "hvc:u:g:p:d:l:")) != -1) | while ((ch = getopt(argc, argv, "hvC:c:u:g:p:d:l:")) != -1) |
switch (ch) { |
switch (ch) { |
case 'l': |
case 'l': |
f = fopen(optarg, "a"); |
f = fopen(optarg, "a"); |
Line 322 main(int argc, char **argv)
|
Line 325 main(int argc, char **argv)
|
case 'c': |
case 'c': |
strlcpy(szCfg, optarg, sizeof szCfg); |
strlcpy(szCfg, optarg, sizeof szCfg); |
break; |
break; |
|
case 'C': |
|
if (chroot(optarg) == -1) |
|
Err("Error:: chroot to dir"); |
|
if ((str = getenv("PATH_TRANSLATED"))) |
|
if ((wrk = strstr(str, optarg))) |
|
setenv("PATH_TRANSLATED", str + strlen(optarg), 42); |
|
break; |
case 'v': |
case 'v': |
Verbose++; |
Verbose++; |
break; |
break; |
Line 334 main(int argc, char **argv)
|
Line 344 main(int argc, char **argv)
|
} |
} |
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
|
|
if (2 <= Verbose) { |
|
for (pp = argv; *pp; pp++) |
|
Log(2, "Args=%s\n", *pp); |
|
for (pp = environ; *pp; pp++) |
|
Log(2, "Envs=%s\n", *pp); |
|
} |
|
|
if (!argc) { |
if (!argc) { |
if (!(str = getenv("PATH_TRANSLATED"))) { |
if (!(str = getenv("PATH_TRANSLATED"))) { |
Usage(); |
Usage(); |