dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0002-test-avoid-endian-issues-in-network-tests.patch

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