diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-07-13 12:32:06 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-07-13 12:32:06 +0200 |
commit | bf8d139b2d8baa9864a3e54d4275b39be450a2f7 (patch) | |
tree | ab7df2a921d4cbf0749baf33c6032e7a3ad0e324 /libssh/connect.c | |
parent | 093983b80415bfbc79841b8d706fd1ce05362449 (diff) | |
download | libssh-bf8d139b2d8baa9864a3e54d4275b39be450a2f7.tar.gz libssh-bf8d139b2d8baa9864a3e54d4275b39be450a2f7.tar.xz libssh-bf8d139b2d8baa9864a3e54d4275b39be450a2f7.zip |
Enable conditional compiling for IP regex code.
Diffstat (limited to 'libssh/connect.c')
-rw-r--r-- | libssh/connect.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libssh/connect.c b/libssh/connect.c index 2a7e82c6..52c48c86 100644 --- a/libssh/connect.c +++ b/libssh/connect.c @@ -56,12 +56,13 @@ #error "Your system must have getaddrinfo()" #endif +#ifdef HAVE_REGCOMP /* don't declare gnu extended regexp's */ #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE #endif #include <regex.h> - +#endif /* HAVE_REGCOMP */ #ifdef _WIN32 static void sock_set_nonblocking(socket_t sock) { @@ -94,7 +95,7 @@ static void sock_set_blocking(socket_t sock) { } #endif /* _WIN32 */ - +#ifdef HAVE_REGCOMP static regex_t *ip_regex = NULL; /** @internal @@ -130,6 +131,14 @@ void ssh_regex_finalize(){ } } +#else /* HAVE_REGCOMP */ +int ssh_regex_init(){ + return 0; +} +void ssh_regex_finalize(){ +} +#endif + static int getai(SSH_SESSION *session, const char *host, int port, struct addrinfo **ai) { const char *service = NULL; struct addrinfo hints; @@ -148,11 +157,13 @@ static int getai(SSH_SESSION *session, const char *host, int port, struct addrin service = s_port; hints.ai_flags=AI_NUMERICSERV; } +#ifdef HAVE_REGCOMP if(regexec(ip_regex,host,0,NULL,0) == 0){ /* this is an IP address */ ssh_log(session,SSH_LOG_PACKET,"host %s matches an IP address",host); hints.ai_flags |= AI_NUMERICHOST; } +#endif return getaddrinfo(host, service, &hints, ai); } |