/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Copyright 2001-2005 The OpenLDAP Foundation.
* Portions Copyright 2001-2003 Pierangelo Masarati.
* All rights reserved.
*
#if defined(LDAP_SLAPI)
#include "slapi.h"
-static int monitor_back_add_plugin( Backend *be, Entry *e );
+static int monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e );
#endif /* defined(LDAP_SLAPI) */
#if defined(SLAPD_BDB)
#include "../back-ldbm/back-ldbm.h"
#endif /* defined(SLAPD_LDBM) */
+/* for PATH_MAX on some systems (e.g. Solaris) */
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif /* HAVE_LIMITS_H */
+#ifndef PATH_MAX
+#define PATH_MAX 4095
+#endif /* ! PATH_MAX */
+
static struct restricted_ops_t {
struct berval op;
unsigned int tag;
mp->mp_children = NULL;
ep = &mp->mp_children;
- for ( i = 0; i < nBackendDB; i++ ) {
+ i = -1;
+ LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
char buf[ BACKMONITOR_BUFSIZE ];
int j;
slap_overinfo *oi = NULL;
- BackendInfo *bi;
+ BackendInfo *bi, *bi2;
Entry *e;
- be = &backendDB[ i ];
+ i++;
bi = be->bd_info;
#if defined(SLAPD_LDAP)
if ( strcmp( bi->bi_type, "ldap" ) == 0 ) {
- struct ldapinfo *li = (struct ldapinfo *)be->be_private;
+ struct ldapinfo *li =
+ (struct ldapinfo *)be->be_private;
struct berval bv;
- bv.bv_val = li->url;
- bv.bv_len = strlen( bv.bv_val );
- attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI,
+ ber_str2bv( li->url, 0, 0, &bv );
+
+ attr_merge_normalize_one( e,
+ slap_schema.si_ad_labeledURI,
&bv, NULL );
}
#endif /* defined(SLAPD_LDAP) */
- for ( j = 0; j < nBackendInfo; j++ ) {
- if ( backendInfo[ j ].bi_type == bi->bi_type ) {
+ j = -1;
+ LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
+ j++;
+ if ( bi2->bi_type == bi->bi_type ) {
struct berval bv;
snprintf( buf, sizeof( buf ),
}
#if defined(LDAP_SLAPI)
- monitor_back_add_plugin( be, e );
+ monitor_back_add_plugin( mi, be, e );
#endif /* defined(LDAP_SLAPI) */
if ( oi != NULL ) {
if ( n < 0 || n >= nBackendDB )
return LDAP_NO_SUCH_OBJECT;
+ LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
+ if ( n == 0 ) break;
+ n--;
+ }
/* do not allow some changes on back-monitor (needs work)... */
- be = &backendDB[ n ];
if ( SLAP_MONITOR( be ) )
return LDAP_UNWILLING_TO_PERFORM;
#if defined(LDAP_SLAPI)
static int
-monitor_back_add_plugin( Backend *be, Entry *e_database )
+monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
{
Slapi_PBlock *pCurrentPB;
int i, rc = LDAP_SUCCESS;
- monitor_info_t *mi = ( monitor_info_t * )be->be_private;
if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
/*