Full_Name: Sergei Trofimovich Version: 2.4.44 OS: linux URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (81.154.9.158) When openldap package is being built in Gentoo GCC C compiler highlights a few problems of implicit function declaration usage as [1]. I've hacked up patches against current master: [2] Why those are problems? implicit function declarations mean the function type will be defaulted to int(int, int). For functions like int slap_sasl_cbinding( Connection *conn, struct berval *cbv ); it might cause pointer-to-int truncation on 64-bit platforms. Simplest way to reproduce the failure is to switch warning into failure as: ./configure CFLAGS="-Werror=implicit-function-declaration" make Many projects enable -Werror=implicit-function-declaration by default to catch that type of failure at development time. Thank you! [1]: * QA Notice: Package triggers severe warnings which indicate that it * may exhibit random runtime failures. * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/libraries/libldap/open.c:251:7: warning: implicit declaration of function �ldap_is_ldapc_url�; did you mean �ldap_i s_ldapi_url�? [-Wimplicit-function-declaration] * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/libraries/libldap_r/thr_posix.c:93:9: warning: implicit declaration of function �pthread_setconcurrency�; did you m ean �pthread_setcanceltype�? [-Wimplicit-function-declaration] * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/libraries/libldap_r/thr_posix.c:107:9: warning: implicit declaration of function �pthread_getconcurrency�; did you mean �ldap_pvt_thread_get_concurrency�? [-Wimplicit-function-declaration] * open.c:251:7: warning: implicit declaration of function �ldap_is_ldapc_url�; did you mean �ldap_is_ldapi_url�? [-Wimplicit-function-declaration] * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/libraries/libldap/open.c:251:7: warning: implicit declaration of function �ldap_is_ldapc_url�; did you mean �ldap_i s_ldapi_url�? [-Wimplicit-function-declaration] * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/libraries/libldap_r/thr_posix.c:93:9: warning: implicit declaration of function �pthread_setconcurrency�; did you m ean �pthread_setcanceltype�? [-Wimplicit-function-declaration] * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/libraries/libldap_r/thr_posix.c:107:9: warning: implicit declaration of function �pthread_getconcurrency�; did you mean �ldap_pvt_thread_get_concurrency�? [-Wimplicit-function-declaration] * open.c:251:7: warning: implicit declaration of function �ldap_is_ldapc_url�; did you mean �ldap_is_ldapi_url�? [-Wimplicit-function-declaration] * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/servers/slapd/back-ldap/bind.c:722:2: warning: implicit declaration of function �slap_client_keepalive�; did you me an �slap_client_connect�? [-Wimplicit-function-declaration] * /tmp/portage-tmpdir/portage/net-nds/openldap-2.4.44/work/openldap-2.4.44/servers/slapd/back-meta/conn.c:424:2: warning: implicit declaration of function �slap_client_keepalive�; did you me an �slap_client_connect�? [-Wimplicit-function-declaration] * cloak.c:246:4: warning: implicit declaration of function �attr_clean�; did you mean �entry_clean�? [-Wimplicit-function-declaration] * Please do not file a Gentoo bug and instead report the above QA * issues directly to the upstream developers of this software. * Homepage: http://www.OpenLDAP.org/ [2]: http://dev.gentoo.org/~slyfox/patches/openldap/0001-tls2.c-fix-implicit-ldap_pvt_tls_get_peercert-functi.patch http://dev.gentoo.org/~slyfox/patches/openldap/0002-thr_posix.c-fix-implicit-function-declaration-for-pt.patch http://dev.gentoo.org/~slyfox/patches/openldap/0003-servers-slapd-config.c-fix-implicit-ldif_must_b64_en.patch http://dev.gentoo.org/~slyfox/patches/openldap/0004-servers-slapd-connection.c-fix-implicit-slap_sasl_cb.patch
On 19. juni 2017 23:19, slyfox@gentoo.org wrote: > Why those are problems? implicit function declarations mean the > function type will be defaulted to int(int, int). > For functions like > int slap_sasl_cbinding( Connection *conn, struct berval *cbv ); > it might cause pointer-to-int truncation on 64-bit platforms. No, implicit declarations are defaulted to int(), and function call args are not converted other than integer promotions. So it's not a problem when the function are called with args of the correct types. But yeah, it won't hurt to clean up. -- Hallvard
changed notes
has patch;openldap-scratch IPR not required
*** Issue 8869 has been marked as a duplicate of this issue. ***
*** Issue 8851 has been marked as a duplicate of this issue. ***
Created attachment 681 [details] 0001-tls2.c-fix-implicit-ldap_pvt_tls_get_peercert-functi.patch
Created attachment 682 [details] 0002-thr_posix.c-fix-implicit-function-declaration-for-pt.patch
Created attachment 683 [details] 0003-servers-slapd-config.c-fix-implicit-ldif_must_b64_en.patch
Created attachment 684 [details] 0004-servers-slapd-connection.c-fix-implicit-slap_sasl_cb.patch
https://git.openldap.org/openldap/openldap/-/merge_requests/10
Commits: • 57b7003a by Sergei Trofimovich at 2020-03-26T22:06:41+00:00 thr_posix.c: fix implicit function declaration for 'pthread_setconcurrency' thr_posix.c: In function 'ldap_pvt_thread_set_concurrency': thr_posix.c:96:9: error: implicit declaration of function 'pthread_setconcurrency' return pthread_setconcurrency( n ); ^~~~~~~~~~~~~~~~~~~~~~ pthread_setcanceltype Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>