Entry *e, *e_backend, *e_tmp;
int i;
struct monitorentrypriv *mp;
- struct berval *bv[2], val;
+ struct berval bv[2];
mi = ( struct monitorinfo * )be->be_private;
return( -1 );
}
- bv[0] = &val;
- bv[1] = NULL;
+ bv[1].bv_val = NULL;
e_tmp = NULL;
for ( i = nBackendInfo; i--; ) {
char buf[1024];
return( -1 );
}
- val.bv_val = bi->bi_type;
- val.bv_len = strlen( val.bv_val );
+ bv[0].bv_val = bi->bi_type;
+ bv[0].bv_len = strlen( bv[0].bv_val );
attr_merge( e, monitor_ad_desc, bv );
attr_merge( e_backend, monitor_ad_desc, bv );
Entry *e, *e_tmp, *e_conn;
struct monitorentrypriv *mp;
char buf[1024];
- struct berval val, *bv[2] = { &val, NULL };
+ struct berval bv[2];
assert( be != NULL );
return( -1 );
}
- val.bv_val = "0";
- val.bv_len = 1;
+ bv[1].bv_val = NULL;
+ bv[0].bv_val = "0";
+ bv[0].bv_len = 1;
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
}
snprintf( buf, sizeof( buf ), "%ld", n );
- ber_bvfree( a->a_vals[ 0 ] );
- a->a_vals[ 0 ] = ber_bvstrdup( buf );
+ free( a->a_vals[ 0 ].bv_val );
+ ber_str2bv( buf, 0, 1, a->a_vals );
}
return( 0 );
char buf2[22];
char buf3[22];
- struct berval val, *bv[2] = { &val, NULL };
+ struct berval bv[2];
Entry *e;
buf3
);
- val.bv_val = buf;
- val.bv_len = strlen( buf );
+ bv[1].bv_val = NULL;
+ bv[0].bv_val = buf;
+ bv[0].bv_len = strlen( buf );
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
int i;
struct monitorentrypriv *mp;
AttributeDescription *ad_nc = slap_schema.si_ad_namingContexts;
- struct berval val, *bv[2] = { &val, NULL };
+ struct berval bv[2];
assert( be != NULL );
assert( monitor_ad_desc != NULL );
return( -1 );
}
- val.bv_val = be->bd_info->bi_type;
- val.bv_len = strlen( val.bv_val );
+ bv[1].bv_val = NULL;
+ bv[0].bv_val = be->bd_info->bi_type;
+ bv[0].bv_len = strlen( bv[0].bv_val );
attr_merge( e, monitor_ad_desc, bv );
for ( j = 0; be->be_suffix[j]; j++ ) {
- val = *be->be_suffix[j];
+ bv[0] = *be->be_suffix[j];
attr_merge( e, ad_nc, bv );
attr_merge( e_database, ad_nc, bv );
struct monitorinfo *mi;
Entry *e;
int i;
- struct berval val, *bv[2] = { &val, NULL };
+ struct berval bv[2];
ldap_pvt_thread_mutex_init( &monitor_log_mutex );
return( -1 );
}
+ bv[1].bv_val = NULL;
+
/* initialize the debug level */
for ( i = 0; int_2_level[ i ].i != 0; i++ ) {
if ( int_2_level[ i ].i & ldap_syslog ) {
- val.bv_val = ( char * )int_2_level[ i ].s;
- val.bv_len = strlen( val.bv_val );
+ bv[0].bv_val = ( char * )int_2_level[ i ].s;
+ bv[0].bv_len = strlen( bv[0].bv_val );
attr_merge( e, monitor_ad_desc, bv );
}
{
int i;
- for ( i = 0; mod->sm_bvalues && mod->sm_bvalues[i] != NULL; i++ ) {
+ for ( i = 0; mod->sm_bvalues && mod->sm_bvalues[i].bv_val != NULL; i++ ) {
int l;
const char *s;
ber_len_t len;
- l = loglevel2int( mod->sm_bvalues[i]->bv_val );
+ l = loglevel2int( mod->sm_bvalues[i].bv_val );
if ( !l ) {
return LDAP_CONSTRAINT_VIOLATION;
}
s = int2loglevel( l );
len = strlen( s );
- assert( len == mod->sm_bvalues[i]->bv_len );
+ assert( len == mod->sm_bvalues[i].bv_len );
- AC_MEMCPY( mod->sm_bvalues[i]->bv_val, s, len );
+ AC_MEMCPY( mod->sm_bvalues[i].bv_val, s, len );
*newlevel |= l;
}
return LDAP_INAPPROPRIATE_MATCHING;
}
- for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
+ for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
int rc;
int j;
const char *text = NULL;
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
- mod->sm_bvalues[i],
+ &mod->sm_bvalues[i],
&asserted,
&text );
return rc;
}
- for ( j = 0; a->a_vals[j] != NULL; j++ ) {
+ for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH,
- a->a_vals[j], &asserted, &text );
+ &a->a_vals[j], &asserted, &text );
if ( rc == LDAP_SUCCESS && match == 0 ) {
free( asserted.bv_val );
/* no - add them */
if ( attr_merge( e, mod->sm_desc, mod->sm_bvalues ) != 0 ) {
- /* this should return result return of attr_merge */
+ /* this should return result of attr_merge */
return LDAP_OTHER;
}
}
/* find each value to delete */
- for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
+ for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
int rc;
const char *text = NULL;
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
- mod->sm_bvalues[i],
+ &mod->sm_bvalues[i],
&asserted,
&text );
if( rc != LDAP_SUCCESS ) return rc;
found = 0;
- for ( j = 0; a->a_vals[j] != NULL; j++ ) {
+ for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH,
- a->a_vals[j], &asserted, &text );
+ &a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match != 0 ) {
continue;
found = 1;
/* delete it */
- ber_bvfree( a->a_vals[j] );
- for ( k = j + 1; a->a_vals[k] != NULL; k++ ) {
+ free( a->a_vals[j].bv_val );
+ for ( k = j + 1; a->a_vals[k].bv_val != NULL; k++ ) {
a->a_vals[k - 1] = a->a_vals[k];
}
- a->a_vals[k - 1] = NULL;
+ a->a_vals[k - 1].bv_val = NULL;
break;
}
}
/* if no values remain, delete the entire attribute */
- if ( a->a_vals[0] == NULL ) {
+ if ( a->a_vals[0].bv_val == NULL ) {
/* should already be zero */
*newlevel = 0;
Entry *e, *e_tmp, *e_op;
struct monitorentrypriv *mp;
char buf[1024];
- struct berval val, *bv[2] = { &val, NULL };
+ struct berval bv[2];
assert( be != NULL );
return( -1 );
}
- val.bv_val = "0";
- val.bv_len = 1;
+ bv[1].bv_val = NULL;
+ bv[0].bv_val = "0";
+ bv[0].bv_len = 1;
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
return( -1 );
}
- val.bv_val = "0";
- val.bv_len = 1;
+ bv[0].bv_val = "0";
+ bv[0].bv_len = 1;
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
}
snprintf( buf, sizeof( buf ), "%ld", n );
- ber_bvfree( a->a_vals[ 0 ] );
- a->a_vals[ 0 ] = ber_bvstrdup( buf );
+ free( a->a_vals[ 0 ].bv_val );
+ ber_str2bv( buf, 0, 1, a->a_vals );
}
return( 0 );
int nconns, nwritewaiters, nreadwaiters;
Attribute *a;
- struct berval *bv[2], val, **b = NULL;
+ struct berval bv[2], *b = NULL;
char buf[1024];
char *str = NULL;
int num = 0;
- bv[0] = &val;
- bv[1] = NULL;
-
assert( mi != NULL );
assert( e != NULL );
- bv[0] = &val;
- bv[1] = NULL;
+ bv[1].bv_val = NULL;
nconns = nwritewaiters = nreadwaiters = 0;
for ( c = connection_first( &connindex );
snprintf( buf, sizeof( buf ), "%s=%d", str, num );
if ( ( a = attr_find( e->e_attrs, monitor_ad_desc ) ) != NULL ) {
- for ( b = a->a_vals; b[0] != NULL; b++ ) {
- if ( strncmp( b[0]->bv_val, str, strlen( str ) ) == 0 ) {
- ber_bvfree( b[0] );
- b[0] = ber_bvstrdup( buf );
+ for ( b = a->a_vals; b[0].bv_val != NULL; b++ ) {
+ if ( strncmp( b[0].bv_val, str, strlen( str ) ) == 0 ) {
+ free( b[0].bv_val );
+ ber_str2bv( buf, 0, 1, b );
break;
}
}
}
- if ( b == NULL || b[0] == NULL ) {
- val.bv_val = buf;
- val.bv_len = strlen( buf );
+ if ( b == NULL || b[0].bv_val == NULL ) {
+ bv[0].bv_val = buf;
+ bv[0].bv_len = strlen( buf );
attr_merge( e, monitor_ad_desc, bv );
}
int slimit,
int tlimit,
Filter *filter,
- const char *filterstr,
+ struct berval *filterstr,
AttributeName *attrs,
int attrsonly
)
Entry *e, *e_tmp, *e_sent;
struct monitorentrypriv *mp;
char buf[1024];
- struct berval val, *bv[2] = { &val, NULL };
+ struct berval bv[2];
assert( be != NULL );
return( -1 );
}
- val.bv_val = "0";
- val.bv_len = 1;
+ bv[1].bv_val = NULL;
+ bv[0].bv_val = "0";
+ bv[0].bv_len = 1;
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
return( -1 );
}
- val.bv_val = "0";
- val.bv_len = 1;
+ bv[0].bv_val = "0";
+ bv[0].bv_len = 1;
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
return( -1 );
}
- val.bv_val = "0";
- val.bv_len = 1;
+ bv[0].bv_val = "0";
+ bv[0].bv_len = 1;
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
return( -1 );
}
- val.bv_val = "0";
- val.bv_len = 1;
+ bv[0].bv_val = "0";
+ bv[0].bv_len = 1;
attr_merge( e, monitor_ad_desc, bv );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
}
snprintf( buf, sizeof( buf ), "%ld", n );
- ber_bvfree( a->a_vals[ 0 ] );
- a->a_vals[ 0 ] = ber_bvstrdup( buf );
+ free( a->a_vals[ 0 ].bv_val );
+ ber_str2bv( buf, 0, 1, a->a_vals );
}
return( 0 );
{
struct monitorinfo *mi;
Entry *e;
- struct berval val, *bv[2] = { &val, NULL };
+ struct berval bv[2];
static char buf[1024];
mi = ( struct monitorinfo * )be->be_private;
/* initialize the thread number */
snprintf( buf, sizeof( buf ), "max=%d", connection_pool_max );
- val.bv_val = buf;
- val.bv_len = strlen( val.bv_val );
+ bv[1].bv_val = NULL;
+ bv[0].bv_val = buf;
+ bv[0].bv_len = strlen( bv[0].bv_val );
attr_merge( e, monitor_ad_desc, bv );
)
{
Attribute *a;
- struct berval *bv[2], val, **b = NULL;
+ struct berval bv[2], *b = NULL;
char buf[1024];
- bv[0] = &val;
- bv[1] = NULL;
+ bv[1].bv_val = NULL;
snprintf( buf, sizeof( buf ), "backload=%d",
ldap_pvt_thread_pool_backload( &connection_pool ) );
if ( ( a = attr_find( e->e_attrs, monitor_ad_desc ) ) != NULL ) {
- for ( b = a->a_vals; b[0] != NULL; b++ ) {
- if ( strncmp( b[0]->bv_val, "backload=",
+ for ( b = a->a_vals; b[0].bv_val != NULL; b++ ) {
+ if ( strncmp( b[0].bv_val, "backload=",
sizeof( "backload=" ) - 1 ) == 0 ) {
- ber_bvfree( b[0] );
- b[0] = ber_bvstrdup( buf );
+ free( b[0].bv_val );
+ ber_str2bv( buf, 0, 1, &b[0] );
break;
}
}
}
- if ( b == NULL || b[0] == NULL ) {
- val.bv_val = buf;
- val.bv_len = strlen( buf );
+ if ( b == NULL || b[0].bv_val == NULL ) {
+ bv[0].bv_val = buf;
+ bv[0].bv_len = strlen( buf );
attr_merge( e, monitor_ad_desc, bv );
}