summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-03-31 20:06:10 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-03-31 20:06:10 +0200
commit3b9fd5330a6599c00e9c3c0a4080a141f173aa6a (patch)
treef01a660c1ccf5070101b32a9e7eb75e07c0c6e57 /tools
parent3e3a9bc9982331e44cf397fef131e75553f2ab2c (diff)
parent91d6888a8afe562bf4d2ef53be94c41898e1a2ec (diff)
downloadrsyslog-3b9fd5330a6599c00e9c3c0a4080a141f173aa6a.tar.gz
rsyslog-3b9fd5330a6599c00e9c3c0a4080a141f173aa6a.tar.xz
rsyslog-3b9fd5330a6599c00e9c3c0a4080a141f173aa6a.zip
Merge branch 'master' into sol-test
Conflicts: tests/Makefile.am
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index a2aead9a..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 */
@@ -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)