Thursday, June 1, 2017

[389-commits] [389-ds-base] 01/01: Ticket 49268 - master branch fails on big endian systems

This is an automated email from the git hooks/post-receive script.

firstyear pushed a commit to branch 389-ds-base-1.3.6
in repository 389-ds-base.

commit bf342184b1d2b86ef1fed4ff5bd9ea50fcb43275
Author: William Brown <firstyear@redhat.com>
Date: Thu May 25 12:49:11 2017 +1000

Ticket 49268 - master branch fails on big endian systems

Bug Description: We had a number of tests that did not function
on a bigendian system, or a system with different pagesizes

Fix Description: Correct the tests to set the page size to a known
value. Fix the hashtest to use correct endianness for inputs.

https://pagure.io/389-ds-base/issue/49268

Author: wibrown

Review by: mreynolds, lslebodn (Thanks!)
---
configure.ac | 2 +-
src/libsds/external/csiphash/csiphash.c | 34 ++++++++++++---------------------
src/libsds/test/test_sds_csiphash.c | 10 +++++++++-
test/libslapd/spal/meminfo.c | 15 +++++++++++++++
4 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index ab9cb41..17831a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,7 @@ AC_PROG_LIBTOOL
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/socket.h sys/time.h syslog.h unistd.h mntent.h sys/sysinfo.h])
+AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/socket.h sys/time.h syslog.h unistd.h mntent.h sys/sysinfo.h sys/endian.h endian.h])

# These are *required* headers without option.
AC_CHECK_HEADERS([inttypes.h], [], AC_MSG_ERROR([unable to locate required header inttypes.h]))
diff --git a/src/libsds/external/csiphash/csiphash.c b/src/libsds/external/csiphash/csiphash.c
index 60066f9..d7a3c94 100644
--- a/src/libsds/external/csiphash/csiphash.c
+++ b/src/libsds/external/csiphash/csiphash.c
@@ -32,31 +32,21 @@
#include <inttypes.h>
#include <stddef.h> /* for size_t */

-#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
- __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-# define _le64toh(x) ((uint64_t)(x))
-#elif defined(_WIN32)
-/* Windows is always little endian, unless you're on xbox360
- http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx */
-# define _le64toh(x) ((uint64_t)(x))
-#elif defined(__APPLE__)
-# include <libkern/OSByteOrder.h>
-# define _le64toh(x) OSSwapLittleToHostInt64(x)
+#include <config.h>
+
+#if defined(HAVE_SYS_ENDIAN_H)
+# include <sys/endian.h>
+#elif defined(HAVE_ENDIAN_H)
+# include <endian.h>
#else
+# error platform header for endian detection not found.
+

No comments:

Post a Comment