]> git.sur5r.net Git - openldap/commitdiff
ITS#4742 cleanup config error reporting
authorHoward Chu <hyc@openldap.org>
Sun, 12 Nov 2006 02:15:49 +0000 (02:15 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 12 Nov 2006 02:15:49 +0000 (02:15 +0000)
servers/slapd/overlays/accesslog.c
servers/slapd/overlays/constraint.c
servers/slapd/overlays/refint.c
servers/slapd/overlays/syncprov.c
servers/slapd/overlays/unique.c

index c7b7f5415b063e002c8e37889de3200e6f1d1ea0..57ee63f77d1f68595e4cf8d722dc9ae18c786ad0 100644 (file)
@@ -107,6 +107,7 @@ static ConfigTable log_cfats[] = {
        { "logoldattr", "attrs", 2, 0, 0, ARG_MAGIC|LOG_OLDATTR,
                log_cf_gen, "( OLcfgOvAt:4.6 NAME 'olcAccessLogOldAttr' "
                        "DESC 'Log old values of these attributes even if unmodified' "
+                       "EQUALITY caseIgnoreMatch "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
        { NULL }
 };
@@ -807,7 +808,10 @@ log_cf_gen(ConfigArgs *c)
                                        la->next = li->li_oldattrs;
                                        li->li_oldattrs = la;
                                } else {
-                                       sprintf( c->msg, "%s: %s", c->argv[i], text );
+                                       snprintf( c->msg, sizeof( c->msg ), "%s <%s>: %s",
+                                               c->argv[0], c->argv[i], text );
+                                       Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                                               "%s: %s\n", c->log, c->msg, 0 );
                                        rc = ARG_BAD_CONF;
                                        break;
                                }
index 7f33dd1cb3f63570ba1f81dfd00fc86a6609805f..feddb7a395290a7f5bc8017a6c9fd9c3ee35b559 100644 (file)
@@ -64,6 +64,7 @@ static ConfigTable constraintcfg[] = {
       4, 4, 0, ARG_MAGIC | CONSTRAINT_ATTRIBUTE, constraint_cf_gen,
       "( OLcfgOvAt:13.1 NAME 'olcConstraintAttribute' "
       "DESC 'regular expression constraint for attribute' "
+         "EQUALITY caseIgnoreMatch "
       "SYNTAX OMsDirectoryString )", NULL, NULL },
     { NULL, NULL, 0, 0, 0, ARG_IGNORED }
 };
@@ -168,9 +169,10 @@ constraint_cf_gen( ConfigArgs *c )
             switch (c->type) {
                 case CONSTRAINT_ATTRIBUTE:
                     if ( slap_str2ad( c->argv[1], &ap.ap, &text ) ) {
-                        Debug( LDAP_DEBUG_CONFIG,
-                               "constraint_add: <%s>: attribute description unknown %s.\n",
-                               c->argv[1], text, 0 );
+                                               snprintf( c->msg, sizeof( c->msg ),
+                                                       "%s <%s>: %s\n", c->argv[0], c->argv[1], text );
+                        Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                               "%s: %s\n", c->log, c->msg, 0 );
                         return( ARG_BAD_CONF );
                     }
 
@@ -184,17 +186,21 @@ constraint_cf_gen( ConfigArgs *c )
                             
                             regerror( err, ap.re, errmsg, sizeof(errmsg) );
                             ch_free(ap.re);
-                            Debug( LDAP_DEBUG_CONFIG,
-                                   "%s: Illegal regular expression \"%s\": Error %s\n",
-                                   c->argv[1], c->argv[3], errmsg);
+                                                       snprintf( c->msg, sizeof( c->msg ),
+                                   "%s %s: Illegal regular expression \"%s\": Error %s",
+                                   c->argv[0], c->argv[1], c->argv[3], errmsg);
+                            Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                                                                       "%s: %s\n", c->log, c->msg, 0 );
                             ap.re = NULL;
                             return( ARG_BAD_CONF );
                         }
                         ap.re_str = ch_strdup( c->argv[3] );
                     } else {
-                        Debug( LDAP_DEBUG_CONFIG,
-                               "%s: Unknown constraint type: %s\n",
-                               c->argv[1], c->argv[2], 0 );
+                                               snprintf( c->msg, sizeof( c->msg ),
+                               "%s %s: Unknown constraint type: %s",
+                               c->argv[0], c->argv[1], c->argv[2] );
+                        Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                               "%s: %s\n", c->log, c->msg, 0 );
                         return ( ARG_BAD_CONF );
                     }
                     
index ce4ecaa29c03f8679ef2a77403af59bfc7441e20..9709909082401b428fd4e19baa293b7b16dfb554 100644 (file)
@@ -96,6 +96,7 @@ static ConfigTable refintcfg[] = {
          ARG_MAGIC|REFINT_ATTRS, refint_cf_gen,
          "( OLcfgOvAt:11.1 NAME 'olcRefintAttribute' "
          "DESC 'Attributes for referential integrity' "
+         "EQUALITY caseIgnoreMatch "
          "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "refint_nothing", "string", 2, 2, 0,
          ARG_DN|ARG_MAGIC|REFINT_NOTHING, refint_cf_gen,
@@ -208,13 +209,10 @@ refint_cf_gen(ConfigArgs *c)
                                        ip->next = dd->attrs;
                                        dd->attrs = ip;
                                } else {
-                                       Debug ( LDAP_DEBUG_CONFIG,
-                                               "refint add: <%s>: %s\n",
-                                               c->argv[i], text, NULL );
-                                       strncpy ( c->msg,
-                                                 text,
-                                                 SLAP_TEXT_BUFLEN-1 );
-                                       c->msg[SLAP_TEXT_BUFLEN-1] = '\0';
+                                       snprintf( c->msg, sizeof( c->msg ),
+                                               "%s <%s>: %s", c->argv[0], c->argv[i], text );
+                                       Debug ( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                                               "%s: %s\n", c->log, c->msg, 0 );
                                        rc = ARG_BAD_CONF;
                                }
                        }
index 85aa485c3d5d61f663cee5d2b89d24b97be7c2dd..0050979217b89dc666887c4f7d5f72548f27dbec 100644 (file)
@@ -2281,27 +2281,31 @@ sp_cf_gen(ConfigArgs *c)
        switch ( c->type ) {
        case SP_CHKPT:
                if ( lutil_atoi( &si->si_chkops, c->argv[1] ) != 0 ) {
-                       sprintf( c->msg, "%s unable to parse checkpoint ops # \"%s\"",
+                       snprintf( c->msg, sizeof( c->msg ), "%s unable to parse checkpoint ops # \"%s\"",
                                c->argv[0], c->argv[1] );
-                       Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+                       Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                               "%s: %s\n", c->log, c->msg, 0 );
                        return ARG_BAD_CONF;
                }
                if ( si->si_chkops <= 0 ) {
-                       sprintf( c->msg, "%s invalid checkpoint ops # \"%d\"",
+                       snprintf( c->msg, sizeof( c->msg ), "%s invalid checkpoint ops # \"%d\"",
                                c->argv[0], si->si_chkops );
-                       Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+                       Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                               "%s: %s\n", c->log, c->msg, 0 );
                        return ARG_BAD_CONF;
                }
                if ( lutil_atoi( &si->si_chktime, c->argv[2] ) != 0 ) {
-                       sprintf( c->msg, "%s unable to parse checkpoint time \"%s\"",
+                       snprintf( c->msg, sizeof( c->msg ), "%s unable to parse checkpoint time \"%s\"",
                                c->argv[0], c->argv[1] );
-                       Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+                       Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                               "%s: %s\n", c->log, c->msg, 0 );
                        return ARG_BAD_CONF;
                }
                if ( si->si_chktime <= 0 ) {
-                       sprintf( c->msg, "%s invalid checkpoint time \"%d\"",
+                       snprintf( c->msg, sizeof( c->msg ), "%s invalid checkpoint time \"%d\"",
                                c->argv[0], si->si_chkops );
-                       Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+                       Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                               "%s: %s\n", c->log, c->msg, 0 );
                        return ARG_BAD_CONF;
                }
                si->si_chktime *= 60;
@@ -2311,9 +2315,10 @@ sp_cf_gen(ConfigArgs *c)
                int size = c->value_int;
 
                if ( size < 0 ) {
-                       sprintf( c->msg, "%s size %d is negative",
+                       snprintf( c->msg, sizeof( c->msg ), "%s size %d is negative",
                                c->argv[0], size );
-                       Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+                       Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                               "%s: %s\n", c->log, c->msg, 0 );
                        return ARG_BAD_CONF;
                }
                sl = si->si_logs;
index 401f1840849d8d13f1493512daa02e93a7e92fe6..f54fe4fcfa27b12b4330a1dc87caae6b9943ae5c 100644 (file)
@@ -68,10 +68,12 @@ static ConfigTable uniquecfg[] = {
        { "unique_ignore", "attribute...", 2, 0, 0, ARG_MAGIC|UNIQUE_IGNORE,
          unique_cf_gen, "( OLcfgOvAt:10.2 NAME 'olcUniqueIgnore' "
          "DESC 'Attributes for which uniqueness shall not be enforced' "
+         "EQUALITY caseIgnoreMatch "   /* Should use OID syntax */
          "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "unique_attributes", "attribute...", 2, 0, 0, ARG_MAGIC|UNIQUE_ATTR,
          unique_cf_gen, "( OLcfgOvAt:10.3 NAME 'olcUniqueAttribute' "
          "DESC 'Attributes for which uniqueness shall be enforced' "
+         "EQUALITY caseIgnoreMatch "
          "SYNTAX OMsDirectoryString )", NULL, NULL },
        { "unique_strict", "on|off", 1, 2, 0,
          ARG_ON_OFF|ARG_OFFSET|UNIQUE_STRICT,
@@ -187,9 +189,10 @@ unique_cf_gen( ConfigArgs *c )
                case UNIQUE_BASE:
                        if ( !dnIsSuffix ( &c->value_ndn,
                                           &be->be_nsuffix[0] ) ) {
-                               sprintf ( c->msg, "dn is not a suffix of backend base" );
-                               Debug ( LDAP_DEBUG_CONFIG, "unique add: %s\n",
-                                       c->msg, NULL, NULL );
+                               sprintf ( c->msg, "%s dn is not a suffix of backend base",
+                                       c->argv[0] );
+                               Debug ( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                                       "%s: %s\n", c->log, c->msg, 0 );
                                rc = ARG_BAD_CONF;
                        }
                        if ( ud->dn.bv_val ) ber_memfree ( ud->dn.bv_val );
@@ -216,13 +219,10 @@ unique_cf_gen( ConfigArgs *c )
                                                ud->attrs = up;
                                        }
                                } else {
-                                       Debug ( LDAP_DEBUG_CONFIG,
-                                               "unique add: <%s>: %s\n",
-                                               c->argv[i], text, NULL );
-                                       strncpy ( c->msg,
-                                                 text,
-                                                 SLAP_TEXT_BUFLEN-1 );
-                                       c->msg[SLAP_TEXT_BUFLEN-1] = '\0';
+                                       snprintf( c->msg, sizeof( c->msg ),
+                                               "%s <%s>: %s", c->argv[0], c->argv[i], text );
+                                       Debug ( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+                                               "%s: %s\n", c->log, c->msg, 0 );
                                        rc = ARG_BAD_CONF;
                                }
                        }