/* log.c - deal with log subsystem */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Portions Copyright 2001-2003 Pierangelo Masarati.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
-/*
- * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
- *
- * This work has beed deveolped for the OpenLDAP Foundation
- * in the hope that it may be useful to the Open Source community,
- * but WITHOUT ANY WARRANTY.
- *
- * Permission is granted to anyone to use this software for any purpose
- * on any computer system, and to alter it and redistribute it, subject
- * to the following restrictions:
- *
- * 1. The author and SysNet s.n.c. are not responsible for the consequences
- * of use of this software, no matter how awful, even if they arise from
- * flaws in it.
- *
- * 2. The origin of this software must not be misrepresented, either by
- * explicit claim or by omission. Since few users ever read sources,
- * credits should appear in the documentation.
- *
- * 3. Altered versions must be plainly marked as such, and must not be
- * misrepresented as being the original software. Since few users
- * ever read sources, credits should appear in the documentation.
- * SysNet s.n.c. cannot be responsible for the consequences of the
- * alterations.
- *
- * 4. This notice may not be removed or altered.
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Pierangelo Masarati for inclusion
+ * in OpenLDAP Software.
*/
#include "portable.h"
struct berval s;
struct berval n;
} int_2_level[] = {
- { 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 } }
+ { LDAP_DEBUG_TRACE, BER_BVC("Trace"), BER_BVNULL },
+ { LDAP_DEBUG_PACKETS, BER_BVC("Packets"), BER_BVNULL },
+ { LDAP_DEBUG_ARGS, BER_BVC("Args"), BER_BVNULL },
+ { LDAP_DEBUG_CONNS, BER_BVC("Conns"), BER_BVNULL },
+ { LDAP_DEBUG_BER, BER_BVC("BER"), BER_BVNULL },
+ { LDAP_DEBUG_FILTER, BER_BVC("Filter"), BER_BVNULL },
+ { LDAP_DEBUG_CONFIG, BER_BVC("Config"), BER_BVNULL }, /* useless */
+ { LDAP_DEBUG_ACL, BER_BVC("ACL"), BER_BVNULL },
+ { LDAP_DEBUG_STATS, BER_BVC("Stats"), BER_BVNULL },
+ { LDAP_DEBUG_STATS2, BER_BVC("Stats2"), BER_BVNULL },
+ { LDAP_DEBUG_SHELL, BER_BVC("Shell"), BER_BVNULL },
+ { LDAP_DEBUG_PARSE, BER_BVC("Parse"), BER_BVNULL },
+ { LDAP_DEBUG_CACHE, BER_BVC("Cache"), BER_BVNULL },
+ { LDAP_DEBUG_INDEX, BER_BVC("Index"), BER_BVNULL },
+ { 0, BER_BVNULL, BER_BVNULL }
};
static int loglevel2int( struct berval *l );
struct berval desc[] = {
BER_BVC("This entry allows to set the log level runtime."),
BER_BVC("Set the attribute 'managedInfo' to the desired log levels."),
- { 0, NULL }
+ BER_BVNULL
};
ldap_pvt_thread_mutex_init( &monitor_log_mutex );
int rc;
rc = (*mi->mi_ad_managedInfo->ad_type->sat_equality->smr_normalize)(
- 0,
+ SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
mi->mi_ad_managedInfo->ad_type->sat_syntax,
mi->mi_ad_managedInfo->ad_type->sat_equality,
&int_2_level[ i ].s,
*/
if ( is_at_operational( mod->sm_desc->ad_type ) ) {
( void ) attr_delete( &e->e_attrs, mod->sm_desc );
- rc = attr_merge( e, mod->sm_desc, mod->sm_bvalues,
- mod->sm_nvalues );
+ rc = attr_merge( e, mod->sm_desc, mod->sm_values, mod->sm_nvalues );
if ( rc != 0 ) {
rc = LDAP_OTHER;
break;
{
int i;
- for ( i = 0; mod->sm_bvalues && mod->sm_bvalues[i].bv_val != NULL; i++ ) {
+ for ( i = 0; mod->sm_values && mod->sm_values[i].bv_val != NULL; i++ ) {
int l;
- l = loglevel2int( &mod->sm_bvalues[i] );
+ l = loglevel2int( &mod->sm_values[i] );
if ( !l ) {
return LDAP_CONSTRAINT_VIOLATION;
}
}
assert( int_2_level[ l ].s.bv_len
- == mod->sm_bvalues[i].bv_len );
+ == mod->sm_values[i].bv_len );
- AC_MEMCPY( mod->sm_bvalues[i].bv_val,
+ AC_MEMCPY( mod->sm_values[i].bv_val,
int_2_level[ l ].s.bv_val,
int_2_level[ l ].s.bv_len );
return LDAP_INAPPROPRIATE_MATCHING;
}
- for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
+ for ( i = 0; mod->sm_values[i].bv_val != NULL; i++ ) {
int rc;
int j;
const char *text = NULL;
rc = asserted_value_validate_normalize(
mod->sm_desc, mr, SLAP_MR_EQUALITY,
- &mod->sm_bvalues[i], &asserted, &text, NULL );
+ &mod->sm_values[i], &asserted, &text, NULL );
if ( rc != LDAP_SUCCESS ) {
return rc;
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
int match;
int rc = value_match( &match, mod->sm_desc, mr,
- 0,
- &a->a_vals[j], &asserted, &text );
+ 0, &a->a_vals[j], &asserted, &text );
if ( rc == LDAP_SUCCESS && match == 0 ) {
free( asserted.bv_val );
}
/* no - add them */
- rc = attr_merge( e, mod->sm_desc, mod->sm_bvalues, mod->sm_nvalues );
+ rc = attr_merge( e, mod->sm_desc, mod->sm_values, mod->sm_nvalues );
if ( rc != LDAP_SUCCESS ) {
/* this should return result of attr_mergeit */
return rc;
*newlevel &= ~nl;
/* delete the entire attribute */
- if ( mod->sm_bvalues == NULL ) {
+ if ( mod->sm_values == NULL ) {
int rc = attr_delete( &e->e_attrs, mod->sm_desc );
if ( rc ) {
}
/* find each value to delete */
- for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
+ for ( i = 0; mod->sm_values[i].bv_val != NULL; i++ ) {
int rc;
const char *text = NULL;
rc = asserted_value_validate_normalize(
mod->sm_desc, mr, SLAP_MR_EQUALITY,
- &mod->sm_bvalues[i], &asserted, &text, NULL );
+ &mod->sm_values[i], &asserted, &text, NULL );
if( rc != LDAP_SUCCESS ) return rc;
return rc;
}
- if ( mod->sm_bvalues != NULL ) {
- rc = attr_merge( e, mod->sm_desc, mod->sm_bvalues,
- mod->sm_nvalues );
+ if ( mod->sm_values != NULL ) {
+ rc = attr_merge( e, mod->sm_desc, mod->sm_values, mod->sm_nvalues );
if ( rc != LDAP_SUCCESS ) {
return rc;
}