&config_generic, "( OLcfgGlAt:5 NAME 'olcAttributeOptions' "
"EQUALITY caseIgnoreMatch "
"SYNTAX OMsDirectoryString )", NULL, NULL },
- { "authid-rewrite", NULL, 2, 0, 0,
+ { "authid-rewrite", NULL, 2, 0, STRLENOF( "authid-rewrite" ),
#ifdef SLAP_AUTH_REWRITE
ARG_MAGIC|CFG_REWRITE|ARG_NO_INSERT, &config_generic,
#else
c->be = LDAP_STAILQ_FIRST(&backendDB);
} else if ( !strcasecmp( c->argv[1], "frontend" )) {
c->be = frontendDB;
- } else if(!(c->be = backend_db_init(c->argv[1]))) {
- sprintf( c->msg, "<%s> failed init", c->argv[0] );
- Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n",
- c->log, c->msg, c->argv[1] );
- return(1);
+ } else {
+ c->be = backend_db_init(c->argv[1]);
+ if ( !c->be ) {
+ sprintf( c->msg, "<%s> failed init", c->argv[0] );
+ Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n",
+ c->log, c->msg, c->argv[1] );
+ return(1);
+ }
+ if ( CONFIG_ONLINE_ADD(c) && backend_startup_one( c->be )) {
+ sprintf( c->msg, "<%s> failed startup", c->argv[0] );
+ Debug(LDAP_DEBUG_ANY, "%s: %s (%s)!\n",
+ c->log, c->msg, c->argv[1] );
+ return(1);
+ }
}
break;
#ifdef SLAP_AUTH_REWRITE
case CFG_REWRITE: {
struct berval bv;
+ char *line;
+
if(slap_sasl_rewrite_config(c->fname, c->lineno, c->argc, c->argv))
return(1);
- ber_str2bv( c->line, 0, 1, &bv );
+
+ if ( c->argc > 1 ) {
+ char *s;
+
+ /* quote all args but the first */
+ line = ldap_charray2str( c->argv, "\" \"" );
+ ber_str2bv( line, 0, 0, &bv );
+ s = strchr( bv.bv_val, '"' );
+ assert( s != NULL );
+ /* move the trailing quote of argv[0] to the end */
+ AC_MEMCPY( s, s + 1, bv.bv_len - ( s - bv.bv_val ) );
+ bv.bv_val[ bv.bv_len - 1 ] = '"';
+
+ } else {
+ ber_str2bv( c->argv[ 0 ], 0, 1, &bv );
+ }
+
ber_bvarray_add( &authz_rewrites, &bv );
}
break;
return 1;
/* If we read the config from back-ldif, nothing to do here */
- if ( cfb->cb_got_ldif )
- return 0;
+ if ( cfb->cb_got_ldif ) {
+ rc = 0;
+ goto done;
+ }
}
if ( fname )
}
break;
}
+
+done:
+ if ( rc == 0 && BER_BVISNULL( &frontendDB->be_schemadn ) ) {
+ ber_str2bv( SLAPD_SCHEMA_DN, STRLENOF( SLAPD_SCHEMA_DN ), 1,
+ &frontendDB->be_schemadn );
+ rc = dnNormalize( 0, NULL, NULL, &frontendDB->be_schemadn, &frontendDB->be_schemandn, NULL );
+ if ( rc != LDAP_SUCCESS ) {
+ Debug(LDAP_DEBUG_ANY, "read_config: "
+ "unable to normalize default schema DN \"%s\"\n",
+ frontendDB->be_schemadn.bv_val, 0, 0 );
+ /* must not happen */
+ assert( 0 );
+ }
+ }
return rc;
}
typedef struct delrec {
struct delrec *next;
int nidx;
- int idx[0];
+ int idx[1];
} delrec;
static int
if ( ct && ml->sml_values ) {
delrec *d;
for (i=0; ml->sml_values[i].bv_val; i++);
- d = ch_malloc( sizeof(delrec) + i * sizeof(int));
+ d = ch_malloc( sizeof(delrec) + (i - 1)* sizeof(int));
d->nidx = i;
d->next = NULL;
if ( dels ) {
if(rc == LDAP_SUCCESS) {
/* check that the entry still obeys the schema */
- rc = entry_schema_check(op->o_bd, e, NULL,
- &rs->sr_text, ca->msg, sizeof(ca->msg) );
+ rc = entry_schema_check(op->o_bd, e, NULL, 0,
+ &rs->sr_text, ca->msg, sizeof(ca->msg) );
}
if ( rc == LDAP_SUCCESS ) {
/* Basic syntax checks are OK. Do the actual settings. */