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