aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-12-03 13:31:28 +0100
committerAndreas Schneider <asn@cryptomilk.org>2012-12-03 13:44:02 +0100
commit3896aa43ffe5d4e55f42065529ecaa8fdb39ed04 (patch)
treee3f48f7baf5aec95da17eb54cad28b1963fdae74
parentda8d44ccbaab21c9dedc258b6572f5514c6c9233 (diff)
downloadlibssh-3896aa43ffe5d4e55f42065529ecaa8fdb39ed04.tar.gz
libssh-3896aa43ffe5d4e55f42065529ecaa8fdb39ed04.tar.xz
libssh-3896aa43ffe5d4e55f42065529ecaa8fdb39ed04.zip
BUG 96: Guard ntohll() and htonll prototypes correctly.
-rw-r--r--ConfigureChecks.cmake1
-rw-r--r--config.h.cmake3
-rw-r--r--include/libssh/misc.h7
3 files changed, 10 insertions, 1 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index c5dd3d29..dba176ed 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -138,6 +138,7 @@ if (UNIX)
check_function_exists(select HAVE_SELECT)
check_function_exists(cfmakeraw HAVE_CFMAKERAW)
check_function_exists(ntohll HAVE_NTOHLL)
+ check_function_exists(htonll HAVE_HTONLL)
endif (UNIX)
set(LIBSSH_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "libssh required system libraries")
diff --git a/config.h.cmake b/config.h.cmake
index 03843e3e..4f0f9570 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -97,6 +97,9 @@
/* Define to 1 if you have the `ntohll' function. */
#cmakedefine HAVE_NTOHLL 1
+/* Define to 1 if you have the `htonll' function. */
+#cmakedefine HAVE_HTONLL 1
+
/*************************** LIBRARIES ***************************/
/* Define to 1 if you have the `crypto' library (-lcrypto). */
diff --git a/include/libssh/misc.h b/include/libssh/misc.h
index eb6c1afa..f9d06e33 100644
--- a/include/libssh/misc.h
+++ b/include/libssh/misc.h
@@ -34,9 +34,14 @@ int ssh_analyze_banner(ssh_session session, int server, int *ssh1, int *ssh2);
int ssh_is_ipaddr_v4(const char *str);
int ssh_is_ipaddr(const char *str);
+#ifndef HAVE_NTOHLL
/* macro for byte ordering */
uint64_t ntohll(uint64_t);
-#define htonll(x) ntohll(x)
+#endif
+
+#ifndef HAVE_HTONLL
+#define htonll(x) ntohll((x))
+#endif
/* list processing */