###############################################################################
+Project: "backbdb"="..\servers\slapd\back-bdb\backbdb.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "backldbm"="..\servers\slapd\back-ldbm\backldbm.dsp" - Package Owner=<4>
Package=<5>
Begin Project Dependency
Project_Dep_Name liblunicode
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name backbdb
+ End Project Dependency
}}}
###############################################################################
Begin Project Dependency
Project_Dep_Name liblunicode
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name backbdb
+ End Project Dependency
}}}
###############################################################################
Begin Project Dependency
Project_Dep_Name liblunicode
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name backbdb
+ End Project Dependency
}}}
###############################################################################
Begin Project Dependency
Project_Dep_Name liblunicode
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name backbdb
+ End Project Dependency
}}}
###############################################################################
#define LDAP_PVT_SASL_LOCAL_SSF 71 /* SSF for Unix Domain Sockets */
+struct ldap;
+LDAP_F (int) ldap_open_internal_connection LDAP_P((
+ struct ldap **ldp, ber_socket_t *fdp ));
+
/* search.c */
LDAP_F( char * )
ldap_pvt_find_wildcard LDAP_P(( const char *s ));
/* Grow the packet buffer if neccessary */
if ( ( p->sec_buf_in.buf_size < ret ) &&
- ber_pvt_sb_grow_buffer( &p->sec_buf_in, ret ) < 0 ) {
+ ber_pvt_sb_grow_buffer( &p->sec_buf_in, ret ) < 0 )
+ {
errno = ENOMEM;
return -1;
}
char *
ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **berout )
{
+#if LBER_SEQORSET_AVOID_OVERRUN
int rc;
+#endif
ber_tag_t tag;
ber_len_t len;
char *attr;
LDAP_BEGIN_DECL
+#define BDB_IDL_SIZE (1<<16)
+#define BDB_IDL_MAX (BDB_IDL_SIZE-16)
+#define BDB_IDL_ALLOC (BDB_IDL_MAX * sizeof(ID))
+
+#define BDB_IS_ALLIDS(ids) ((ids)[0] == NOID)
+
#define DN_BASE_PREFIX SLAP_INDEX_EQUALITY_PREFIX
#define DN_ONE_PREFIX '%'
#define DN_SUBTREE_PREFIX '@'
# Name "backbdb - Win32 Single Release"
# Begin Source File
+SOURCE=.\add.c
+# End Source File
+# Begin Source File
+
SOURCE=".\back-bdb.h"
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\search.c
+# End Source File
+# Begin Source File
+
SOURCE=.\tools.c
# End Source File
# End Target
LDAP_BEGIN_DECL
-extern int bdb_back_initialize LDAP_P(( BackendInfo *bi ));
+extern int bdb_initialize LDAP_P(( BackendInfo *bi ));
LDAP_END_DECL
#include "back-bdb.h"
-#define BDB_IDL_SIZE (1<<16)
-#define BDB_IDL_MAX (BDB_IDL_SIZE-16)
-#define BDB_IDL_ALLOC (BDB_IDL_MAX * sizeof(ID))
-
-#define BDB_IS_ALLIDS(ids) ((ids)[0] == NOID)
-
#define IDL_CMP(x,y) ( x < y ? -1 : ( x > y ? 1 : 0 ) )
static int idl_search( ID *ids, ID id )
#include "back-bdb.h"
-static char *bdbi_dbnames[BDB_INDICES] = {
- "nextid", "id2entry", "dn2entry"
+static struct bdbi_database {
+ char *file;
+ char *name;
+ int type;
+ int flags;
+} bdbi_databases[BDB_INDICES] = {
+ { "nextid", "nextid", DB_BTREE, 0 },
+ { "id2entry", "id2entry", DB_BTREE, 0 },
+ { "dn2entry", "dn2entry", DB_BTREE, 0 }
};
static int
-bi_back_destroy( BackendInfo *bi )
+bdb_destroy( BackendInfo *bi )
{
return 0;
}
static int
-bi_back_open( BackendInfo *bi )
+bdb_open( BackendInfo *bi )
{
/* initialize the underlying database system */
return 0;
}
static int
-bi_back_close( BackendInfo *bi )
+bdb_close( BackendInfo *bi )
{
/* terminate the underlying database system */
return 0;
}
static int
-bi_back_db_init( Backend *be )
+bdb_db_init( Backend *be )
{
struct bdb_info *bdb;
}
static int
-bi_back_db_open( BackendDB *be )
+bdb_db_open( BackendDB *be )
{
int rc, i;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
return rc;
}
- flags = DB_THREAD;
-
-#if 0
- if( be->be_read_only ) {
- flags |= DB_RDONLY;
- } else
-#endif
- {
- flags |= DB_CREATE;
- }
+ flags = DB_THREAD | DB_CREATE;
/* open (and create) main database */
for( i = 0; i < BDB_INDICES; i++ ) {
}
rc = db->bdi_db->open( db->bdi_db,
- bdbi_dbnames[i],
- bdbi_dbnames[i],
- DB_BTREE,
- flags,
+ bdbi_databases[i].file,
+ bdbi_databases[i].name,
+ bdbi_databases[i].type,
+ bdbi_databases[i].flags | flags,
bdb->bi_dbenv_mode );
if( rc != 0 ) {
}
static int
-bi_back_db_close( BackendDB *be )
+bdb_db_close( BackendDB *be )
{
int rc;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
}
static int
-bi_back_db_destroy( BackendDB *be )
+bdb_db_destroy( BackendDB *be )
{
int rc;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
memset( &bi, '\0', sizeof(bi) );
bi.bi_type = "bdb";
- bi.bi_init = bi_back_initialize;
+ bi.bi_init = bdb_initialize;
backend_add( &bi );
return 0;
#endif /* SLAPD_BDB_DYNAMIC */
int
-bdb_back_initialize(
+bdb_initialize(
BackendInfo *bi
)
{
"\tgot: %s \n", version, 0, 0 );
}
- Debug( LDAP_DEBUG_ANY, "bi_back_initialize: %s\n",
+ Debug( LDAP_DEBUG_ANY, "bdb_initialize: %s\n",
version, 0, 0 );
}
bi->bi_controls = controls;
- bi->bi_open = bi_back_open;
- bi->bi_close = bi_back_close;
+ bi->bi_open = bdb_open;
+ bi->bi_close = bdb_close;
bi->bi_config = 0;
- bi->bi_destroy = bi_back_destroy;
+ bi->bi_destroy = bdb_destroy;
- bi->bi_db_init = bi_back_db_init;
+ bi->bi_db_init = bdb_db_init;
bi->bi_db_config = 0;
- bi->bi_db_open = bi_back_db_open;
- bi->bi_db_close = bi_back_db_close;
- bi->bi_db_destroy = bi_back_db_destroy;
+ bi->bi_db_open = bdb_db_open;
+ bi->bi_db_close = bdb_db_close;
+ bi->bi_db_destroy = bdb_db_destroy;
#if 0
bi->bi_op_bind = bi_back_bind;
ID kid = NOID;
ID id;
DBT key, data;
+ DB_TXN *ltid;
+
+ rc = txn_begin( bdb->bi_dbenv, tid, <id, 0 );
+ if( rc != 0 ) {
+ return rc;
+ }
DBTzero( &key );
key.data = (char *) &kid;
/* get exiting value (with write lock) */
rc = bdb->bi_entries->bdi_db->get( bdb->bi_nextid->bdi_db,
- tid, &key, &data, DB_RMW );
+ ltid, &key, &data, DB_RMW );
if( rc == DB_NOTFOUND ) {
/* must be first add */
id = NOID;
} else if( rc != 0 ) {
- return rc;
+ goto done;
} else if ( data.size != sizeof(ID) ) {
/* size mismatch! */
- return -1;
+ rc = -1;
+ goto done;
}
id++;
/* store new value */
rc = bdb->bi_entries->bdi_db->put( bdb->bi_nextid->bdi_db,
- tid, &key, &data, 0 );
+ ltid, &key, &data, 0 );
*out = id;
+
+done:
+ if( rc != 0 ) {
+ (void) txn_abort( ltid );
+ } else {
+ rc = txn_commit( ltid, 0 );
+ }
+
return rc;
}
LDAP_BEGIN_DECL
+
/*
- * error.c
+ * alias.c
*/
-void bdb_errcall( const char *pfx, char * msg );
+Entry *bdb_deref_internal_r LDAP_P((
+ Backend *be,
+ Entry *e,
+ const char *dn,
+ int *err,
+ Entry **matched,
+ const char **text ));
+
+#define deref_entry_r( be, e, err, matched, text ) \
+ bdb_deref_internal_r( be, e, NULL, err, matched, text )
+#define deref_dn_r( be, dn, err, matched, text ) \
+ bdb_deref_internal_r( be, NULL, dn, err, matched, text)
/*
* dn2id.c
const char *dn,
ID id );
+Entry * bdb_dn2entry_rw LDAP_P(( Backend *be, DB_TXN *tid,
+ const char *dn, Entry **matched, int rw ));
+
+#define dn2entry_r(be, tid, dn, m) bdb_dn2entry_rw((be), (tid), (dn), (m), 0)
+#define dn2entry_w(be, tid, dn, m) bdb_dn2entry_rw((be), (tid), (dn), (m), 1)
+
+/*
+ * error.c
+ */
+void bdb_errcall( const char *pfx, char * msg );
+
/*
* idl.c
*/
Debug( LDAP_DEBUG_ANY,
"bdb_tool_entry_reindex:: could not locate id=%ld\n",
(long) id, 0, 0 );
- txn_abort( bdi->bdi_db_env );
+ txn_abort( tid );
return -1;
}
static BackendInfo binfo[] = {
#if defined(SLAPD_BDB) && !defined(SLAPD_BDB_DYNAMIC)
- {"bdb", bdb_back_initialize},
+ {"bdb", bdb_initialize},
#endif
#if defined(SLAPD_DNSSRV) && !defined(SLAPD_DNSSRV_DYNAMIC)
{"dnssrv", dnssrv_back_initialize},
}
} else if ( !strcasecmp( cargv[0], "saslregexp" ) ) {
+ int rc;
if ( cargc != 3 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: need 2 args in \"saslregexp <match> <replace>\"\n",
return( 1 );
}
rc = slap_sasl_regexp_config( cargv[1], cargv[2] );
- if ( rc )
+ if ( rc ) {
return rc;
+ }
/* SASL security properties */
} else if ( strcasecmp( cargv[0], "sasl-secprops" ) == 0 ) {
#include <ac/time.h>
#include "ldap_pvt.h"
+#include "lutil.h"
#include "slap.h"
/* protected by connections_mutex */
const char* sockname,
int use_tls,
slap_ssf_t ssf,
- char *authid )
+ const char *authid )
{
unsigned long id;
Connection *c;
* one another, for the front end to use for searches on arbitrary back ends.
*/
-int connection_internal_open( Connection **conn, LDAP **ldp, char *id )
+int connection_internal_open( Connection **conn, LDAP **ldp, const char *id )
{
int rc;
ber_socket_t fd[2] = {-1,-1};
Operation *op;
-
*conn=NULL;
*ldp=NULL;
- rc = pipe( fd );
- if( rc == -1 )
- return( LDAP_OPERATIONS_ERROR );
+ rc = lutil_pair( fd );
+ if( rc == -1 ) {
+ return LDAP_OTHER;
+ }
rc = connection_init( fd[1], "INT", "localhost",
"localhost:0", "localhost:00", 0, 256, id );
if( rc < 0 ) {
- close( fd[0] );
- close( fd[1] );
- return( LDAP_OPERATIONS_ERROR );
+ tcp_close( fd[0] );
+ tcp_close( fd[1] );
+ return LDAP_OTHER;
}
slapd_add_internal( fd[1] );
/* Create the client side of the connection */
rc = ldap_open_internal_connection( ldp, &(fd[0]) );
if( rc != LDAP_SUCCESS ) {
- close( fd[0] );
- return( LDAP_OPERATIONS_ERROR );
+ tcp_close( fd[0] );
+ return LDAP_OTHER;
}
/* The connection_get() will have locked the connection's mutex */
ldap_pvt_thread_mutex_unlock( &((*conn)->c_mutex) );
- return( LDAP_SUCCESS );
+ return LDAP_SUCCESS;
}
# End Source File
# Begin Source File
+SOURCE=.\saslauthz.c
+# End Source File
+# Begin Source File
+
SOURCE=.\schema.c
# End Source File
# Begin Source File
const char* sockname,
int use_tls,
slap_ssf_t ssf,
- char *id ));
+ const char *id ));
LDAP_SLAPD_F (void) connection_closing LDAP_P(( Connection *c ));
LDAP_SLAPD_F (int) connection_state_closing LDAP_P(( Connection *c ));
LDAP_SLAPD_F (void) connection2anonymous LDAP_P((Connection *));
+LDAP_SLAPD_F (int) connection_internal_open(
+ Connection **conn, LDAP **ldp, const char *id );
+LDAP_SLAPD_F (void) connection_internal_close( Connection *conn );
+
/*
* dn.c
*/
LDAP_SLAPD_F (int) slap_sasl_external( Connection *c,
slap_ssf_t ssf, /* relative strength of external security */
- char *authid ); /* asserted authenication id */
+ const char *authid ); /* asserted authenication id */
LDAP_SLAPD_F (int) slap_sasl_reset( Connection *c );
LDAP_SLAPD_F (int) slap_sasl_close( Connection *c );
struct berval *cred,
char **edn, slap_ssf_t *ssf ));
+/*
+ * saslauthz.c
+ */
+LDAP_SLAPD_F (int) slap_sasl_authorized LDAP_P((
+ Connection *conn,
+ const char *authcid,
+ const char *authzid ));
+LDAP_SLAPD_F (int) slap_sasl_regexp_config LDAP_P((
+ const char *match, const char *replace ));
+
/* oc.c */
LDAP_SLAPD_F (int) oc_schema_info( Entry *e );
struct sockaddr_in;
+LDAP_SLAPD_F (void) slapd_add_internal(ber_socket_t s);
LDAP_SLAPD_F (int) slapd_daemon_init( const char *urls );
LDAP_SLAPD_F (int) slapd_daemon_destroy(void);
LDAP_SLAPD_F (int) slapd_daemon(void);
int slap_sasl_external(
Connection *conn,
slap_ssf_t ssf,
- char *auth_id )
+ const char *auth_id )
{
#ifdef HAVE_CYRUS_SASL
int sc;
memset( &extprops, '\0', sizeof(extprops) );
extprops.ssf = ssf;
- extprops.auth_id = auth_id;
+ extprops.auth_id = (char *) auth_id;
sc = sasl_setprop( ctx, SASL_SSF_EXTERNAL,
(void *) &extprops );
return( LDAP_SUCCESS );
}
- end = index( uri + 7, '/' );
+ end = strchr( uri + 7, '/' );
if ( end == NULL )
return( LDAP_PROTOCOL_ERROR );
/* Grab the searchbase */
start = end+1;
- end = index( start, '?' );
+ end = strchr( start, '?' );
if( end == NULL ) {
*searchbase = ch_strdup( start );
dn_normalize( *searchbase );
/* Skip the attrs */
start = end+1;
- end = index( start, '?' );
+ end = strchr( start, '?' );
if( end == NULL ) {
return( LDAP_SUCCESS );
}
/* Check if a bind can SASL authorize to another identity. */
-int slap_sasl_authorized( Connection *conn, char *authcid, char *authzid )
+int slap_sasl_authorized( Connection *conn,
+ const char *authcid, const char *authzid )
{
int rc;
char *saslname=NULL,*authcDN=NULL,*realm=NULL, *authzDN=NULL;