From 88a0c39b341098f92725458b2055faaaf2bbad5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Wed, 20 May 2020 12:07:13 +0200 Subject: [PATCH] test: avoid endian issues in network tests --- src/tests/cmocka/test_nss_srv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tests/cmocka/test_nss_srv.c b/src/tests/cmocka/test_nss_srv.c index 2c91d0a23fe4ce6e66fee70da7501b0ec5f0feb8..3cd7809cf001f5f8ac68fcd191e05660b40cd267 100644 --- a/src/tests/cmocka/test_nss_srv.c +++ b/src/tests/cmocka/test_nss_srv.c @@ -35,6 +35,7 @@ #include "util/util_sss_idmap.h" #include "util/crypto/sss_crypto.h" #include "util/crypto/nss/nss_util.h" +#include "util/sss_endian.h" #include "db/sysdb_private.h" /* new_subdomain() */ #include "db/sysdb_iphosts.h" #include "db/sysdb_ipnetworks.h" @@ -5308,7 +5309,13 @@ struct netent test_netent = { .n_name = discard_const("test_network"), .n_aliases = discard_const(test_netent_aliases), .n_addrtype = AF_INET, +#if (__BYTE_ORDER == __LITTLE_ENDIAN) .n_net = 0x04030201 /* 1.2.3.4 */ +#elif (__BYTE_ORDER == __BIG_ENDIAN) + .n_net = 0x01020304 /* 1.2.3.4 */ +#else + #error "unknow endianess" +#endif }; static void mock_input_netbyname(const char *name) -- 2.20.1