Issue 8676 - openldap source uses implicit function declarations
Summary: openldap source uses implicit function declarations
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.44
Hardware: All All
: --- normal
Target Milestone: 2.5.0
Assignee: Quanah Gibson-Mount
URL:
Keywords:
: 8851 8869 (view as issue list)
Depends on:
Blocks:
 
Reported: 2017-06-19 21:19 UTC by slyfox@gentoo.org
Modified: 2020-10-14 21:10 UTC (History)
2 users (show)

See Also:


Attachments
0001-tls2.c-fix-implicit-ldap_pvt_tls_get_peercert-functi.patch (1.03 KB, patch)
2020-03-23 20:00 UTC, Quanah Gibson-Mount
Details
0002-thr_posix.c-fix-implicit-function-declaration-for-pt.patch (1.00 KB, patch)
2020-03-23 20:00 UTC, Quanah Gibson-Mount
Details
0003-servers-slapd-config.c-fix-implicit-ldif_must_b64_en.patch (1021 bytes, patch)
2020-03-23 20:01 UTC, Quanah Gibson-Mount
Details
0004-servers-slapd-connection.c-fix-implicit-slap_sasl_cb.patch (1.03 KB, patch)
2020-03-23 20:02 UTC, Quanah Gibson-Mount
Details

Note You need to log in before you can comment on or make changes to this issue.
Description slyfox@gentoo.org 2017-06-19 21:19:46 UTC
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
Comment 1 Hallvard Furuseth 2017-06-20 13:44:45 UTC
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

Comment 2 Quanah Gibson-Mount 2017-09-11 16:46:56 UTC
changed notes
Comment 3 OpenLDAP project 2017-10-19 19:12:38 UTC
has patch;openldap-scratch
IPR not required
Comment 4 Quanah Gibson-Mount 2017-10-19 19:12:38 UTC
changed notes
Comment 5 Quanah Gibson-Mount 2020-03-23 19:16:50 UTC
*** Issue 8869 has been marked as a duplicate of this issue. ***
Comment 6 Quanah Gibson-Mount 2020-03-23 19:17:08 UTC
*** Issue 8851 has been marked as a duplicate of this issue. ***
Comment 7 Quanah Gibson-Mount 2020-03-23 20:00:26 UTC
Created attachment 681 [details]
0001-tls2.c-fix-implicit-ldap_pvt_tls_get_peercert-functi.patch
Comment 8 Quanah Gibson-Mount 2020-03-23 20:00:53 UTC
Created attachment 682 [details]
0002-thr_posix.c-fix-implicit-function-declaration-for-pt.patch
Comment 9 Quanah Gibson-Mount 2020-03-23 20:01:38 UTC
Created attachment 683 [details]
0003-servers-slapd-config.c-fix-implicit-ldif_must_b64_en.patch
Comment 10 Quanah Gibson-Mount 2020-03-23 20:02:05 UTC
Created attachment 684 [details]
0004-servers-slapd-connection.c-fix-implicit-slap_sasl_cb.patch
Comment 12 Quanah Gibson-Mount 2020-03-27 07:31:28 UTC
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>