diff options
Diffstat (limited to 'recipes-support/openldap/openldap-2.4.39/getaddrinfo-is-threadsafe.patch')
| -rw-r--r-- | recipes-support/openldap/openldap-2.4.39/getaddrinfo-is-threadsafe.patch | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/recipes-support/openldap/openldap-2.4.39/getaddrinfo-is-threadsafe.patch b/recipes-support/openldap/openldap-2.4.39/getaddrinfo-is-threadsafe.patch new file mode 100644 index 0000000..ab6e2b7 --- /dev/null +++ b/recipes-support/openldap/openldap-2.4.39/getaddrinfo-is-threadsafe.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | Author: Steve Langasek <vorlon@debian.org> | ||
| 2 | |||
| 3 | OpenLDAP upstream conservatively assumes that certain resolver functions | ||
| 4 | (getaddrinfo, getnameinfo, res_query, dn_expand) are not re-entrant; but we | ||
| 5 | know that the glibc implementations of these functions are thread-safe, so | ||
| 6 | we should bypass the use of this mutex. This fixes a locking problem when | ||
| 7 | an application uses libldap and libnss-ldap is also used for hosts | ||
| 8 | resolution. | ||
| 9 | |||
| 10 | Closes Debian bug #340601. | ||
| 11 | |||
| 12 | Not suitable for forwarding upstream; might be made suitable by adding a | ||
| 13 | configure-time check for glibc and disabling the mutex only on known | ||
| 14 | thread-safe implementations. | ||
| 15 | |||
| 16 | --- a/libraries/libldap/os-ip.c | ||
| 17 | +++ b/libraries/libldap/os-ip.c | ||
| 18 | @@ -602,13 +602,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf * | ||
| 19 | hints.ai_socktype = socktype; | ||
| 20 | snprintf(serv, sizeof serv, "%d", port ); | ||
| 21 | |||
| 22 | - /* most getaddrinfo(3) use non-threadsafe resolver libraries */ | ||
| 23 | - LDAP_MUTEX_LOCK(&ldap_int_resolv_mutex); | ||
| 24 | - | ||
| 25 | err = getaddrinfo( host, serv, &hints, &res ); | ||
| 26 | - | ||
| 27 | - LDAP_MUTEX_UNLOCK(&ldap_int_resolv_mutex); | ||
| 28 | - | ||
| 29 | if ( err != 0 ) { | ||
| 30 | osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n", | ||
| 31 | AC_GAI_STRERROR(err), 0, 0); | ||
| 32 | --- a/libraries/libldap/util-int.c | ||
| 33 | +++ b/libraries/libldap/util-int.c | ||
| 34 | @@ -431,9 +431,7 @@ int ldap_pvt_get_hname( | ||
| 35 | int rc; | ||
| 36 | #if defined( HAVE_GETNAMEINFO ) | ||
| 37 | |||
| 38 | - LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex ); | ||
| 39 | rc = getnameinfo( sa, len, name, namelen, NULL, 0, 0 ); | ||
| 40 | - LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex ); | ||
| 41 | if ( rc ) *err = (char *)AC_GAI_STRERROR( rc ); | ||
| 42 | return rc; | ||
| 43 | |||
