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
) )
/* 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
)
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 ) {
acl_usage();
}
#endif
+#else
+ b->a_dn_at = ch_strdup( right );
#endif
continue;
}
}
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",
acl_usage();
}
#endif /* SLAPD_OID_DN_SYNTAX */
-#endif /* !SLAPD_SCHEMA_COMPAT */
+#endif /* SLAPD_SCHEMA_NOT_COMPAT */
continue;
}
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 {
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;
}
}
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;
**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;
*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;
return( 0 );
}
-#ifdef SLAPD_SCHEMA_COMPAT
+#ifndef SLAPD_SCHEMA_NOT_COMPAT
#define DEFAULT_SYNTAX SYNTAX_CIS
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.
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) ) )
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
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
}
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
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 );
extern int ldbm_back_abandon LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op, ber_int_t msgid ));
-#ifdef SLAPD_SCHEMA_COMPAT
+#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, const char* group_at));
+ 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, AttributeType* group_at));
+ const char* objectclassValue, const char* group_at));
#endif
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
)
{
Attribute *attr;
struct berval bv;
-#ifndef SLAPD_SCHEMA_COMPAT
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
char *groupattrName = at_canonical_name( group_at );
#endif
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,
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 ) {
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 ) {
}
-#ifdef SLAPD_SCHEMA_COMPAT
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ /* not yet implemented */
+#else
for ( i = 0; vals[i] != NULL; i++ ) {
/*
* presence index entry
/* 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 );
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;
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 ) {
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 );
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
)
{
/*
* 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,
static Attribute ss_attr = {
"subschemasubentry",
ss_vals,
-#ifdef SLAPD_SCHEMA_COMPAT
+#ifndef SLAPD_SCHEMA_NOT_COMPAT
SYNTAX_DN | SYNTAX_CIS,
#endif
NULL
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
}
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
}
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
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
#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
*/
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 ) {
return( nomatch );
}
+#ifndef SLAPD_SCHEMA_NOT_COMPAT
static void
strcpy_regex( char *d, char *s )
{
}
*d = '\0';
}
+#endif
static int
test_substring_filter(
Filter *f
)
{
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ /* not yet implemented */
+#else
Attribute *a;
int i, rc;
char *p, *end, *realval, *tmp;
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
realval = tmp;
}
-#ifdef SLAPD_SCHEMA_COMPAT
value_normalize( realval, a->a_syntax );
-#endif
rc = !regexec(&re, realval, 0, NULL, 0);
}
regfree(&re);
+#endif
Debug( LDAP_DEBUG_FILTER, "end test_substring_filter 1\n", 0, 0, 0 );
return( 1 );
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 ));
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,
const char *gr_ndn,
const char *op_ndn,
const char *objectclassValue,
- AttributeType *groupAttrType
+ const char *groupattrName
));
#endif
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.
}
-#ifdef SLAPD_SCHEMA_COMPAT
+#ifndef SLAPD_SCHEMA_NOT_COMPAT
/* these shouldn't be hardcoded */
static char *oc_op_usermod_attrs[] = {
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 */
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 );
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;
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));
}
}
-#ifdef SLAPD_SCHEMA_COMPAT
+#ifndef SLAPD_SCHEMA_NOT_COMPAT
void
parse_oc_old(
Backend *be,
exit( EXIT_FAILURE );
}
-#ifdef SLAPD_SCHEMA_COMPAT
+#ifndef SLAPD_SCHEMA_NOT_COMPAT
static void
oc_usage_old( void )
{
#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>
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.
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;
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;
return( 0 );
}
-#ifdef SLAPD_SCHEMA_COMPAT
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ /* not yet implemented */
+#else
void
value_normalize(
char *s,