aboutsummaryrefslogtreecommitdiff
path: root/contrib/unbound/smallapp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/unbound/smallapp')
-rw-r--r--contrib/unbound/smallapp/unbound-anchor.c12
-rw-r--r--contrib/unbound/smallapp/unbound-checkconf.c51
-rw-r--r--contrib/unbound/smallapp/unbound-control.c3
3 files changed, 59 insertions, 7 deletions
diff --git a/contrib/unbound/smallapp/unbound-anchor.c b/contrib/unbound/smallapp/unbound-anchor.c
index 708731a09dd8..55d363da70bb 100644
--- a/contrib/unbound/smallapp/unbound-anchor.c
+++ b/contrib/unbound/smallapp/unbound-anchor.c
@@ -382,7 +382,7 @@ read_cert_file(const char* file)
STACK_OF(X509)* sk;
FILE* in;
int content = 0;
- char buf[128];
+ long flen;
if(file == NULL || strcmp(file, "") == 0) {
return NULL;
}
@@ -399,6 +399,11 @@ read_cert_file(const char* file)
#endif
return NULL;
}
+ if(fseek(in, 0, SEEK_END) < 0)
+ printf("%s fseek: %s\n", file, strerror(errno));
+ flen = ftell(in);
+ if(fseek(in, 0, SEEK_SET) < 0)
+ printf("%s fseek: %s\n", file, strerror(errno));
while(!feof(in)) {
X509* x = PEM_read_X509(in, NULL, NULL, NULL);
if(x == NULL) {
@@ -414,8 +419,9 @@ read_cert_file(const char* file)
exit(0);
}
content = 1;
- /* read away newline after --END CERT-- */
- if(!fgets(buf, (int)sizeof(buf), in))
+ /* feof may not be true yet, but if the position is
+ * at end of file, stop reading more certificates. */
+ if(ftell(in) == flen)
break;
}
fclose(in);
diff --git a/contrib/unbound/smallapp/unbound-checkconf.c b/contrib/unbound/smallapp/unbound-checkconf.c
index 8fd821396025..b3c57fd2a52c 100644
--- a/contrib/unbound/smallapp/unbound-checkconf.c
+++ b/contrib/unbound/smallapp/unbound-checkconf.c
@@ -294,7 +294,8 @@ view_and_respipchecks(struct config_file* cfg)
{
struct views* views = NULL;
struct respip_set* respip = NULL;
- int ignored = 0;
+ int have_view_respip_cfg = 0;
+ int use_response_ip = 0;
if(!(views = views_create()))
fatal_exit("Could not create views: out of memory");
if(!(respip = respip_set_create()))
@@ -303,8 +304,11 @@ view_and_respipchecks(struct config_file* cfg)
fatal_exit("Could not set up views");
if(!respip_global_apply_cfg(respip, cfg))
fatal_exit("Could not setup respip set");
- if(!respip_views_apply_cfg(views, cfg, &ignored))
+ if(!respip_views_apply_cfg(views, cfg, &have_view_respip_cfg))
fatal_exit("Could not setup per-view respip sets");
+ use_response_ip = !respip_set_is_empty(respip) || have_view_respip_cfg;
+ if(use_response_ip && !strstr(cfg->module_conf, "respip"))
+ fatal_exit("response-ip options require respip module");
acl_view_tag_checks(cfg, views);
views_delete(views);
respip_set_delete(respip);
@@ -450,6 +454,39 @@ ifautomaticportschecks(char* ifautomaticports)
}
}
+/** check control interface strings */
+static void
+controlinterfacechecks(struct config_file* cfg)
+{
+ struct config_strlist* p;
+ for(p = cfg->control_ifs.first; p; p = p->next) {
+ struct sockaddr_storage a;
+ socklen_t alen;
+ char** rcif = NULL;
+ int i, num_rcif = 0;
+ /* See if it is a local socket, starts with a '/'. */
+ if(p->str && p->str[0] == '/')
+ continue;
+ if(!resolve_interface_names(&p->str, 1, NULL, &rcif,
+ &num_rcif)) {
+ fatal_exit("could not resolve interface names, for control-interface: %s",
+ p->str);
+ }
+ for(i=0; i<num_rcif; i++) {
+ if(!extstrtoaddr(rcif[i], &a, &alen,
+ cfg->control_port)) {
+ if(strcmp(p->str, rcif[i])!=0)
+ fatal_exit("cannot parse control-interface address '%s' from the control-interface specified as '%s'",
+ rcif[i], p->str);
+ else
+ fatal_exit("cannot parse control-interface specified as '%s'",
+ p->str);
+ }
+ }
+ config_del_strarray(rcif, num_rcif);
+ }
+}
+
/** check acl ips */
static void
aclchecks(struct config_file* cfg)
@@ -636,8 +673,10 @@ check_modules_exist(const char* module_conf)
}
n[j] = s[j];
}
- fatal_exit("module_conf lists module '%s' but that "
- "module is not available.", n);
+ fatal_exit("Unknown value in module-config, module: "
+ "'%s'. This module is not present (not "
+ "compiled in); see the list of linked modules "
+ "with unbound -V", n);
}
s += strlen(names[i]);
}
@@ -926,6 +965,8 @@ morechecks(struct config_file* cfg)
fatal_exit("control-cert-file: \"%s\" does not exist",
cfg->control_cert_file);
}
+ if(cfg->remote_control_enable)
+ controlinterfacechecks(cfg);
donotquerylocalhostcheck(cfg);
localzonechecks(cfg);
@@ -966,6 +1007,8 @@ check_auth(struct config_file* cfg)
if(!az || !auth_zones_apply_cfg(az, cfg, 0, &is_rpz, NULL, NULL)) {
fatal_exit("Could not setup authority zones");
}
+ if(is_rpz && !strstr(cfg->module_conf, "respip"))
+ fatal_exit("RPZ requires the respip module");
auth_zones_delete(az);
}
diff --git a/contrib/unbound/smallapp/unbound-control.c b/contrib/unbound/smallapp/unbound-control.c
index cf5abe7eb29d..b7e9d98a27b9 100644
--- a/contrib/unbound/smallapp/unbound-control.c
+++ b/contrib/unbound/smallapp/unbound-control.c
@@ -143,6 +143,8 @@ usage(void)
printf(" load_cache load cache from stdin\n");
printf(" (not supported in remote unbounds in\n");
printf(" multi-process operation)\n");
+ printf(" cache_lookup [+t] <names> print rrsets and msgs at or under the names\n");
+ printf(" +t allow tld and root names.\n");
printf(" lookup <name> print nameservers for name\n");
printf(" flush [+c] <name> flushes common types for name from cache\n");
printf(" types: A, AAAA, MX, PTR, NS,\n");
@@ -409,6 +411,7 @@ static void print_extended(struct ub_stats_info* s, int inhibit_zero)
PR_UL("num.answer.secure", s->svr.ans_secure);
PR_UL("num.answer.bogus", s->svr.ans_bogus);
PR_UL("num.rrset.bogus", s->svr.rrset_bogus);
+ PR_UL("num.valops", s->svr.val_ops);
PR_UL("num.query.aggressive.NOERROR", s->svr.num_neg_cache_noerror);
PR_UL("num.query.aggressive.NXDOMAIN", s->svr.num_neg_cache_nxdomain);
/* threat detection */