]> git.sur5r.net Git - openldap/commitdiff
Add global_host_bv, why do we still have bare char *s lying around...
authorHoward Chu <hyc@openldap.org>
Sun, 19 Apr 2009 23:25:41 +0000 (23:25 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 19 Apr 2009 23:25:41 +0000 (23:25 +0000)
servers/slapd/config.c
servers/slapd/daemon.c
servers/slapd/main.c
servers/slapd/proto-slap.h

index e6c138b3ac66c5c726802a1107c1435f41977370..a343eae17401e5f9f1b399f0b9c3817916460434 100644 (file)
@@ -64,6 +64,7 @@ int           global_gentlehup = 0;
 int            global_idletimeout = 0;
 int            global_writetimeout = 0;
 char   *global_host = NULL;
+struct berval global_host_bv = BER_BVNULL;
 char   *global_realm = NULL;
 char   *sasl_host = NULL;
 char           **default_passwd_hash = NULL;
index 23193d149846e0efe5b42c7b78ccecaf57010f47..55681f47124044d5e29832d0cd16ac224f9bf808 100644 (file)
@@ -687,16 +687,16 @@ slapd_slp_init( const char* urls )
        for ( i = 0; slapd_srvurls[i] != NULL; i++ ) {
                if ( strcmp( slapd_srvurls[i], "ldap:///" ) == 0 ) {
                        slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
-                               strlen( global_host ) +
+                               global_host_bv.bv_len +
                                sizeof( LDAP_SRVTYPE_PREFIX ) );
                        strcpy( lutil_strcopy(slapd_srvurls[i],
-                               LDAP_SRVTYPE_PREFIX ), global_host );
+                               LDAP_SRVTYPE_PREFIX ), global_host_bv.bv_val );
                } else if ( strcmp( slapd_srvurls[i], "ldaps:///" ) == 0 ) {
                        slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
-                               strlen( global_host ) +
+                               global_host_bv.bv_len +
                                sizeof( LDAPS_SRVTYPE_PREFIX ) );
                        strcpy( lutil_strcopy(slapd_srvurls[i],
-                               LDAPS_SRVTYPE_PREFIX ), global_host );
+                               LDAPS_SRVTYPE_PREFIX ), global_host_bv.bv_val );
                }
        }
 
index b22e8b70f139c65beb1c76d52e92689e134126ce..64d1876dc747acac227ebdfe235662b0c51ab2d5 100644 (file)
@@ -699,6 +699,7 @@ unhandled_option:;
        Debug( LDAP_DEBUG_ANY, "%s", Versionstr, 0, 0 );
 
        global_host = ldap_pvt_get_fqdn( NULL );
+       ber_str2bv( global_host, 0, 0, &global_host_bv );
 
        if( check == CHECK_NONE && slapd_daemon_init( urls ) != 0 ) {
                rc = 1;
index ae2753483dc8d581ce059a180d4ba8af9b3ab35c..abf6593396b7c18374e0e0076b6473dd2ef4cab7 100644 (file)
@@ -1935,6 +1935,7 @@ LDAP_SLAPD_V (int)                global_gentlehup;
 LDAP_SLAPD_V (int)             global_idletimeout;
 LDAP_SLAPD_V (int)             global_writetimeout;
 LDAP_SLAPD_V (char *)  global_host;
+LDAP_SLAPD_V (struct berval)   global_host_bv;
 LDAP_SLAPD_V (char *)  global_realm;
 LDAP_SLAPD_V (char *)  sasl_host;
 LDAP_SLAPD_V (char **) default_passwd_hash;