diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-02 12:19:44 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-02 12:19:44 +0200 |
commit | e92a0db46dfd2661a92e41a678d982ce6d3eedde (patch) | |
tree | 4e09eb39484f497e8eab28bf85bb933e139df49d /tools/syslogd.c | |
parent | 8a819d6a0623c0854462dd2dc632700f9a5c576c (diff) | |
parent | e4f012eb60f6531f964557ba9eac54048ae2bef8 (diff) | |
download | rsyslog-e92a0db46dfd2661a92e41a678d982ce6d3eedde.tar.gz rsyslog-e92a0db46dfd2661a92e41a678d982ce6d3eedde.tar.bz2 rsyslog-e92a0db46dfd2661a92e41a678d982ce6d3eedde.zip |
Merge branch 'master' into oracle
Conflicts:
Makefile.am
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r-- | tools/syslogd.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index 235bc52e..c72160fb 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -3324,7 +3324,7 @@ int realMain(int argc, char **argv) * only when actually neeeded. * rgerhards, 2008-04-04 */ - while((ch = getopt(argc, argv, "46a:Ac:def:g:hi:l:m:M:nN:op:qQr::s:t:u:vwx")) != EOF) { + while((ch = getopt(argc, argv, "46a:Ac:def:g:hi:l:m:M:nN:op:qQr::s:t:T:u:vwx")) != EOF) { switch((char)ch) { case '4': case '6': @@ -3342,6 +3342,7 @@ int realMain(int argc, char **argv) case 'q': /* add hostname if DNS resolving has failed */ case 'Q': /* dont resolve hostnames in ACL to IPs */ case 's': + case 'T': /* chroot on startup (primarily for testing) */ case 'u': /* misc user settings */ case 'w': /* disable disallowed host warnings */ case 'x': /* disable dns for remote messages */ @@ -3475,7 +3476,7 @@ int realMain(int argc, char **argv) /* END core initializations - we now come back to carrying out command line options*/ while((iRet = bufOptRemove(&ch, &arg)) == RS_RET_OK) { - dbgprintf("deque option %c, optarg '%s'\n", ch, arg); + dbgprintf("deque option %c, optarg '%s'\n", ch, (arg == NULL) ? "" : arg); switch((char)ch) { case '4': glbl.SetDefPFFamily(PF_INET); @@ -3586,6 +3587,20 @@ int realMain(int argc, char **argv) } else fprintf(stderr, "-t option only supported in compatibility modes 0 to 2 - ignored\n"); break; + case 'T':/* chroot() immediately at program startup, but only for testing, NOT security yet */ +{ +char buf[1024]; +getcwd(buf, 1024); +printf("pwd: '%s'\n", buf); +printf("chroot to '%s'\n", arg); + if(chroot(arg) != 0) { + perror("chroot"); + exit(1); + } +getcwd(buf, 1024); +printf("pwd: '%s'\n", buf); +} + break; case 'u': /* misc user settings */ iHelperUOpt = atoi(arg); if(iHelperUOpt & 0x01) |