version 1.1.2.5, 2010/10/18 11:13:50
|
version 1.1.2.6, 2010/10/18 11:20:37
|
Line 23 Usage()
|
Line 23 Usage()
|
"\t-v\t\tVerbose ...\n" |
"\t-v\t\tVerbose ...\n" |
"\t-c <dir>\tBefore execute chroot to dir [default=/]\n" |
"\t-c <dir>\tBefore execute chroot to dir [default=/]\n" |
"\t-u <user>\tBefore execute change user\n" |
"\t-u <user>\tBefore execute change user\n" |
|
"\t-P\t\tInfinit loop, bypass penalty timeout\n" |
"\n", compiled, compiledby, compilehost); |
"\n", compiled, compiledby, compilehost); |
} |
} |
|
|
Line 45 sigHand(int sig)
|
Line 46 sigHand(int sig)
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
char ch, szChroot[MAXPATHLEN] = "/"; | char ch, bypass = 0, szChroot[MAXPATHLEN] = "/"; |
int status = 0, ret = 1; |
int status = 0, ret = 1; |
struct sigaction sa; |
struct sigaction sa; |
struct passwd *pass = NULL; |
struct passwd *pass = NULL; |
uid_t uid = getuid(); |
uid_t uid = getuid(); |
u_int penalty = 1; |
u_int penalty = 1; |
|
|
while ((ch = getopt(argc, argv, "vhc:u:")) != -1) | while ((ch = getopt(argc, argv, "vhPc:u:")) != -1) |
switch (ch) { |
switch (ch) { |
case 'v': |
case 'v': |
Verbose++; |
Verbose++; |
break; |
break; |
|
case 'P': |
|
bypass = 1; |
|
break; |
case 'c': |
case 'c': |
if (uid) { |
if (uid) { |
printf("Error:: can`t chroot, please run as root!\n"); |
printf("Error:: can`t chroot, please run as root!\n"); |
Line 149 main(int argc, char **argv)
|
Line 153 main(int argc, char **argv)
|
} |
} |
/* penalty timeout retry */ |
/* penalty timeout retry */ |
usleep(penalty); |
usleep(penalty); |
penalty <<= 1; | if (!bypass) { |
VERB(2) printf("Info:: penalty timeout %u microseconds\n", penalty); | penalty <<= 1; |
| VERB(2) printf("Info:: penalty timeout %u microseconds\n", penalty); |
| } |
} |
} |
if (!penalty) |
if (!penalty) |
ret = 9; |
ret = 9; |