|
|
| version 1.5.20.7, 2018/01/01 23:52:54 | version 1.5.20.9, 2018/01/02 02:02:16 |
|---|---|
| Line 61 Usage() | Line 61 Usage() |
| "=== %s === %s@%s ===\n\n" | "=== %s === %s@%s ===\n\n" |
| " Syntax: cfexec [options] [exec_file]\n\n" | " Syntax: cfexec [options] [exec_file]\n\n" |
| "\t-v\t\tVerbose ...\n" | "\t-v\t\tVerbose ...\n" |
| "\t-C <config>\tLoad config [default=/etc/cfexec.conf]\n" | |
| "\t-c <dir>\tAfter execute chroot to dir [default=/]\n" | "\t-c <dir>\tAfter execute chroot to dir [default=/]\n" |
| "\t-u <user>\tAfter execute suid to user [default=root]\n" | "\t-u <user>\tAfter execute suid to user [default=root]\n" |
| "\t-m <mnt>\tOther mount dir [default=/]\n" | "\t-m <mnt>\tOther mount dir [default=/]\n" |
| Line 168 cleanexit() | Line 169 cleanexit() |
| AIT_FREE_VAL(&User); | AIT_FREE_VAL(&User); |
| AIT_FREE_VAL(&Mount); | AIT_FREE_VAL(&Mount); |
| AIT_FREE_VAL(&Chroot); | AIT_FREE_VAL(&Chroot); |
| cfgUnloadConfig(&cfg); | |
| } | } |
| static int | static int |
| Line 258 main(int argc, char **argv) | Line 257 main(int argc, char **argv) |
| atexit(cleanexit); | atexit(cleanexit); |
| /* Load variables from arguments if exists */ | /* Load variables from arguments if exists */ |
| while ((ch = getopt(argc, argv, "hvUu:c:m:t:L:")) != -1) | while ((ch = getopt(argc, argv, "hvUC:u:c:m:t:L:")) != -1) |
| switch (ch) { | switch (ch) { |
| case 'C': | |
| if (!cfgLoadConfig(optarg, &cfg)) { | |
| cfg_loadAttribute(&cfg, "cfexec", "timeout", &User, DEFAULT_TIMEOUT); | |
| #ifndef HAVE_STRTONUM | |
| Timeout = (int) strtol(szUser, NULL, 0); | |
| #else | |
| Timeout = strtonum(AIT_GET_STR(&User), 0, 3600, &err); | |
| #endif | |
| AIT_FREE_VAL(&User); | |
| if (!Timeout && err) { | |
| printf("Error:: in seconds for timeout %s - %s\n", optarg, err); | |
| cfgUnloadConfig(&cfg); | |
| return 1; | |
| } | |
| cfg_loadAttribute(&cfg, "cfexec", "suid", &User, DEFAULT_USER); | |
| cfg_loadAttribute(&cfg, "cfexec", "mount", &Mount, DEFAULT_MOUNT); | |
| cfg_loadAttribute(&cfg, "cfexec", "chroot", &Chroot, DEFAULT_CHROOT); | |
| cfgUnloadConfig(&cfg); | |
| } | |
| break; | |
| case 'v': | case 'v': |
| Verbose++; | Verbose++; |
| break; | break; |
| Line 302 main(int argc, char **argv) | Line 322 main(int argc, char **argv) |
| memset(szSess, 0, MAXPATHLEN); | memset(szSess, 0, MAXPATHLEN); |
| snprintf(szSess, MAXPATHLEN, "%s%s-cfexec.LCK", DEFAULT_TMP, AIT_GET_STR(&Mount)); | snprintf(szSess, MAXPATHLEN, "%s%s-cfexec.LCK", DEFAULT_TMP, AIT_GET_STR(&Mount)); |
| memset(szSLCK, 0, MAXPATHLEN); | memset(szSLCK, 0, MAXPATHLEN); |
| snprintf(szSLCK, MAXPATHLEN, CFEXEC_SLOCK, DEFAULT_TMP); | snprintf(szSLCK, MAXPATHLEN, "%s%s-SYS-cfexec.LCK", DEFAULT_TMP, AIT_GET_STR(&Mount)); |
| /* we have request for service lock! */ | /* we have request for service lock! */ |
| if (mod) { | if (mod) { |