- Fix unit test for added ulimit checks.

This commit is contained in:
W.C.A. Wijngaards 2021-02-24 15:30:12 +01:00
parent e6ffacc16a
commit a9e15f36d8
5 changed files with 35 additions and 32 deletions

View file

@ -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.

View file

@ -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; i<cfg->num_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.

View file

@ -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.

View file

@ -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; i<cfg->num_ifs; i++) {
if(if_is_https(cfg->ifs[i], portbuf, cfg->https_port))
return 1;
}
return 0;
}

View file

@ -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 */