dirmngr,w32: Silence compiler warnings for the LDAP API.

--
This commit is contained in:
Werner Koch 2022-06-03 15:36:58 +02:00
parent dfc01118ce
commit cc1d475f98
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 26 additions and 2 deletions

View File

@ -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;

View File

@ -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)
{

View File

@ -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 $ */