mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
fix attr nvals & more improvements
This commit is contained in:
parent
9e66d3d1f0
commit
f73eddd426
14 changed files with 235 additions and 140 deletions
|
|
@ -203,6 +203,7 @@ struct monitorsubsys {
|
|||
extern struct monitorsubsys monitor_subsys[];
|
||||
|
||||
extern AttributeDescription *monitor_ad_desc;
|
||||
extern slap_mr_normalize_func *monitor_ad_normalize;
|
||||
extern BackendDB *be_monitor;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ monitor_subsys_backend_init(
|
|||
for ( i = nBackendInfo; i--; ) {
|
||||
char buf[1024];
|
||||
BackendInfo *bi;
|
||||
struct berval bv[ 2 ];
|
||||
struct berval bv, nbv;
|
||||
int rc;
|
||||
|
||||
bi = &backendInfo[i];
|
||||
|
||||
|
|
@ -106,20 +107,34 @@ monitor_subsys_backend_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[0].bv_val = bi->bi_type;
|
||||
bv[0].bv_len = strlen( bv[0].bv_val );
|
||||
bv[1].bv_val = NULL;
|
||||
bv.bv_val = bi->bi_type;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
attr_mergeit( e_backend, monitor_ad_desc, bv );
|
||||
nbv.bv_val = NULL;
|
||||
if ( monitor_ad_normalize ) {
|
||||
rc = monitor_ad_normalize(
|
||||
0,
|
||||
monitor_ad_desc->ad_type->sat_syntax,
|
||||
monitor_ad_desc->ad_type->sat_equality,
|
||||
&bv, &nbv );
|
||||
if ( rc ) {
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
attr_merge_one( e, monitor_ad_desc, &bv,
|
||||
nbv.bv_val ? &nbv : NULL );
|
||||
attr_merge_one( e_backend, monitor_ad_desc, &bv,
|
||||
nbv.bv_val ? &nbv : NULL );
|
||||
ch_free( nbv.bv_val );
|
||||
|
||||
if ( bi->bi_controls ) {
|
||||
int j;
|
||||
|
||||
for ( j = 0; bi->bi_controls[ j ]; j++ ) {
|
||||
bv[0].bv_val = bi->bi_controls[ j ];
|
||||
bv[0].bv_len = strlen( bv[0].bv_val );
|
||||
attr_mergeit( e, slap_schema.si_ad_supportedControl, bv );
|
||||
bv.bv_val = bi->bi_controls[ j ];
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
attr_merge_one( e, slap_schema.si_ad_supportedControl, &bv, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,15 +49,15 @@ monitor_back_compare( struct slap_op *op, struct slap_rep *rs)
|
|||
/* get entry with reader lock */
|
||||
monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
|
||||
if ( e == NULL ) {
|
||||
if ( matched ) {
|
||||
rs->sr_matched = ch_strdup( matched->e_dn );
|
||||
monitor_cache_release( mi, matched );
|
||||
}
|
||||
rs->sr_err = LDAP_NO_SUCH_OBJECT;
|
||||
|
||||
if ( matched ) {
|
||||
rs->sr_matched = matched->e_dn;
|
||||
}
|
||||
send_ldap_result( op, rs );
|
||||
|
||||
if ( matched ) {
|
||||
monitor_cache_release( mi, matched );
|
||||
rs->sr_matched = NULL;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ monitor_subsys_conn_init(
|
|||
Entry *e, *e_tmp, *e_conn;
|
||||
struct monitorentrypriv *mp;
|
||||
char buf[1024];
|
||||
struct berval bv[2];
|
||||
struct berval bv;
|
||||
|
||||
assert( be != NULL );
|
||||
|
||||
|
|
@ -102,10 +102,9 @@ monitor_subsys_conn_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -160,10 +159,9 @@ monitor_subsys_conn_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -257,7 +255,7 @@ conn_create(
|
|||
char buf2[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
char buf3[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
|
||||
struct berval bv[2];
|
||||
struct berval bv;
|
||||
|
||||
Entry *e;
|
||||
|
||||
|
|
@ -333,10 +331,9 @@ conn_create(
|
|||
buf3
|
||||
);
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = buf;
|
||||
bv[0].bv_len = strlen( buf );
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = buf;
|
||||
bv.bv_len = strlen( buf );
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
|
|||
|
|
@ -136,11 +136,11 @@ monitor_subsys_database_init(
|
|||
}
|
||||
|
||||
if ( be->be_flags & SLAP_BFLAG_MONITOR ) {
|
||||
attr_mergeit( e, ad_mc, be->be_suffix );
|
||||
attr_mergeit( e_database, ad_mc, be->be_suffix );
|
||||
attr_merge( e, ad_mc, be->be_suffix, be->be_nsuffix );
|
||||
attr_merge( e_database, ad_mc, be->be_suffix, be->be_nsuffix );
|
||||
} else {
|
||||
attr_mergeit( e, ad_nc, be->be_suffix );
|
||||
attr_mergeit( e_database, ad_nc, be->be_suffix );
|
||||
attr_merge( e, ad_nc, be->be_suffix, be->be_nsuffix );
|
||||
attr_merge( e_database, ad_nc, be->be_suffix, be->be_nsuffix );
|
||||
}
|
||||
|
||||
for ( j = nBackendInfo; j--; ) {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
* used by many functions to add description to entries
|
||||
*/
|
||||
AttributeDescription *monitor_ad_desc = NULL;
|
||||
slap_mr_normalize_func *monitor_ad_normalize = NULL;
|
||||
BackendDB *be_monitor = NULL;
|
||||
|
||||
/*
|
||||
|
|
@ -244,7 +245,7 @@ monitor_back_db_init(
|
|||
char buf[1024], *end_of_line;
|
||||
struct berval dn, ndn;
|
||||
const char *text;
|
||||
struct berval bv[2];
|
||||
struct berval bv;
|
||||
|
||||
/*
|
||||
* database monitor can be defined once only
|
||||
|
|
@ -281,8 +282,8 @@ monitor_back_db_init(
|
|||
return -1;
|
||||
}
|
||||
|
||||
ber_dupbv( &bv[0], &dn );
|
||||
ber_bvarray_add( &be->be_suffix, &bv[0] );
|
||||
ber_dupbv( &bv, &dn );
|
||||
ber_bvarray_add( &be->be_suffix, &bv );
|
||||
ber_bvarray_add( &be->be_nsuffix, &ndn );
|
||||
|
||||
mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 );
|
||||
|
|
@ -300,6 +301,10 @@ monitor_back_db_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
if ( monitor_ad_desc->ad_type->sat_equality ) {
|
||||
monitor_ad_normalize = monitor_ad_desc->ad_type->sat_equality->smr_normalize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create all the subsystem specific entries
|
||||
*/
|
||||
|
|
@ -417,15 +422,14 @@ monitor_back_db_init(
|
|||
#endif
|
||||
return( -1 );
|
||||
}
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = (char *) Versionstr;
|
||||
bv.bv_val = (char *) Versionstr;
|
||||
end_of_line = strchr( Versionstr, '\n' );
|
||||
if ( end_of_line ) {
|
||||
bv[0].bv_len = end_of_line - Versionstr;
|
||||
bv.bv_len = end_of_line - Versionstr;
|
||||
} else {
|
||||
bv[0].bv_len = strlen( Versionstr );
|
||||
bv.bv_len = strlen( Versionstr );
|
||||
}
|
||||
if ( attr_mergeit( e, monitor_ad_desc, bv ) ) {
|
||||
if ( attr_merge_one( e, monitor_ad_desc, &bv, NULL ) ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, CRIT,
|
||||
"unable to add description to '%s' entry\n",
|
||||
|
|
|
|||
|
|
@ -122,20 +122,54 @@ monitor_subsys_listener_init(
|
|||
|
||||
#ifdef HAVE_TLS
|
||||
if ( l[i]->sl_is_tls ) {
|
||||
struct berval bv[2];
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = "TLS";
|
||||
bv[0].bv_len = sizeof("TLS")-1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
struct berval bv, nbv;
|
||||
|
||||
bv.bv_val = "TLS";
|
||||
bv.bv_len = sizeof("TLS")-1;
|
||||
|
||||
nbv.bv_val = NULL;
|
||||
if ( monitor_ad_normalize ) {
|
||||
int rc;
|
||||
|
||||
rc = monitor_ad_normalize(
|
||||
0,
|
||||
monitor_ad_desc->ad_type->sat_syntax,
|
||||
monitor_ad_desc->ad_type->sat_equality,
|
||||
&bv, &nbv );
|
||||
if ( rc ) {
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
attr_merge_one( e, monitor_ad_desc, &bv,
|
||||
nbv.bv_val ? &nbv : NULL );
|
||||
ch_free( nbv.bv_val );
|
||||
}
|
||||
#endif /* HAVE_TLS */
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( l[i]->sl_is_udp ) {
|
||||
struct berval bv[2];
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = "UDP";
|
||||
bv[0].bv_len = sizeof("UDP")-1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
struct berval bv, nbv;
|
||||
|
||||
bv.bv_val = "UDP";
|
||||
bv.bv_len = sizeof("UDP")-1;
|
||||
|
||||
nbv.bv_val = NULL;
|
||||
if ( monitor_ad_normalize ) {
|
||||
int rc;
|
||||
|
||||
rc = monitor_ad_normalize(
|
||||
0,
|
||||
monitor_ad_desc->ad_type->sat_syntax,
|
||||
monitor_ad_desc->ad_type->sat_equality,
|
||||
&bv, &nbv );
|
||||
if ( rc ) {
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
attr_merge_one( e, monitor_ad_desc, &bv,
|
||||
nbv.bv_val ? &nbv : NULL );
|
||||
ch_free( nbv.bv_val );
|
||||
}
|
||||
#endif /* HAVE_TLS */
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <ac/string.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include <lber_pvt.h>
|
||||
#include "lutil.h"
|
||||
#include "ldif.h"
|
||||
#include "back-monitor.h"
|
||||
|
|
@ -49,27 +50,28 @@ ldap_pvt_thread_mutex_t monitor_log_mutex;
|
|||
|
||||
static struct {
|
||||
int i;
|
||||
const char *s;
|
||||
struct berval s;
|
||||
struct berval n;
|
||||
} int_2_level[] = {
|
||||
{ LDAP_DEBUG_TRACE, "Trace" },
|
||||
{ LDAP_DEBUG_PACKETS, "Packets" },
|
||||
{ LDAP_DEBUG_ARGS, "Args" },
|
||||
{ LDAP_DEBUG_CONNS, "Conns" },
|
||||
{ LDAP_DEBUG_BER, "BER" },
|
||||
{ LDAP_DEBUG_FILTER, "Filter" },
|
||||
{ LDAP_DEBUG_CONFIG, "Config" }, /* useless */
|
||||
{ LDAP_DEBUG_ACL, "ACL" },
|
||||
{ LDAP_DEBUG_STATS, "Stats" },
|
||||
{ LDAP_DEBUG_STATS2, "Stats2" },
|
||||
{ LDAP_DEBUG_SHELL, "Shell" },
|
||||
{ LDAP_DEBUG_PARSE, "Parse" },
|
||||
{ LDAP_DEBUG_CACHE, "Cache" },
|
||||
{ LDAP_DEBUG_INDEX, "Index" },
|
||||
{ 0, NULL }
|
||||
{ LDAP_DEBUG_TRACE, BER_BVC("Trace"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_PACKETS, BER_BVC("Packets"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_ARGS, BER_BVC("Args"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_CONNS, BER_BVC("Conns"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_BER, BER_BVC("BER"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_FILTER, BER_BVC("Filter"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_CONFIG, BER_BVC("Config"), { 0, NULL } }, /* useless */
|
||||
{ LDAP_DEBUG_ACL, BER_BVC("ACL"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_STATS, BER_BVC("Stats"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_STATS2, BER_BVC("Stats2"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_SHELL, BER_BVC("Shell"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_PARSE, BER_BVC("Parse"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_CACHE, BER_BVC("Cache"), { 0, NULL } },
|
||||
{ LDAP_DEBUG_INDEX, BER_BVC("Index"), { 0, NULL } },
|
||||
{ 0, { 0, NULL }, { 0, NULL } }
|
||||
};
|
||||
|
||||
static int loglevel2int( const char *str );
|
||||
static const char * int2loglevel( int n );
|
||||
static int loglevel2int( struct berval *l );
|
||||
static int int2loglevel( int n );
|
||||
|
||||
static int add_values( Entry *e, Modification *mod, int *newlevel );
|
||||
static int delete_values( Entry *e, Modification *mod, int *newlevel );
|
||||
|
|
@ -111,13 +113,27 @@ monitor_subsys_log_init(
|
|||
|
||||
bv[1].bv_val = NULL;
|
||||
|
||||
/* initialize the debug level */
|
||||
/* initialize the debug level(s) */
|
||||
for ( i = 0; int_2_level[ i ].i != 0; i++ ) {
|
||||
if ( int_2_level[ i ].i & ldap_syslog ) {
|
||||
bv[0].bv_val = ( char * )int_2_level[ i ].s;
|
||||
bv[0].bv_len = strlen( bv[0].bv_val );
|
||||
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
if ( monitor_ad_normalize ) {
|
||||
int rc;
|
||||
|
||||
rc = monitor_ad_normalize(
|
||||
0,
|
||||
monitor_ad_desc->ad_type->sat_syntax,
|
||||
monitor_ad_desc->ad_type->sat_equality,
|
||||
&int_2_level[ i ].s,
|
||||
&int_2_level[ i ].n );
|
||||
if ( rc ) {
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( int_2_level[ i ].i & ldap_syslog ) {
|
||||
attr_merge_one( e, monitor_ad_desc,
|
||||
&int_2_level[ i ].s,
|
||||
&int_2_level[ i ].n );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -239,12 +255,16 @@ cleanup:;
|
|||
}
|
||||
|
||||
static int
|
||||
loglevel2int( const char *str )
|
||||
loglevel2int( struct berval *l )
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; int_2_level[ i ].i != 0; i++ ) {
|
||||
if ( strcasecmp( str, int_2_level[ i ].s ) == 0 ) {
|
||||
if ( l->bv_len != int_2_level[ i ].s.bv_len ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( strcasecmp( l->bv_val, int_2_level[ i ].s.bv_val ) == 0 ) {
|
||||
return int_2_level[ i ].i;
|
||||
}
|
||||
}
|
||||
|
|
@ -252,18 +272,18 @@ loglevel2int( const char *str )
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
static int
|
||||
int2loglevel( int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; int_2_level[ i ].i != 0; i++ ) {
|
||||
if ( int_2_level[ i ].i == n ) {
|
||||
return int_2_level[ i ].s;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -273,19 +293,26 @@ check_constraints( Modification *mod, int *newlevel )
|
|||
|
||||
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] );
|
||||
if ( !l ) {
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
|
||||
s = int2loglevel( l );
|
||||
len = strlen( s );
|
||||
assert( len == mod->sm_bvalues[i].bv_len );
|
||||
if ( ( l = int2loglevel( l ) ) == -1 ) {
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
AC_MEMCPY( mod->sm_bvalues[i].bv_val, s, len );
|
||||
assert( int_2_level[ l ].s.bv_len
|
||||
== mod->sm_bvalues[i].bv_len );
|
||||
|
||||
AC_MEMCPY( mod->sm_bvalues[i].bv_val,
|
||||
int_2_level[ l ].s.bv_val,
|
||||
int_2_level[ l ].s.bv_len );
|
||||
|
||||
AC_MEMCPY( mod->sm_nvalues[i].bv_val,
|
||||
int_2_level[ l ].n.bv_val,
|
||||
int_2_level[ l ].n.bv_len );
|
||||
|
||||
*newlevel |= l;
|
||||
}
|
||||
|
|
@ -347,7 +374,8 @@ add_values( Entry *e, Modification *mod, int *newlevel )
|
|||
}
|
||||
|
||||
/* no - add them */
|
||||
if ( attr_mergeit( e, mod->sm_desc, mod->sm_bvalues ) != 0 ) {
|
||||
if ( attr_merge( e, mod->sm_desc, mod->sm_bvalues,
|
||||
mod->sm_nvalues ) != 0 ) {
|
||||
/* this should return result of attr_mergeit */
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
|
@ -472,7 +500,8 @@ replace_values( Entry *e, Modification *mod, int *newlevel )
|
|||
}
|
||||
|
||||
if ( mod->sm_bvalues != NULL &&
|
||||
attr_mergeit( e, mod->sm_desc, mod->sm_bvalues ) != 0 ) {
|
||||
attr_merge( e, mod->sm_desc, mod->sm_bvalues,
|
||||
mod->sm_nvalues ) != 0 ) {
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ monitor_back_modify( Operation *op, SlapReply *rs )
|
|||
if ( matched != NULL ) {
|
||||
rs->sr_matched = NULL;
|
||||
monitor_cache_release( mi, matched );
|
||||
return( 0 );
|
||||
}
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
if ( !acl_check_modlist( op, e, op->oq_modify.rs_modlist )) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ monitor_subsys_ops_init(
|
|||
Entry *e, *e_tmp, *e_op, *e_children;
|
||||
struct monitorentrypriv *mp;
|
||||
char buf[1024];
|
||||
struct berval bv[2];
|
||||
struct berval bv;
|
||||
int i;
|
||||
|
||||
assert( be != NULL );
|
||||
|
|
@ -121,10 +121,9 @@ monitor_subsys_ops_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -189,10 +188,9 @@ monitor_subsys_ops_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -257,9 +255,9 @@ monitor_subsys_ops_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -324,9 +322,9 @@ monitor_subsys_ops_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ monitor_subsys_readw_update_internal(
|
|||
int nconns, nwritewaiters, nreadwaiters;
|
||||
|
||||
Attribute *a;
|
||||
struct berval bv[2], *b = NULL;
|
||||
struct berval *b = NULL;
|
||||
char buf[1024];
|
||||
|
||||
char *str = NULL;
|
||||
|
|
@ -79,8 +79,6 @@ monitor_subsys_readw_update_internal(
|
|||
assert( mi != NULL );
|
||||
assert( e != NULL );
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
|
||||
nconns = nwritewaiters = nreadwaiters = 0;
|
||||
for ( c = connection_first( &connindex );
|
||||
c != NULL;
|
||||
|
|
@ -117,9 +115,28 @@ monitor_subsys_readw_update_internal(
|
|||
}
|
||||
|
||||
if ( b == NULL || b[0].bv_val == NULL ) {
|
||||
bv[0].bv_val = buf;
|
||||
bv[0].bv_len = strlen( buf );
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
struct berval bv, nbv;
|
||||
|
||||
bv.bv_val = buf;
|
||||
bv.bv_len = strlen( buf );
|
||||
|
||||
nbv.bv_val = NULL;
|
||||
if ( monitor_ad_normalize ) {
|
||||
int rc;
|
||||
|
||||
rc = monitor_ad_normalize(
|
||||
0,
|
||||
monitor_ad_desc->ad_type->sat_syntax,
|
||||
monitor_ad_desc->ad_type->sat_equality,
|
||||
&bv, &nbv );
|
||||
if ( rc ) {
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
attr_merge_one( e, monitor_ad_desc, &bv,
|
||||
nbv.bv_val ? &nbv : NULL );
|
||||
ch_free( nbv.bv_val );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
|
|
|||
|
|
@ -156,12 +156,14 @@ monitor_back_search( Operation *op, SlapReply *rs )
|
|||
if ( e == NULL ) {
|
||||
rs->sr_err = LDAP_NO_SUCH_OBJECT;
|
||||
if ( matched ) {
|
||||
rs->sr_matched = ch_strdup( matched->e_dn );
|
||||
monitor_cache_release( mi, matched );
|
||||
rs->sr_matched = matched->e_dn;
|
||||
}
|
||||
|
||||
send_ldap_result( op, rs );
|
||||
if ( matched ) {
|
||||
monitor_cache_release( mi, matched );
|
||||
rs->sr_matched = NULL;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ monitor_subsys_sent_init(
|
|||
Entry *e, *e_tmp, *e_sent;
|
||||
struct monitorentrypriv *mp;
|
||||
char buf[1024];
|
||||
struct berval bv[2];
|
||||
struct berval bv;
|
||||
|
||||
assert( be != NULL );
|
||||
|
||||
|
|
@ -99,10 +99,9 @@ monitor_subsys_sent_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -156,9 +155,9 @@ monitor_subsys_sent_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -212,9 +211,9 @@ monitor_subsys_sent_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
@ -268,9 +267,9 @@ monitor_subsys_sent_init(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
bv[0].bv_val = "0";
|
||||
bv[0].bv_len = 1;
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
bv.bv_val = "0";
|
||||
bv.bv_len = 1;
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
|
||||
e->e_private = ( void * )mp;
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ monitor_subsys_thread_init(
|
|||
{
|
||||
struct monitorinfo *mi;
|
||||
Entry *e;
|
||||
struct berval bv[2];
|
||||
static char buf[1024];
|
||||
struct berval bv;
|
||||
|
||||
mi = ( struct monitorinfo * )be->be_private;
|
||||
|
||||
|
|
@ -72,11 +72,10 @@ monitor_subsys_thread_init(
|
|||
/* initialize the thread number */
|
||||
snprintf( buf, sizeof( buf ), "max=%d", connection_pool_max );
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
bv[0].bv_val = buf;
|
||||
bv[0].bv_len = strlen( bv[0].bv_val );
|
||||
bv.bv_val = buf;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
|
||||
monitor_cache_release( mi, e );
|
||||
|
||||
|
|
@ -90,11 +89,9 @@ monitor_subsys_thread_update(
|
|||
)
|
||||
{
|
||||
Attribute *a;
|
||||
struct berval bv[2], *b = NULL;
|
||||
struct berval *b = NULL;
|
||||
char buf[1024];
|
||||
|
||||
bv[1].bv_val = NULL;
|
||||
|
||||
snprintf( buf, sizeof( buf ), "backload=%d",
|
||||
ldap_pvt_thread_pool_backload( &connection_pool ) );
|
||||
|
||||
|
|
@ -111,9 +108,11 @@ monitor_subsys_thread_update(
|
|||
}
|
||||
|
||||
if ( b == NULL || b[0].bv_val == NULL ) {
|
||||
bv[0].bv_val = buf;
|
||||
bv[0].bv_len = strlen( buf );
|
||||
attr_mergeit( e, monitor_ad_desc, bv );
|
||||
struct berval bv;
|
||||
|
||||
bv.bv_val = buf;
|
||||
bv.bv_len = strlen( buf );
|
||||
attr_merge_one( e, monitor_ad_desc, &bv, NULL );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
|
|
|||
Loading…
Reference in a new issue