Bug#1078822: openldap FTBFS on 32bit architectures: ../../../../libraries/libldap/tls_g.c:951:57: error: passing argument 4 of 'gnutls_fingerprint' from incompatible pointer type [-Wincompatible-pointer-types]

Helmut Grohne helmut at subdivi.de
Fri Aug 16 20:32:42 BST 2024


Source: openldap
Version: 2.5.18+dfsg-2
Severity: serious
Tags: ftbfs upstream
User: helmutg at debian.org
Usertags: rebootstrap

Hi,

openldap fails to build from source on 32bit architectures. A build ends
as follows:

| /bin/bash ../../libtool  --mode=compile i686-linux-gnu-gcc -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I../../include        -I../../../../include   -Wdate-time -D_FORTIFY_SOURCE=2   -DLDAP_LIBRARY -c ../../../../libraries/libldap/tls_g.c
| libtool: compile:  i686-linux-gnu-gcc -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I../../include -I../../../../include -Wdate-time -D_FORTIFY_SOURCE=2 -DLDAP_LIBRARY -c ../../../../libraries/libldap/tls_g.c  -fPIC -DPIC -o .libs/tls_g.o
| ../../../../libraries/libldap/tls_g.c: In function 'tlsg_session_endpoint':
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_UNKNOWN' not handled in switch [-Wswitch]
|   832 |         switch (md) {
|       |         ^~~~~~
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_RMD160' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA256' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA384' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA512' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA224' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA3_224' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA3_256' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA3_384' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHA3_512' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_MD5_SHA1' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_GOSTR_94' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_STREEBOG_256' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_STREEBOG_512' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHAKE_128' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c:832:9: warning: enumeration value 'GNUTLS_DIG_SHAKE_256' not handled in switch [-Wswitch]
| ../../../../libraries/libldap/tls_g.c: In function 'tlsg_session_pinning':
| ../../../../libraries/libldap/tls_g.c:951:57: error: passing argument 4 of 'gnutls_fingerprint' from incompatible pointer type [-Wincompatible-pointer-types]
|   951 |                                         keyhash.bv_val, &keyhash.bv_len ) < 0 ) {
|       |                                                         ^~~~~~~~~~~~~~~
|       |                                                         |
|       |                                                         ber_len_t * {aka long unsigned int *}
| In file included from ../../../../libraries/libldap/tls_g.c:44:
| /usr/include/gnutls/gnutls.h:2408:32: note: expected 'size_t *' {aka 'unsigned int *'} but argument is of type 'ber_len_t *' {aka 'long unsigned int *'}
|  2408 |                        size_t *result_size);
|       |                        ~~~~~~~~^~~~~~~~~~~
| make[5]: *** [Makefile:432: tls_g.lo] Error 1
| make[5]: Leaving directory '/<<PKGBUILDDIR>>/debian/build/libraries/libldap'
| make[4]: *** [Makefile:312: all-common] Error 1
| make[4]: Leaving directory '/<<PKGBUILDDIR>>/debian/build/libraries'
| make[3]: *** [Makefile:320: all-common] Error 1
| make[3]: Leaving directory '/<<PKGBUILDDIR>>/debian/build'
| dh_auto_build: error: cd debian/build && make -j1 returned exit code 2
| make[2]: *** [debian/rules:82: override_dh_auto_build] Error 25
| make[2]: Leaving directory '/<<PKGBUILDDIR>>'
| make[1]: *** [debian/rules:54: build] Error 2
| make[1]: Leaving directory '/<<PKGBUILDDIR>>'
| make: *** [debian/rules:56: binary] Error 2
| dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

ber_len_t is typedef'ed in openldap as unsigned LBER_LEN_T, which is
AC_DEFINED as long. I'm not sure what a static AC_DEFINE in configure.ac
achieves, but that's what we have. On the other side, we have size_t,
which happens to be 32bit. Bummer. I suggest passing the 4th argument as
a temporary variable of type size_t and copying it from/to the target
structure after validating that it fits. If you happen to locate a patch
fixing this, please tell as I would like to cherry-pick it into
rebootstrap.git due to the low frequency of openldap uploads.

Helmut



More information about the Pkg-openldap-devel mailing list