]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/tls.c
Move serverID into a Global configuration section.
[openldap] / libraries / libldap / tls.c
index f0cda0de325db7377dc45b779d87409f4ec75ffa..a40601b784128c3f2f9db48e3a52ad20bf0048ec 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2007 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -307,6 +307,7 @@ tls_parse_ciphers( tls_ctx *ctx, char *suites )
                        /* unrecognized cipher suite */
                        return -1;
                }
+               ptr += len + 1;
        } while (end);
 
        /* Space for all 3 lists */
@@ -348,6 +349,7 @@ tls_parse_ciphers( tls_ctx *ctx, char *suites )
                                break;
                        }
                }
+               ptr += len + 1;
        } while (end);
        kx[nkx] = 0;
        cipher[ncipher] = 0;
@@ -406,16 +408,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 +3029,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;