]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#7295 don't init TLS threads by default
authorHoward Chu <hyc@openldap.org>
Sun, 21 Mar 2021 15:25:56 +0000 (15:25 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 21 Mar 2021 15:26:57 +0000 (15:26 +0000)
Do it explicitly in servers

include/ldap_pvt.h
libraries/libldap/tls2.c
servers/lloadd/main.c
servers/slapd/main.c

index 9d9d697ce7c55ba067377cab9925d611b29cc609..b05d452bcca7e3286996c0caa0ddded9a8e072f8 100644 (file)
@@ -426,7 +426,7 @@ LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldap *ld,
        int option, void *arg ));
 
 LDAP_F (void) ldap_pvt_tls_destroy LDAP_P(( void ));
-LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
+LDAP_F (int) ldap_pvt_tls_init LDAP_P(( int do_threads ));
 LDAP_F (int) ldap_pvt_tls_init_def_ctx LDAP_P(( int is_server ));
 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
 LDAP_F (int) ldap_pvt_tls_connect LDAP_P(( struct ldap *ld, Sockbuf *sb, const char *host ));
index fcf0da307a4ecf781b316490b4a8d4be47118d40..539fbfa8fb4de68505b8a48c3da6bcadbabcdf4f 100644 (file)
@@ -165,7 +165,7 @@ ldap_pvt_tls_destroy( void )
  * Called once per implementation.
  */
 static int
-tls_init(tls_impl *impl )
+tls_init(tls_impl *impl, int do_threads )
 {
        static int tls_initialized = 0;
 
@@ -177,9 +177,12 @@ tls_init(tls_impl *impl )
 
        if ( impl->ti_inited++ ) return 0;
 
+       if ( do_threads ) {
 #ifdef LDAP_R_COMPILE
-       impl->ti_thr_init();
+               impl->ti_thr_init();
 #endif
+       }
+
        return impl->ti_tls_init();
 }
 
@@ -187,9 +190,9 @@ tls_init(tls_impl *impl )
  * Initialize TLS subsystem. Called once per implementation.
  */
 int
-ldap_pvt_tls_init( void )
+ldap_pvt_tls_init( int do_threads )
 {
-       return tls_init( tls_imp );
+       return tls_init( tls_imp, do_threads );
 }
 
 /*
@@ -205,7 +208,7 @@ ldap_int_tls_init_ctx( struct ldapoptions *lo, int is_server )
        if ( lo->ldo_tls_ctx )
                return 0;
 
-       tls_init( ti );
+       tls_init( ti, 0 );
 
        if ( is_server && !lts.lt_certfile && !lts.lt_keyfile &&
                !lts.lt_cacertfile && !lts.lt_cacertdir &&
@@ -1102,7 +1105,7 @@ ldap_int_tls_start ( LDAP *ld, LDAPConn *conn, LDAPURLDesc *srv )
                host = "localhost";
        }
 
-       (void) tls_init( tls_imp );
+       (void) tls_init( tls_imp, 0 );
 
        /*
         * Use non-blocking io during SSL Handshake when a timeout is configured
index 4c80f5860b54614412a444cd33ecc69a3b8b0156..4412523682f866f40571686bda17dc9697f963cc 100644 (file)
@@ -707,7 +707,7 @@ unhandled_option:;
     }
 
 #ifdef HAVE_TLS
-    rc = ldap_pvt_tls_init();
+    rc = ldap_pvt_tls_init( 1 );
     if ( rc != 0 ) {
         Debug( LDAP_DEBUG_ANY, "main: "
                 "TLS init failed: %d\n",
index 8af74e8043737e4a5ce7137385332b0967a273fa..a5867350bcca9ea346d34e5876fd1a6d1045ff7f 100644 (file)
@@ -858,7 +858,7 @@ unhandled_option:;
        }
 
 #ifdef HAVE_TLS
-       rc = ldap_pvt_tls_init();
+       rc = ldap_pvt_tls_init( 1 );
        if( rc != 0) {
                Debug( LDAP_DEBUG_ANY,
                    "main: TLS init failed: %d\n",