diff options
Diffstat (limited to 'plugins/netutils.c')
-rw-r--r-- | plugins/netutils.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c index 705aaf09..1bb4f076 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -359,20 +359,21 @@ is_addr (const char *address) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | int | 361 | int |
362 | resolve_host_or_addr (const char *address, int family) | 362 | dns_lookup (const char *in, struct sockaddr_storage *ss, int family) |
363 | { | 363 | { |
364 | struct addrinfo hints; | 364 | struct addrinfo hints; |
365 | struct addrinfo *res; | 365 | struct addrinfo *res; |
366 | int retval; | 366 | int retval; |
367 | 367 | ||
368 | memset (&hints, 0, sizeof (hints)); | 368 | memset (&hints, 0, sizeof(struct addrinfo)); |
369 | hints.ai_family = family; | 369 | hints.ai_family = family; |
370 | retval = getaddrinfo (address, NULL, &hints, &res); | ||
371 | 370 | ||
371 | retval = getaddrinfo (in, NULL, &hints, &res); | ||
372 | if (retval != 0) | 372 | if (retval != 0) |
373 | return FALSE; | 373 | return FALSE; |
374 | else { | 374 | |
375 | freeaddrinfo (res); | 375 | if (ss != NULL) |
376 | return TRUE; | 376 | memcpy (ss, res->ai_addr, res->ai_addrlen); |
377 | } | 377 | freeaddrinfo (res); |
378 | return TRUE; | ||
378 | } | 379 | } |