aboutsummaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2015-04-26 11:25:07 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2015-04-26 11:25:07 +0000
commit9145bbd450b41b3d36e63a815d45bf740a3e0230 (patch)
tree6307de5b04b7eea58b8169c069c66d2d477930f9 /daemon
parentd3348d437fb0408bc24892ebd0b035686c294705 (diff)
downloadsrc-9145bbd450b41b3d36e63a815d45bf740a3e0230.tar.gz
src-9145bbd450b41b3d36e63a815d45bf740a3e0230.zip
import unbound 1.5.3vendor/unbound/1.5.3
Notes
Notes: svn path=/vendor/unbound/dist/; revision=282011 svn path=/vendor/unbound/1.5.3/; revision=282012; tag=vendor/unbound/1.5.3
Diffstat (limited to 'daemon')
-rw-r--r--daemon/remote.c2
-rw-r--r--daemon/unbound.c23
2 files changed, 13 insertions, 12 deletions
diff --git a/daemon/remote.c b/daemon/remote.c
index 7a8fdb75e75b..65749568fddf 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -329,7 +329,7 @@ add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err,
if(fd != -1) {
#ifdef HAVE_CHOWN
if (cfg->username && cfg->username[0])
- chown(ip, cfg->uid, cfg->gid);
+ chown(ip, cfg_uid, cfg_gid);
chmod(ip, (mode_t)(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
#else
(void)cfg;
diff --git a/daemon/unbound.c b/daemon/unbound.c
index f6bd924a57b9..b70e39686d4c 100644
--- a/daemon/unbound.c
+++ b/daemon/unbound.c
@@ -505,9 +505,9 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
writepid(daemon->pidfile, getpid());
if(cfg->username && cfg->username[0]) {
# ifdef HAVE_CHOWN
- if(chown(daemon->pidfile, cfg->uid, cfg->gid) == -1) {
+ if(chown(daemon->pidfile, cfg_uid, cfg_gid) == -1) {
log_err("cannot chown %u.%u %s: %s",
- (unsigned)cfg->uid, (unsigned)cfg->gid,
+ (unsigned)cfg_uid, (unsigned)cfg_gid,
daemon->pidfile, strerror(errno));
}
# endif /* HAVE_CHOWN */
@@ -524,7 +524,7 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
/* setusercontext does initgroups, setuid, setgid, and
* also resource limits from login config, but we
* still call setresuid, setresgid to be sure to set all uid*/
- if(setusercontext(NULL, pwd, cfg->uid, (unsigned)
+ if(setusercontext(NULL, pwd, cfg_uid, (unsigned)
LOGIN_SETALL & ~LOGIN_SETUSER & ~LOGIN_SETGROUP) != 0)
log_warn("unable to setusercontext %s: %s",
cfg->username, strerror(errno));
@@ -588,27 +588,27 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
#ifdef HAVE_GETPWNAM
if(cfg->username && cfg->username[0]) {
# ifdef HAVE_INITGROUPS
- if(initgroups(cfg->username, cfg->gid) != 0)
+ if(initgroups(cfg->username, cfg_gid) != 0)
log_warn("unable to initgroups %s: %s",
cfg->username, strerror(errno));
# endif /* HAVE_INITGROUPS */
endpwent();
#ifdef HAVE_SETRESGID
- if(setresgid(cfg->gid,cfg->gid,cfg->gid) != 0)
+ if(setresgid(cfg_gid,cfg_gid,cfg_gid) != 0)
#elif defined(HAVE_SETREGID) && !defined(DARWIN_BROKEN_SETREUID)
- if(setregid(cfg->gid,cfg->gid) != 0)
+ if(setregid(cfg_gid,cfg_gid) != 0)
#else /* use setgid */
- if(setgid(cfg->gid) != 0)
+ if(setgid(cfg_gid) != 0)
#endif /* HAVE_SETRESGID */
fatal_exit("unable to set group id of %s: %s",
cfg->username, strerror(errno));
#ifdef HAVE_SETRESUID
- if(setresuid(cfg->uid,cfg->uid,cfg->uid) != 0)
+ if(setresuid(cfg_uid,cfg_uid,cfg_uid) != 0)
#elif defined(HAVE_SETREUID) && !defined(DARWIN_BROKEN_SETREUID)
- if(setreuid(cfg->uid,cfg->uid) != 0)
+ if(setreuid(cfg_uid,cfg_uid) != 0)
#else /* use setuid */
- if(setuid(cfg->uid) != 0)
+ if(setuid(cfg_uid) != 0)
#endif /* HAVE_SETRESUID */
fatal_exit("unable to set user id of %s: %s",
cfg->username, strerror(errno));
@@ -653,7 +653,8 @@ run_daemon(const char* cfgfile, int cmdline_verbose, int debug_mode)
log_warn("Continuing with default config settings");
}
apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
- config_lookup_uid(cfg);
+ if(!done_setup)
+ config_lookup_uid(cfg);
/* prepare */
if(!daemon_open_shared_ports(daemon))