diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/idmap/sss_idmap_conv.c | 1 | ||||
-rw-r--r-- | src/util/crypto/libcrypto/crypto_sha512crypt.c | 2 | ||||
-rw-r--r-- | src/util/crypto/nss/nss_sha512crypt.c | 2 | ||||
-rw-r--r-- | src/util/murmurhash3.c | 13 | ||||
-rw-r--r-- | src/util/sss_endian.h | 57 | ||||
-rw-r--r-- | src/util/util.h | 19 |
6 files changed, 62 insertions, 32 deletions
diff --git a/src/lib/idmap/sss_idmap_conv.c b/src/lib/idmap/sss_idmap_conv.c index ef93f2a9f..fd06b23dd 100644 --- a/src/lib/idmap/sss_idmap_conv.c +++ b/src/lib/idmap/sss_idmap_conv.c @@ -30,6 +30,7 @@ #include "lib/idmap/sss_idmap.h" #include "lib/idmap/sss_idmap_private.h" #include "util/util.h" +#include "util/sss_endian.h" #define SID_ID_AUTHS 6 #define SID_SUB_AUTHS 15 diff --git a/src/util/crypto/libcrypto/crypto_sha512crypt.c b/src/util/crypto/libcrypto/crypto_sha512crypt.c index f4c3e0dae..88628b686 100644 --- a/src/util/crypto/libcrypto/crypto_sha512crypt.c +++ b/src/util/crypto/libcrypto/crypto_sha512crypt.c @@ -12,7 +12,6 @@ #include "config.h" -#include <endian.h> #include <errno.h> #include <limits.h> #include <stdbool.h> @@ -24,6 +23,7 @@ #include <sys/types.h> #include "util/util.h" +#include "util/sss_endian.h" #include <openssl/evp.h> #include <openssl/rand.h> diff --git a/src/util/crypto/nss/nss_sha512crypt.c b/src/util/crypto/nss/nss_sha512crypt.c index 76eb8a635..2838c4716 100644 --- a/src/util/crypto/nss/nss_sha512crypt.c +++ b/src/util/crypto/nss/nss_sha512crypt.c @@ -10,7 +10,6 @@ #include "config.h" -#include <endian.h> #include <errno.h> #include <limits.h> #include <stdbool.h> @@ -22,6 +21,7 @@ #include <sys/types.h> #include "util/util.h" +#include "util/sss_endian.h" #include "util/crypto/nss/nss_util.h" #include <prinit.h> diff --git a/src/util/murmurhash3.c b/src/util/murmurhash3.c index 80e52ed56..cab138e17 100644 --- a/src/util/murmurhash3.c +++ b/src/util/murmurhash3.c @@ -8,19 +8,10 @@ #include <stdlib.h> #include <stdint.h> -#include <endian.h> #include <string.h> -#include <byteswap.h> - -/* support RHEL5 lack of definitions */ -#ifndef le32toh -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define le32toh(x) (x) -# else -# define le32toh(x) bswap_32 (x) -# endif -#endif +#include "config.h" +#include "util/sss_endian.h" static uint32_t rotl(uint32_t x, int8_t r) { diff --git a/src/util/sss_endian.h b/src/util/sss_endian.h new file mode 100644 index 000000000..952f8e1aa --- /dev/null +++ b/src/util/sss_endian.h @@ -0,0 +1,57 @@ +/* + SSSD + + Authors: + Lukas Slebodnik <lslebodn@redhat.com> + + Copyright (C) 2013 Red Hat + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef SSS_ENDIAN_H_ +#define SSS_ENDIAN_H_ + +#ifdef HAVE_ENDIAN_H +# include <endian.h> +#elif defined HAVE_SYS_ENDIAN_H +# include <sys/endian.h> +#endif /* !HAVE_ENDIAN_H && !HAVE_SYS_ENDIAN_H */ + +/* Endianness-compatibility for systems running older versions of glibc */ + +#ifndef le32toh +#ifndef HAVE_BYTESWAP_H +#error missing le32toh and byteswap.h +#else /* defined HAVE_BYTESWAP_H */ +#include <byteswap.h> + +/* support RHEL5 lack of definitions */ +/* Copied from endian.h on glibc 2.15 */ +#ifdef __USE_BSD +/* Conversion interfaces. */ +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define le32toh(x) (x) +# define htole32(x) (x) +# else +# define le32toh(x) __bswap_32 (x) +# define htole32(x) __bswap_32 (x) +# endif +#endif /* __USE_BSD */ + +#endif /* HAVE_BYTESWAP_H */ + +#endif /* le32toh */ + +#endif /* SSS_ENDIAN_H_ */ diff --git a/src/util/util.h b/src/util/util.h index f350bc76e..516edc81c 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -564,25 +564,6 @@ errno_t sss_br_lock_file(int fd, size_t start, size_t len, int num_tries, useconds_t wait); #include "io.h" -/* Endianness-compatibility for systems running older versions of glibc */ - -#ifndef le32toh -#include <byteswap.h> - -/* Copied from endian.h on glibc 2.15 */ -#ifdef __USE_BSD -/* Conversion interfaces. */ -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define le32toh(x) (x) -# define htole32(x) (x) -# else -# define le32toh(x) __bswap_32 (x) -# define htole32(x) __bswap_32 (x) -# endif -#endif /* __USE_BSD */ - -#endif /* le32toh */ - #ifdef HAVE_PAC_RESPONDER #define BUILD_WITH_PAC_RESPONDER true #else |