Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always add hostnames and vhosts in lower-case format. #218

Merged
merged 1 commit into from
Apr 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions base/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ gvm_hosts_new_with_max (const gchar *hosts_str, unsigned int max_hosts)
gvm_host_t *host = gvm_host_new ();
host->type = host_type;
if (host_type == HOST_TYPE_NAME)
host->name = g_strdup (stripped);
host->name = g_ascii_strdown (stripped, -1);
else if (host_type == HOST_TYPE_IPV4)
{
if (inet_pton (AF_INET, stripped, &host->addr) != 1)
Expand Down Expand Up @@ -1419,7 +1419,7 @@ gvm_vhosts_exclude (gvm_host_t *host, const char *excluded_str)

while (*tmp)
{
if (!strcmp (value, g_strstrip (*tmp)))
if (!strcasecmp (value, g_strstrip (*tmp)))
{
gvm_vhost_free (vhost->data);
host->vhosts = vhost = g_slist_delete_link (host->vhosts, vhost);
Expand Down Expand Up @@ -1559,7 +1559,7 @@ gvm_host_reverse_lookup (gvm_host_t *host)
int ret = getnameinfo ((struct sockaddr *) &sa, sizeof (sa), hostname,
sizeof (hostname), NULL, 0, NI_NAMEREQD);
if (!ret)
return g_strdup (hostname);
return g_ascii_strdown (hostname, -1);
if (ret != EAI_AGAIN)
break;
}
Expand All @@ -1578,7 +1578,7 @@ gvm_host_reverse_lookup (gvm_host_t *host)
sizeof (hostname), NULL, 0, NI_NAMEREQD))
return NULL;
else
return g_strdup (hostname);
return g_ascii_strdown (hostname, -1);
}
else
return NULL;
Expand Down Expand Up @@ -1607,7 +1607,7 @@ host_name_verify (gvm_host_t *host, const char *value)
{
char buffer[INET6_ADDRSTRLEN];
addr6_to_str (tmp->data, buffer);
if (!strcmp (host_str, buffer))
if (!strcasecmp (host_str, buffer))
{
ret = 0;
break;
Expand Down Expand Up @@ -1646,7 +1646,7 @@ gvm_host_add_reverse_lookup (gvm_host_t *host)
vhosts = host->vhosts;
while (vhosts)
{
if (!strcmp (((gvm_vhost_t *) vhosts->data)->value, value))
if (!strcasecmp (((gvm_vhost_t *) vhosts->data)->value, value))
{
g_free (value);
return;
Expand Down