ITS#4983: Partly revert tls_thread_self() paranoia from rev 1.154: Only

require that ldap_pvt_thread_t can be cast to u.long and is not wider.
ITS#5010: In ldap_X509dn2bv(), catch error return from ber_decode_oid().
This commit is contained in:
Hallvard Furuseth 2007-06-12 23:57:08 +00:00
parent ed0c9d223a
commit 90fe4bd927

View File

@ -406,16 +406,11 @@ static unsigned long tls_thread_self( void )
* is an integral type that fits in an unsigned long
*/
/* force an error if ldap_pvt_thread_t is not such a type */
enum {
ok =
3 / (ldap_pvt_thread_t)2 == 1 /* integer */
&& (ldap_pvt_thread_t)-1 > 0UL /* not too wide signed */
&& (ldap_pvt_thread_t)-2 < -1UL /* not too wide unsigned */
};
/* force an error if the ldap_pvt_thread_t type is too large */
enum { ok = sizeof( ldap_pvt_thread_t ) <= sizeof( unsigned long ) };
typedef struct { int dummy: ok ? 1 : -1; } Check[ok ? 1 : -1];
return ldap_pvt_thread_self();
return (unsigned long) ldap_pvt_thread_self();
}
static void tls_init_threads( void )
@ -3032,7 +3027,10 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func,
oid2.bv_val = oidptr;
oid2.bv_len = oidrem;
ber_decode_oid( &Oid, &oid2 );
if ( ber_decode_oid( &Oid, &oid2 ) < 0 ) {
rc = LDAP_DECODING_ERROR;
goto nomem;
}
oidname = find_oid( &oid2 );
if ( !oidname ) {
newAVA->la_attr = oid2;