From: Pierangelo Masarati Date: Mon, 12 Jun 2006 15:52:23 +0000 (+0000) Subject: address ITS#4586 X-Git-Tag: OPENLDAP_REL_ENG_2_4_3ALPHA~9^2~138 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7e275fdc2c8c93e0e29e98b3df9837372e777c9f;p=openldap address ITS#4586 --- diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index 27cd9c9adc..275b8aaf5b 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -605,6 +605,14 @@ log_cf_gen(ConfigArgs *c) case SLAP_CONFIG_EMIT: switch( c->type ) { case LOG_DB: + if ( li->li_db == NULL ) { + snprintf( c->msg, sizeof( c->msg ), + "accesslog: \"logdb \" must be specified" ); + Debug( LDAP_DEBUG_ANY, "%s: %s \"%s\"\n", + c->log, c->msg, c->value_dn.bv_val ); + rc = 1; + break; + } value_add( &c->rvalue_vals, li->li_db->be_suffix ); value_add( &c->rvalue_nvals, li->li_db->be_nsuffix ); break; @@ -690,7 +698,7 @@ log_cf_gen(ConfigArgs *c) ch_free( la ); } } else { - log_attr *la, **lp; + log_attr *la = NULL, **lp; int i; for ( lp = &li->li_oldattrs, i=0; i < c->valx; i++ ) { @@ -708,7 +716,8 @@ log_cf_gen(ConfigArgs *c) case LOG_DB: li->li_db = select_backend( &c->value_ndn, 0, 0 ); if ( !li->li_db ) { - sprintf( c->msg, "<%s> no matching backend found for suffix", + snprintf( c->msg, sizeof( c->msg ), + "<%s> no matching backend found for suffix", c->argv[0] ); Debug( LDAP_DEBUG_ANY, "%s: %s \"%s\"\n", c->log, c->msg, c->value_dn.bv_val ); @@ -1426,6 +1435,13 @@ accesslog_db_open( int rc; void *thrctx; + if ( li->li_db == NULL ) { + Debug( LDAP_DEBUG_ANY, + "accesslog: \"logdb \" must be specified.\n", + 0, 0, 0 ); + return 1; + } + if ( slapMode & SLAP_TOOL_MODE ) return 0;