From b4164ccf2e1fcd35097dbb67470a00cb3da00735 Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Sep 18 2018 12:33:20 +0000 Subject: Ticket 49954 - On s390x arch retrieved DB page size is stored as size_t rather than uint32_t Bug Description: The page size is retrieved from uint32_t dblayer_page_size. Later it is stored in a size_t variable with a cast. Depending on little/big endian the page size can be stored in the upper/lower bits of the 64bits variable. Later the variable is used to set the page size of a database file using the lower bits (uint32_t) that are zeroed. Fix Description: The BDB callback to set the pagesize, expects a a uint32_t. Make sure the field containing it is uint32_t (instead of size_t) as the page size is retrieved as a uint32_t as well (dblayer_page_size/BACK_INFO_INDEXPAGESIZE) https://pagure.io/389-ds-base/issue/49954 Reviewed by: Ludwig Krispen Platforms tested: F27 Flag Day: no Doc impact: no --- diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c index 89ae995..65801bc 100644 --- a/ldap/servers/plugins/replication/cl5_api.c +++ b/ldap/servers/plugins/replication/cl5_api.c @@ -1852,7 +1852,7 @@ _cl5AppInit(void) { int rc = -1; /* initialize to failure */ DB_ENV *dbEnv = NULL; - size_t pagesize = 0; + uint32_t pagesize = 0; int openflags = 0; char *cookie = NULL; Slapi_Backend *be = slapi_get_first_backend(&cookie); diff --git a/ldap/servers/plugins/replication/cl5_api.h b/ldap/servers/plugins/replication/cl5_api.h index 419dc2d..4331fdb 100644 --- a/ldap/servers/plugins/replication/cl5_api.h +++ b/ldap/servers/plugins/replication/cl5_api.h @@ -39,7 +39,7 @@ /* changelog configuration structure */ typedef struct cl5dbconfig { - size_t pageSize; /* page size in bytes */ + uint32_t pageSize; /* page size in bytes */ PRInt32 fileMode; /* file mode */ char *encryptionAlgorithm; /* nsslapd-encryptionalgorithm */ char *symmetricKey;