summaryrefslogtreecommitdiffstats
path: root/smallapp
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2015-04-26 11:23:26 +0000
committerdes <des@FreeBSD.org>2015-04-26 11:23:26 +0000
commitfe0c01d26579d19ddf439fb46ef0bd3cc2bc7f4c (patch)
tree01c1d94467622a175fad10cd34a2f6f05d32c1b7 /smallapp
parentcabe860377233bc13a6d101fdb59bb834cab980a (diff)
downloadFreeBSD-src-fe0c01d26579d19ddf439fb46ef0bd3cc2bc7f4c.zip
FreeBSD-src-fe0c01d26579d19ddf439fb46ef0bd3cc2bc7f4c.tar.gz
import unbound 1.5.2
Diffstat (limited to 'smallapp')
-rw-r--r--smallapp/unbound-checkconf.c20
-rw-r--r--smallapp/unbound-control-setup.sh.in3
-rw-r--r--smallapp/unbound-control.c8
3 files changed, 20 insertions, 11 deletions
diff --git a/smallapp/unbound-checkconf.c b/smallapp/unbound-checkconf.c
index 7723c33..b5d7b9f 100644
--- a/smallapp/unbound-checkconf.c
+++ b/smallapp/unbound-checkconf.c
@@ -78,6 +78,7 @@ usage()
printf(" Checks unbound configuration file for errors.\n");
printf("file if omitted %s is used.\n", CONFIGFILE);
printf("-o option print value of option to stdout.\n");
+ printf("-f output full pathname with chroot applied, eg. with -o pidfile.\n");
printf("-h show this usage help.\n");
printf("Version %s\n", PACKAGE_VERSION);
printf("BSD licensed, see LICENSE in source package for details.\n");
@@ -90,10 +91,15 @@ usage()
* @param cfg: config
* @param opt: option name without trailing :.
* This is different from config_set_option.
+ * @param final: if final pathname with chroot applied has to be printed.
*/
static void
-print_option(struct config_file* cfg, const char* opt)
+print_option(struct config_file* cfg, const char* opt, int final)
{
+ if(strcmp(opt, "pidfile") == 0 && final) {
+ printf("%s\n", fname_after_chroot(cfg->pidfile, cfg, 1));
+ return;
+ }
if(!config_get_option(cfg, opt, config_print_func, stdout))
fatal_exit("cannot print option '%s'", opt);
}
@@ -456,7 +462,7 @@ check_hints(struct config_file* cfg)
/** check config file */
static void
-checkconf(const char* cfgfile, const char* opt)
+checkconf(const char* cfgfile, const char* opt, int final)
{
struct config_file* cfg = config_create();
if(!cfg)
@@ -467,7 +473,7 @@ checkconf(const char* cfgfile, const char* opt)
exit(1);
}
if(opt) {
- print_option(cfg, opt);
+ print_option(cfg, opt, final);
config_delete(cfg);
return;
}
@@ -493,6 +499,7 @@ extern char* optarg;
int main(int argc, char* argv[])
{
int c;
+ int final = 0;
const char* f;
const char* opt = NULL;
const char* cfgfile = CONFIGFILE;
@@ -505,8 +512,11 @@ int main(int argc, char* argv[])
cfgfile = CONFIGFILE;
#endif /* USE_WINSOCK */
/* parse the options */
- while( (c=getopt(argc, argv, "ho:")) != -1) {
+ while( (c=getopt(argc, argv, "fho:")) != -1) {
switch(c) {
+ case 'f':
+ final = 1;
+ break;
case 'o':
opt = optarg;
break;
@@ -523,7 +533,7 @@ int main(int argc, char* argv[])
if(argc == 1)
f = argv[0];
else f = cfgfile;
- checkconf(f, opt);
+ checkconf(f, opt, final);
checklock_stop();
return 0;
}
diff --git a/smallapp/unbound-control-setup.sh.in b/smallapp/unbound-control-setup.sh.in
index 79605dc..75e76e2 100644
--- a/smallapp/unbound-control-setup.sh.in
+++ b/smallapp/unbound-control-setup.sh.in
@@ -36,8 +36,7 @@
# settings:
# directory for files
-prefix=@prefix@
-DESTDIR=@sysconfdir@/unbound
+DESTDIR=@ub_conf_dir@
# issuer and subject name for certificates
SERVERNAME=unbound
diff --git a/smallapp/unbound-control.c b/smallapp/unbound-control.c
index ac8d968..3b47d3b 100644
--- a/smallapp/unbound-control.c
+++ b/smallapp/unbound-control.c
@@ -204,12 +204,12 @@ contact_server(const char* svr, struct config_file* cfg, int statuscmd)
fatal_exit("could not parse IP@port: %s", svr);
#ifdef HAVE_SYS_UN_H
} else if(svr[0] == '/') {
- struct sockaddr_un* sun = (struct sockaddr_un *) &addr;
- sun->sun_family = AF_LOCAL;
+ struct sockaddr_un* usock = (struct sockaddr_un *) &addr;
+ usock->sun_family = AF_LOCAL;
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
- sun->sun_len = (sa_family_t)sizeof(sun);
+ usock->sun_len = (socklen_t)sizeof(usock);
#endif
- (void)strlcpy(sun->sun_path, svr, sizeof(sun->sun_path));
+ (void)strlcpy(usock->sun_path, svr, sizeof(usock->sun_path));
addrlen = (socklen_t)sizeof(struct sockaddr_un);
addrfamily = AF_LOCAL;
#endif
OpenPOWER on IntegriCloud