Lines Matching defs:cfg

90  * @param cfg: config
95 print_option(struct config_file* cfg, const char* opt)
97 if(!config_get_option(cfg, opt, config_print_func, stdout))
103 check_mod(struct config_file* cfg, struct module_func_block* fb)
107 env.cfg = cfg;
122 localzonechecks(struct config_file* cfg)
127 if(!local_zones_apply_cfg(zs, cfg))
156 interfacechecks(struct config_file* cfg)
161 for(i=0; i<cfg->num_ifs; i++) {
162 if(!extstrtoaddr(cfg->ifs[i], &a, &alen)) {
164 cfg->ifs[i]);
166 for(j=0; j<cfg->num_ifs; j++) {
167 if(i!=j && strcmp(cfg->ifs[i], cfg->ifs[j])==0)
170 cfg->ifs[i]);
173 for(i=0; i<cfg->num_out_ifs; i++) {
174 if(!ipstrtoaddr(cfg->out_ifs[i], UNBOUND_DNS_PORT,
177 "specified as '%s'", cfg->out_ifs[i]);
179 for(j=0; j<cfg->num_out_ifs; j++) {
180 if(i!=j && strcmp(cfg->out_ifs[i], cfg->out_ifs[j])==0)
183 cfg->out_ifs[i]);
190 aclchecks(struct config_file* cfg)
196 for(acl=cfg->acls; acl; acl = acl->next) {
261 const char* chrootdir, struct config_file* cfg)
265 *ss = fname_after_chroot(str, cfg, 1);
283 const char* chrootdir, struct config_file* cfg)
287 check_chroot_string(desc, &p->str, chrootdir, cfg);
294 const char* chrootdir, struct config_file* cfg)
304 p->str = fname_after_chroot(p->str, cfg, 1);
308 check_chroot_string(desc, &p->str, chrootdir, cfg);
314 morechecks(struct config_file* cfg, const char* fname)
316 warn_hosts("stub-host", cfg->stubs);
317 warn_hosts("forward-host", cfg->forwards);
318 interfacechecks(cfg);
319 aclchecks(cfg);
321 if(cfg->verbosity < 0)
323 if(cfg->num_threads <= 0 || cfg->num_threads > 10000)
325 if(!cfg->do_ip4 && !cfg->do_ip6)
327 if(!cfg->do_udp && !cfg->do_tcp)
329 if(cfg->edns_buffer_size > cfg->msg_buffer_size)
333 if(cfg->chrootdir && cfg->chrootdir[0] &&
334 cfg->chrootdir[strlen(cfg->chrootdir)-1] == '/')
336 cfg->chrootdir);
337 if(cfg->chrootdir && cfg->chrootdir[0] &&
338 !is_dir(cfg->chrootdir)) {
341 if(cfg->chrootdir && cfg->chrootdir[0]) {
350 if(strncmp(buf, cfg->chrootdir, strlen(cfg->chrootdir)) != 0)
352 buf, cfg->chrootdir);
354 if(cfg->directory && cfg->directory[0]) {
355 char* ad = fname_after_chroot(cfg->directory, cfg, 0);
360 if( (cfg->chrootdir && cfg->chrootdir[0]) ||
361 (cfg->directory && cfg->directory[0])) {
362 if(cfg->pidfile && cfg->pidfile[0]) {
363 char* ad = (cfg->pidfile[0]=='/')?strdup(cfg->pidfile):
364 fname_after_chroot(cfg->pidfile, cfg, 1);
370 if(cfg->logfile && cfg->logfile[0]) {
371 char* ad = fname_after_chroot(cfg->logfile, cfg, 1);
380 cfg->root_hints, cfg->chrootdir, cfg);
382 cfg->trust_anchor_file_list, cfg->chrootdir, cfg);
384 cfg->auto_trust_anchor_file_list, cfg->chrootdir, cfg);
386 cfg->trusted_keys_file_list, cfg->chrootdir, cfg);
387 check_chroot_string("dlv-anchor-file", &cfg->dlv_anchor_file,
388 cfg->chrootdir, cfg);
390 free(cfg->chrootdir);
391 cfg->chrootdir = NULL;
393 if(strcmp(cfg->module_conf, "iterator") != 0
394 && strcmp(cfg->module_conf, "validator iterator") != 0
396 && strcmp(cfg->module_conf, "python iterator") != 0
397 && strcmp(cfg->module_conf, "python validator iterator") != 0
398 && strcmp(cfg->module_conf, "validator python iterator") != 0
402 cfg->module_conf);
406 if(cfg->username && cfg->username[0]) {
407 if(getpwnam(cfg->username) == NULL)
408 fatal_exit("user '%s' does not exist.", cfg->username);
412 if(cfg->remote_control_enable) {
413 check_chroot_string("server-key-file", &cfg->server_key_file,
414 cfg->chrootdir, cfg);
415 check_chroot_string("server-cert-file", &cfg->server_cert_file,
416 cfg->chrootdir, cfg);
417 if(!is_file(cfg->control_key_file))
419 cfg->control_key_file);
420 if(!is_file(cfg->control_cert_file))
422 cfg->control_cert_file);
425 localzonechecks(cfg);
430 check_fwd(struct config_file* cfg)
433 if(!fwd || !forwards_apply_cfg(fwd, cfg)) {
441 check_hints(struct config_file* cfg)
444 if(!hints || !hints_apply_cfg(hints, cfg)) {
454 struct config_file* cfg = config_create();
455 if(!cfg)
457 if(!config_read(cfg, cfgfile, NULL)) {
459 config_delete(cfg);
462 morechecks(cfg, cfgfile);
463 check_mod(cfg, iter_get_funcblock());
464 check_mod(cfg, val_get_funcblock());
466 if(strstr(cfg->module_conf, "python"))
467 check_mod(cfg, pythonmod_get_funcblock());
469 check_fwd(cfg);
470 check_hints(cfg);
471 if(opt) print_option(cfg, opt);
473 config_delete(cfg);