#include "portable.h"
#include <stdio.h>
-
#include <ac/string.h>
#include <ac/time.h>
#include <ac/socket.h>
Modifications *mods = NULL;
const char *text;
int rc = LDAP_SUCCESS;
+ struct berval **urls = NULL;
Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
goto done;
}
- if ( modlist == NULL )
- {
+ if ( modlist == NULL ) {
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
NULL, "no attributes provided", NULL, NULL );
goto done;
/* make sure this backend recongizes critical controls */
rc = backend_check_controls( be, conn, op, &text ) ;
-
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
goto done;
}
+ /* check for referrals */
+ rc = backend_check_referrals( be, conn, op, &urls, &text );
+ if ( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc,
+ NULL, text, urls, NULL );
+ ber_bvecfree( urls );
+ goto done;
+ }
+
if ( global_readonly || be->be_readonly ) {
Debug( LDAP_DEBUG_ANY, "do_add: database is read-only\n",
0, 0, 0 );
return LDAP_SUCCESS;
}
+int backend_check_referrals(
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval ***bv,
+ const char **text )
+{
+ *bv = NULL;
+
+ if( be->be_chk_referrals ) {
+ return be->be_chk_referrals( be,
+ conn, op, bv, text );
+ }
+
+ return LDAP_SUCCESS;
+}
+
int
backend_group(
Backend *be,
#include "portable.h"
#include <stdio.h>
-
#include <ac/socket.h>
#include "ldap_pvt.h"
AttributeAssertion ava;
Backend *be;
int rc = LDAP_SUCCESS;
+ struct berval **urls = NULL;
const char *text = NULL;
ava.aa_desc = NULL;
goto cleanup;
}
+ /*
+ * We could be serving multiple database backends. Select the
+ * appropriate one, or send a referral to our "referral server"
+ * if we don't hold it.
+ */
+ if ( (be = select_backend( ndn )) == NULL ) {
+ send_ldap_result( conn, op, rc = LDAP_REFERRAL,
+ NULL, NULL, default_referral, NULL );
+ rc = 1;
+ goto cleanup;
+ }
+
+ /* make sure this backend recongizes critical controls */
+ rc = backend_check_controls( be, conn, op, &text ) ;
+ if( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc,
+ NULL, text, NULL, NULL );
+ goto cleanup;
+ }
+
+ /* check for referrals */
+ rc = backend_check_referrals( be, conn, op, &urls, &text );
+ if ( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc,
+ NULL, text, urls, NULL );
+ ber_bvecfree( urls );
+ goto cleanup;
+ }
+
rc = slap_bv2ad( &desc, &ava.aa_desc, &text );
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc, NULL,
op->o_connid, op->o_opid, dn, ava.aa_desc->ad_cname->bv_val, 0 );
-
- /*
- * We could be serving multiple database backends. Select the
- * appropriate one, or send a referral to our "referral server"
- * if we don't hold it.
- */
- if ( (be = select_backend( ndn )) == NULL ) {
- send_ldap_result( conn, op, rc = LDAP_REFERRAL,
- NULL, NULL, default_referral, NULL );
- rc = 1;
- goto cleanup;
- }
-
- /* make sure this backend recongizes critical controls */
- rc = backend_check_controls( be, conn, op, &text ) ;
-
- if( rc != LDAP_SUCCESS ) {
- send_ldap_result( conn, op, rc,
- NULL, text, NULL, NULL );
- goto cleanup;
- }
-
/* deref suffix alias if appropriate */
ndn = suffix_alias( be, ndn );
{
char *dn, *ndn = NULL;
const char *text;
+ struct berval **urls = NULL;
Backend *be;
int rc;
/* make sure this backend recongizes critical controls */
rc = backend_check_controls( be, conn, op, &text ) ;
-
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
goto cleanup;
}
+ /* check for referrals */
+ rc = backend_check_referrals( be, conn, op, &urls, &text );
+ if ( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc,
+ NULL, text, urls, NULL );
+ ber_bvecfree( urls );
+ goto cleanup;
+ }
+
if ( global_readonly || be->be_readonly ) {
Debug( LDAP_DEBUG_ANY, "do_delete: database is read-only\n",
0, 0, 0 );
#include "slap.h"
-
int
do_modify(
Connection *conn,
- Operation *op
-)
+ Operation *op )
{
char *dn, *ndn = NULL;
char *last;
Backend *be;
int rc;
const char *text;
+ struct berval **urls;
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
}
(*modtail)->ml_op = mop;
-
-
modtail = &(*modtail)->ml_next;
}
*modtail = NULL;
}
#endif
-
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MOD dn=\"%s\"\n",
op->o_connid, op->o_opid, dn, 0, 0 );
goto cleanup;
}
+ /* check for referrals */
+ rc = backend_check_referrals( be, conn, op, &urls, &text );
+ if ( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc,
+ NULL, text, urls, NULL );
+ ber_bvecfree( urls );
+ goto cleanup;
+ }
+
if ( global_readonly || be->be_readonly ) {
Debug( LDAP_DEBUG_ANY, "do_modify: database is read-only\n",
0, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
- NULL, "directory is read-only", NULL, NULL );
+ NULL, "directory is read-only", NULL, NULL );
goto cleanup;
}
ber_len_t length;
int rc;
const char *text;
+ struct berval **urls = NULL;
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
/* make sure this backend recongizes critical controls */
rc = backend_check_controls( be, conn, op, &text ) ;
-
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
goto cleanup;
}
+ /* check for referrals */
+ rc = backend_check_referrals( be, conn, op, &urls, &text );
+ if ( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc,
+ NULL, text, urls, NULL );
+ ber_bvecfree( urls );
+ goto cleanup;
+ }
+
if ( global_readonly || be->be_readonly ) {
Debug( LDAP_DEBUG_ANY, "do_modrdn: database is read-only\n",
0, 0, 0 );
Operation *op,
const char **text ));
+LIBSLAPD_F( int ) backend_check_referrals LDAP_P((
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval ***bv,
+ const char **text ));
+
LIBSLAPD_F (int) backend_connection_init LDAP_P((Connection *conn));
LIBSLAPD_F (int) backend_connection_destroy LDAP_P((Connection *conn));
#include "ldap_pvt.h"
#include "slap.h"
-
int
do_search(
Connection *conn, /* where to send results */
Operation *op /* info about the op to which we're responding */
-)
-{
+) {
int i;
ber_int_t scope, deref, attrsonly;
ber_int_t sizelimit, timelimit;
Backend *be;
int rc;
const char *text;
+ struct berval **urls = NULL;
Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
/* make sure this backend recongizes critical controls */
rc = backend_check_controls( be, conn, op, &text ) ;
-
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
goto return_results;
}
+ /* check for referrals */
+ rc = backend_check_referrals( be, conn, op, &urls, &text );
+ if ( rc != LDAP_SUCCESS ) {
+ send_ldap_result( conn, op, rc,
+ NULL, text, urls, NULL );
+ ber_bvecfree( urls );
+ goto return_results;
+ }
+
/* deref the base if needed */
nbase = suffix_alias( be, nbase );
#define be_extended bd_info->bi_extended
#define be_release bd_info->bi_entry_release_rw
+#define be_chk_referrals bd_info->bi_chk_referrals
#define be_group bd_info->bi_acl_group
#define be_controls bd_info->bi_controls
/* Auxilary Functions */
int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw));
+ int (*bi_chk_referrals) LDAP_P((BackendDB *bd,
+ struct slap_conn *c, struct slap_op *o,
+ struct berval ***urls,
+ const char **text ));
+
int (*bi_acl_group) LDAP_P((Backend *bd,
Entry *e, const char *bdn, const char *edn,
ObjectClass *group_oc,