} else {
Debug( LDAP_DEBUG_CONFIG,
"Config: ** successfully added syncrepl \"%s\"\n",
- si->si_provideruri == NULL ? "(null)" : si->si_provideruri, 0, 0 );
+ BER_BVISNULL( &si->si_provideruri ) ?
+ "(null)" : si->si_provideruri.bv_val, 0, 0 );
if ( !si->si_schemachecking ) {
SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
}
STRLENOF( PROVIDERSTR "=" ) ) )
{
val = cargv[ i ] + STRLENOF( PROVIDERSTR "=" );
- si->si_provideruri = ch_strdup( val );
- si->si_provideruri_bv = (BerVarray)
- ch_calloc( 2, sizeof( struct berval ));
- ber_str2bv( si->si_provideruri, strlen( si->si_provideruri ),
- 1, &si->si_provideruri_bv[0] );
- si->si_provideruri_bv[1].bv_len = 0;
- si->si_provideruri_bv[1].bv_val = NULL;
+ ber_str2bv( val, 0, 1, &si->si_provideruri );
gots |= GOT_PROVIDER;
} else if ( !strncasecmp( cargv[ i ], STARTTLSSTR "=",
STRLENOF(STARTTLSSTR "=") ) )
typedef struct syncinfo_s {
struct slap_backend_db *si_be;
long si_rid;
- char *si_provideruri;
- BerVarray si_provideruri_bv;
+ struct berval si_provideruri;
#define SYNCINFO_TLS_OFF 0
#define SYNCINFO_TLS_ON 1
#define SYNCINFO_TLS_CRITICAL 2
psub = &si->si_be->be_nsuffix[0];
/* Init connection to master */
- rc = ldap_initialize( &si->si_ld, si->si_provideruri );
+ rc = ldap_initialize( &si->si_ld, si->si_provideruri.bv_val );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
"do_syncrep1: ldap_initialize failed (%s)\n",
- si->si_provideruri, 0, 0 );
+ si->si_provideruri.bv_val, 0, 0 );
return rc;
}
if( rc != LDAP_OPT_SUCCESS ) {
Debug( LDAP_DEBUG_ANY, "Error: ldap_set_option "
"(%s,SECPROPS,\"%s\") failed!\n",
- si->si_provideruri, si->si_secprops, 0 );
+ si->si_provideruri.bv_val, si->si_secprops, 0 );
goto done;
}
}
void
syncinfo_free( syncinfo_t *sie )
{
- if ( sie->si_provideruri ) {
- ch_free( sie->si_provideruri );
- }
- if ( sie->si_provideruri_bv ) {
- ber_bvarray_free( sie->si_provideruri_bv );
+ if ( !BER_BVISNULL( &sie->si_provideruri ) ) {
+ ch_free( sie->si_provideruri.bv_val );
}
if ( sie->si_binddn ) {
ch_free( sie->si_binddn );