aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-06-03 13:36:58 +0000
committerWerner Koch <[email protected]>2022-06-03 13:36:58 +0000
commitcc1d475f98ba56971d7a3ab9f68213a125a38335 (patch)
tree99c875a9453c052bc989a7248d65b94f1e2fca2a
parentw32: Avoid warning about not including winsock2.h after windows.h (diff)
downloadgnupg-cc1d475f98ba56971d7a3ab9f68213a125a38335.tar.gz
gnupg-cc1d475f98ba56971d7a3ab9f68213a125a38335.zip
dirmngr,w32: Silence compiler warnings for the LDAP API.
--
-rw-r--r--dirmngr/dirmngr_ldap.c2
-rw-r--r--dirmngr/ks-engine-ldap.c7
-rw-r--r--dirmngr/ldap-url.c19
3 files changed, 26 insertions, 2 deletions
diff --git a/dirmngr/dirmngr_ldap.c b/dirmngr/dirmngr_ldap.c
index e37a0a847..ea0da6c9d 100644
--- a/dirmngr/dirmngr_ldap.c
+++ b/dirmngr/dirmngr_ldap.c
@@ -747,7 +747,7 @@ print_ldap_entries (LDAP *ld, LDAPMessage *msg, char *want_attr)
/* Fetch data from the server at LD using FILTER. */
static int
-fetch_ldap (LDAP *ld, const char *base, int scope, const char *filter)
+fetch_ldap (LDAP *ld, char *base, int scope, char *filter)
{
gpg_error_t err;
int lerr;
diff --git a/dirmngr/ks-engine-ldap.c b/dirmngr/ks-engine-ldap.c
index afc7f56ed..6bf19cb1f 100644
--- a/dirmngr/ks-engine-ldap.c
+++ b/dirmngr/ks-engine-ldap.c
@@ -544,8 +544,13 @@ my_ldap_connect (parsed_uri_t uri, LDAP **ldap_connp,
}
else if (bindname)
{
+
npth_unprotect ();
- lerr = ldap_simple_bind_s (ldap_conn, bindname, password);
+ /* Older Windows header dont have the const for the last two args.
+ * Thus we need to cast to avoid warnings. */
+ lerr = ldap_simple_bind_s (ldap_conn,
+ (char * const)bindname,
+ (char * const)password);
npth_protect ();
if (lerr != LDAP_SUCCESS)
{
diff --git a/dirmngr/ldap-url.c b/dirmngr/ldap-url.c
index 8308514d6..0cb5d4a27 100644
--- a/dirmngr/ldap-url.c
+++ b/dirmngr/ldap-url.c
@@ -100,6 +100,25 @@ void ldap_pvt_hex_unescape( char *s );
# define LDAP_SCOPE_DEFAULT -1
#endif
+#if __GNUC__
+# define MY_GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+#else
+# define MY_GCC_VERSION 0
+#endif
+
+
+/* Avoid warnings about strncpy usage. */
+#if MY_GCC_VERSION >= 80000
+# pragma GCC diagnostic ignored "-Wstringop-truncation"
+# pragma GCC diagnostic ignored "-Wstringop-overflow"
+#elif defined __clang__
+# pragma clang diagnostic ignored "-Wstringop-truncation"
+# pragma clang diagnostic ignored "-Wstringop-overflow"
+#endif
+
+
/* $OpenLDAP: pkg/ldap/libraries/libldap/charray.c,v 1.9.2.2 2003/03/03 17:10:04 kurt Exp $ */