fe_op_add( Operation *op, SlapReply *rs )
{
int manageDSAit;
- Modifications *modlist = op->ora_modlist;
- Modifications **modtail = &modlist;
+ Modifications **modtail = &op->ora_modlist;
int rc = 0;
- BackendDB *op_be;
+ BackendDB *op_be;
char textbuf[ SLAP_TEXT_BUFLEN ];
size_t textlen = sizeof( textbuf );
goto done;
}
- rs->sr_err = slap_mods_obsolete_check( op, modlist,
+ rs->sr_err = slap_mods_obsolete_check( op, op->ora_modlist,
&rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
int repl_user = be_isupdate( op );
#ifndef SLAPD_MULTIMASTER
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
{
int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
op->o_bd = op_be;
if ( !update ) {
- rs->sr_err = slap_mods_no_user_mod_check( op, modlist,
+ rs->sr_err = slap_mods_no_user_mod_check( op, op->ora_modlist,
&rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
if ( !repl_user ) {
/* go to the last mod */
- for ( modtail = &modlist;
+ for ( modtail = &op->ora_modlist;
*modtail != NULL;
modtail = &(*modtail)->sml_next )
{
/* check for duplicate values */
rs->sr_err = slap_mods_no_repl_user_mod_check( op,
- modlist, &rs->sr_text, textbuf, textlen );
+ op->ora_modlist, &rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
goto done;
#ifdef SLAPD_MULTIMASTER
if ( !repl_user )
-#endif
+#endif /* SLAPD_MULTIMASTER */
{
cb.sc_next = op->o_callback;
op->o_callback = &cb;
if ( bd->be_replogfile ) {
ch_free( bd->be_replogfile );
}
+ if ( bd->be_replica_argsfile ) {
+ ch_free( bd->be_replica_argsfile );
+ }
+ if ( bd->be_replica_pidfile ) {
+ ch_free( bd->be_replica_pidfile );
+ }
destroy_replica_info( bd );
if ( !BER_BVISNULL( &bd->be_update_ndn ) ) {
ch_free( bd->be_update_ndn.bv_val );
if ( bd->be_replogfile != NULL ) {
free( bd->be_replogfile );
}
+ if ( bd->be_replica_argsfile ) {
+ ch_free( bd->be_replica_argsfile );
+ }
+ if ( bd->be_replica_pidfile ) {
+ ch_free( bd->be_replica_pidfile );
+ }
assert( bd->be_replica == NULL );
}
return -1;
}
- if ( SLAP_DBFLAGS( be ) & SLAP_DBFLAG_GLOBAL_OVERLAY ) {
+ if ( SLAP_ISGLOBALOVERLAY( be ) ) {
BackendDB *bd;
/* add to all backends... */
int i = c->valx;
ch_free( c->be->be_suffix[i].bv_val );
ch_free( c->be->be_nsuffix[i].bv_val );
- for (; c->be->be_suffix[i].bv_val; i++) {
+ do {
c->be->be_suffix[i] = c->be->be_suffix[i+1];
c->be->be_nsuffix[i] = c->be->be_nsuffix[i+1];
- }
+ i++;
+ } while ( !BER_BVISNULL( &c->be->be_suffix[i] ) );
}
return 0;
}
{
iarg = 0;
} else {
- snprintf( c->msg, sizeof( c->msg ), "<%s> invalid value, ignored",
+ snprintf( c->msg, sizeof( c->msg ), "<%s> invalid value",
c->argv[0] );
- Debug(LDAP_DEBUG_CONFIG, "%s: %s\n",
+ Debug(LDAP_DEBUG_ANY, "%s: %s\n",
c->log, c->msg, 0 );
- return(0);
+ return(ARG_BAD_CONF);
}
break;
}
j = (arg_type & ARG_NONZERO) ? 1 : 0;
if(iarg < j && larg < j && barg < j ) {
larg = larg ? larg : (barg ? barg : iarg);
- snprintf( c->msg, sizeof( c->msg ), "<%s> invalid value, ignored",
+ snprintf( c->msg, sizeof( c->msg ), "<%s> invalid value",
c->argv[0] );
- Debug(LDAP_DEBUG_CONFIG, "%s: %s\n",
+ Debug(LDAP_DEBUG_ANY, "%s: %s\n",
c->log, c->msg, 0 );
return(ARG_BAD_CONF);
}
rc = (*c->be->be_config)(c->be, c->fname, c->lineno,
c->argc, c->argv);
}
- if ( rc ) {
- switch(rc) {
- case SLAP_CONF_UNKNOWN:
- Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
- "unknown directive <%s> inside backend database "
- "definition" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
- c->log, *c->argv, 0);
+ 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);
+ }
+
+ switch ( rc ) {
+ case 0:
+ break;
+
+ case SLAP_CONF_UNKNOWN:
+ Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: "
+ "unknown directive <%s> inside backend database "
+ "definition" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
+ c->log, *c->argv, 0);
#ifndef SLAPD_CONF_UNKNOWN_BAILOUT
- continue;
+ break;
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
- default:
- rc = 1;
- goto done;
- }
+
+ default:
+ rc = 1;
+ goto done;
}
} else if ( frontendDB->be_config ) {
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
c->log, *c->argv, 0);
#ifndef SLAPD_CONF_UNKNOWN_BAILOUT
- continue;
+ break;
#endif /* ! SLAPD_CONF_UNKNOWN_BAILOUT */
+
default:
rc = 1;
goto done;
int repl_user = be_isupdate( op );
#ifndef SLAPD_MULTIMASTER
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
{
struct berval org_req_dn = BER_BVNULL;
struct berval org_req_ndn = BER_BVNULL;
#ifdef SLAPD_MULTIMASTER
if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
-#endif
+#endif /* SLAPD_MULTIMASTER */
{
cb.sc_next = op->o_callback;
op->o_callback = &cb;
LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
}
} else {
Modifications *tmp;
#endif
int manageDSAit;
- Modifications *modlist = op->orm_modlist;
- int increment = op->orm_increment;
- BackendDB *op_be;
+ BackendDB *op_be;
char textbuf[ SLAP_TEXT_BUFLEN ];
size_t textlen = sizeof( textbuf );
- if( BER_BVISEMPTY( &op->o_req_ndn ) ) {
+ if ( BER_BVISEMPTY( &op->o_req_ndn ) ) {
Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
#ifdef LDAP_DEBUG
Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
- for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
+ for ( tmp = op->orm_modlist; tmp != NULL; tmp = tmp->sml_next ) {
Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
tmp->sml_op == LDAP_MOD_ADD ? "add" :
(tmp->sml_op == LDAP_MOD_INCREMENT ? "increment" :
Statslog( LDAP_DEBUG_STATS, "%s MOD dn=\"%s\"\n",
op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
- for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
+ for ( tmp = op->orm_modlist; tmp != NULL; tmp = tmp->sml_next ) {
if (len + 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
op->o_log_prefix, abuf, 0, 0, 0 );
if ( op->o_bd == NULL ) {
rs->sr_ref = referral_rewrite( default_referral,
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
- if (!rs->sr_ref) rs->sr_ref = default_referral;
+ if ( !rs->sr_ref ) {
+ rs->sr_ref = default_referral;
+ }
- if (rs->sr_ref != NULL ) {
+ if ( rs->sr_ref != NULL ) {
rs->sr_err = LDAP_REFERRAL;
op->o_bd = frontendDB;
send_ldap_result( op, rs );
op->o_bd = NULL;
- if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+ if ( rs->sr_ref != default_referral ) {
+ ber_bvarray_free( rs->sr_ref );
+ }
+
} else {
op->o_bd = frontendDB;
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
}
/* check restrictions */
- if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
+ if ( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
goto cleanup;
}
/* check for referrals */
- if( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
+ if ( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) {
goto cleanup;
}
- rs->sr_err = slap_mods_obsolete_check( op, modlist,
+ rs->sr_err = slap_mods_obsolete_check( op, op->orm_modlist,
&rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
}
/* check for modify/increment support */
- if( increment && !SLAP_INCREMENT( op->o_bd ) ) {
+ if ( op->orm_increment && !SLAP_INCREMENT( op->o_bd ) ) {
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"modify/increment not supported in context" );
}
*/
#ifndef SLAPD_MULTIMASTER
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
{
int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
op->o_bd = op_be;
if ( !update ) {
- rs->sr_err = slap_mods_no_user_mod_check( op, modlist,
+ rs->sr_err = slap_mods_no_user_mod_check( op, op->orm_modlist,
&rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
}
}
- op->orm_modlist = modlist;
#ifdef SLAPD_MULTIMASTER
if ( !repl_user )
-#endif
+#endif /* SLAPD_MULTIMASTER */
{
/* but multimaster slapd logs only the ones
* not from a replicator user */
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
}
} else {
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
size_t textlen )
{
for ( ; ml != NULL; ml = ml->sml_next ) {
- if ( !is_at_no_user_mod( ml->sml_desc->ad_type ) ) continue;
+ if ( !is_at_no_user_mod( ml->sml_desc->ad_type ) ) {
+ continue;
+ }
if ( get_manageDIT( op ) ) {
if ( ml->sml_desc->ad_type->sat_flags & SLAP_AT_MANAGEABLE ) {
int repl_user = be_isupdate( op );
#ifndef SLAPD_MULTIMASTER
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
{
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
#ifdef SLAPD_MULTIMASTER
if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
-#endif
+#endif /* SLAPD_MULTIMASTER */
{
cb.sc_next = op->o_callback;
op->o_callback = &cb;
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"shadow context; no update referral" );
}
-#endif
+#endif /* ! SLAPD_MULTIMASTER */
}
} else {
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
case LDAP_URL_ERR_BADSCHEME:
/* not LDAP hence valid */
+ Debug( LDAP_DEBUG_CONFIG, "referral \"%s\": not LDAP.\n", url, 0, 0 );
return 0;
default:
/* undef NO_LOG_WHEN_NO_REPLICAS */
#ifdef NO_LOG_WHEN_NO_REPLICAS
int count = 0;
-#endif
+#endif /* NO_LOG_WHEN_NO_REPLICAS */
int subsets = 0;
long now = slap_get_time();
char *replogfile;
fprintf( fp, "replica: %s\n", op->o_bd->be_replica[i]->ri_host );
#ifdef NO_LOG_WHEN_NO_REPLICAS
++count;
-#endif
+#endif /* NO_LOG_WHEN_NO_REPLICAS */
}
#ifdef NO_LOG_WHEN_NO_REPLICAS
return;
}
-#endif
+#endif /* NO_LOG_WHEN_NO_REPLICAS */
replog1( NULL, op, fp, now );
#define SLAP_NOLASTMOD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD)
#define SLAP_LASTMOD(be) (!SLAP_NOLASTMOD(be))
#define SLAP_ISOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_OVERLAY)
+#define SLAP_ISGLOBALOVERLAY(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLOBAL_OVERLAY)
#define SLAP_NO_SCHEMA_CHECK(be) \
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_NO_SCHEMA_CHECK)
#define SLAP_GLUE_INSTANCE(be) \