diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-03-19 17:50:07 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-03-19 17:50:07 +0100 |
commit | bbfa04fbe63f1bbb47f5cdc683045cf2775b3977 (patch) | |
tree | 1321c8edd1daede54d7b9680fc58ebd5cca1ead9 /tools | |
parent | 790532bb834e3d4fc07273b2d72127e39ef3e142 (diff) | |
download | rsyslog-bbfa04fbe63f1bbb47f5cdc683045cf2775b3977.tar.gz rsyslog-bbfa04fbe63f1bbb47f5cdc683045cf2775b3977.tar.xz rsyslog-bbfa04fbe63f1bbb47f5cdc683045cf2775b3977.zip |
improved testing support
worked on ways to provide a better test suite:
- added -T rsyslogd command line option, enables to specify a directory
where to chroot() into on startup. This is NOT a security feature but
introduced to support testing. Thus, -T does not make sure chroot()
is used in a secure way. (may be removed later)
- added omstdout module for testing purposes. Spits out all messages to
stdout - no config option, no other features
- modified $ModLoad statement so that for modules whom's name starts with
a dot, no path is prepended (this enables relative-pathes and should
not break any valid current config)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/syslogd.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index 235bc52e..9f962899 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 */ @@ -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) |