]> git.sur5r.net Git - openldap/commitdiff
(nearly blind) fix for NULL in TLS error message (ITS#6079)
authorPierangelo Masarati <ando@openldap.org>
Wed, 29 Apr 2009 11:31:39 +0000 (11:31 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 29 Apr 2009 11:31:39 +0000 (11:31 +0000)
libraries/libldap/ldap-int.h
libraries/libldap/tls2.c

index c4d1d3073cd5d107ec239208709364efc73f6095..48b6ccd298802634cad9c4696e8f186165bcc32d 100644 (file)
@@ -75,6 +75,9 @@
 
 #ifdef LDAP_DEBUG
 
+#define DebugTest( level ) \
+       ( ldap_debug & level )
+
 #define Debug( level, fmt, arg1, arg2, arg3 ) \
        do { if ( ldap_debug & level ) \
        ldap_log_printf( NULL, (level), (fmt), (arg1), (arg2), (arg3) ); \
@@ -85,6 +88,7 @@
 
 #else
 
+#define DebugTest( level )                                    (0 == 1)
 #define Debug( level, fmt, arg1, arg2, arg3 )                 ((void)0)
 #define LDAP_Debug( subsystem, level, fmt, arg1, arg2, arg3 ) ((void)0)
 
index 642cc118ebc88a17a026abdebb1e5feca6b4b3d6..851ffdad51171f58ee888e9ec1407d0b7d0f7d86 100644 (file)
@@ -434,11 +434,14 @@ ldap_pvt_tls_accept( Sockbuf *sb, void *ctx_arg )
 
        if ( err < 0 )
        {
-               char buf[256];
                if ( update_flags( sb, ssl, err )) return 1;
 
-               Debug( LDAP_DEBUG_ANY,"TLS: can't accept: %s.\n",
-                       tls_imp->ti_session_errmsg( err, buf, sizeof(buf) ),0,0 );
+               if ( DebugTest( LDAP_DEBUG_ANY ) ) {
+                       char buf[256], *msg;
+                       msg = tls_imp->ti_session_errmsg( err, buf, sizeof(buf) );
+                       Debug( LDAP_DEBUG_ANY,"TLS: can't accept: %s.\n",
+                               msg ? msg : "(unknown)", 0, 0 );
+               }
 
                ber_sockbuf_remove_io( sb, tls_imp->ti_sbio,
                        LBER_SBIOD_LEVEL_TRANSPORT );