From: Howard Chu Date: Sat, 3 Feb 2007 02:53:10 +0000 (+0000) Subject: Always initialize global_host X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~94 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0787d0c4346c7fa94803759c0fba2fe63bbbdd48;p=openldap Always initialize global_host --- diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index e215347f4c..9f86d3d130 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -583,28 +583,17 @@ slapd_slp_init( const char* urls ) /* 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 ); } } diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 1b653c6d51..b18b8e0e07 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -697,6 +697,8 @@ unhandled_option:; 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 ); @@ -830,12 +832,6 @@ unhandled_option:; } #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 );