]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#4586 from HEAD
authorHoward Chu <hyc@openldap.org>
Sat, 7 Oct 2006 21:45:08 +0000 (21:45 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 7 Oct 2006 21:45:08 +0000 (21:45 +0000)
servers/slapd/overlays/accesslog.c

index 9ac161000220813fc2cf9093beca958c5a06aa44..d47ae1d47aaebe687ef62e3452d7d89bed8390c1 100644 (file)
@@ -597,6 +597,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 <suffix>\" 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;
@@ -674,7 +682,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 );
@@ -1341,6 +1350,13 @@ accesslog_db_open(
        int rc;
        void *thrctx;
 
+       if ( li->li_db == NULL ) {
+               Debug( LDAP_DEBUG_ANY,
+                       "accesslog: \"logdb <suffix>\" must be specified.\n",
+                       0, 0, 0 );
+               return 1;
+       }
+
        if ( slapMode & SLAP_TOOL_MODE )
                return 0;