Skip to content

Commit

Permalink
Some debugging cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoertzen-sb committed Dec 15, 2023
1 parent f5f8802 commit 5061ea1
Showing 1 changed file with 31 additions and 43 deletions.
74 changes: 31 additions & 43 deletions bin/named/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1501,10 +1501,6 @@ main(int argc, char *argv[]) {
#ifdef HAVE_GPERFTOOLS_PROFILER
(void)ProfilerStart(NULL);
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
printf("=============================================================\n");
printf("starting providers\n");
printf("=============================================================\n");
fflush(stdout);
/*
* Technically, this call is superfluous because on startup of the main
* program, the portable "C" locale is selected by default. This
Expand Down Expand Up @@ -1537,16 +1533,43 @@ main(int argc, char *argv[]) {
isc_assertion_setcallback(assertion_failed);
isc_error_setfatal(library_fatal_error);
isc_error_setunexpected(library_unexpected_error);

named_os_init(program_name);

parse_command_line(argc, argv);

#ifdef ENABLE_AFL
if (named_g_fuzz_type != isc_fuzz_none) {
named_fuzz_setup();
}

if (named_g_fuzz_type == isc_fuzz_resolver) {
dns_resolver_setfuzzing();
} else if (named_g_fuzz_type == isc_fuzz_http) {
isc_httpd_setfinishhook(named_fuzz_notify);
}
#endif /* ifdef ENABLE_AFL */
/*
* Warn about common configuration error.
*/
if (named_g_chrootdir != NULL) {
int len = strlen(named_g_chrootdir);
if (strncmp(named_g_chrootdir, named_g_conffile, len) == 0 &&
(named_g_conffile[len] == '/' ||
named_g_conffile[len] == '\\'))
{
named_main_earlywarning("config filename (-c %s) "
"contains chroot path (-t %s)",
named_g_conffile,
named_g_chrootdir);
}
}
/*
* Since providers may be loaded due to command line
* arguments, load oqs and default providers now.
* TODO: Maybe disable FIPS mode, or make oqs and FIPS
* mutually exclusive modes?
*/
printf("=============================================================\n");
printf("loading providers\n");
printf("=============================================================\n");
fflush(stdout);
#if OPENSSL_VERSION_NUMER >= 0x30200000L && OPENSSL_API_LEVEL >= 30200
oqs = OSSL_PROVIDER_load(NULL, "oqsprovider");
if (oqs == NULL) {
Expand All @@ -1573,41 +1596,6 @@ main(int argc, char *argv[]) {
}
#endif /* if OPENSSL_VERSION_NUMER >= 0x30200000L && OPENSSL_API_LEVEL >= \
30200 */
printf("=============================================================\n");
printf("loaded providers\n");
printf("=============================================================\n");
fflush(stdout);

named_os_init(program_name);

parse_command_line(argc, argv);

#ifdef ENABLE_AFL
if (named_g_fuzz_type != isc_fuzz_none) {
named_fuzz_setup();
}

if (named_g_fuzz_type == isc_fuzz_resolver) {
dns_resolver_setfuzzing();
} else if (named_g_fuzz_type == isc_fuzz_http) {
isc_httpd_setfinishhook(named_fuzz_notify);
}
#endif /* ifdef ENABLE_AFL */
/*
* Warn about common configuration error.
*/
if (named_g_chrootdir != NULL) {
int len = strlen(named_g_chrootdir);
if (strncmp(named_g_chrootdir, named_g_conffile, len) == 0 &&
(named_g_conffile[len] == '/' ||
named_g_conffile[len] == '\\'))
{
named_main_earlywarning("config filename (-c %s) "
"contains chroot path (-t %s)",
named_g_conffile,
named_g_chrootdir);
}
}

setup();
isc_mem_setname(named_g_mctx, "main");
Expand Down

0 comments on commit 5061ea1

Please sign in to comment.