]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/main.c
don't leak matchedDN
[openldap] / servers / slurpd / main.c
index d3522355b3617267ee536acf2f7dbc44cb6e3701..ccd75e7ed0398f6227fea53a7c2c87289fb394e4 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -156,10 +156,20 @@ int main( int argc, char **argv )
 
 #ifdef HAVE_TLS
        if( ldap_pvt_tls_init() || ldap_pvt_tls_init_def_ctx() ) {
-               fprintf( stderr, "TLS Initialization failed.\n" );
-               SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 );
-               rc = 1;
-               goto stop;
+               rc = 0;
+               /* See if we actually need TLS */
+               for ( i=0; i < sglob->num_replicas; i++ ) {
+                       if ( sglob->replicas[i]->ri_tls || ( sglob->replicas[i]->ri_uri &&
+                               !strncmp( sglob->replicas[i]->ri_uri, "ldaps:", 6 ))) {
+                               rc = 1;
+                               break;
+                       }
+               }
+               if ( rc ) {
+                       fprintf( stderr, "TLS Initialization failed.\n" );
+                       SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 );
+                       goto stop;
+               }
        }
 #endif