aboutsummaryrefslogtreecommitdiff
path: root/contrib/unbound/util
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2015-01-12 09:46:49 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2015-01-12 09:46:49 +0000
commit748bd8295751e2dc7587bce32a5d1899c02cf7a7 (patch)
tree78cecbbf73d2015563540a7206b0aaf4a051fb3e /contrib/unbound/util
parentfc7ea8b690365d580b4337b8bb6ceace480a8ea7 (diff)
parent54dd3272da3f4a5fda7dd6ac359b7cf68e21a796 (diff)
downloadsrc-748bd8295751e2dc7587bce32a5d1899c02cf7a7.tar.gz
src-748bd8295751e2dc7587bce32a5d1899c02cf7a7.zip
MFV (r277045): merge upstream version of the local socket patch.
Notes
Notes: svn path=/head/; revision=277057
Diffstat (limited to 'contrib/unbound/util')
-rw-r--r--contrib/unbound/util/config_file.c25
-rw-r--r--contrib/unbound/util/config_file.h6
2 files changed, 21 insertions, 10 deletions
diff --git a/contrib/unbound/util/config_file.c b/contrib/unbound/util/config_file.c
index 922901041bd7..a2352d5c6a42 100644
--- a/contrib/unbound/util/config_file.c
+++ b/contrib/unbound/util/config_file.c
@@ -201,6 +201,7 @@ config_create(void)
cfg->remote_control_enable = 0;
cfg->control_ifs = NULL;
cfg->control_port = UNBOUND_CONTROL_PORT;
+ cfg->remote_control_use_cert = 1;
cfg->minimal_responses = 0;
cfg->rrset_roundrobin = 0;
cfg->max_udp_size = 4096;
@@ -805,16 +806,6 @@ config_read(struct config_file* cfg, const char* filename, const char* chroot)
return 0;
}
-#ifdef HAVE_GETPWNAM
- /* translate username into uid and gid */
- if(cfg->username && cfg->username[0]) {
- struct passwd *pwd;
- if((pwd = getpwnam(cfg->username)) == NULL)
- log_err("user '%s' does not exist.", cfg->username);
- cfg->uid = pwd->pw_uid;
- cfg->gid = pwd->pw_gid;
- }
-#endif
return 1;
}
@@ -1203,6 +1194,20 @@ config_apply(struct config_file* config)
log_set_time_asc(config->log_time_ascii);
}
+void config_lookup_uid(struct config_file* cfg)
+{
+#ifdef HAVE_GETPWNAM
+ /* translate username into uid and gid */
+ if(cfg->username && cfg->username[0]) {
+ struct passwd *pwd;
+ if((pwd = getpwnam(cfg->username)) == NULL)
+ log_err("user '%s' does not exist.", cfg->username);
+ cfg->uid = pwd->pw_uid;
+ cfg->gid = pwd->pw_gid;
+ }
+#endif
+}
+
/**
* Calculate string length of full pathname in original filesys
* @param fname: the path name to convert.
diff --git a/contrib/unbound/util/config_file.h b/contrib/unbound/util/config_file.h
index fd35d7863ae1..327eadc76f7b 100644
--- a/contrib/unbound/util/config_file.h
+++ b/contrib/unbound/util/config_file.h
@@ -427,6 +427,12 @@ void config_delete(struct config_file* config);
void config_apply(struct config_file* config);
/**
+ * Find username, sets uid and gid.
+ * @param config: the config structure.
+ */
+void config_lookup_uid(struct config_file* config);
+
+/**
* Set the given keyword to the given value.
* @param config: where to store config
* @param option: option name, including the ':' character.