From: W.C.A. Wijngaards Date: Wed, 24 Feb 2021 14:30:12 +0000 (+0100) Subject: - Fix unit test for added ulimit checks. X-Git-Tag: release-1.13.2rc1~256 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9e15f36d8f184999e74e86331a7556fe9c46fe8;p=thirdparty%2Funbound.git - Fix unit test for added ulimit checks. --- diff --git a/doc/Changelog b/doc/Changelog index b7af9c463..9492bc988 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -8,6 +8,7 @@ - On startup of unbound it checks if rlimits on memory size look sufficient for the configured cache size, and logs warning if not. - Fix function documentation. + - Fix unit test for added ulimit checks. 23 February 2021: Wouter - Fix for zonemd, that domain-insecure zones work without dnssec. diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index 7a90677a4..64d22d4d8 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -1093,31 +1093,6 @@ if_is_ssl(const char* ifname, const char* port, int ssl_port, return 0; } -/** see if interface is https, its port number == the https port number */ -static int -if_is_https(const char* ifname, const char* port, int https_port) -{ - char* p = strchr(ifname, '@'); - if(!p && atoi(port) == https_port) - return 1; - if(p && atoi(p+1) == https_port) - return 1; - return 0; -} - -/** see if config contains https turned on */ -int cfg_has_https(struct config_file* cfg) -{ - int i; - char portbuf[32]; - snprintf(portbuf, sizeof(portbuf), "%d", cfg->port); - for(i = 0; inum_ifs; i++) { - if(if_is_https(cfg->ifs[i], portbuf, cfg->https_port)) - return 1; - } - return 0; -} - /** * Helper for ports_open. Creates one interface (or NULL for default). * @param ifname: The interface ip address. diff --git a/services/listen_dnsport.h b/services/listen_dnsport.h index 77062f68d..f438ff458 100644 --- a/services/listen_dnsport.h +++ b/services/listen_dnsport.h @@ -147,13 +147,6 @@ void listening_ports_free(struct listen_port* list); int resolve_interface_names(struct config_file* cfg, char*** resif, int* num_resif); -/** - * Return true if the config contains settinsg that enable https. - * @param cfg: config information. - * @return true if https ports are used for server. - */ -int cfg_has_https(struct config_file* cfg); - /** * Create commpoints with for this thread for the shared ports. * @param base: the comm_base that provides event functionality. diff --git a/util/config_file.c b/util/config_file.c index 9090e595c..171251f67 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -2608,3 +2608,27 @@ int options_remote_is_address(struct config_file* cfg) return (cfg->control_ifs.first->str[0] != '/'); } +/** see if interface is https, its port number == the https port number */ +int +if_is_https(const char* ifname, const char* port, int https_port) +{ + char* p = strchr(ifname, '@'); + if(!p && atoi(port) == https_port) + return 1; + if(p && atoi(p+1) == https_port) + return 1; + return 0; +} + +/** see if config contains https turned on */ +int cfg_has_https(struct config_file* cfg) +{ + int i; + char portbuf[32]; + snprintf(portbuf, sizeof(portbuf), "%d", cfg->port); + for(i = 0; inum_ifs; i++) { + if(if_is_https(cfg->ifs[i], portbuf, cfg->https_port)) + return 1; + } + return 0; +} diff --git a/util/config_file.h b/util/config_file.h index 9d3297f7b..1042bd879 100644 --- a/util/config_file.h +++ b/util/config_file.h @@ -1305,5 +1305,15 @@ void w_config_adjust_directory(struct config_file* cfg); /** debug option for unit tests. */ extern int fake_dsa, fake_sha1; +/** see if interface is https, its port number == the https port number */ +int if_is_https(const char* ifname, const char* port, int https_port); + +/** + * Return true if the config contains settinsg that enable https. + * @param cfg: config information. + * @return true if https ports are used for server. + */ +int cfg_has_https(struct config_file* cfg); + #endif /* UTIL_CONFIG_FILE_H */