]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
fixup chroot and kill-HUP reread of config file.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 21 Apr 2008 11:34:25 +0000 (11:34 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 21 Apr 2008 11:34:25 +0000 (11:34 +0000)
git-svn-id: file:///svn/unbound/trunk@1061 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/unbound.c
doc/Changelog

index 492cc88e5773d111f709bbbedeb0780b98c13515..74b49bae27d04a21f9d9bc21bdc29071aa02e340 100644 (file)
@@ -284,7 +284,8 @@ detach(struct config_file* cfg)
 
 /** daemonize, drop user priviliges and chroot if needed */
 static void
-do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode)
+do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
+       char** cfgfile)
 {
        uid_t uid;
        gid_t gid;
@@ -314,6 +315,9 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode)
                        fatal_exit("unable to chroot to %s: %s", 
                                cfg->chrootdir, strerror(errno));
                verbose(VERB_QUERY, "chroot to %s", cfg->chrootdir);
+               if(strncmp(*cfgfile, cfg->chrootdir, 
+                       strlen(cfg->chrootdir)) == 0) 
+                       (*cfgfile) += strlen(cfg->chrootdir);
        }
        if(cfg->username && cfg->username[0]) {
                if(setgid(gid) != 0)
@@ -382,7 +386,7 @@ run_daemon(char* cfgfile, int cmdline_verbose, int debug_mode)
                if(!daemon_open_shared_ports(daemon))
                        fatal_exit("could not open ports");
                if(!done_chroot) { 
-                       do_chroot(daemon, cfg, debug_mode); 
+                       do_chroot(daemon, cfg, debug_mode, &cfgfile); 
                        done_chroot = 1; 
                } else log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
                /* work */
index baf77ead799090abd2ae85370763bcec8efcce99..8d3ffef6ab906c13300fe88184ce44f824ee3548 100644 (file)
@@ -1,5 +1,7 @@
 21 April 2008: Wouter
        - FEATURES document.
+       - fixup reread of config file if it was given as a full path
+         and chroot was used.
 
 16 April 2008: Wouter
        - requirements doc, updated clean query returns.