unifdef -DSLAPD_CONF_UNKNOWN_BAILOUT -DSLAPD_CONF_UNKNOWN_IGNORED=""

-DSLAPD_DEBUG_CONFIG_ERROR=LDAP_DEBUG_ANY
This commit is contained in:
Kurt Zeilenga 2006-01-24 04:40:01 +00:00
parent fdc89d2604
commit f5b9ff7940
9 changed files with 52 additions and 138 deletions

View File

@ -574,21 +574,15 @@ parse_acl(
/* FIXME: should be an error */
snprintf( buf, sizeof( buf ),
"unknown val.<style> \"%s\" "
"for attributeType \"%s\" with DN syntax"
#ifndef SLAPD_CONF_UNKNOWN_BAILOUT
"; using \"base\""
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
SLAPD_CONF_UNKNOWN_IGNORED ".",
"unknown val.<style> \"%s\" for attributeType \"%s\" "
"with DN syntax.",
style,
a->acl_attrs[0].an_desc->ad_cname.bv_val );
Debug( LDAP_DEBUG_CONFIG | LDAP_DEBUG_ACL,
"%s: line %d: %s\n",
fname, lineno, buf );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
a->acl_attrval_style = ACL_STYLE_BASE;
}
@ -614,19 +608,12 @@ parse_acl(
/* FIXME: should be an error */
snprintf( buf, sizeof( buf ),
"unknown val.<style> \"%s\" "
"for attributeType \"%s\""
#ifndef SLAPD_CONF_UNKNOWN_BAILOUT
"; using \"exact\""
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
SLAPD_CONF_UNKNOWN_IGNORED ".",
"unknown val.<style> \"%s\" for attributeType \"%s\".",
style, a->acl_attrs[0].an_desc->ad_cname.bv_val );
Debug( LDAP_DEBUG_CONFIG | LDAP_DEBUG_ACL,
"%s: line %d: %s\n",
fname, lineno, buf );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
a->acl_attrval_style = ACL_STYLE_BASE;
}
}
@ -827,12 +814,9 @@ parse_acl(
#ifndef LDAP_PF_LOCAL
Debug( LDAP_DEBUG_CONFIG | LDAP_DEBUG_ACL,
"%s: line %d: "
"\"path\" style modifier is useless without local"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
"\"path\" style modifier is useless without local.\n",
fname, lineno, 0 );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
#endif /* LDAP_PF_LOCAL */
} else {
@ -848,13 +832,9 @@ parse_acl(
switch ( sty ) {
case ACL_STYLE_REGEX:
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"\"regex\" style implies "
"\"expand\" modifier"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
"\"regex\" style implies \"expand\" modifier.\n",
fname, lineno, 0 );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
break;
case ACL_STYLE_EXPAND:
@ -871,15 +851,10 @@ parse_acl(
if ( ( sty == ACL_STYLE_EXPAND || expand )
&& a->acl_dn_style != ACL_STYLE_REGEX )
{
Debug( LDAP_DEBUG_CONFIG | LDAP_DEBUG_ACL, "%s: line %d: "
"\"expand\" style or modifier used "
"in conjunction with "
"a non-regex <what> clause"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_CONFIG | LDAP_DEBUG_ACL, "%s: line %d: \"expand\" style "
"or modifier used in conjunction with a non-regex <what> clause.\n",
fname, lineno, 0 );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
}
if ( strncasecmp( left, "real", STRLENOF( "real" ) ) == 0 ) {
@ -1021,9 +996,9 @@ parse_acl(
int gotit = 0;
for ( exp = strchr( bdn->a_pat.bv_val, '$' );
exp && (ber_len_t)(exp - bdn->a_pat.bv_val)
< bdn->a_pat.bv_len;
exp = strchr( exp, '$' ) )
exp && (ber_len_t)(exp - bdn->a_pat.bv_val)
< bdn->a_pat.bv_len;
exp = strchr( exp, '$' ) )
{
if ( isdigit( exp[ 1 ] ) ) {
gotit = 1;
@ -1035,14 +1010,10 @@ parse_acl(
bdn->a_expand = expand;
} else {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: \"expand\" used "
"with no expansions in \"pattern\""
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"\"expand\" used with no expansions in \"pattern\".\n",
fname, lineno, 0 );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
}
}
if ( sty == ACL_STYLE_SELF ) {
@ -1909,13 +1880,9 @@ parse_acl(
/* if we have no real access clause, complain and do nothing */
if ( a == NULL ) {
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"warning: no access clause(s) "
"specified in access line"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
"warning: no access clause(s) specified in access line.\n",
fname, lineno, 0 );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
} else {
#ifdef LDAP_DEBUG
@ -1926,13 +1893,9 @@ parse_acl(
if ( a->acl_access == NULL ) {
Debug( LDAP_DEBUG_ANY, "%s: line %d: "
"warning: no by clause(s) "
"specified in access line"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
"warning: no by clause(s) specified in access line.\n",
fname, lineno, 0 );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return acl_usage();
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
}
if ( be != NULL ) {

View File

@ -285,8 +285,8 @@ bdb_attr_index_config(
ch_free( a );
continue;
}
fprintf( stderr, "%s: line %d: duplicate index definition "
"for attr \"%s\"" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
fprintf( stderr,
"%s: line %d: duplicate index definition for attr \"%s\".\n",
fname, lineno, attrs[i] );
return LDAP_PARAM_ERROR;

View File

@ -200,8 +200,8 @@ attr_index_config(
ainfo_cmp, avl_dup_error );
if( rc ) {
fprintf( stderr, "%s: line %d: duplicate index definition "
"for attr \"%s\"" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
fprintf( stderr,
"%s: line %d: duplicate index definition for attr \"%s\".\n",
fname, lineno, attrs[i] );
return LDAP_PARAM_ERROR;

View File

@ -78,12 +78,10 @@ ldbm_back_db_config(
fname, lineno );
return( 1 );
} else if ( argc > 3 ) {
fprintf( stderr,
"%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
fprintf( stderr, "%s: line %d: extra junk "
"after \"index <attr> [pres,eq,approx,sub]\" line.\n",
fname, lineno );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return( 1 );
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
}
rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] );

View File

@ -1126,7 +1126,7 @@ ldap_back_map_config(
|| avl_find( map->remap, (caddr_t)&mapping[ 1 ], mapping_cmp ) != NULL)
{
Debug( LDAP_DEBUG_ANY,
"%s: line %d: duplicate mapping found" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
"%s: line %d: duplicate mapping found.\n",
fname, lineno, 0 );
goto error_return;
}

View File

@ -1450,13 +1450,10 @@ config_generic(ConfigArgs *c) {
default:
Debug( SLAPD_DEBUG_CONFIG_ERROR,
"%s: unknown CFG_TYPE %d"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY,
"%s: unknown CFG_TYPE %d.\n",
c->log, c->type, 0 );
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return 1;
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
}
return(0);
@ -1701,12 +1698,10 @@ config_overlay(ConfigArgs *c) {
}
if(c->argv[1][0] == '-' && overlay_config(c->be, &c->argv[1][1])) {
/* log error */
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: (optional) %s overlay \"%s\" configuration failed"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY,
"%s: (optional) %s overlay \"%s\" configuration failed.\n",
c->log, c->be == frontendDB ? "global " : "", &c->argv[1][1]);
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return 1;
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
} else if(overlay_config(c->be, c->argv[1])) {
return(1);
}
@ -1848,13 +1843,9 @@ config_suffix(ConfigArgs *c)
ndn = c->value_ndn;
tbe = select_backend(&ndn, 0, 0);
if(tbe == c->be) {
Debug( SLAPD_DEBUG_CONFIG_ERROR,
"%s: suffix already served by this backend!"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY, "%s: suffix already served by this backend!.\n",
c->log, 0, 0);
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return 1;
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
free(pdn.bv_val);
free(ndn.bv_val);
} else if(tbe) {
@ -2576,22 +2567,16 @@ config_replica(ConfigArgs *c) {
} else if(!strncasecmp(c->argv[i], "suffix=", STRLENOF( "suffix="))) {
switch(add_replica_suffix(c->be, nr, c->argv[i] + STRLENOF("suffix="))) {
case 1:
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
"suffix \"%s\" in \"replica\" line is not valid for backend"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
c->log, c->argv[i] + STRLENOF("suffix="), 0);
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
Debug( LDAP_DEBUG_ANY, "%s: "
"suffix \"%s\" in \"replica\" line is not valid for backend.\n",
c->log, c->argv[i] + STRLENOF("suffix="), 0);
return 1;
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
break;
case 2:
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
"unable to normalize suffix in \"replica\" line"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
c->log, 0, 0);
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
Debug( LDAP_DEBUG_ANY, "%s: "
"unable to normalize suffix in \"replica\" line.\n",
c->log, 0, 0);
return 1;
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
break;
}

View File

@ -735,15 +735,10 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
}
if ( c->argc < 1 ) {
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: bad config line"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY, "%s: bad config line.\n",
c->log, 0, 0);
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
rc = 1;
goto done;
#else /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
continue;
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
}
c->op = SLAP_CONFIG_ADD;
@ -780,13 +775,9 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
if ( rc ) {
switch(rc) {
case SLAP_CONF_UNKNOWN:
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
"unknown directive <%s> inside backend info definition"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
"<%s> inside backend info definition.\n",
c->log, *c->argv, 0);
#ifndef SLAPD_CONF_UNKNOWN_BAILOUT
continue;
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
default:
rc = 1;
goto done;
@ -805,11 +796,13 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
rc = (*c->be->be_config)(c->be, c->fname, c->lineno,
c->argc, c->argv);
}
if ( rc == SLAP_CONF_UNKNOWN && SLAP_ISGLOBALOVERLAY( frontendDB ) ) {
if ( rc == SLAP_CONF_UNKNOWN && SLAP_ISGLOBALOVERLAY( frontendDB ) )
{
/* global overlays may need
* definitions inside other databases...
*/
rc = (*frontendDB->be_config)(frontendDB, c->fname, (int)c->lineno, c->argc, c->argv);
rc = (*frontendDB->be_config)( frontendDB,
c->fname, (int)c->lineno, c->argc, c->argv );
}
switch ( rc ) {
@ -817,13 +810,9 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
break;
case SLAP_CONF_UNKNOWN:
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
"unknown directive <%s> inside backend database "
"definition" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
"<%s> inside backend database definition.\n",
c->log, *c->argv, 0);
#ifndef SLAPD_CONF_UNKNOWN_BAILOUT
break;
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
default:
rc = 1;
@ -831,17 +820,14 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
}
} else if ( frontendDB->be_config ) {
rc = (*frontendDB->be_config)(frontendDB, c->fname, (int)c->lineno, c->argc, c->argv);
rc = (*frontendDB->be_config)( frontendDB,
c->fname, (int)c->lineno, c->argc, c->argv);
if ( rc ) {
switch(rc) {
case SLAP_CONF_UNKNOWN:
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
"unknown directive <%s> inside global database definition"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
"<%s> inside global database definition.\n",
c->log, *c->argv, 0);
#ifndef SLAPD_CONF_UNKNOWN_BAILOUT
break;
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
default:
rc = 1;
@ -850,16 +836,11 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
}
} else {
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
"unknown directive <%s> outside backend info and database definitions"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
"<%s> outside backend info and database definitions.\n",
c->log, *c->argv, 0);
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
rc = 1;
goto done;
#else /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
continue;
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
}
}
@ -878,9 +859,9 @@ done:
int
verb_to_mask(const char *word, slap_verbmasks *v) {
int i;
for(i = 0; !BER_BVISNULL(&v[i].word); i++)
if(!strcasecmp(word, v[i].word.bv_val))
break;
for(i = 0; !BER_BVISNULL(&v[i].word); i++) {
if(!strcasecmp(word, v[i].word.bv_val)) break;
}
return(i);
}
@ -924,8 +905,7 @@ slap_verbmasks_init( slap_verbmasks **vp, slap_verbmasks *v )
assert( *vp == NULL );
for ( i = 0; !BER_BVISNULL( &v[ i ].word ); i++ )
;
for ( i = 0; !BER_BVISNULL( &v[ i ].word ); i++ ) /* EMPTY */;
*vp = ch_calloc( i + 1, sizeof( slap_verbmasks ) );

View File

@ -217,7 +217,7 @@ rwm_map_config(
|| avl_find( map->remap, (caddr_t)&mapping[1], rwm_mapping_cmp ) != NULL)
{
fprintf( stderr,
"%s: line %d: duplicate mapping found" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
"%s: line %d: duplicate mapping found.\n",
fname, lineno );
/* FIXME: free stuff */
goto error_return;

View File

@ -72,7 +72,6 @@ LDAP_BEGIN_DECL
#define LDAP_DYNAMIC_OBJECTS
#define LDAP_SYNC_TIMESTAMP
#define LDAP_COLLECTIVE_ATTRIBUTES
#define SLAPD_CONF_UNKNOWN_BAILOUT
#define SLAP_CONTROL_X_TREE_DELETE LDAP_CONTROL_X_TREE_DELETE
#define SLAP_ORDERED_PRETTYNORM
@ -87,17 +86,6 @@ LDAP_BEGIN_DECL
#define SLAP_OVERLAY_ACCESS
#endif
/*
* ITS#3705: bail out if unknown config directives appear in slapd.conf
*/
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
#define SLAPD_CONF_UNKNOWN_IGNORED ""
#define SLAPD_DEBUG_CONFIG_ERROR LDAP_DEBUG_ANY
#else /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
#define SLAPD_CONF_UNKNOWN_IGNORED " (ignored)"
#define SLAPD_DEBUG_CONFIG_ERROR LDAP_DEBUG_CONFIG
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
/*
* SLAPD Memory allocation macros
*