/* find and expand INADDR_ANY URLs */
for ( i = 0; slapd_srvurls[i] != NULL; i++ ) {
if ( strcmp( slapd_srvurls[i], "ldap:///" ) == 0 ) {
- char *host = ldap_pvt_get_fqdn( NULL );
- if ( host != NULL ) {
- slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
- strlen( host ) +
- sizeof( LDAP_SRVTYPE_PREFIX ) );
- strcpy( lutil_strcopy(slapd_srvurls[i],
- LDAP_SRVTYPE_PREFIX ), host );
-
- ch_free( host );
- }
-
+ slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
+ strlen( global_host ) +
+ sizeof( LDAP_SRVTYPE_PREFIX ) );
+ strcpy( lutil_strcopy(slapd_srvurls[i],
+ LDAP_SRVTYPE_PREFIX ), global_host );
} else if ( strcmp( slapd_srvurls[i], "ldaps:///" ) == 0 ) {
- char *host = ldap_pvt_get_fqdn( NULL );
- if ( host != NULL ) {
- slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
- strlen( host ) +
- sizeof( LDAPS_SRVTYPE_PREFIX ) );
- strcpy( lutil_strcopy(slapd_srvurls[i],
- LDAPS_SRVTYPE_PREFIX ), host );
-
- ch_free( host );
- }
+ slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
+ strlen( global_host ) +
+ sizeof( LDAPS_SRVTYPE_PREFIX ) );
+ strcpy( lutil_strcopy(slapd_srvurls[i],
+ LDAPS_SRVTYPE_PREFIX ), global_host );
}
}
Debug( LDAP_DEBUG_ANY, "%s", Versionstr, 0, 0 );
+ global_host = ldap_pvt_get_fqdn( NULL );
+
if( check == CHECK_NONE && slapd_daemon_init( urls ) != 0 ) {
rc = 1;
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 16 );
}
#endif
-#ifdef HAVE_CYRUS_SASL
- if( global_host == NULL ) {
- global_host = ldap_pvt_get_fqdn( NULL );
- }
-#endif
-
(void) SIGNAL( LDAP_SIGUSR1, slap_sig_wake );
(void) SIGNAL( LDAP_SIGUSR2, slap_sig_shutdown );