mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-29 02:59:34 -05:00
Replace -DSLAPD_SCHEMA_COMPAT with -USLAPD_SCHEMA_NOT_COMPAT
This commit is contained in:
parent
08e3b010d5
commit
3a6e906194
19 changed files with 171 additions and 131 deletions
|
|
@ -403,22 +403,26 @@ acl_mask(
|
|||
bv.bv_val = op->o_ndn;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
dn_at = b->a_dn_at;
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
dn_at = at_canonical_name( b->a_dn_at );
|
||||
#else
|
||||
dn_at = b->a_dn_at;
|
||||
#endif
|
||||
|
||||
/* see if asker is listed in dnattr */
|
||||
if ( (at = attr_find( e->e_attrs, dn_at )) != NULL
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
&& value_find( at->a_vals, &bv, at->a_syntax, 3 ) == 0
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if ( b->a_dn_self &&
|
||||
(val == NULL
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
|| value_cmp( &bv, val, at->a_syntax, 2 )
|
||||
#endif
|
||||
) )
|
||||
|
|
@ -428,7 +432,9 @@ acl_mask(
|
|||
|
||||
/* asker not listed in dnattr - check for self access */
|
||||
} else if ( ! b->a_dn_self || val == NULL
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
|| value_cmp( &bv, val, at->a_syntax, 2 ) != 0
|
||||
#endif
|
||||
)
|
||||
|
|
|
|||
|
|
@ -320,9 +320,7 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
b->a_dn_at = ch_strdup( right );
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
b->a_dn_at = at_find( right );
|
||||
|
||||
if( b->a_dn_at == NULL ) {
|
||||
|
|
@ -342,6 +340,8 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
b->a_dn_at = ch_strdup( right );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
|
@ -378,22 +378,22 @@ parse_acl(
|
|||
}
|
||||
|
||||
if (name && *name) {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
b->a_group_at = ch_strdup(name);
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
b->a_group_at = at_find( name );
|
||||
#else
|
||||
b->a_group_at = ch_strdup(name);
|
||||
#endif
|
||||
*--name = '/';
|
||||
|
||||
} else {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
b->a_group_at = ch_strdup("member");
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
b->a_group_at = at_find("member");
|
||||
#else
|
||||
b->a_group_at = ch_strdup("member");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( b->a_group_at == NULL ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: group attribute type undefined.\n",
|
||||
|
|
@ -411,7 +411,7 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
#endif /* SLAPD_OID_DN_SYNTAX */
|
||||
#endif /* !SLAPD_SCHEMA_COMPAT */
|
||||
#endif /* SLAPD_SCHEMA_NOT_COMPAT */
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -476,13 +476,7 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
if ( right != NULL && *right != '\0' ) {
|
||||
b->a_aci_at = ch_strdup( right );
|
||||
} else {
|
||||
b->a_aci_at = ch_strdup( SLAPD_ACI_DEFAULT_ATTR );
|
||||
}
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( right != NULL && *right != '\0' ) {
|
||||
b->a_aci_at = at_find( right );
|
||||
} else {
|
||||
|
|
@ -504,6 +498,12 @@ parse_acl(
|
|||
fname, lineno );
|
||||
acl_usage();
|
||||
}
|
||||
#else
|
||||
if ( right != NULL && *right != '\0' ) {
|
||||
b->a_aci_at = ch_strdup( right );
|
||||
} else {
|
||||
b->a_aci_at = ch_strdup( SLAPD_ACI_DEFAULT_ATTR );
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ Attribute *attr_dup( Attribute *a )
|
|||
}
|
||||
|
||||
tmp->a_type = ch_strdup( a->a_type );
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
tmp->a_syntax = a->a_syntax;
|
||||
#endif
|
||||
tmp->a_next = NULL;
|
||||
|
|
@ -144,7 +144,7 @@ attr_merge_fast(
|
|||
**a = (Attribute *) ch_malloc( sizeof(Attribute) );
|
||||
(**a)->a_type = attr_normalize( ch_strdup( type ) );
|
||||
(**a)->a_vals = NULL;
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
(**a)->a_syntax = attr_syntax( type );
|
||||
#endif
|
||||
(**a)->a_next = NULL;
|
||||
|
|
@ -180,7 +180,7 @@ attr_merge(
|
|||
*a = (Attribute *) ch_malloc( sizeof(Attribute) );
|
||||
(*a)->a_type = attr_normalize( ch_strdup( type ) );
|
||||
(*a)->a_vals = NULL;
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
(*a)->a_syntax = attr_syntax( type );
|
||||
#endif
|
||||
(*a)->a_next = NULL;
|
||||
|
|
@ -241,7 +241,7 @@ attr_delete(
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
|
||||
#define DEFAULT_SYNTAX SYNTAX_CIS
|
||||
|
||||
|
|
@ -408,7 +408,7 @@ at_find(
|
|||
struct aindexrec *air;
|
||||
char *tmpname;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* The name may actually be an AttributeDescription, i.e. it may
|
||||
* contain options.
|
||||
|
|
@ -638,7 +638,7 @@ at_add(
|
|||
return SLAP_SCHERR_SYN_NOT_FOUND;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( !strcmp(at->at_syntax_oid, SYNTAX_DS_OID) ) {
|
||||
if ( at->at_equality_oid && (
|
||||
!strcmp(at->at_equality_oid, SYNTAX_DSCE_OID) ) )
|
||||
|
|
@ -709,23 +709,23 @@ at_add(
|
|||
|
||||
|
||||
char *
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
at_canonical_name( const char * a_type )
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
at_canonical_name( AttributeType * atp )
|
||||
#else
|
||||
at_canonical_name( const char * a_type )
|
||||
#endif
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *atp;
|
||||
|
||||
atp=at_find(a_type);
|
||||
#endif
|
||||
|
||||
if ( atp == NULL ) {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
return (char *) a_type;
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return NULL;
|
||||
#else
|
||||
return (char *) a_type;
|
||||
#endif
|
||||
|
||||
} else if ( atp->sat_names
|
||||
|
|
@ -737,10 +737,10 @@ at_canonical_name( AttributeType * atp )
|
|||
return atp->sat_oid;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
return (char *) a_type;
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return NULL;
|
||||
#else
|
||||
return (char *) a_type;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ get_ava(
|
|||
|
||||
attr_normalize( ava->ava_type );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
value_normalize( ava->ava_value.bv_val, attr_syntax( ava->ava_type ) );
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,9 @@ ldbm_back_compare(
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
if ( value_find( a->a_vals, &ava->ava_value, a->a_syntax, 1 ) == 0 )
|
||||
send_ldap_result( conn, op, LDAP_COMPARE_TRUE,
|
||||
NULL, NULL, NULL, NULL );
|
||||
|
|
|
|||
|
|
@ -67,14 +67,14 @@ extern int ldbm_back_delete LDAP_P(( BackendDB *bd,
|
|||
extern int ldbm_back_abandon LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op, ber_int_t msgid ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
extern int ldbm_back_group LDAP_P(( BackendDB *bd,
|
||||
Entry *target, const char* gr_ndn, const char* op_ndn,
|
||||
const char* objectclassValue, const char* group_at));
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
extern int ldbm_back_group LDAP_P(( BackendDB *bd,
|
||||
Entry *target, const char* gr_ndn, const char* op_ndn,
|
||||
const char* objectclassValue, AttributeType* group_at));
|
||||
#else
|
||||
extern int ldbm_back_group LDAP_P(( BackendDB *bd,
|
||||
Entry *target, const char* gr_ndn, const char* op_ndn,
|
||||
const char* objectclassValue, const char* group_at));
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ ldbm_back_group(
|
|||
const char *gr_ndn,
|
||||
const char *op_ndn,
|
||||
const char *objectclassValue,
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
const char *groupattrName
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *group_at
|
||||
#else
|
||||
const char *groupattrName
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ ldbm_back_group(
|
|||
Attribute *attr;
|
||||
struct berval bv;
|
||||
|
||||
#ifndef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *groupattrName = at_canonical_name( group_at );
|
||||
#endif
|
||||
|
||||
|
|
@ -88,7 +88,9 @@ ldbm_back_group(
|
|||
|
||||
rc = 1;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
|
||||
if ((attr = attr_find(e->e_attrs, "objectclass")) == NULL) {
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
|
|
|
|||
|
|
@ -145,11 +145,11 @@ index_read(
|
|||
return( idl );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
at_cn = at_canonical_name( at_find( type ) );
|
||||
#else
|
||||
attr_normalize( type );
|
||||
at_cn = at_canonical_name( type );
|
||||
#else
|
||||
at_cn = at_canonical_name( at_find( type ) );
|
||||
#endif
|
||||
|
||||
if ( at_cn == NULL ) {
|
||||
|
|
@ -316,11 +316,11 @@ index_change_values(
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
at_cn = at_canonical_name( at_find( type ) );
|
||||
#else
|
||||
syntax = attr_syntax( type );
|
||||
at_cn = at_canonical_name( type );
|
||||
#else
|
||||
at_cn = at_canonical_name( at_find( type ) );
|
||||
#endif
|
||||
|
||||
if ( at_cn == NULL ) {
|
||||
|
|
@ -340,7 +340,9 @@ index_change_values(
|
|||
}
|
||||
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
for ( i = 0; vals[i] != NULL; i++ ) {
|
||||
/*
|
||||
* presence index entry
|
||||
|
|
|
|||
|
|
@ -248,7 +248,9 @@ add_values(
|
|||
/* check if the values we're adding already exist */
|
||||
if ( (a = attr_find( e->e_attrs, mod->mod_type )) != NULL ) {
|
||||
for ( i = 0; mod->mod_bvalues[i] != NULL; i++ ) {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
if ( value_find( a->a_vals, mod->mod_bvalues[i],
|
||||
a->a_syntax, 3 ) == 0 ) {
|
||||
return( LDAP_TYPE_OR_VALUE_EXISTS );
|
||||
|
|
@ -294,7 +296,9 @@ delete_values(
|
|||
for ( i = 0; mod->mod_bvalues[i] != NULL; i++ ) {
|
||||
found = 0;
|
||||
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
if ( value_cmp( mod->mod_bvalues[i], a->a_vals[j],
|
||||
a->a_syntax, 3 ) != 0 ) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -199,22 +199,13 @@ int ldbm_tool_index_attr(
|
|||
static DBCache *db = NULL;
|
||||
int indexmask;
|
||||
char * at_cn;
|
||||
#ifndef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *at;
|
||||
#endif
|
||||
|
||||
assert( slapMode & SLAP_TOOL_MODE );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
attr_normalize( type );
|
||||
at_cn = at_canonical_name( type );
|
||||
|
||||
if( at_cn ) {
|
||||
Debug( LDAP_DEBUG_ANY, "<= index_attr NULL (attribute type %s has no canonical name)\n",
|
||||
type, 0, 0 );
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
at = at_find( type );
|
||||
|
||||
if( at == NULL ) {
|
||||
|
|
@ -227,10 +218,21 @@ int ldbm_tool_index_attr(
|
|||
at_cn = at_canonical_name( at );
|
||||
|
||||
if( at_cn ) {
|
||||
Debug( LDAP_DEBUG_ANY, "<= index_attr NULL (attribute type %s (%s) has no canonical name)\n",
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"<= index_attr NULL (attribute type %s (%s) has no canonical name)\n",
|
||||
at->sat_oid, type, 0 );
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
attr_normalize( type );
|
||||
at_cn = at_canonical_name( type );
|
||||
|
||||
if( at_cn ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"<= index_attr NULL (attribute type %s has no canonical name)\n",
|
||||
type, 0, 0 );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
attr_mask( be->be_private, at_cn, &indexmask );
|
||||
|
|
|
|||
|
|
@ -618,10 +618,10 @@ backend_group(
|
|||
const char *gr_ndn,
|
||||
const char *op_ndn,
|
||||
const char *objectclassValue,
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
const char *group_at
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *group_at
|
||||
#else
|
||||
const char *group_at
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -638,7 +638,7 @@ Attribute *backend_subschemasubentry( Backend *be )
|
|||
/*
|
||||
* This routine returns points to STATIC data!!!
|
||||
*/
|
||||
/* should be backend specific */
|
||||
/* and should be backend specific */
|
||||
|
||||
static struct berval ss_val = {
|
||||
sizeof(SLAPD_SCHEMA_DN)-1,
|
||||
|
|
@ -647,7 +647,7 @@ Attribute *backend_subschemasubentry( Backend *be )
|
|||
static Attribute ss_attr = {
|
||||
"subschemasubentry",
|
||||
ss_vals,
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
SYNTAX_DN | SYNTAX_CIS,
|
||||
#endif
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -462,12 +462,12 @@ read_config( const char *fname )
|
|||
p = strchr(saveline,'(');
|
||||
parse_oc( fname, lineno, p, cargv );
|
||||
} else {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
parse_oc_old( be, fname, lineno, cargc, cargv );
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: old objectclass format not supported.\n",
|
||||
fname, lineno, 0 );
|
||||
#else
|
||||
parse_oc_old( be, fname, lineno, cargc, cargv );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -480,13 +480,13 @@ read_config( const char *fname )
|
|||
p = strchr(saveline,'(');
|
||||
parse_at( fname, lineno, p, cargv );
|
||||
} else {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
attr_syntax_config( fname, lineno, cargc - 1,
|
||||
&cargv[1] );
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: old attribute type format not supported.\n",
|
||||
fname, lineno, 0 );
|
||||
#else
|
||||
attr_syntax_config( fname, lineno, cargc - 1,
|
||||
&cargv[1] );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,9 @@ get_substring_filter(
|
|||
|
||||
attr_normalize( f->f_sub_type );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
/* should get real syntax and see if we have a substring matching rule */
|
||||
syntax = attr_syntax( f->f_sub_type );
|
||||
#endif
|
||||
|
|
@ -272,7 +274,9 @@ get_substring_filter(
|
|||
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
/* we should call a substring syntax normalization routine */
|
||||
value_normalize( val->bv_val, syntax );
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -11,19 +11,33 @@
|
|||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
#include <ac/regex.h>
|
||||
#endif
|
||||
|
||||
#include "slap.h"
|
||||
|
||||
static int test_filter_list(Backend *be, Connection *conn, Operation *op, Entry *e, Filter *flist, int ftype);
|
||||
static int test_substring_filter(Backend *be, Connection *conn, Operation *op, Entry *e, Filter *f);
|
||||
static int test_ava_filter(Backend *be, Connection *conn, Operation *op, Entry *e, Ava *ava, int type);
|
||||
static int test_approx_filter(Backend *be, Connection *conn, Operation *op, Entry *e, Ava *ava);
|
||||
static int test_presence_filter(Backend *be, Connection *conn, Operation *op, Entry *e, char *type);
|
||||
static int test_filter_list(Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, Filter *flist, int ftype);
|
||||
static int test_substring_filter(Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, Filter *f);
|
||||
static int test_ava_filter(Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, Ava *ava, int type);
|
||||
static int test_approx_filter(Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, Ava *ava);
|
||||
static int test_presence_filter(Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, char *type);
|
||||
|
||||
/*
|
||||
* test_filter - test a filter against a single entry.
|
||||
* returns 0 filter matched
|
||||
* returns:
|
||||
* 0 filter matched
|
||||
* -1 filter did not match
|
||||
* >0 an ldap error code
|
||||
*/
|
||||
|
|
@ -125,18 +139,20 @@ test_ava_filter(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
if ( a->a_syntax == 0 ) {
|
||||
a->a_syntax = attr_syntax( ava->ava_type );
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
rc = value_cmp( a->a_vals[i], &ava->ava_value, a->a_syntax,
|
||||
3 );
|
||||
#else
|
||||
rc = 0;
|
||||
#endif
|
||||
|
||||
switch ( type ) {
|
||||
|
|
@ -290,6 +306,7 @@ test_filter_list(
|
|||
return( nomatch );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static void
|
||||
strcpy_regex( char *d, char *s )
|
||||
{
|
||||
|
|
@ -317,6 +334,7 @@ strcpy_regex( char *d, char *s )
|
|||
}
|
||||
*d = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
test_substring_filter(
|
||||
|
|
@ -327,6 +345,9 @@ test_substring_filter(
|
|||
Filter *f
|
||||
)
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
Attribute *a;
|
||||
int i, rc;
|
||||
char *p, *end, *realval, *tmp;
|
||||
|
|
@ -347,13 +368,11 @@ test_substring_filter(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
if ( a->a_syntax & SYNTAX_BIN ) {
|
||||
Debug( LDAP_DEBUG_FILTER, "test_substring_filter bin attr\n",
|
||||
0, 0, 0 );
|
||||
return( -1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* construct a regular expression corresponding to the
|
||||
|
|
@ -428,9 +447,7 @@ test_substring_filter(
|
|||
realval = tmp;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
value_normalize( realval, a->a_syntax );
|
||||
#endif
|
||||
|
||||
rc = !regexec(&re, realval, 0, NULL, 0);
|
||||
|
||||
|
|
@ -444,6 +461,7 @@ test_substring_filter(
|
|||
}
|
||||
|
||||
regfree(&re);
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "end test_substring_filter 1\n", 0, 0, 0 );
|
||||
return( 1 );
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ LIBSLAPD_F (int) at_fake_if_needed LDAP_P(( const char *name ));
|
|||
LIBSLAPD_F (int) at_schema_info LDAP_P(( Entry *e ));
|
||||
LIBSLAPD_F (int) at_add LDAP_P(( LDAP_ATTRIBUTE_TYPE *at, const char **err ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
LIBSLAPD_F (char *) at_canonical_name LDAP_P(( const char * a_type ));
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (char *) at_canonical_name LDAP_P(( AttributeType *a_type ));
|
||||
#else
|
||||
LIBSLAPD_F (char *) at_canonical_name LDAP_P(( const char * a_type ));
|
||||
#endif
|
||||
|
||||
LIBSLAPD_F (void) attrs_free LDAP_P(( Attribute *a ));
|
||||
|
|
@ -120,13 +120,13 @@ LIBSLAPD_F( int ) backend_check_controls LDAP_P((
|
|||
LIBSLAPD_F (int) backend_connection_init LDAP_P((Connection *conn));
|
||||
LIBSLAPD_F (int) backend_connection_destroy LDAP_P((Connection *conn));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (int) backend_group LDAP_P((Backend *be,
|
||||
Entry *target,
|
||||
const char *gr_ndn,
|
||||
const char *op_ndn,
|
||||
const char *objectclassValue,
|
||||
const char *groupattrName
|
||||
AttributeType *groupAttrType
|
||||
));
|
||||
#else
|
||||
LIBSLAPD_F (int) backend_group LDAP_P((Backend *be,
|
||||
|
|
@ -134,7 +134,7 @@ LIBSLAPD_F (int) backend_group LDAP_P((Backend *be,
|
|||
const char *gr_ndn,
|
||||
const char *op_ndn,
|
||||
const char *objectclassValue,
|
||||
AttributeType *groupAttrType
|
||||
const char *groupattrName
|
||||
));
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ oc_check_allowed( char *type, struct berval **ocl )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* Treat any attribute type with option as an unknown attribute type */
|
||||
/*
|
||||
* The "type" we have received is actually an AttributeDescription.
|
||||
|
|
@ -252,7 +252,7 @@ oc_check_allowed( char *type, struct berval **ocl )
|
|||
}
|
||||
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* these shouldn't be hardcoded */
|
||||
|
||||
static char *oc_op_usermod_attrs[] = {
|
||||
|
|
@ -334,7 +334,7 @@ oc_check_op_attr( const char *type )
|
|||
int
|
||||
oc_check_op_usermod_attr( const char *type )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return charray_inlist( oc_op_usermod_attrs, type );
|
||||
#else
|
||||
/* not (yet) in schema */
|
||||
|
|
@ -348,7 +348,7 @@ oc_check_op_usermod_attr( const char *type )
|
|||
int
|
||||
oc_check_op_no_usermod_attr( const char *type )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return charray_inlist( oc_op_no_usermod_attrs, type );
|
||||
#else
|
||||
AttributeType *at = at_find( type );
|
||||
|
|
@ -1097,7 +1097,9 @@ int is_entry_objectclass(
|
|||
bv.bv_val = (char *) oc;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
if( value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
|
||||
/* entry is not of this objectclass */
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
int global_schemacheck = 1; /* schemacheck on is default */
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static void oc_usage_old(void) LDAP_GCCATTR((noreturn));
|
||||
#endif
|
||||
static void oc_usage(void) LDAP_GCCATTR((noreturn));
|
||||
|
|
@ -50,7 +50,7 @@ scherr2str(int code)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
void
|
||||
parse_oc_old(
|
||||
Backend *be,
|
||||
|
|
@ -301,7 +301,7 @@ oc_usage( void )
|
|||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static void
|
||||
oc_usage_old( void )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@
|
|||
#ifndef _SLDAPD_H_
|
||||
#define _SLDAPD_H_
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
#define SLAPD_SCHEMA_COMPAT 1
|
||||
#endif
|
||||
|
||||
#include "ldap_defaults.h"
|
||||
|
||||
#include <ac/stdlib.h>
|
||||
|
|
@ -339,13 +335,13 @@ typedef struct slap_filter {
|
|||
typedef struct slap_attr {
|
||||
char *a_type; /* description */
|
||||
struct berval **a_vals;
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int a_syntax;
|
||||
#endif
|
||||
struct slap_attr *a_next;
|
||||
} Attribute;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* the attr_syntax() routine returns one of these values
|
||||
* telling what kind of syntax an attribute supports.
|
||||
|
|
@ -469,10 +465,10 @@ typedef struct slap_access {
|
|||
slap_access_mask_t a_mask;
|
||||
|
||||
char *a_dn_pat;
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
char *a_dn_at;
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *a_dn_at;
|
||||
#else
|
||||
char *a_dn_at;
|
||||
#endif
|
||||
int a_dn_self;
|
||||
|
||||
|
|
@ -483,20 +479,20 @@ typedef struct slap_access {
|
|||
char *a_sockurl_pat;
|
||||
|
||||
#ifdef SLAPD_ACI_ENABLED
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
char *a_aci_at;
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *a_aci_at;
|
||||
#else
|
||||
char *a_aci_at;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ACL Groups */
|
||||
char *a_group_pat;
|
||||
char *a_group_oc;
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
char *a_group_at;
|
||||
#else
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *a_group_at;
|
||||
#else
|
||||
char *a_group_at;
|
||||
#endif
|
||||
|
||||
struct slap_access *a_next;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,9 @@ value_add(
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_COMPAT
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
void
|
||||
value_normalize(
|
||||
char *s,
|
||||
|
|
|
|||
Loading…
Reference in a new issue