Add LDBM referral handler...

This commit is contained in:
Kurt Zeilenga 2000-06-17 07:45:40 +00:00
parent 97137ca016
commit 189b738c63
5 changed files with 111 additions and 85 deletions

90
README
View File

@ -1,86 +1,14 @@
OpenLDAP Devel README
OpenLDAP -devel is for the development of OpenLDAP. As such,
it changes often. These changes include changes in functionality
and unproven bug fixes. Many of these changes will cause
previous working programs to fail.
Additional developer documents are available in doc/devel,
todo list
guidelines for developers
Client developers seeking a stable development platform
should use an OpenLDAP release.
This software was obtained from the development branch (HEAD) of
the OpenLDAP Software Repository. This copy is likely already
not current, the development branch changes frequently. These
changes include code implementing experimental features and
unproven bug fixes. This copy is meant only for reference
purposes.
The OpenLDAP Developer's FAQ is available at:
http://www.openldap.org/faq/index.cgi?file=4
OpenLDAP Release README
For a description of what this distribution contains, see the
ANNOUNCEMENT file in this directory. For a description of
changes from previous releases, see the CHANGES file in this
directory.
For a more detailed description of how to make an install the
distribution, see the INSTALL file in this directory. Additional
installation information can be found on the OpenLDAP website:
http://www.openldap.org/
REQUIRED SOFTWARE
Build OpenLDAP requires the following software components:
Base system (libraries and tools):
Standard C compiler, headers, and libraries
POSIX REGEX headers and libraries
SLAPD:
LDBM compatible datastore
(Sleepycat Berkeley DB 2.7.5 or GDBM)
SLURPD:
LTHREAD compatible thread package
(POSIX threads, Mach Cthreads, Sun LWP, or GNU Pth)
CLIENTS/CONTRIB ware:
Depends on package. See per package README.
MAKING AND INSTALLING THE DISTRIBUTION
Please see the INSTALL file for details.
DOCUMENTATION
There are man pages for most programs in the distribution and
routines in the various libraries. See ldap(3) for details.
Additional documentation can be found in the doc directory.
doc/devel Developer Information
doc/drafts LDAP-related IETF drafts
doc/install Installation and Integration
doc/man Raw man(1) pages
doc/rfcs LDAP-related Request for Comments
There is an OpenLDAP home page available that contains the latest
LDAP news, releases announcements, pointers to other LDAP resources,
etc.. It is located at:
http://www.OpenLDAP.org/
The OpenLDAP Quick Start Guide is available at:
http://www.openldap.org/faq/index.cgi?file=172
The OpenLDAP Software FAQ is available at:
http://www.openldap.org/faq/index.cgi?file=2
SUPPORT / FEEDBACK / PROBLEM REPORTS / DISCUSSIONS
OpenLDAP is user supported. If you have problems, please
review the OpenLDAP FAQ <http://www.openldap.org/faq/> and
archives of the OpenLDAP-software and OpenLDAP-bugs mailing
lists <http://www.openldap.org/lists/>.
Issues, such as bug reports, should be reported using our
our Issue Tracking System <http://www.OpenLDAP.com/its/> or
by sending mail to OpenLDAP-its@OpenLDAP.org. Do not use
this system for general or software equiries. Please direct
these to the appropriate mailing list.
Client developers seeking a stable development platform
should use OpenLDAP-release or OpenLDAP-software.
http://www.openldap.org/software/

View File

@ -4,12 +4,12 @@ SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c id2entry.c \
index.c id2children.c nextid.c abandon.c compare.c group.c \
modify.c modrdn.c delete.c init.c config.c bind.c attr.c \
filterindex.c unbind.c close.c alias.c tools.c key.c \
extended.c passwd.c sasl.c
extended.c passwd.c sasl.c referral.c
OBJS = idl.lo add.lo search.lo cache.lo dbcache.lo dn2id.lo entry.lo id2entry.lo \
index.lo id2children.lo nextid.lo abandon.lo compare.lo group.lo \
modify.lo modrdn.lo delete.lo init.lo config.lo bind.lo attr.lo \
filterindex.lo unbind.lo close.lo alias.lo tools.lo key.lo \
extended.lo passwd.lo sasl.lo
extended.lo passwd.lo sasl.lo referral.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries

View File

@ -96,7 +96,11 @@ extern int ldbm_tool_index_change LDAP_P(( BackendDB *be,
struct berval **bv, ID id, int op ));
extern int ldbm_tool_sync LDAP_P(( BackendDB *be ));
extern int ldbm_back_referrals LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
const char **text ));
LDAP_END_DECL
#endif /* _LDBM_EXTERNAL_H */

View File

@ -67,7 +67,7 @@ ldbm_back_initialize(
bi->bi_entry_release_rw = ldbm_back_entry_release_rw;
bi->bi_acl_group = ldbm_back_group;
bi->bi_chk_referrals = 0;
bi->bi_chk_referrals = ldbm_back_referrals;
/*
* hooks for slap tools

View File

@ -0,0 +1,94 @@
/* referral.c - LDBM backend referral handler */
/* $OpenLDAP$ */
/*
* Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include <ac/socket.h>
#include "slap.h"
#include "back-ldbm.h"
int
ldbm_back_referrals(
Backend *be,
Connection *conn,
Operation *op,
const char *dn,
const char *ndn,
const char **text )
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
int rc = LDAP_SUCCESS;
Entry *e, *matched;
if( op->o_tag == LDAP_REQ_SEARCH ) {
/* let search take care of itself */
return rc;
}
if( get_manageDSAit( op ) ) {
/* let op take care of DSA management */
return rc;
}
/* get entry with reader lock */
e = dn2entry_r( be, ndn, &matched );
if ( e == NULL ) {
char *matched_dn = NULL;
struct berval **refs = default_referral;
if ( matched != NULL ) {
matched_dn = ch_strdup( matched->e_dn );
Debug( LDAP_DEBUG_TRACE,
"ldbm_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
op->o_tag, dn, matched_dn );
refs = is_entry_referral( matched )
? get_entry_referrals( be, conn, op, matched )
: NULL;
cache_return_entry_r( &li->li_cache, matched );
}
if( refs != NULL ) {
/* send referrals */
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
matched_dn, NULL, refs, NULL );
}
if( matched != NULL ) {
ber_bvecfree( refs );
free( matched_dn );
}
return rc;
}
if ( is_entry_referral( e ) ) {
/* entry is a referral */
struct berval **refs = get_entry_referrals( be,
conn, op, e );
Debug( LDAP_DEBUG_TRACE,
"ldbm_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
op->o_tag, dn, e->e_dn );
if( refs != NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
e->e_dn, NULL, refs, NULL );
}
ber_bvecfree( refs );
}
cache_return_entry_r( &li->li_cache, e );
return rc;
}