Commit 68b1bbb8 authored by Howard Chu's avatar Howard Chu
Browse files

Changed search attrs to struct berval **.

Use typedefs for all backend functions, to minimize work in future API
updates. (back-*/external.h will never need updating in the future.)
parent 65977a0f
......@@ -210,12 +210,8 @@ parse_acl(
}
} else if ( strncasecmp( left, "attr", 4 ) == 0 ) {
char **alist;
alist = str2charray( right, "," );
charray_merge( &a->acl_attrs, alist );
charray_free( alist );
a->acl_attrs = str2bvec( a->acl_attrs,
right, "," );
} else {
fprintf( stderr,
"%s: line %d: expecting <what> got \"%s\"\n",
......@@ -1281,7 +1277,7 @@ acl_free( AccessControl *a )
if ( a->acl_dn_pat.bv_len )
free ( a->acl_dn_pat.bv_val );
if ( a->acl_attrs )
charray_free( a->acl_attrs );
ber_bvecfree( a->acl_attrs );
for (; a->acl_access; a->acl_access = n) {
n = a->acl_access->a_next;
access_free( a->acl_access );
......@@ -1494,7 +1490,7 @@ print_acl( Backend *be, AccessControl *a )
if ( ! first ) {
fprintf( stderr, "," );
}
fprintf( stderr, a->acl_attrs[i] );
fputs( a->acl_attrs[i]->bv_val, stderr );
first = 0;
}
fprintf( stderr, "\n" );
......
......@@ -266,7 +266,7 @@ int is_ad_subtype(
int ad_inlist(
AttributeDescription *desc,
char **attrs )
struct berval **attrs )
{
int i;
for( i=0; attrs[i] != NULL; i++ ) {
......@@ -275,7 +275,7 @@ int ad_inlist(
const char *text;
int rc;
rc = slap_str2ad( attrs[i], &ad, &text );
rc = slap_bv2ad( attrs[i], &ad, &text );
if( rc == LDAP_SUCCESS ) {
rc = is_ad_subtype( desc, ad );
if( rc ) return 1;
......@@ -286,7 +286,7 @@ int ad_inlist(
* EXTENSION: see if requested description is an object class
* if so, return attributes which the class requires/allows
*/
oc = oc_find( attrs[i] );
oc = oc_bvfind( attrs[i] );
if( oc != NULL ) {
if ( oc == slap_schema.si_oc_extensibleObject ) {
/* extensibleObject allows the return of anything */
......
......@@ -15,7 +15,7 @@
static struct exop {
char *oid;
SLAP_EXTENDED_FN extended;
BI_op_extended *extended;
} exop_table[] = {
{ LDAP_EXOP_X_MODIFY_PASSWD, bdb_exop_passwd },
{ NULL, NULL }
......
......@@ -9,59 +9,29 @@
LDAP_BEGIN_DECL
extern int bdb_initialize LDAP_P(( BackendInfo *bi ));
extern int bdb_db_config LDAP_P(( BackendDB *bd,
const char *fname, int lineno,
int argc, char **argv ));
extern int bdb_add LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, Entry *e ));
extern int bdb_bind LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, int method,
struct berval *cred, char** edn ));
extern int bdb_compare LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
AttributeAssertion *ava ));
extern int bdb_delete LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn ));
extern int bdb_abandon LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, ber_int_t msgid ));
extern int bdb_modify LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, Modifications *ml ));
extern int bdb_modrdn LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
const char* newrdn, int deleteoldrdn,
const char *newSuperior ));
extern int bdb_search LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *base, const char *nbase,
int scope, int deref, int sizelimit, int timelimit,
Filter *filter, const char *filterstr,
char **attrs, int attrsonly ));
extern int bdb_unbind LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op ));
extern int bdb_referrals(
BackendDB *be,
Connection *conn,
Operation *op,
const char *dn,
const char *ndn,
const char **text );
extern BI_init bdb_initialize;
extern BI_db_config bdb_db_config;
extern BI_op_add bdb_add;
extern BI_op_bind bdb_bind;
extern BI_op_compare bdb_compare;
extern BI_op_delete bdb_delete;
extern BI_op_abandon bdb_abandon;
extern BI_op_modify bdb_modify;
extern BI_op_modrdn bdb_modrdn;
extern BI_op_search bdb_search;
extern BI_op_unbind bdb_unbind;
extern BI_chk_referrals bdb_referrals;
LDAP_END_DECL
......
......@@ -43,10 +43,7 @@ void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
* attribute.c
*/
int
bdb_attribute LDAP_P(( Backend *be, Connection *conn, Operation *op,
Entry *target, const char *entry_ndn, AttributeDescription *entry_at,
struct berval ***vals ));
BI_acl_attribute bdb_attribute;
/*
* dbcache.c
......@@ -107,7 +104,7 @@ bdb_dn2idl(
* entry.c
*/
int bdb_entry_return( BackendDB *be, Entry *e );
int bdb_entry_release( BackendDB *, Connection *, Operation *, Entry *, int );
BI_entry_release_rw bdb_entry_release;
/*
* error.c
......@@ -127,15 +124,7 @@ int bdb_filter_candidates(
* group.c
*/
int bdb_group(
Backend *be,
Connection *conn,
Operation *op,
Entry *target,
const char *gr_ndn,
const char *op_ndn,
ObjectClass *group_oc,
AttributeDescription *group_at);
BI_acl_group bdb_group;
/*
* id2entry
......@@ -286,28 +275,17 @@ int bdb_modify_internal(
/*
* passwd.c
*/
int
bdb_exop_passwd(
Backend *be,
Connection *conn,
Operation *op,
const char *reqoid,
struct berval *reqdata,
char **rspoid,
struct berval **rspdata,
LDAPControl *** rspctrls,
const char **text,
struct berval *** refs );
BI_op_extended bdb_exop_passwd;
/*
* tools.c
*/
int bdb_tool_entry_open( BackendDB *be, int mode );
int bdb_tool_entry_close( BackendDB *be );
ID bdb_tool_entry_next( BackendDB *be );
Entry* bdb_tool_entry_get( BackendDB *be, ID id );
ID bdb_tool_entry_put( BackendDB *be, Entry *e );
int bdb_tool_entry_reindex( BackendDB *be, ID id );
BI_tool_entry_open bdb_tool_entry_open;
BI_tool_entry_close bdb_tool_entry_close;
BI_tool_entry_next bdb_tool_entry_next;
BI_tool_entry_get bdb_tool_entry_get;
BI_tool_entry_put bdb_tool_entry_put;
BI_tool_entry_reindex bdb_tool_entry_reindex;
LDAP_END_DECL
......
......@@ -40,7 +40,7 @@ bdb_search(
int tlimit,
Filter *filter,
const char *filterstr,
char **attrs,
struct berval **attrs,
int attrsonly )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
......
......@@ -30,7 +30,7 @@ dnssrv_back_search(
int time,
Filter *filter,
const char *filterstr,
char **attrs,
struct berval **attrs,
int attrsonly )
{
int i;
......
......@@ -9,74 +9,38 @@
LDAP_BEGIN_DECL
extern int ldap_back_initialize LDAP_P(( BackendInfo *bi ));
extern int ldap_back_open LDAP_P(( BackendInfo *bi ));
extern int ldap_back_close LDAP_P(( BackendInfo *bi ));
extern int ldap_back_destroy LDAP_P(( BackendInfo *bi ));
extern int ldap_back_db_init LDAP_P(( BackendDB *bd ));
extern int ldap_back_db_destroy LDAP_P(( BackendDB *bd ));
extern int ldap_back_db_config LDAP_P(( BackendDB *bd,
const char *fname, int lineno, int argc, char **argv ));
extern int ldap_back_bind LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, int method,
struct berval *cred, char** edn ));
extern int ldap_back_conn_destroy LDAP_P(( BackendDB *bd,
Connection *conn ));
extern int ldap_back_search LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *base, const char *nbase,
int scope, int deref, int sizelimit, int timelimit,
Filter *filter, const char *filterstr,
char **attrs, int attrsonly ));
extern int ldap_back_compare LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
AttributeAssertion *ava ));
extern int ldap_back_modify LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, Modifications *ml ));
extern int ldap_back_modrdn LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
const char *newrdn, int deleteoldrdn,
const char *newSuperior ));
extern int ldap_back_add LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, Entry *e ));
extern int ldap_back_delete LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn ));
extern int ldap_back_abandon LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, int msgid ));
extern int ldap_back_group LDAP_P(( BackendDB *bd,
Connection *conn,
Operation *op,
Entry *target,
const char* gr_ndn,
const char* op_ndn,
ObjectClass* group_oc,
AttributeDescription* group_at));
extern int ldap_back_attribute LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
Entry *target,
const char* ndn,
AttributeDescription* entry_at,
struct berval ***vals));
extern BI_init ldap_back_initialize;
extern BI_open ldap_back_open;
extern BI_close ldap_back_close;
extern BI_destroy ldap_back_destroy;
extern BI_db_init ldap_back_db_init;
extern BI_db_destroy ldap_back_db_destroy;
extern BI_db_config ldap_back_db_config;
extern BI_op_bind ldap_back_bind;
extern BI_connection_destroy ldap_back_conn_destroy;
extern BI_op_search ldap_back_search;
extern BI_op_compare ldap_back_compare;
extern BI_op_modify ldap_back_modify;
extern BI_op_modrdn ldap_back_modrdn;
extern BI_op_add ldap_back_add;
extern BI_op_delete ldap_back_delete;
extern BI_op_abandon ldap_back_abandon;
extern BI_acl_group ldap_back_group;
extern BI_acl_attribute ldap_back_attribute;
LDAP_END_DECL
#endif /* _LDAP_EXTERNAL_H */
......@@ -47,7 +47,7 @@
#include "back-ldap.h"
static void ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
LDAPMessage *e, char **attrs, int attrsonly );
LDAPMessage *e, struct berval **attrs, int attrsonly );
int
ldap_back_search(
......@@ -62,7 +62,7 @@ ldap_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
char **attrs,
struct berval **attrs,
int attrsonly
)
{
......@@ -363,7 +363,7 @@ ldap_send_entry(
Operation *op,
struct ldapconn *lc,
LDAPMessage *e,
char **attrs,
struct berval **attrs,
int attrsonly
)
{
......
......@@ -18,7 +18,7 @@
struct exop {
char *oid;
SLAP_EXTENDED_FN extended;
BI_op_extended *extended;
} exop_table[] = {
{ LDAP_EXOP_X_MODIFY_PASSWD, ldbm_back_exop_passwd },
{ NULL, NULL }
......
......@@ -9,109 +9,57 @@
LDAP_BEGIN_DECL
extern int ldbm_back_initialize LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_open LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_close LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_destroy LDAP_P(( BackendInfo *bi ));
extern int ldbm_back_db_init LDAP_P(( BackendDB *bd ));
extern int ldbm_back_db_open LDAP_P(( BackendDB *bd ));
extern int ldbm_back_db_close LDAP_P(( BackendDB *bd ));
extern int ldbm_back_db_destroy LDAP_P(( BackendDB *bd ));
extern int ldbm_back_db_config LDAP_P(( BackendDB *bd,
const char *fname, int lineno,
int argc, char **argv ));
extern int ldbm_back_extended LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *reqoid,
struct berval *reqdata,
char **rspoid,
struct berval **rspdata,
LDAPControl *** rspctrls,
const char **text,
struct berval *** refs ));
extern int ldbm_back_bind LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, int method,
struct berval *cred, char** edn ));
extern int ldbm_back_unbind LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op ));
extern int ldbm_back_search LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *base, const char *nbase,
int scope, int deref, int sizelimit, int timelimit,
Filter *filter, const char *filterstr,
char **attrs, int attrsonly ));
extern int ldbm_back_compare LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
AttributeAssertion *ava ));
extern int ldbm_back_modify LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn, Modifications *ml ));
extern int ldbm_back_modrdn LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
const char* newrdn, int deleteoldrdn,
const char *newSuperior ));
extern int ldbm_back_add LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, Entry *e ));
extern int ldbm_back_delete LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn ));
extern int ldbm_back_abandon LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, ber_int_t msgid ));
extern int ldbm_back_group LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
Entry *target,
const char* gr_ndn,
const char* op_ndn,
ObjectClass* group_oc,
AttributeDescription* group_at));
extern int ldbm_back_attribute LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
Entry *target,
const char* entry_ndn,
AttributeDescription* entry_at,
struct berval ***vals));
extern int ldbm_back_operational LDAP_P((BackendDB *bd,
Connection *conn, Operation *op,
Entry *e,
char **attrs,
int opattrs,
Attribute **a ));
extern BI_init ldbm_back_initialize;
extern BI_open ldbm_back_open;
extern BI_close ldbm_back_close;
extern BI_destroy ldbm_back_destroy;
extern BI_db_init ldbm_back_db_init;
extern BI_db_open ldbm_back_db_open;
extern BI_db_close ldbm_back_db_close;
extern BI_db_destroy ldbm_back_db_destroy;
extern BI_db_config ldbm_back_db_config;
extern BI_op_extended ldbm_back_extended;
extern BI_op_bind ldbm_back_bind;
extern BI_op_unbind ldbm_back_unbind;
extern BI_op_search ldbm_back_search;
extern BI_op_compare ldbm_back_compare;
extern BI_op_modify ldbm_back_modify;
extern BI_op_modrdn ldbm_back_modrdn;
extern BI_op_add ldbm_back_add;
extern BI_op_delete ldbm_back_delete;
extern BI_op_abandon ldbm_back_abandon;
extern BI_acl_group ldbm_back_group;
extern BI_acl_attribute ldbm_back_attribute;
extern BI_operational ldbm_back_operational;
/* hooks for slap tools */
extern int ldbm_tool_entry_open LDAP_P(( BackendDB *be, int mode ));
extern int ldbm_tool_entry_close LDAP_P(( BackendDB *be ));
extern ID ldbm_tool_entry_first LDAP_P(( BackendDB *be ));
extern ID ldbm_tool_entry_next LDAP_P(( BackendDB *be ));
extern Entry* ldbm_tool_entry_get LDAP_P(( BackendDB *be, ID id ));
extern ID ldbm_tool_entry_put LDAP_P(( BackendDB *be, Entry *e ));
extern BI_tool_entry_open ldbm_tool_entry_open;
extern BI_tool_entry_close ldbm_tool_entry_close;
extern BI_tool_entry_first ldbm_tool_entry_first;
extern BI_tool_entry_next ldbm_tool_entry_next;
extern BI_tool_entry_get ldbm_tool_entry_get;
extern BI_tool_entry_put ldbm_tool_entry_put;
extern int ldbm_tool_entry_reindex LDAP_P(( BackendDB *be, ID id ));
extern int ldbm_tool_sync LDAP_P(( BackendDB *be ));
extern BI_tool_entry_reindex ldbm_tool_entry_reindex;
extern BI_tool_sync ldbm_tool_sync;
extern int ldbm_back_referrals LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
const char **text ));
extern BI_chk_referrals ldbm_back_referrals;
LDAP_END_DECL
#endif /* _LDBM_EXTERNAL_H */
......@@ -25,7 +25,7 @@ ldbm_back_operational(
Connection *conn,
Operation *op,
Entry *e,
char **attrs,
struct berval **attrs,
int opattrs,
Attribute **a )
{
......
......@@ -37,7 +37,7 @@ ldbm_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
char **attrs,
struct berval **attrs,
int attrsonly )
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
......
......@@ -84,7 +84,7 @@ meta_send_entry(
struct metaconn *lc,
int i,
LDAPMessage *e,
char **attrs,
struct berval **attrs,
int attrsonly
);
......@@ -107,7 +107,7 @@ meta_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
char **attrs,
struct berval **attrs,
int attrsonly
)
{
......@@ -569,7 +569,7 @@ meta_send_entry(
struct metaconn *lc,
int target,
LDAPMessage *e,
char **attrs,
struct berval **attrs,
int attrsonly
)
{
......
......@@ -51,7 +51,7 @@ monitor_send_children(
Connection *conn,
Operation *op,
Filter *filter,
char **attrs,
struct berval **attrs,
int attrsonly,