Skip to content

Commit

Permalink
net-nds/openldap: fix more -Werror=incompatible-pointer-types cases
Browse files Browse the repository at this point in the history
Signed-off-by: Robin H. Johnson <[email protected]>
Closes: https://bugs.gentoo.org/show_bug.cgi?id=933875
  • Loading branch information
robbat2 committed Aug 25, 2024
1 parent 609b67d commit 5fffb10
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 2 deletions.
40 changes: 40 additions & 0 deletions net-nds/openldap/files/openldap-2.6.x-gnutls-pointer-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 634017950c1c920d0de63fffa5c52e621de1d603 Mon Sep 17 00:00:00 2001
From: Wang Mingyu <[email protected]>
Date: Wed, 26 Jun 2024 07:41:01 +0000
Subject: Fix incompatible pointer type error with gcc option
-Wincompatible-pointer-types

lib32-openldap do_compile failure with gcc-14:
| tls_g.c:971:57: error: passing argument 4 of 'gnutls_fingerprint' from incompatible pointer type [-Wincompatible-pointer-types]
| 971 | keyhash.bv_val, &keyhash.bv_len ) < 0 ) {
| | ^~~~~~~~~~~~~~~
| | |
| | ber_len_t * {aka long unsigned int *}
| In file included from tls_g.c:44:
| /usr/include/gnutls/gnutls.h:2406:32: note: expected 'size_t *' {aka 'unsigned int *'} but argument is of type 'ber_len_t *' {aka 'long unsigned int *'}
| 2406 | size_t *result_size);
| | ^~~

Upstream-Status: Submitted

Signed-off-by: Wang Mingyu <[email protected]>
---
libraries/libldap/tls_g.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/libldap/tls_g.c b/libraries/libldap/tls_g.c
index 7c23875..b4b487d 100644
--- a/libraries/libldap/tls_g.c
+++ b/libraries/libldap/tls_g.c
@@ -968,7 +968,7 @@ tlsg_session_pinning( LDAP *ld, tls_session *sess, char *hashalg, struct berval
keyhash.bv_len = gnutls_hash_get_len( alg );
keyhash.bv_val = LDAP_MALLOC( keyhash.bv_len );
if ( !keyhash.bv_val || gnutls_fingerprint( alg, &key,
- keyhash.bv_val, &keyhash.bv_len ) < 0 ) {
+ keyhash.bv_val, (size_t *)&keyhash.bv_len ) < 0 ) {
goto done;
}
} else {
--
2.34.1

71 changes: 71 additions & 0 deletions net-nds/openldap/files/openldap-2.6.x-slapd-pointer-types.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# https://git.openldap.org/openldap/openldap/-/commit/fb9e6a81bbee880549e7ec18f0a74ddddbd2d1ab.patch
From fb9e6a81bbee880549e7ec18f0a74ddddbd2d1ab Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <[email protected]>
Date: Tue, 6 Feb 2024 21:38:24 -0500
Subject: [PATCH] ITS#10171 - Explicitly cast private values

Fixes issues with -Werror=incompatible-pointer-types

Signed-off-by: Stephen Gallagher <[email protected]>
---
servers/slapd/config.c | 2 +-
servers/slapd/overlays/constraint.c | 2 +-
servers/slapd/overlays/dyngroup.c | 2 +-
servers/slapd/overlays/valsort.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/servers/slapd/config.c b/servers/slapd/config.c
index 80333f359c..987c862d91 100644
--- a/servers/slapd/config.c
+++ b/servers/slapd/config.c
@@ -151,7 +151,7 @@ int config_check_vals(ConfigTable *Conf, ConfigArgs *c, int check_only ) {
int rc, arg_user, arg_type, arg_syn, iarg;
unsigned uiarg;
long larg;
- size_t ularg;
+ unsigned long ularg;
ber_len_t barg;

if(Conf->arg_type == ARG_IGNORED) {
diff --git a/servers/slapd/overlays/constraint.c b/servers/slapd/overlays/constraint.c
index f939b37762..0d6156af4d 100644
--- a/servers/slapd/overlays/constraint.c
+++ b/servers/slapd/overlays/constraint.c
@@ -557,7 +557,7 @@ done:;
a2->restrict_filter = ap.restrict_filter;
a2->restrict_val = ap.restrict_val;

- for ( app = &on->on_bi.bi_private; *app; app = &(*app)->ap_next )
+ for ( app = (constraint **)&on->on_bi.bi_private; *app; app = &(*app)->ap_next )
/* Get to the end */ ;

a2->ap_next = *app;
diff --git a/servers/slapd/overlays/dyngroup.c b/servers/slapd/overlays/dyngroup.c
index 5d890d6650..e0e70af2d9 100644
--- a/servers/slapd/overlays/dyngroup.c
+++ b/servers/slapd/overlays/dyngroup.c
@@ -111,7 +111,7 @@ static int dgroup_cf( ConfigArgs *c )
*/
a2 = ch_malloc( sizeof(adpair) );

- for ( app = &on->on_bi.bi_private; *app; app = &(*app)->ap_next )
+ for ( app = (adpair **)&on->on_bi.bi_private; *app; app = &(*app)->ap_next )
/* Get to the end */ ;

a2->ap_mem = ap.ap_mem;
diff --git a/servers/slapd/overlays/valsort.c b/servers/slapd/overlays/valsort.c
index 3d998e2fcb..e251500d0b 100644
--- a/servers/slapd/overlays/valsort.c
+++ b/servers/slapd/overlays/valsort.c
@@ -201,7 +201,7 @@ valsort_cf_func(ConfigArgs *c) {
return(1);
}

- for ( vip = &on->on_bi.bi_private; *vip; vip = &(*vip)->vi_next )
+ for ( vip = (valsort_info **)&on->on_bi.bi_private; *vip; vip = &(*vip)->vi_next )
/* Get to the end */ ;

vi = ch_malloc( sizeof(valsort_info) );
--
GitLab

4 changes: 3 additions & 1 deletion net-nds/openldap/openldap-2.5.18.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.6.1-system-mdb.patch
"${FILESDIR}"/${PN}-2.6.1-cloak.patch
"${FILESDIR}"/${PN}-2.6.1-flags.patch
"${FILESDIR}"/${PN}-2.6.x-gnutls-pointer-error.patch
#"${FILESDIR}"/${PN}-2.6.x-slapd-pointer-types.patch # needs backport
)

openldap_filecount() {
Expand Down Expand Up @@ -417,7 +419,7 @@ multilib_src_configure() {
# error: passing argument 3 of ‘ldap_bv2rdn’ from incompatible pointer type
# [-Wincompatible-pointer-types]
# expected ‘char **’ but argument is of type ‘const char **’
append-flags $(test-flags-CC -Wno-error=incompatible-pointer-types)
#append-flags $(test-flags-CC -Wno-error=incompatible-pointer-types)

if use experimental ; then
# connectionless ldap per bug #342439
Expand Down
2 changes: 2 additions & 0 deletions net-nds/openldap/openldap-2.6.6-r2.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.6.1-flags.patch
"${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.patch
"${FILESDIR}"/${PN}-2.6.6-fix-type-mismatch-lloadd.patch
"${FILESDIR}"/${PN}-2.6.x-gnutls-pointer-error.patch
"${FILESDIR}"/${PN}-2.6.x-slapd-pointer-types.patch
)

openldap_filecount() {
Expand Down
4 changes: 3 additions & 1 deletion net-nds/openldap/openldap-2.6.8.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.6.1-flags.patch
"${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.patch
#"${FILESDIR}"/${PN}-2.6.6-fix-type-mismatch-lloadd.patch
"${FILESDIR}"/${PN}-2.6.x-gnutls-pointer-error.patch
#"${FILESDIR}"/${PN}-2.6.x-slapd-pointer-types.patch # included upstream
)

openldap_filecount() {
Expand Down Expand Up @@ -417,7 +419,7 @@ multilib_src_configure() {

# error: passing argument 3 of ‘ldap_bv2rdn’ from incompatible pointer type [-Wincompatible-pointer-types]
# expected ‘char **’ but argument is of type ‘const char **’
append-flags $(test-flags-CC -Wno-error=incompatible-pointer-types)
#append-flags $(test-flags-CC -Wno-error=incompatible-pointer-types)

if use experimental ; then
# connectionless ldap per bug #342439
Expand Down

0 comments on commit 5fffb10

Please sign in to comment.