CFG_SASLSECP,
CFG_SSTR_IF_MAX,
CFG_SSTR_IF_MIN,
+
+ CFG_LAST
};
typedef struct {
&config_generic, "( OLcfgGlAt:13 NAME 'olcDatabase' "
"DESC 'The backend type for a database instance' "
"SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
- { "defaultSearchBase", "dn", 2, 2, 0, ARG_PRE_BI|ARG_PRE_DB|ARG_DN|ARG_MAGIC,
+ { "defaultSearchBase", "dn", 2, 2, 0, ARG_PRE_BI|ARG_PRE_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
&config_search_base, "( OLcfgGlAt:14 NAME 'olcDefaultSearchBase' "
"SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL },
{ "disallows", "features", 2, 0, 8, ARG_PRE_DB|ARG_MAGIC,
#endif
"( OLcfgGlAt:49 NAME 'olcReverseLookup' "
"SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
- { "rootdn", "dn", 2, 2, 0, ARG_DB|ARG_DN|ARG_MAGIC,
+ { "rootdn", "dn", 2, 2, 0, ARG_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
&config_rootdn, "( OLcfgDbAt:0.8 NAME 'olcRootDN' "
"SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL },
{ "rootDSE", "file", 2, 2, 0, ARG_MAGIC|CFG_ROOTDSE,
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
{ "saslRegexp", NULL, 3, 3, 0, ARG_MAGIC|CFG_AZREGEXP,
&config_generic, NULL, NULL, NULL },
- { "schemadn", "dn", 2, 2, 0, ARG_MAY_DB|ARG_DN|ARG_MAGIC,
+ { "schemadn", "dn", 2, 2, 0, ARG_MAY_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
&config_schema_dn, "( OLcfgGlAt:58 NAME 'olcSchemaDN' "
"SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL },
{ "security", "factors", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
#endif
"( OLcfgGlAt:63 NAME 'olcSrvtab' "
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
- { "suffix", "suffix", 2, 2, 0, ARG_DB|ARG_DN|ARG_MAGIC,
+ { "suffix", "suffix", 2, 2, 0, ARG_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
&config_suffix, "( OLcfgDbAt:0.10 NAME 'olcSuffix' "
"SYNTAX OMsDN )", NULL, NULL },
{ "syncrepl", NULL, 0, 0, 0, ARG_DB|ARG_MAGIC,
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
{ "ucdata-path", "path", 2, 2, 0, ARG_IGNORED,
NULL, NULL, NULL, NULL },
- { "updatedn", "dn", 2, 2, 0, ARG_DB|ARG_MAGIC,
+ { "updatedn", "dn", 2, 2, 0, ARG_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
&config_updatedn, "( OLcfgDbAt:0.12 NAME 'olcUpdateDN' "
"SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL },
{ "updateref", "url", 2, 2, 0, ARG_DB|ARG_MAGIC,
return rc;
}
for ( i=0; vals[i].bv_val; i++ ) {
- int freeline = 0;
- if ( ad && ad->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName ) {
- ca->line = ch_malloc( vals[i].bv_len + STRLENOF( "\"\"" ) + 1 );
- sprintf( ca->line, "\"%s\"", vals[i].bv_val );
- freeline = 1;
- } else {
- ca->line = vals[i].bv_val;
- if ( sort ) {
- char *idx = strchr( ca->line, '}' );
- if ( idx ) ca->line = idx+1;
- }
+ ca->line = vals[i].bv_val;
+ if ( sort ) {
+ char *idx = strchr( ca->line, '}' );
+ if ( idx ) ca->line = idx+1;
}
rc = config_parse_vals( ct, ca, i );
- if ( freeline ) {
- ch_free( ca->line );
- }
if ( rc ) {
break;
}
ct = config_find_table( colst, nocs, a->a_desc );
if ( !ct ) continue; /* user data? */
for (i=0; a->a_vals[i].bv_val; i++) {
- int freeline = 0;
-
- if ( a->a_desc && a->a_desc->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName ) {
- ca->line = ch_malloc( a->a_vals[i].bv_len + STRLENOF( "\"\"" ) + 1 );
- sprintf( ca->line, "\"%s\"", a->a_vals[i].bv_val );
- freeline = 1;
- } else {
- ca->line = a->a_vals[i].bv_val;
- if ( a->a_desc->ad_type->sat_flags & SLAP_AT_ORDERED ) {
- ptr = strchr( ca->line, '}' );
- if ( ptr ) ca->line = ptr+1;
- }
+ ca->line = a->a_vals[i].bv_val;
+ if ( a->a_desc->ad_type->sat_flags & SLAP_AT_ORDERED ) {
+ ptr = strchr( ca->line, '}' );
+ if ( ptr ) ca->line = ptr+1;
}
ca->valx = i;
rc = config_parse_add( ct, ca );
- if ( freeline ) {
- ch_free( ca->line );
- }
if ( rc ) {
rc = LDAP_OTHER;
goto leave;
bi->bi_tool_entry_get = config_tool_entry_get;
bi->bi_tool_entry_put = config_tool_entry_put;
+ /* Make sure we don't exceed the bits reserved for userland */
+ assert( ( ( CFG_LAST - 1 ) & ARGS_USERLAND ) == ( CFG_LAST - 1 ) );
+
argv[3] = NULL;
for (i=0; OidMacros[i].name; i++ ) {
argv[1] = OidMacros[i].name;
int
config_parse_vals(ConfigTable *ct, ConfigArgs *c, int valx)
{
- int rc = 0;
+ int rc = 0;
+ char *saveline = NULL;
snprintf( c->log, sizeof( c->log ), "%s: value #%d",
ct->ad->ad_cname.bv_val, valx );
c->argc = 1;
c->argv[0] = ct->ad->ad_cname.bv_val;
+
+ if ( ( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) {
+ ber_len_t len;
+
+ saveline = c->line;
+ len = strlen( c->line );
+ c->line = ch_malloc( len + STRLENOF( "\"\"" ) + 1 );
+ sprintf( c->line, "\"%s\"", saveline );
+ }
+
if ( fp_parse_line( c ) ) {
rc = 1;
} else {
rc = config_check_vals( ct, c, 1 );
}
+
+ if ( saveline ) {
+ ch_free( c->line );
+ c->line = saveline;
+ }
+
if ( rc )
rc = LDAP_CONSTRAINT_VIOLATION;
int
config_parse_add(ConfigTable *ct, ConfigArgs *c)
{
- int rc = 0;
+ int rc = 0;
+ char *saveline = NULL;
snprintf( c->log, sizeof( c->log ), "%s: value #%d",
ct->ad->ad_cname.bv_val, c->valx );
c->argc = 1;
c->argv[0] = ct->ad->ad_cname.bv_val;
+
+ if ( ( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) {
+ ber_len_t len;
+
+ saveline = c->line;
+ len = strlen( c->line );
+
+ c->line = ch_malloc( len + STRLENOF( "\"\"" ) + 1 );
+ sprintf( c->line, "\"%s\"", saveline );
+ }
+
if ( fp_parse_line( c ) ) {
rc = 1;
} else {
rc = config_add_vals( ct, c );
}
+ if ( saveline ) {
+ ch_free( c->line );
+ c->line = saveline;
+ }
+
ch_free( c->tline );
return rc;
}