diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/utils.c | 12 | ||||
-rw-r--r-- | plugins/utils.h.in | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index 0d250677..9ac5596e 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -32,7 +32,9 @@ int is_host (char *); | |||
32 | int is_addr (char *); | 32 | int is_addr (char *); |
33 | int resolve_host_or_addr (char *, int); | 33 | int resolve_host_or_addr (char *, int); |
34 | int is_inet_addr (char *); | 34 | int is_inet_addr (char *); |
35 | #ifdef USE_IPV6 | ||
35 | int is_inet6_addr (char *); | 36 | int is_inet6_addr (char *); |
37 | #endif | ||
36 | int is_hostname (char *); | 38 | int is_hostname (char *); |
37 | 39 | ||
38 | int is_integer (char *); | 40 | int is_integer (char *); |
@@ -181,7 +183,11 @@ is_host (char *address) | |||
181 | int | 183 | int |
182 | is_addr (char *address) | 184 | is_addr (char *address) |
183 | { | 185 | { |
186 | #ifdef USE_IPV6 | ||
184 | if (is_inet_addr (address) || is_inet6_addr (address)) | 187 | if (is_inet_addr (address) || is_inet6_addr (address)) |
188 | #else | ||
189 | if (is_inet_addr (address)) | ||
190 | #endif | ||
185 | return (TRUE); | 191 | return (TRUE); |
186 | 192 | ||
187 | return (FALSE); | 193 | return (FALSE); |
@@ -212,11 +218,13 @@ is_inet_addr (char *address) | |||
212 | return resolve_host_or_addr (address, AF_INET); | 218 | return resolve_host_or_addr (address, AF_INET); |
213 | } | 219 | } |
214 | 220 | ||
221 | #ifdef USE_IPV6 | ||
215 | int | 222 | int |
216 | is_inet6_addr (char *address) | 223 | is_inet6_addr (char *address) |
217 | { | 224 | { |
218 | return resolve_host_or_addr (address, AF_INET6); | 225 | return resolve_host_or_addr (address, AF_INET6); |
219 | } | 226 | } |
227 | #endif | ||
220 | 228 | ||
221 | /* from RFC-1035 | 229 | /* from RFC-1035 |
222 | * | 230 | * |
@@ -228,7 +236,11 @@ is_inet6_addr (char *address) | |||
228 | int | 236 | int |
229 | is_hostname (char *s1) | 237 | is_hostname (char *s1) |
230 | { | 238 | { |
239 | #ifdef USE_IPV6 | ||
231 | return resolve_host_or_addr (s1, AF_UNSPEC); | 240 | return resolve_host_or_addr (s1, AF_UNSPEC); |
241 | #else | ||
242 | return resolve_host_or_addr (s1, AF_INET); | ||
243 | #endif | ||
232 | } | 244 | } |
233 | 245 | ||
234 | int | 246 | int |
diff --git a/plugins/utils.h.in b/plugins/utils.h.in index 0d947f42..89ada6f0 100644 --- a/plugins/utils.h.in +++ b/plugins/utils.h.in | |||
@@ -30,7 +30,9 @@ int timeout_interval = DEFAULT_SOCKET_TIMEOUT; | |||
30 | int is_host (char *); | 30 | int is_host (char *); |
31 | int is_addr (char *); | 31 | int is_addr (char *); |
32 | int is_inet_addr (char *); | 32 | int is_inet_addr (char *); |
33 | #ifdef USE_IPV6 | ||
33 | int is_inet6_addr (char *); | 34 | int is_inet6_addr (char *); |
35 | #endif | ||
34 | int is_hostname (char *); | 36 | int is_hostname (char *); |
35 | 37 | ||
36 | int is_integer (char *); | 38 | int is_integer (char *); |