summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c17
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)