mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-09 16:34:45 -05:00
unifdef -DSLAPD_SCHEMA_NOT_COMPAT -USLAPD_SCHEMA_COMPAT
This commit is contained in:
parent
dd00feb04d
commit
693fb9424a
59 changed files with 0 additions and 3216 deletions
|
|
@ -14,12 +14,6 @@
|
|||
|
||||
/* end of preamble */
|
||||
|
||||
#if !defined(SLAPD_SCHEMA_COMPAT) && !defined(SLAPD_SCHEMA_NOT_COMPAT)
|
||||
/* define SLAPD_SCHEMA_COMPAT if you want old schema codes */
|
||||
#define SLAPD_SCHEMA_NOT_COMPAT 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@
|
|||
|
||||
/* end of preamble */
|
||||
|
||||
#if !defined( SLAPD_SCHEMA_COMPAT ) && !defined( SLAPD_SCHEMA_NOT_COMPAT )
|
||||
/* use new schema codes */
|
||||
#define SLAPD_SCHEMA_NOT_COMPAT 1
|
||||
#endif
|
||||
|
||||
/* comment this out if you don't have Cyrus SASL */
|
||||
#define HAVE_CYRUS_SASL 1
|
||||
|
||||
|
|
|
|||
|
|
@ -19,22 +19,14 @@ static AccessControl * acl_get(
|
|||
AccessControl *ac, int *count,
|
||||
Backend *be, Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *desc,
|
||||
#endif
|
||||
int nmatches, regmatch_t *matches );
|
||||
|
||||
static slap_control_t acl_mask(
|
||||
AccessControl *ac, slap_access_mask_t *mask,
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *desc,
|
||||
#endif
|
||||
struct berval *val,
|
||||
regmatch_t *matches );
|
||||
|
||||
|
|
@ -43,11 +35,7 @@ static int aci_mask(
|
|||
Backend *be,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *desc,
|
||||
#endif
|
||||
struct berval *val,
|
||||
struct berval *aci,
|
||||
regmatch_t *matches,
|
||||
|
|
@ -83,11 +71,7 @@ access_allowed(
|
|||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *desc,
|
||||
#endif
|
||||
struct berval *val,
|
||||
slap_access_t access )
|
||||
{
|
||||
|
|
@ -99,11 +83,7 @@ access_allowed(
|
|||
slap_access_mask_t mask;
|
||||
slap_control_t control;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
const char *attr = desc ? desc->ad_cname->bv_val : NULL;
|
||||
#else
|
||||
const char *attr = desc;
|
||||
#endif
|
||||
|
||||
regmatch_t matches[MAXREMATCHES];
|
||||
|
||||
|
|
@ -130,11 +110,7 @@ access_allowed(
|
|||
* by ACL_WRITE checking as any found here are not provided
|
||||
* by the user
|
||||
*/
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( access >= ACL_WRITE && is_at_no_user_mod( desc->ad_type ) )
|
||||
#else
|
||||
if ( access >= ACL_WRITE && oc_check_op_no_usermod_attr( attr ) )
|
||||
#endif
|
||||
{
|
||||
Debug( LDAP_DEBUG_ACL, "NoUserMod Operational attribute:"
|
||||
" %s access granted\n",
|
||||
|
|
@ -232,11 +208,7 @@ acl_get(
|
|||
Backend *be,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *desc,
|
||||
#endif
|
||||
int nmatch,
|
||||
regmatch_t *matches )
|
||||
{
|
||||
|
|
@ -244,11 +216,7 @@ acl_get(
|
|||
assert( e != NULL );
|
||||
assert( count != NULL );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
attr = desc ? desc->ad_cname->bv_val : NULL;
|
||||
#else
|
||||
attr = desc;
|
||||
#endif
|
||||
|
||||
if( a == NULL ) {
|
||||
if( be == NULL ) {
|
||||
|
|
@ -322,11 +290,7 @@ acl_mask(
|
|||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *desc,
|
||||
#endif
|
||||
struct berval *val,
|
||||
regmatch_t *matches
|
||||
)
|
||||
|
|
@ -336,11 +300,7 @@ acl_mask(
|
|||
#ifdef LDAP_DEBUG
|
||||
char accessmaskbuf[ACCESSMASK_MAXLEN];
|
||||
#endif
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
const char *attr = desc ? desc->ad_cname->bv_val : NULL;
|
||||
#else
|
||||
const char *attr = desc;
|
||||
#endif
|
||||
|
||||
assert( a != NULL );
|
||||
assert( mask != NULL );
|
||||
|
|
@ -449,13 +409,9 @@ acl_mask(
|
|||
if ( b->a_dn_at != NULL && op->o_ndn != NULL ) {
|
||||
Attribute *at;
|
||||
struct berval bv;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int match;
|
||||
const char *text;
|
||||
const char *desc = b->a_dn_at->ad_cname->bv_val;
|
||||
#else
|
||||
const char *desc = b->a_dn_at;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_ACL, "<= check a_dn_at: %s\n",
|
||||
b->a_dn_at, 0, 0);
|
||||
|
|
@ -464,7 +420,6 @@ acl_mask(
|
|||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
/* see if asker is listed in dnattr */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
for( at = attrs_find( e->e_attrs, b->a_dn_at );
|
||||
at == NULL;
|
||||
at = attrs_find( e->e_attrs->a_next, b->a_dn_at ) )
|
||||
|
|
@ -493,24 +448,6 @@ acl_mask(
|
|||
{
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
/* see if asker is listed in dnattr */
|
||||
if ( (at = attr_find( e->e_attrs, b->a_dn_at )) != NULL &&
|
||||
value_find( at->a_vals, &bv, at->a_syntax, 3 ) == 0 )
|
||||
{
|
||||
if ( b->a_dn_self && (val == NULL
|
||||
|| value_cmp( &bv, val, at->a_syntax, 2 ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* asker not listed in dnattr - check for self access */
|
||||
} else if ( ! b->a_dn_self || val == NULL
|
||||
|| value_cmp( &bv, val, at->a_syntax, 2 ) != 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( b->a_group_pat != NULL && op->o_ndn != NULL ) {
|
||||
|
|
@ -725,21 +662,12 @@ acl_check_modlist(
|
|||
* by ACL_WRITE checking as any found here are not provided
|
||||
* by the user
|
||||
*/
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( is_at_no_user_mod( mlist->sml_desc->ad_type ) ) {
|
||||
Debug( LDAP_DEBUG_ACL, "acl: no-user-mod %s:"
|
||||
" modify access granted\n",
|
||||
mlist->sml_desc->ad_cname->bv_val, 0, 0 );
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if ( oc_check_op_no_usermod_attr( mlist->sml_type ) ) {
|
||||
Debug( LDAP_DEBUG_ACL, "acl: no-user-mod %s:"
|
||||
" modify access granted\n",
|
||||
mlist->sml_type, 0, 0 );
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch ( mlist->sml_op ) {
|
||||
case LDAP_MOD_REPLACE:
|
||||
|
|
@ -1019,14 +947,9 @@ aci_group_member (
|
|||
char *subjdn, *grpdn = NULL;
|
||||
char *grpoc;
|
||||
char *grpat;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ObjectClass *grp_oc = NULL;
|
||||
AttributeDescription *grp_ad = NULL;
|
||||
char *text;
|
||||
#else
|
||||
char *grp_oc;
|
||||
char *grp_ad;
|
||||
#endif
|
||||
int rc;
|
||||
|
||||
/* format of string is "group/objectClassValue/groupAttrName" */
|
||||
|
|
@ -1051,15 +974,11 @@ aci_group_member (
|
|||
grpat = aci_bvstrdup(&bv);
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_str2ad( grpat, &grp_ad, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
rc = 0;
|
||||
goto done;
|
||||
}
|
||||
#else
|
||||
grp_ad = grpat;
|
||||
#endif
|
||||
rc = 0;
|
||||
|
||||
grpdn = (char *)ch_malloc(1024);
|
||||
|
|
@ -1071,10 +990,8 @@ aci_group_member (
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
done:
|
||||
if( grp_ad != NULL ) ad_free( grp_ad, 1 );
|
||||
#endif
|
||||
ch_free(grpdn);
|
||||
ch_free(grpat);
|
||||
ch_free(grpoc);
|
||||
|
|
@ -1087,11 +1004,7 @@ aci_mask(
|
|||
Backend *be,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *attr,
|
||||
#endif
|
||||
struct berval *val,
|
||||
struct berval *aci,
|
||||
regmatch_t *matches,
|
||||
|
|
@ -1102,9 +1015,7 @@ aci_mask(
|
|||
struct berval bv, perms, sdn;
|
||||
char *subjdn;
|
||||
int rc, i;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *attr;
|
||||
#endif
|
||||
|
||||
/* parse an aci of the form:
|
||||
oid#scope#action;rights;attr;rights;attr$action;rights;attr;rights;attr#dnType#subjectDN
|
||||
|
|
@ -1163,7 +1074,6 @@ aci_mask(
|
|||
|
||||
} else if (aci_strbvcmp( "dnattr", &bv ) == 0) {
|
||||
char *dnattr = aci_bvstrdup(&sdn);
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
Attribute *at;
|
||||
AttributeDescription *ad = NULL;
|
||||
const char *text;
|
||||
|
|
@ -1193,19 +1103,6 @@ aci_mask(
|
|||
ad_free( ad, 1 );
|
||||
return rc;
|
||||
|
||||
#else
|
||||
Attribute *at;
|
||||
at = attr_find( e->e_attrs, dnattr );
|
||||
ch_free( dnattr );
|
||||
|
||||
if (at != NULL) {
|
||||
bv.bv_val = op->o_ndn;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
if (value_find( at->a_vals, &bv, at->a_syntax, 3 ) == 0 )
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
} else if (aci_strbvcmp( "group", &bv ) == 0) {
|
||||
if (aci_group_member(&sdn, SLAPD_GROUP_CLASS, SLAPD_GROUP_ATTR, be, e, op, matches))
|
||||
|
|
|
|||
|
|
@ -95,10 +95,8 @@ parse_acl(
|
|||
char *left, *right;
|
||||
AccessControl *a;
|
||||
Access *b;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
const char *text;
|
||||
#endif
|
||||
|
||||
a = NULL;
|
||||
for ( i = 1; i < argc; i++ ) {
|
||||
|
|
@ -324,7 +322,6 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_str2ad( right, &b->a_dn_at, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -346,9 +343,6 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
|
||||
#else
|
||||
b->a_dn_at = ch_strdup( right );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -377,11 +371,7 @@ parse_acl(
|
|||
b->a_group_pat = ch_strdup( right );
|
||||
|
||||
if (value && *value) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
b->a_group_oc = oc_find( value );
|
||||
#else
|
||||
b->a_group_oc = ch_strdup(value);
|
||||
#endif
|
||||
*--value = '/';
|
||||
|
||||
if( b->a_group_oc == NULL ) {
|
||||
|
|
@ -392,7 +382,6 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
} else {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
b->a_group_oc = oc_find(SLAPD_GROUP_CLASS);
|
||||
|
||||
if( b->a_group_oc == NULL ) {
|
||||
|
|
@ -402,12 +391,8 @@ parse_acl(
|
|||
fname, lineno, SLAPD_GROUP_CLASS );
|
||||
acl_usage();
|
||||
}
|
||||
#else
|
||||
b->a_group_oc = ch_strdup(SLAPD_GROUP_CLASS);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
#if 0
|
||||
if( is_object_subclass( b->a_group_oc,
|
||||
slap_schema.si_oc_referral ) )
|
||||
|
|
@ -428,11 +413,9 @@ parse_acl(
|
|||
fname, lineno, value );
|
||||
acl_usage();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (name && *name) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_str2ad( right, &b->a_group_at, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -441,12 +424,8 @@ parse_acl(
|
|||
fname, lineno, right, text );
|
||||
acl_usage();
|
||||
}
|
||||
#else
|
||||
b->a_group_at = ch_strdup(name);
|
||||
#endif
|
||||
*--name = '/';
|
||||
} else {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_str2ad( SLAPD_GROUP_ATTR, &b->a_group_at, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -455,12 +434,8 @@ parse_acl(
|
|||
fname, lineno, SLAPD_GROUP_ATTR, text );
|
||||
acl_usage();
|
||||
}
|
||||
#else
|
||||
b->a_group_at = ch_strdup( SLAPD_GROUP_ATTR );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( !is_at_syntax( b->a_group_at->ad_type,
|
||||
SLAPD_DN_SYNTAX ) )
|
||||
{
|
||||
|
|
@ -494,7 +469,6 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -559,7 +533,6 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( right != NULL && *right != '\0' ) {
|
||||
rc = slap_str2ad( right, &b->a_aci_at, &text );
|
||||
|
||||
|
|
@ -591,13 +564,6 @@ parse_acl(
|
|||
acl_usage();
|
||||
}
|
||||
|
||||
#else
|
||||
if ( right != NULL && *right != '\0' ) {
|
||||
b->a_aci_at = ch_strdup( right );
|
||||
} else {
|
||||
b->a_aci_at = ch_strdup( SLAPD_ACI_ATTR );
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
#endif /* SLAPD_ACI_ENABLED */
|
||||
|
|
@ -1012,11 +978,7 @@ print_access( Access *b )
|
|||
}
|
||||
|
||||
if ( b->a_dn_at != NULL ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, " dnattr=%s", b->a_dn_at->ad_cname->bv_val );
|
||||
#else
|
||||
fprintf( stderr, " dnattr=%s", b->a_dn_at );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( b->a_group_pat != NULL ) {
|
||||
|
|
@ -1026,11 +988,7 @@ print_access( Access *b )
|
|||
fprintf( stderr, " objectClass: %s", b->a_group_oc );
|
||||
|
||||
if ( b->a_group_at ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, " attributeType: %s", b->a_group_at->ad_cname->bv_val );
|
||||
#else
|
||||
fprintf( stderr, " attributeType: %s", b->a_group_at );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1053,11 +1011,7 @@ print_access( Access *b )
|
|||
|
||||
#ifdef SLAPD_ACI_ENABLED
|
||||
if ( b->a_aci_at != NULL ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, " aci=%s", b->a_aci_at->ad_cname->bv_val );
|
||||
#else
|
||||
fprintf( stderr, " aci=%s", b->a_aci_at );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_dup(
|
||||
AttributeDescription *desc )
|
||||
{
|
||||
|
|
@ -243,5 +242,4 @@ int ad_inlist(
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,10 @@
|
|||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int slap_mods2entry(
|
||||
Modifications *mods,
|
||||
Entry **e,
|
||||
const char **text );
|
||||
#else
|
||||
static int add_created_attrs(Operation *op, Entry *e);
|
||||
#endif
|
||||
|
||||
int
|
||||
do_add( Connection *conn, Operation *op )
|
||||
|
|
@ -44,11 +40,9 @@ do_add( Connection *conn, Operation *op )
|
|||
ber_tag_t tag;
|
||||
Entry *e;
|
||||
Backend *be;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LDAPModList *modlist = NULL;
|
||||
LDAPModList **modtail = &modlist;
|
||||
Modifications *mods = NULL;
|
||||
#endif
|
||||
const char *text;
|
||||
int rc = LDAP_SUCCESS;
|
||||
|
||||
|
|
@ -98,12 +92,7 @@ do_add( Connection *conn, Operation *op )
|
|||
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
|
||||
tag = ber_next_element( ber, &len, last ) )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LDAPModList *mod = (LDAPModList *) ch_malloc( sizeof(LDAPModList) );
|
||||
#else
|
||||
LDAPModList tmpmod;
|
||||
LDAPModList *mod = &tmpmod;
|
||||
#endif
|
||||
mod->ml_op = LDAP_MOD_ADD;
|
||||
mod->ml_next = NULL;
|
||||
|
||||
|
|
@ -114,9 +103,7 @@ do_add( Connection *conn, Operation *op )
|
|||
send_ldap_disconnect( conn, op,
|
||||
LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rc = -1;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
free( mod );
|
||||
#endif
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -126,21 +113,12 @@ do_add( Connection *conn, Operation *op )
|
|||
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
|
||||
NULL, "no values for attribute type", NULL, NULL );
|
||||
free( mod->ml_type );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
free( mod );
|
||||
#endif
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
*modtail = mod;
|
||||
modtail = &mod->ml_next;
|
||||
#else
|
||||
attr_merge( e, mod->ml_type, mod->ml_bvalues );
|
||||
|
||||
free( mod->ml_type );
|
||||
ber_bvecfree( mod->ml_bvalues );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( ber_scanf( ber, /*{*/ "}") == LBER_ERROR ) {
|
||||
|
|
@ -156,11 +134,7 @@ do_add( Connection *conn, Operation *op )
|
|||
goto done;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( modlist == NULL )
|
||||
#else
|
||||
if ( e->e_attrs == NULL )
|
||||
#endif
|
||||
{
|
||||
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
|
||||
NULL, "no attributes provided", NULL, NULL );
|
||||
|
|
@ -218,7 +192,6 @@ do_add( Connection *conn, Operation *op )
|
|||
{
|
||||
int update = be->be_update_ndn != NULL;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
|
|
@ -226,13 +199,11 @@ do_add( Connection *conn, Operation *op )
|
|||
goto done;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && !update )
|
||||
#endif
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
Modifications **modstail;
|
||||
for( modstail = &mods;
|
||||
*modstail != NULL;
|
||||
|
|
@ -242,10 +213,6 @@ do_add( Connection *conn, Operation *op )
|
|||
assert( (*modstail)->sml_desc != NULL );
|
||||
}
|
||||
rc = slap_mods_opattrs( op, modstail, &text );
|
||||
#else
|
||||
char *text = "no-user-modification attribute type";
|
||||
rc = add_created_attrs( op, e );
|
||||
#endif
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
NULL, text, NULL, NULL );
|
||||
|
|
@ -253,14 +220,12 @@ do_add( Connection *conn, Operation *op )
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_mods2entry( mods, &e, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
NULL, text, NULL, NULL );
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (*be->be_add)( be, conn, op, e ) == 0 ) {
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
|
|
@ -287,14 +252,12 @@ do_add( Connection *conn, Operation *op )
|
|||
}
|
||||
|
||||
done:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( modlist != NULL ) {
|
||||
slap_modlist_free( modlist );
|
||||
}
|
||||
if( mods != NULL ) {
|
||||
slap_mods_free( mods );
|
||||
}
|
||||
#endif
|
||||
if( e != NULL ) {
|
||||
entry_free( e );
|
||||
}
|
||||
|
|
@ -302,7 +265,6 @@ done:
|
|||
return rc;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int slap_mods2entry(
|
||||
Modifications *mods,
|
||||
Entry **e,
|
||||
|
|
@ -342,51 +304,3 @@ static int slap_mods2entry(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
static int
|
||||
add_created_attrs( Operation *op, Entry *e )
|
||||
{
|
||||
char buf[22];
|
||||
struct berval bv;
|
||||
struct berval *bvals[2];
|
||||
Attribute *a;
|
||||
struct tm *ltm;
|
||||
time_t currenttime;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "add_created_attrs\n", 0, 0, 0 );
|
||||
|
||||
bvals[0] = &bv;
|
||||
bvals[1] = NULL;
|
||||
|
||||
/* return error on any attempts by the user to add these attrs */
|
||||
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
|
||||
if ( oc_check_op_no_usermod_attr( a->a_type ) ) {
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
}
|
||||
|
||||
if ( op->o_dn == NULL || op->o_dn[0] == '\0' ) {
|
||||
bv.bv_val = SLAPD_ANONYMOUS;
|
||||
bv.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
|
||||
;
|
||||
} else {
|
||||
bv.bv_val = op->o_dn;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
}
|
||||
attr_merge( e, "creatorsname", bvals );
|
||||
attr_merge( e, "modifiersname", bvals );
|
||||
|
||||
currenttime = slap_get_time();
|
||||
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
|
||||
ltm = gmtime( ¤ttime );
|
||||
strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
|
||||
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
|
||||
|
||||
bv.bv_val = buf;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
attr_merge( e, "createtimestamp", bvals );
|
||||
attr_merge( e, "modifytimestamp", bvals );
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,160 +18,6 @@
|
|||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *
|
||||
at_canonical_name( const char * a_type )
|
||||
{
|
||||
AttributeType *atp;
|
||||
|
||||
atp=at_find(a_type);
|
||||
|
||||
if ( atp == NULL ) {
|
||||
return (char *) a_type;
|
||||
|
||||
} else if ( atp->sat_names
|
||||
&& atp->sat_names[0] && (*(atp->sat_names[0]) != '\0') )
|
||||
{
|
||||
return atp->sat_names[0];
|
||||
|
||||
} else if (atp->sat_oid && (*atp->sat_oid != '\0')) {
|
||||
return atp->sat_oid;
|
||||
}
|
||||
|
||||
return (char *) a_type;
|
||||
}
|
||||
|
||||
#define DEFAULT_SYNTAX SYNTAX_CIS
|
||||
|
||||
/*
|
||||
* attr_syntax - return the syntax of attribute type
|
||||
*/
|
||||
|
||||
int
|
||||
attr_syntax( const char *type )
|
||||
{
|
||||
AttributeType *sat;
|
||||
|
||||
sat = at_find(type);
|
||||
if ( sat ) {
|
||||
return( sat->sat_syntax_compat );
|
||||
}
|
||||
|
||||
return( DEFAULT_SYNTAX );
|
||||
}
|
||||
|
||||
/*
|
||||
* attr_syntax_config - process an attribute syntax config line
|
||||
*/
|
||||
|
||||
void
|
||||
at_config(
|
||||
const char *fname,
|
||||
int lineno,
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
char *save;
|
||||
LDAP_ATTRIBUTE_TYPE *at;
|
||||
int lasti;
|
||||
int code;
|
||||
const char *err;
|
||||
|
||||
if ( argc < 2 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: missing name in \"attribute <name>+ <syntax>\" (ignored)\n",
|
||||
fname, lineno, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
at = (LDAP_ATTRIBUTE_TYPE *)
|
||||
ch_calloc( 1, sizeof(LDAP_ATTRIBUTE_TYPE) );
|
||||
|
||||
#define SYNTAX_DS_OID "1.3.6.1.4.1.1466.115.121.1.15"
|
||||
#define SYNTAX_DSCE_OID "2.5.13.5"
|
||||
#define SYNTAX_IA5_OID "1.3.6.1.4.1.1466.115.121.1.26"
|
||||
#define SYNTAX_IA5CE_OID "1.3.6.1.4.1.1466.109.114.1"
|
||||
#define SYNTAX_DN_OID "1.3.6.1.4.1.1466.115.121.1.12"
|
||||
#define SYNTAX_TEL_OID "1.3.6.1.4.1.1466.115.121.1.50"
|
||||
#define SYNTAX_BIN_OID "1.3.6.1.4.1.1466.115.121.1.40" /* octetString */
|
||||
|
||||
lasti = argc - 1;
|
||||
if ( strcasecmp( argv[lasti], "caseignorestring" ) == 0 ||
|
||||
strcasecmp( argv[lasti], "cis" ) == 0 ) {
|
||||
at->at_syntax_oid = SYNTAX_DS_OID;
|
||||
at->at_equality_oid = "2.5.13.2";
|
||||
at->at_ordering_oid = "2.5.13.3";
|
||||
at->at_substr_oid = "2.5.13.4";
|
||||
|
||||
} else if ( strcasecmp( argv[lasti], "telephone" ) == 0 ||
|
||||
strcasecmp( argv[lasti], "tel" ) == 0 ) {
|
||||
at->at_syntax_oid = SYNTAX_TEL_OID;
|
||||
at->at_equality_oid = "2.5.13.20";
|
||||
at->at_substr_oid = "2.5.13.21";
|
||||
|
||||
} else if ( strcasecmp( argv[lasti], "dn" ) == 0 ) {
|
||||
at->at_syntax_oid = SYNTAX_DN_OID;
|
||||
at->at_equality_oid = "2.5.13.1";
|
||||
|
||||
} else if ( strcasecmp( argv[lasti], "caseexactstring" ) == 0 ||
|
||||
strcasecmp( argv[lasti], "ces" ) == 0 ) {
|
||||
at->at_syntax_oid = SYNTAX_DS_OID;
|
||||
at->at_equality_oid = SYNTAX_DSCE_OID;
|
||||
at->at_ordering_oid = "2.5.13.6";
|
||||
at->at_substr_oid = "2.5.13.7";
|
||||
|
||||
} else if ( strcasecmp( argv[lasti], "binary" ) == 0 ||
|
||||
strcasecmp( argv[lasti], "bin" ) == 0 ) {
|
||||
/* bin -> octetString, not binary! */
|
||||
at->at_syntax_oid = SYNTAX_BIN_OID;
|
||||
at->at_equality_oid = "2.5.13.17";
|
||||
|
||||
} else {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: unknown syntax \"%s\" in attribute line (ignored)\n",
|
||||
fname, lineno, argv[lasti] );
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"possible syntaxes are \"cis\", \"ces\", \"tel\", \"dn\", or \"bin\"\n",
|
||||
0, 0, 0 );
|
||||
free( (AttributeType *) at );
|
||||
return;
|
||||
}
|
||||
|
||||
save = argv[lasti];
|
||||
argv[lasti] = NULL;
|
||||
at->at_names = charray_dup( argv );
|
||||
argv[lasti] = save;
|
||||
|
||||
code = at_add( at, &err );
|
||||
if ( code ) {
|
||||
fprintf( stderr, "%s: line %d: %s %s\n",
|
||||
fname, lineno, scherr2str(code), err);
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
ldap_memfree(at);
|
||||
}
|
||||
|
||||
int
|
||||
at_fake_if_needed(
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
char *argv[3];
|
||||
|
||||
if ( at_find( name ) ) {
|
||||
return 0;
|
||||
} else {
|
||||
argv[0] = (char*) name;
|
||||
argv[1] = "cis";
|
||||
argv[2] = NULL;
|
||||
at_config( "implicit", 0, 2, argv );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int is_at_syntax(
|
||||
AttributeType *at,
|
||||
|
|
@ -231,19 +77,6 @@ at_find(
|
|||
struct aindexrec *air;
|
||||
char *tmpname;
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* The name may actually be an AttributeDescription, i.e. it may
|
||||
* contain options.
|
||||
*/
|
||||
/* Treat any attribute type with option as an unknown attribute type */
|
||||
char *p = strchr( name, ';' );
|
||||
if ( p ) {
|
||||
tmpname = ch_malloc( p-name+1 );
|
||||
strncpy( tmpname, name, p-name );
|
||||
tmpname[p-name] = '\0';
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
tmpname = (char *)name;
|
||||
}
|
||||
|
|
@ -427,9 +260,7 @@ at_add(
|
|||
sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
|
||||
memcpy( &sat->sat_atype, at, sizeof(LDAP_ATTRIBUTE_TYPE));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
sat->sat_cname = cname;
|
||||
#endif
|
||||
|
||||
if ( at->at_sup_oid ) {
|
||||
AttributeType *supsat = at_find(at->at_sup_oid);
|
||||
|
|
@ -454,9 +285,6 @@ at_add(
|
|||
*/
|
||||
if ( sat->sat_sup ) {
|
||||
sat->sat_syntax = sat->sat_sup->sat_syntax;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
sat->sat_syntax_compat = sat->sat_sup->sat_syntax_compat;
|
||||
#endif
|
||||
sat->sat_equality = sat->sat_sup->sat_equality;
|
||||
sat->sat_ordering = sat->sat_sup->sat_ordering;
|
||||
sat->sat_substr = sat->sat_sup->sat_substr;
|
||||
|
|
@ -470,38 +298,6 @@ at_add(
|
|||
return SLAP_SCHERR_SYN_NOT_FOUND;
|
||||
}
|
||||
|
||||
#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) ) )
|
||||
{
|
||||
sat->sat_syntax_compat = SYNTAX_CES;
|
||||
} else {
|
||||
sat->sat_syntax_compat = SYNTAX_CIS;
|
||||
}
|
||||
|
||||
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_IA5_OID) ) {
|
||||
if ( at->at_equality_oid && (
|
||||
!strcmp(at->at_equality_oid, SYNTAX_IA5CE_OID) ) )
|
||||
{
|
||||
sat->sat_syntax_compat = SYNTAX_CES;
|
||||
} else {
|
||||
sat->sat_syntax_compat = SYNTAX_CIS;
|
||||
}
|
||||
|
||||
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_DN_OID ) ) {
|
||||
sat->sat_syntax_compat = SYNTAX_CIS | SYNTAX_DN;
|
||||
|
||||
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_TEL_OID ) ) {
|
||||
sat->sat_syntax_compat = SYNTAX_CIS | SYNTAX_TEL;
|
||||
|
||||
} else if ( !strcmp(at->at_syntax_oid, SYNTAX_BIN_OID ) ) {
|
||||
sat->sat_syntax_compat = SYNTAX_BIN;
|
||||
|
||||
} else {
|
||||
sat->sat_syntax_compat = DEFAULT_SYNTAX;
|
||||
}
|
||||
#endif
|
||||
|
||||
} else if ( sat->sat_syntax == NULL ) {
|
||||
return SLAP_SCHERR_ATTR_INCOMPLETE;
|
||||
|
|
@ -567,11 +363,7 @@ at_schema_info( Entry *e )
|
|||
struct berval *vals[2];
|
||||
AttributeType *at;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_attributeTypes = slap_schema.si_ad_attributeTypes;
|
||||
#else
|
||||
char *ad_attributeTypes = "attributeTypes";
|
||||
#endif
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,7 @@ static void at_index_print( void );
|
|||
void
|
||||
attr_free( Attribute *a )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad_free( a->a_desc, 1 );
|
||||
#else
|
||||
free( a->a_type );
|
||||
#endif
|
||||
ber_bvecfree( a->a_vals );
|
||||
free( a );
|
||||
}
|
||||
|
|
@ -78,12 +74,7 @@ Attribute *attr_dup( Attribute *a )
|
|||
tmp->a_vals = NULL;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
tmp->a_desc = ad_dup( a->a_desc );
|
||||
#else
|
||||
tmp->a_type = ch_strdup( a->a_type );
|
||||
tmp->a_syntax = a->a_syntax;
|
||||
#endif
|
||||
tmp->a_next = NULL;
|
||||
|
||||
return tmp;
|
||||
|
|
@ -107,58 +98,6 @@ Attribute *attrs_dup( Attribute *a )
|
|||
return tmp;
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* attr_normalize - normalize an attribute name (make it all lowercase)
|
||||
*/
|
||||
|
||||
char *
|
||||
attr_normalize( char *s )
|
||||
{
|
||||
assert( s != NULL );
|
||||
|
||||
return( ldap_pvt_str2lower( s ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* attr_merge_fast - merge the given type and value with the list of
|
||||
* attributes in attrs. called from str2entry(), where we can make some
|
||||
* assumptions to make things faster.
|
||||
* returns 0 everything went ok
|
||||
* -1 trouble
|
||||
*/
|
||||
|
||||
int
|
||||
attr_merge_fast(
|
||||
Entry *e,
|
||||
const char *type,
|
||||
struct berval **vals,
|
||||
int nvals,
|
||||
int naddvals,
|
||||
int *maxvals,
|
||||
Attribute ***a
|
||||
)
|
||||
{
|
||||
if ( *a == NULL ) {
|
||||
for ( *a = &e->e_attrs; **a != NULL; *a = &(**a)->a_next ) {
|
||||
if ( strcasecmp( (**a)->a_type, type ) == 0 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( **a == NULL ) {
|
||||
**a = (Attribute *) ch_malloc( sizeof(Attribute) );
|
||||
(**a)->a_vals = NULL;
|
||||
(**a)->a_type = attr_normalize( ch_strdup( type ) );
|
||||
(**a)->a_syntax = attr_syntax( type );
|
||||
(**a)->a_next = NULL;
|
||||
}
|
||||
|
||||
return( value_add_fast( &(**a)->a_vals, vals, nvals, naddvals,
|
||||
maxvals ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -171,21 +110,13 @@ attr_merge_fast(
|
|||
int
|
||||
attr_merge(
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
const char *type,
|
||||
#endif
|
||||
struct berval **vals )
|
||||
{
|
||||
Attribute **a;
|
||||
|
||||
for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( ad_cmp( (*a)->a_desc, desc ) == 0 )
|
||||
#else
|
||||
if ( strcasecmp( (*a)->a_type, type ) == 0 )
|
||||
#endif
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
@ -193,12 +124,7 @@ attr_merge(
|
|||
|
||||
if ( *a == NULL ) {
|
||||
*a = (Attribute *) ch_malloc( sizeof(Attribute) );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
(*a)->a_desc = ad_dup( desc );
|
||||
#else
|
||||
(*a)->a_type = attr_normalize( ch_strdup( type ) );
|
||||
(*a)->a_syntax = attr_syntax( type );
|
||||
#endif
|
||||
(*a)->a_vals = NULL;
|
||||
(*a)->a_next = NULL;
|
||||
}
|
||||
|
|
@ -206,7 +132,6 @@ attr_merge(
|
|||
return( value_add( &(*a)->a_vals, vals ) );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* attrs_find - find attribute(s) by AttributeDescription
|
||||
* returns next attribute which is subtype of provided description.
|
||||
|
|
@ -226,7 +151,6 @@ attrs_find(
|
|||
|
||||
return( NULL );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* attr_find - find attribute by type
|
||||
|
|
@ -235,19 +159,11 @@ attrs_find(
|
|||
Attribute *
|
||||
attr_find(
|
||||
Attribute *a,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc
|
||||
#else
|
||||
const char *type
|
||||
#endif
|
||||
)
|
||||
{
|
||||
for ( ; a != NULL; a = a->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( ad_cmp( a->a_desc, desc ) == 0 )
|
||||
#else
|
||||
if ( strcasecmp( a->a_type, type ) == 0 )
|
||||
#endif
|
||||
{
|
||||
return( a );
|
||||
}
|
||||
|
|
@ -266,21 +182,13 @@ attr_find(
|
|||
int
|
||||
attr_delete(
|
||||
Attribute **attrs,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc
|
||||
#else
|
||||
const char *type
|
||||
#endif
|
||||
)
|
||||
{
|
||||
Attribute **a;
|
||||
|
||||
for ( a = attrs; *a != NULL; a = &(*a)->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( ad_cmp( (*a)->a_desc, desc ) == 0 )
|
||||
#else
|
||||
if ( strcasecmp( (*a)->a_type, type ) == 0 )
|
||||
#endif
|
||||
{
|
||||
Attribute *save = *a;
|
||||
*a = (*a)->a_next;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
|
||||
void
|
||||
ava_free(
|
||||
|
|
@ -78,39 +77,3 @@ get_ava(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
ava_free(
|
||||
Ava *ava,
|
||||
int freeit
|
||||
)
|
||||
{
|
||||
ch_free( (char *) ava->ava_type );
|
||||
ch_free( (char *) ava->ava_value.bv_val );
|
||||
if ( freeit ) {
|
||||
ch_free( (char *) ava );
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
get_ava(
|
||||
BerElement *ber,
|
||||
Ava *ava,
|
||||
const char **text
|
||||
)
|
||||
{
|
||||
if ( ber_scanf( ber, "{ao}", &ava->ava_type, &ava->ava_value )
|
||||
== LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 );
|
||||
*text = "Error decoding attribute value assertion";
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
attr_normalize( ava->ava_type );
|
||||
value_normalize( ava->ava_value.bv_val, attr_syntax( ava->ava_type ) );
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ dnssrv_back_compare(
|
|||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeAssertion *ava
|
||||
#else
|
||||
Ava *ava
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return dnssrv_back_request( be, conn, op, dn, ndn,
|
||||
|
|
|
|||
|
|
@ -35,15 +35,9 @@ extern int dnssrv_back_search LDAP_P(( BackendDB *bd,
|
|||
Filter *filter, const char *filterstr,
|
||||
char **attrs, int attrsonly ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
extern int dnssrv_back_compare LDAP_P((BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
const char *dn, const char *ndn, AttributeAssertion *ava ));
|
||||
#else
|
||||
extern int dnssrv_back_compare LDAP_P((BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
const char *dn, const char *ndn, Ava *ava ));
|
||||
#endif
|
||||
|
||||
extern int dnssrv_back_modify LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
|
|
|
|||
|
|
@ -131,14 +131,9 @@ dnssrv_back_request(
|
|||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
Entry *e = ch_calloc( 1, sizeof(Entry) );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass
|
||||
= slap_schema.si_ad_objectClass;
|
||||
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
|
||||
#else
|
||||
const char ad_objectClass = "objectClass";
|
||||
const char ad_ref = "ref";
|
||||
#endif
|
||||
e->e_dn = strdup( dn );
|
||||
e->e_ndn = strdup( ndn );
|
||||
|
||||
|
|
@ -161,15 +156,10 @@ dnssrv_back_request(
|
|||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad = NULL;
|
||||
const char *text;
|
||||
|
||||
rc = slap_str2ad( "dc", &ad, &text );
|
||||
#else
|
||||
rc = LDAP_SUCCESS;
|
||||
const char *ad = "dc";
|
||||
#endif
|
||||
|
||||
if( rc == LDAP_SUCCESS ) {
|
||||
char *p;
|
||||
|
|
@ -191,15 +181,10 @@ dnssrv_back_request(
|
|||
}
|
||||
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad = NULL;
|
||||
const char *text;
|
||||
|
||||
rc = slap_str2ad( "associatedDomain", &ad, &text );
|
||||
#else
|
||||
rc = LDAP_SUCCESS;
|
||||
const char *ad = "associatedDomain";
|
||||
#endif
|
||||
|
||||
if( rc == LDAP_SUCCESS ) {
|
||||
val.bv_val = domain;
|
||||
|
|
|
|||
|
|
@ -67,11 +67,7 @@ ldap_back_add(
|
|||
for (i=0, a=e->e_attrs; a; i++, a=a->a_next) {
|
||||
attrs[i] = (LDAPMod *)ch_malloc(sizeof(LDAPMod));
|
||||
attrs[i]->mod_op = LDAP_MOD_BVALUES;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
attrs[i]->mod_type = a->a_desc->ad_cname->bv_val;
|
||||
#else
|
||||
attrs[i]->mod_type = a->a_type;
|
||||
#endif
|
||||
attrs[i]->mod_vals.modv_bvals = a->a_vals;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,7 @@ ldap_back_compare(
|
|||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeAssertion *ava
|
||||
#else
|
||||
Ava *ava
|
||||
#endif
|
||||
)
|
||||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
|
||||
|
|
@ -59,10 +55,6 @@ ldap_back_compare(
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ldap_compare_s( lc->ld, dn, ava->aa_desc->ad_cname->bv_val, ava->aa_value->bv_val );
|
||||
#else
|
||||
ldap_compare_s( lc->ld, dn, ava->ava_type, ava->ava_value.bv_val );
|
||||
#endif
|
||||
return( ldap_back_op_result( lc, op ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,17 +30,10 @@ extern int ldap_back_search LDAP_P(( BackendDB *bd,
|
|||
Filter *filter, const char *filterstr,
|
||||
char **attrs, int attrsonly ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
extern int ldap_back_compare LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
const char *dn, const char *ndn,
|
||||
AttributeAssertion *ava ));
|
||||
#else
|
||||
extern int ldap_back_compare LDAP_P((BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
const char *dn, const char *ndn,
|
||||
Ava *ava ));
|
||||
#endif
|
||||
|
||||
extern int ldap_back_modify LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
|
|
@ -62,20 +55,12 @@ extern int ldap_back_delete LDAP_P(( BackendDB *bd,
|
|||
extern int ldap_back_abandon LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op, int msgid ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
extern int ldap_back_group LDAP_P(( BackendDB *bd,
|
||||
Entry *target,
|
||||
const char* gr_ndn,
|
||||
const char* op_ndn,
|
||||
ObjectClass* group_oc,
|
||||
AttributeDescription* group_at));
|
||||
#else
|
||||
extern int ldap_back_group LDAP_P(( BackendDB *bd,
|
||||
Entry *target,
|
||||
const char* gr_ndn, const char* op_ndn,
|
||||
const char* group_oc,
|
||||
const char* group_at));
|
||||
#endif
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
|
|
|||
|
|
@ -145,9 +145,7 @@ ldap_send_entry(
|
|||
BerElement *ber = NULL;
|
||||
Attribute *attr, **attrp;
|
||||
struct berval *dummy = NULL;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *text;
|
||||
#endif
|
||||
|
||||
ent.e_dn = ldap_get_dn(lc->ld, e);
|
||||
ent.e_ndn = ch_strdup( ent.e_dn);
|
||||
|
|
@ -165,12 +163,7 @@ ldap_send_entry(
|
|||
if (attr == NULL)
|
||||
continue;
|
||||
attr->a_next = 0;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
slap_str2ad(a, &attr->a_desc, &text);
|
||||
#else
|
||||
attr->a_type = ch_strdup(a);
|
||||
attr->a_syntax = attr_syntax(a);
|
||||
#endif
|
||||
attr->a_vals = ldap_get_values_len(lc->ld, e, a);
|
||||
if (!attr->a_vals)
|
||||
attr->a_vals = &dummy;
|
||||
|
|
@ -181,11 +174,7 @@ ldap_send_entry(
|
|||
for (;ent.e_attrs;) {
|
||||
attr=ent.e_attrs;
|
||||
ent.e_attrs = attr->a_next;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad_free(attr->a_desc, 1);
|
||||
#else
|
||||
free(attr->a_type);
|
||||
#endif
|
||||
if (attr->a_vals != &dummy)
|
||||
ber_bvecfree(attr->a_vals);
|
||||
free(attr);
|
||||
|
|
|
|||
|
|
@ -30,11 +30,7 @@ ldbm_back_add(
|
|||
int rootlock = 0;
|
||||
int rc;
|
||||
const char *text = NULL;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *children = slap_schema.si_ad_children;
|
||||
#else
|
||||
static const char *children = "children";
|
||||
#endif
|
||||
|
||||
|
||||
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_add: %s\n", e->e_dn, 0, 0);
|
||||
|
|
|
|||
|
|
@ -217,11 +217,7 @@ static char* get_alias_dn(
|
|||
const char **errmsg )
|
||||
{
|
||||
Attribute *a;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *aliasedObjectName = slap_schema.si_ad_aliasedObjectName;
|
||||
#else
|
||||
static const char *aliasedObjectName = "aliasedObjectName";
|
||||
#endif
|
||||
|
||||
a = attr_find( e->e_attrs, aliasedObjectName );
|
||||
|
||||
|
|
|
|||
|
|
@ -138,10 +138,8 @@ attr_index_config(
|
|||
|
||||
for ( i = 0; attrs[i] != NULL; i++ ) {
|
||||
AttrInfo *a;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad;
|
||||
const char *text;
|
||||
#endif
|
||||
|
||||
if( strcasecmp( attrs[i], "default" ) == 0 ) {
|
||||
li->li_defaultmask = mask;
|
||||
|
|
@ -150,7 +148,6 @@ attr_index_config(
|
|||
|
||||
a = (AttrInfo *) ch_malloc( sizeof(AttrInfo) );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad = NULL;
|
||||
rc = slap_str2ad( attrs[i], &ad, &text );
|
||||
|
||||
|
|
@ -213,9 +210,6 @@ attr_index_config(
|
|||
a->ai_desc = ch_strdup( ad->ad_cname->bv_val );
|
||||
ad_free( ad, 1 );
|
||||
#endif
|
||||
#else
|
||||
a->ai_desc = ch_strdup( attrs[i] );
|
||||
#endif
|
||||
|
||||
a->ai_indexmask = mask;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,13 +40,8 @@ ldbm_back_bind(
|
|||
AUTH_DAT ad;
|
||||
#endif
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *password = slap_schema.si_ad_userPassword;
|
||||
AttributeDescription *entry = slap_schema.si_ad_entry;
|
||||
#else
|
||||
static const char *password = "userpassword";
|
||||
static const char *entry = "entry";
|
||||
#endif
|
||||
|
||||
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_bind: dn: %s\n", dn, 0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,7 @@ ldbm_back_compare(
|
|||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeAssertion *ava
|
||||
#else
|
||||
Ava *ava
|
||||
#endif
|
||||
)
|
||||
{
|
||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||
|
|
@ -80,13 +76,8 @@ ldbm_back_compare(
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( ! access_allowed( be, conn, op, e,
|
||||
ava->aa_desc, ava->aa_value, ACL_COMPARE ) )
|
||||
#else
|
||||
if ( ! access_allowed( be, conn, op, e,
|
||||
ava->ava_type, &ava->ava_value, ACL_COMPARE ) )
|
||||
#endif
|
||||
{
|
||||
send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
|
||||
NULL, NULL, NULL, NULL );
|
||||
|
|
@ -96,26 +87,16 @@ ldbm_back_compare(
|
|||
|
||||
rc = LDAP_NO_SUCH_ATTRIBUTE;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
for(a = attrs_find( e->e_attrs, ava->aa_desc );
|
||||
a != NULL;
|
||||
a = attrs_find( a->a_next, ava->aa_desc ))
|
||||
#else
|
||||
if ((a = attr_find( e->e_attrs, ava->ava_type )) != NULL )
|
||||
#endif
|
||||
{
|
||||
rc = LDAP_COMPARE_FALSE;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 )
|
||||
#else
|
||||
if ( value_find( a->a_vals, &ava->ava_value, a->a_syntax, 1 ) == 0 )
|
||||
#endif
|
||||
{
|
||||
rc = LDAP_COMPARE_TRUE;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,7 @@ ldbm_back_delete(
|
|||
int rootlock = 0;
|
||||
int rc = -1;
|
||||
int manageDSAit = get_manageDSAit( op );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *children = slap_schema.si_ad_children;
|
||||
#else
|
||||
static const char *children = "children";
|
||||
#endif
|
||||
|
||||
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn, 0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,17 +48,10 @@ extern int ldbm_back_search LDAP_P(( BackendDB *bd,
|
|||
Filter *filter, const char *filterstr,
|
||||
char **attrs, int attrsonly ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
extern int ldbm_back_compare LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
const char *dn, const char *ndn,
|
||||
AttributeAssertion *ava ));
|
||||
#else
|
||||
extern int ldbm_back_compare LDAP_P((BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
const char *dn, const char *ndn,
|
||||
Ava *ava ));
|
||||
#endif
|
||||
|
||||
extern int ldbm_back_modify LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
|
|
@ -80,20 +73,12 @@ 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_NOT_COMPAT
|
||||
extern int ldbm_back_group LDAP_P(( BackendDB *bd,
|
||||
Entry *target,
|
||||
const char* gr_ndn,
|
||||
const char* op_ndn,
|
||||
ObjectClass* group_oc,
|
||||
AttributeDescription* group_at));
|
||||
#else
|
||||
extern int ldbm_back_group LDAP_P(( BackendDB *bd,
|
||||
Entry *target,
|
||||
const char* gr_ndn, const char* op_ndn,
|
||||
const char* group_oc,
|
||||
const char* group_at));
|
||||
#endif
|
||||
|
||||
|
||||
/* hooks for slap tools */
|
||||
|
|
@ -104,19 +89,11 @@ 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 ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
extern int ldbm_tool_index_attr LDAP_P(( BackendDB *be,
|
||||
AttributeDescription* desc ));
|
||||
extern int ldbm_tool_index_change LDAP_P(( BackendDB *be,
|
||||
AttributeDescription* desc,
|
||||
struct berval **bv, ID id, int op ));
|
||||
#else
|
||||
extern int ldbm_tool_index_attr LDAP_P(( BackendDB *be,
|
||||
char* type ));
|
||||
extern int ldbm_tool_index_change LDAP_P(( BackendDB *be,
|
||||
char* type,
|
||||
struct berval **bv, ID id, int op ));
|
||||
#endif
|
||||
extern int ldbm_tool_sync LDAP_P(( BackendDB *be ));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static ID_BLOCK *presence_candidates(
|
||||
Backend *be,
|
||||
AttributeDescription *desc );
|
||||
|
|
@ -30,15 +29,6 @@ static ID_BLOCK *list_candidates(
|
|||
Backend *be,
|
||||
Filter *flist,
|
||||
int ftype );
|
||||
#else
|
||||
static ID_BLOCK *presence_candidates( Backend *be, char *type );
|
||||
static ID_BLOCK *equality_candidates( Backend *be, Ava *ava );
|
||||
static ID_BLOCK *approx_candidates( Backend *be, Ava *ava );
|
||||
static ID_BLOCK *list_candidates( Backend *be, Filter *flist, int ftype );
|
||||
static ID_BLOCK *substring_candidates( Backend *be, Filter *f );
|
||||
static ID_BLOCK *substring_comp_candidates( Backend *be, char *type,
|
||||
struct berval *val, int prepost );
|
||||
#endif
|
||||
|
||||
ID_BLOCK *
|
||||
filter_candidates(
|
||||
|
|
@ -69,20 +59,12 @@ filter_candidates(
|
|||
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
result = equality_candidates( be, f->f_ava );
|
||||
#else
|
||||
result = equality_candidates( be, &f->f_ava );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_APPROX:
|
||||
Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
result = approx_candidates( be, f->f_ava );
|
||||
#else
|
||||
result = approx_candidates( be, &f->f_ava );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_SUBSTRINGS:
|
||||
|
|
@ -128,25 +110,18 @@ filter_candidates(
|
|||
static ID_BLOCK *
|
||||
presence_candidates(
|
||||
Backend *be,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc
|
||||
#else
|
||||
char *desc
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ID_BLOCK *idl;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
DBCache *db;
|
||||
int rc;
|
||||
char *dbname;
|
||||
slap_index mask;
|
||||
struct berval *prefix;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
idl = idl_allids( be );
|
||||
|
||||
rc = index_param( be, desc, LDAP_FILTER_PRESENT,
|
||||
|
|
@ -188,9 +163,6 @@ presence_candidates(
|
|||
|
||||
ldbm_cache_close( be, db );
|
||||
|
||||
#else
|
||||
idl = index_read( be, desc, SLAP_INDEX_PRESENT, NULL );
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= presence_candidates %ld\n",
|
||||
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
|
||||
|
|
@ -200,15 +172,10 @@ presence_candidates(
|
|||
static ID_BLOCK *
|
||||
equality_candidates(
|
||||
Backend *be,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeAssertion *ava
|
||||
#else
|
||||
Ava *ava
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ID_BLOCK *idl;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
DBCache *db;
|
||||
int i;
|
||||
int rc;
|
||||
|
|
@ -217,11 +184,9 @@ equality_candidates(
|
|||
struct berval *prefix;
|
||||
struct berval **keys = NULL;
|
||||
MatchingRule *mr;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> equality_candidates\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
idl = idl_allids( be );
|
||||
|
||||
rc = index_param( be, ava->aa_desc, LDAP_FILTER_EQUALITY,
|
||||
|
|
@ -300,10 +265,6 @@ equality_candidates(
|
|||
|
||||
ldbm_cache_close( be, db );
|
||||
|
||||
#else
|
||||
idl = index_read( be, ava->ava_type, SLAP_INDEX_EQUALITY,
|
||||
ava->ava_value.bv_val );
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= equality_candidates %ld\n",
|
||||
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
|
||||
|
|
@ -313,15 +274,10 @@ equality_candidates(
|
|||
static ID_BLOCK *
|
||||
approx_candidates(
|
||||
Backend *be,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeAssertion *ava
|
||||
#else
|
||||
Ava *ava
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ID_BLOCK *idl;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
DBCache *db;
|
||||
int i;
|
||||
int rc;
|
||||
|
|
@ -330,14 +286,9 @@ approx_candidates(
|
|||
struct berval *prefix;
|
||||
struct berval **keys = NULL;
|
||||
MatchingRule *mr;
|
||||
#else
|
||||
char *w, *c;
|
||||
ID_BLOCK *tmp;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> approx_candidates\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
idl = idl_allids( be );
|
||||
|
||||
rc = index_param( be, ava->aa_desc, LDAP_FILTER_EQUALITY,
|
||||
|
|
@ -421,31 +372,6 @@ approx_candidates(
|
|||
|
||||
ldbm_cache_close( be, db );
|
||||
|
||||
#else
|
||||
idl = NULL;
|
||||
for ( w = first_word( ava->ava_value.bv_val );
|
||||
w != NULL;
|
||||
w = next_word( w ) )
|
||||
{
|
||||
c = phonetic( w );
|
||||
if ( (tmp = index_read( be, ava->ava_type, SLAP_INDEX_APPROX, c ))
|
||||
== NULL ) {
|
||||
free( c );
|
||||
idl_free( idl );
|
||||
Debug( LDAP_DEBUG_TRACE, "<= approx_candidates NULL\n",
|
||||
0, 0, 0 );
|
||||
return( NULL );
|
||||
}
|
||||
free( c );
|
||||
|
||||
if ( idl == NULL ) {
|
||||
idl = tmp;
|
||||
} else {
|
||||
idl = idl_intersection( be, idl, tmp );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Debug( LDAP_DEBUG_TRACE, "<= approx_candidates %ld\n",
|
||||
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
|
||||
return( idl );
|
||||
|
|
@ -499,155 +425,12 @@ substring_candidates(
|
|||
)
|
||||
{
|
||||
ID_BLOCK *idl;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int i;
|
||||
ID_BLOCK *tmp, *tmp2;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> substring_candidates\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
idl = idl_allids( be );
|
||||
#else
|
||||
idl = NULL;
|
||||
|
||||
/* initial */
|
||||
if ( f->f_sub_initial != NULL ) {
|
||||
if ( f->f_sub_initial->bv_len < SUBLEN - 1 ) {
|
||||
idl = idl_allids( be );
|
||||
} else if ( (idl = substring_comp_candidates( be, f->f_sub_type,
|
||||
f->f_sub_initial, '^' )) == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
/* final */
|
||||
if ( f->f_sub_final != NULL ) {
|
||||
if ( f->f_sub_final->bv_len < SUBLEN - 1 ) {
|
||||
tmp = idl_allids( be );
|
||||
} else if ( (tmp = substring_comp_candidates( be, f->f_sub_type,
|
||||
f->f_sub_final, '$' )) == NULL ) {
|
||||
idl_free( idl );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if ( idl == NULL ) {
|
||||
idl = tmp;
|
||||
} else {
|
||||
tmp2 = idl;
|
||||
idl = idl_intersection( be, idl, tmp );
|
||||
idl_free( tmp );
|
||||
idl_free( tmp2 );
|
||||
}
|
||||
}
|
||||
|
||||
if( f->f_sub_any != NULL ) {
|
||||
for ( i = 0; f->f_sub_any[i] != NULL; i++ ) {
|
||||
if ( f->f_sub_any[i]->bv_len < SUBLEN ) {
|
||||
tmp = idl_allids( be );
|
||||
} else if ( (tmp = substring_comp_candidates( be, f->f_sub_type,
|
||||
f->f_sub_any[i], 0 )) == NULL ) {
|
||||
idl_free( idl );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if ( idl == NULL ) {
|
||||
idl = tmp;
|
||||
} else {
|
||||
tmp2 = idl;
|
||||
idl = idl_intersection( be, idl, tmp );
|
||||
idl_free( tmp );
|
||||
idl_free( tmp2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Debug( LDAP_DEBUG_TRACE, "<= substring_candidates %ld\n",
|
||||
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
|
||||
return( idl );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static ID_BLOCK *
|
||||
substring_comp_candidates(
|
||||
Backend *be,
|
||||
char *type,
|
||||
struct berval *bv,
|
||||
int prepost
|
||||
)
|
||||
{
|
||||
int i, len;
|
||||
ID_BLOCK *idl, *tmp, *tmp2;
|
||||
char *p;
|
||||
char buf[SUBLEN + 1];
|
||||
char *val;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> substring_comp_candidates\n", 0, 0, 0 );
|
||||
|
||||
val = bv->bv_val;
|
||||
len = bv->bv_len;
|
||||
idl = NULL;
|
||||
|
||||
/* prepend ^ for initial substring */
|
||||
if ( prepost == '^' ) {
|
||||
buf[0] = '^';
|
||||
for ( i = 0; i < SUBLEN - 1; i++ ) {
|
||||
buf[i + 1] = val[i];
|
||||
}
|
||||
buf[SUBLEN] = '\0';
|
||||
|
||||
if ( (idl = index_read( be, type, SLAP_INDEX_SUBSTR, buf )) == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
} else if ( prepost == '$' ) {
|
||||
p = val + len - SUBLEN + 1;
|
||||
for ( i = 0; i < SUBLEN - 1; i++ ) {
|
||||
buf[i] = p[i];
|
||||
}
|
||||
buf[SUBLEN - 1] = '$';
|
||||
buf[SUBLEN] = '\0';
|
||||
|
||||
if ( (idl = index_read( be, type, SLAP_INDEX_SUBSTR, buf )) == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
for ( p = val; p < (val + len - SUBLEN + 1); p++ ) {
|
||||
for ( i = 0; i < SUBLEN; i++ ) {
|
||||
buf[i] = p[i];
|
||||
}
|
||||
buf[SUBLEN] = '\0';
|
||||
|
||||
if ( (tmp = index_read( be, type, SLAP_INDEX_SUBSTR, buf )) == NULL ) {
|
||||
idl_free( idl );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if ( idl == NULL ) {
|
||||
idl = tmp;
|
||||
} else {
|
||||
tmp2 = idl;
|
||||
idl = idl_intersection( be, idl, tmp );
|
||||
idl_free( tmp );
|
||||
idl_free( tmp2 );
|
||||
}
|
||||
|
||||
/* break if no candidates */
|
||||
if( idl == NULL ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* if we're down to two (or less) matches, stop searching */
|
||||
if( ID_BLOCK_NIDS(idl) < 3 ) {
|
||||
Debug( LDAP_DEBUG_TRACE, "substring_comp_candiates: "
|
||||
"down to a %ld matches, stopped search\n",
|
||||
(long) ID_BLOCK_NIDS(idl), 0, 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= substring_comp_candidates %ld\n",
|
||||
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
|
||||
return( idl );
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,13 +27,8 @@ ldbm_back_group(
|
|||
Entry *target,
|
||||
const char *gr_ndn,
|
||||
const char *op_ndn,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ObjectClass *group_oc,
|
||||
AttributeDescription *group_at
|
||||
#else
|
||||
const char *group_oc,
|
||||
const char *group_at
|
||||
#endif
|
||||
)
|
||||
{
|
||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||
|
|
@ -42,7 +37,6 @@ ldbm_back_group(
|
|||
Attribute *attr;
|
||||
struct berval bv;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
const char *group_oc_name = NULL;
|
||||
const char *group_at_name = group_at->ad_cname->bv_val;
|
||||
|
|
@ -52,11 +46,6 @@ ldbm_back_group(
|
|||
} else {
|
||||
group_oc_name = group_oc->soc_oid;
|
||||
}
|
||||
#else
|
||||
const char *ad_objectClass = "objectclass";
|
||||
const char *group_oc_name = group_oc;
|
||||
const char *group_at_name = group_at;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS,
|
||||
"=> ldbm_back_group: gr dn: \"%s\"\n",
|
||||
|
|
@ -101,7 +90,6 @@ ldbm_back_group(
|
|||
rc = 1;
|
||||
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( is_entry_alias( e ) ) {
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: group is an alias\n", 0, 0, 0 );
|
||||
|
|
@ -142,64 +130,6 @@ ldbm_back_group(
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
#else
|
||||
if ((attr = attr_find(e->e_attrs, ad_objectClass)) == NULL) {
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: failed to find objectClass\n", 0, 0, 0 );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
bv.bv_val = "ALIAS";
|
||||
bv.bv_len = sizeof("ALIAS")-1;
|
||||
|
||||
if ( value_find(attr->a_vals, &bv, attr->a_syntax, 1) == 0) {
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: group is an alias\n", 0, 0, 0 );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
bv.bv_val = "REFERRAL";
|
||||
bv.bv_len = sizeof("REFERRAL")-1;
|
||||
|
||||
if ( value_find(attr->a_vals, &bv, attr->a_syntax, 1) == 0) {
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: group is a referral\n",
|
||||
0, 0, 0 );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
bv.bv_val = (char *) group_oc_name;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
if (value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: failed to find %s in objectClass\n",
|
||||
group_oc_name, 0, 0 );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
if ((attr = attr_find(e->e_attrs, group_at)) == NULL) {
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: failed to find %s\n",
|
||||
group_at_name, 0, 0 );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: found objectClass %s and %s\n",
|
||||
group_oc_name, group_at_name, 0 );
|
||||
|
||||
bv.bv_val = (char *) op_ndn;
|
||||
bv.bv_len = strlen( op_ndn );
|
||||
|
||||
if( value_find( attr->a_vals, &bv, attr->a_syntax, 1) != 0 )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
"<= ldbm_back_group: \"%s\" not in \"%s\": %s\n",
|
||||
op_ndn, gr_ndn, group_at_name );
|
||||
goto return_results;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Debug( LDAP_DEBUG_ACL,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
static ID_BLOCK* idl_dup( ID_BLOCK *idl );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static void cont_alloc( Datum cont, Datum key )
|
||||
{
|
||||
ldbm_datum_init( cont );
|
||||
|
|
@ -43,7 +42,6 @@ static void cont_free( Datum cont )
|
|||
{
|
||||
ch_free( cont.dptr );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocate an ID_BLOCK with room for nids ids */
|
||||
ID_BLOCK *
|
||||
|
|
@ -135,9 +133,6 @@ idl_fetch(
|
|||
ID_BLOCK *idl;
|
||||
ID_BLOCK **tmp;
|
||||
int i, nids;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *kstr;
|
||||
#endif
|
||||
|
||||
idl = idl_fetch_one( be, db, key );
|
||||
|
||||
|
|
@ -171,22 +166,10 @@ idl_fetch(
|
|||
tmp = (ID_BLOCK **) ch_malloc( (i + 1) * sizeof(ID_BLOCK *) );
|
||||
|
||||
/* read in all the blocks */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_alloc( data, key );
|
||||
#else
|
||||
kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE );
|
||||
#endif
|
||||
nids = 0;
|
||||
for ( i = 0; !ID_BLOCK_NOID(idl, i); i++ ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_id( data, ID_BLOCK_ID(idl, i) );
|
||||
#else
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(idl, i), key.dptr );
|
||||
|
||||
data.dptr = kstr;
|
||||
data.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
|
||||
if ( (tmp[i] = idl_fetch_one( be, db, data )) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
|
|
@ -197,11 +180,7 @@ idl_fetch(
|
|||
nids += ID_BLOCK_NIDS(tmp[i]);
|
||||
}
|
||||
tmp[i] = NULL;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( data );
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
idl_free( idl );
|
||||
|
||||
/* allocate space for the big block */
|
||||
|
|
@ -340,13 +319,7 @@ idl_change_first(
|
|||
}
|
||||
|
||||
/* write block with new key */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_id( bkey, ID_BLOCK_ID(b, 0) );
|
||||
#else
|
||||
sprintf( bkey.dptr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(b, 0), hkey.dptr );
|
||||
bkey.dsize = strlen( bkey.dptr ) + 1;
|
||||
#endif
|
||||
|
||||
if ( (rc = idl_store( be, db, bkey, b )) != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
|
|
@ -377,11 +350,6 @@ idl_insert_key(
|
|||
int i, j, first, rc;
|
||||
ID_BLOCK *idl, *tmp, *tmp2, *tmp3;
|
||||
Datum k2;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *kstr;
|
||||
|
||||
ldbm_datum_init( k2 );
|
||||
#endif
|
||||
|
||||
if ( (idl = idl_fetch_one( be, db, key )) == NULL ) {
|
||||
#ifdef LDBM_DEBUG
|
||||
|
|
@ -438,37 +406,15 @@ idl_insert_key(
|
|||
/* store it */
|
||||
rc = idl_store( be, db, key, idl );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_alloc( k2, key );
|
||||
cont_id( k2, ID_BLOCK_ID(tmp, 0) );
|
||||
#else
|
||||
/* store the first id block */
|
||||
kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE );
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(tmp, 0), key.dptr );
|
||||
|
||||
k2.dptr = kstr;
|
||||
k2.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
|
||||
rc = idl_store( be, db, k2, tmp );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_id( k2, ID_BLOCK_ID(tmp2, 0) );
|
||||
#else
|
||||
/* store the second id block */
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(tmp2, 0), key.dptr );
|
||||
k2.dptr = kstr;
|
||||
k2.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
rc = idl_store( be, db, k2, tmp2 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( k2 );
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
|
||||
idl_free( tmp );
|
||||
idl_free( tmp2 );
|
||||
|
|
@ -499,25 +445,13 @@ idl_insert_key(
|
|||
}
|
||||
|
||||
/* get the block */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_alloc( k2, key );
|
||||
cont_id( k2, ID_BLOCK_ID(idl, i) );
|
||||
#else
|
||||
kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE );
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(idl, i), key.dptr );
|
||||
k2.dptr = kstr;
|
||||
k2.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
|
||||
if ( (tmp = idl_fetch_one( be, db, k2 )) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "nonexistent continuation block (%s)\n",
|
||||
k2.dptr, 0, 0 );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( k2 );
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
idl_free( idl );
|
||||
return( -1 );
|
||||
}
|
||||
|
|
@ -556,25 +490,14 @@ idl_insert_key(
|
|||
/* is there a next block? */
|
||||
if ( !first && !ID_BLOCK_NOID(idl, i + 1) ) {
|
||||
/* read it in */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_alloc( k2, key );
|
||||
cont_id( k2, ID_BLOCK_ID(idl, i) );
|
||||
#else
|
||||
k2.dptr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE );
|
||||
sprintf( k2.dptr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(idl, i + 1), key.dptr );
|
||||
k2.dsize = strlen( k2.dptr ) + 1;
|
||||
#endif
|
||||
if ( (tmp2 = idl_fetch_one( be, db, k2 )) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"idl_fetch_one (%s) returns NULL\n",
|
||||
k2.dptr, 0, 0 );
|
||||
/* split the original block */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( k2 );
|
||||
#else
|
||||
free( k2.dptr );
|
||||
#endif
|
||||
goto split;
|
||||
}
|
||||
|
||||
|
|
@ -595,25 +518,15 @@ idl_insert_key(
|
|||
*/
|
||||
rc = idl_insert( &tmp, id, db->dbc_maxids );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
k3.dptr = ch_malloc(k2.dsize);
|
||||
k3.dsize = k2.dsize;
|
||||
memcpy(k3.dptr, k2.dptr, k3.dsize);
|
||||
#else
|
||||
k3.dptr = strdup( kstr );
|
||||
k3.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
if ( (rc = idl_store( be, db, k3, tmp )) != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"idl_store of (%s) returns %d\n", k3.dptr, rc, 0 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
free( k3.dptr );
|
||||
#else
|
||||
free( kstr );
|
||||
kstr = k2.dptr;
|
||||
#endif
|
||||
|
||||
id = id2;
|
||||
/* This new id will necessarily be inserted
|
||||
|
|
@ -641,11 +554,7 @@ idl_insert_key(
|
|||
id, 0, 0 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
assert( 0 ); /* not yet implemented */
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
idl_free( tmp );
|
||||
idl_free( tmp2 );
|
||||
idl_free( idl );
|
||||
|
|
@ -683,14 +592,7 @@ split:
|
|||
|
||||
/* delete all indirect blocks */
|
||||
for ( j = 0; !ID_BLOCK_NOID(idl, j); j++ ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_id( k2, ID_BLOCK_ID(idl, j) );
|
||||
#else
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(idl, j), key.dptr );
|
||||
k2.dptr = kstr;
|
||||
k2.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
|
||||
rc = ldbm_cache_delete( db, k2 );
|
||||
}
|
||||
|
|
@ -700,11 +602,7 @@ split:
|
|||
idl = idl_allids( be );
|
||||
rc = idl_store( be, db, key, idl );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( k2 );
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
idl_free( idl );
|
||||
idl_free( tmp );
|
||||
return( rc );
|
||||
|
|
@ -734,25 +632,11 @@ split:
|
|||
rc = idl_store( be, db, key, tmp );
|
||||
|
||||
/* store the first id block */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_id( k2, ID_BLOCK_ID(tmp2, 0) );
|
||||
#else
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(tmp2, 0), key.dptr );
|
||||
k2.dptr = kstr;
|
||||
k2.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
rc = idl_store( be, db, k2, tmp2 );
|
||||
|
||||
/* store the second id block */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_id( k2, ID_BLOCK_ID(tmp3, 0) );
|
||||
#else
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(tmp3, 0), key.dptr );
|
||||
k2.dptr = kstr;
|
||||
k2.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
rc = idl_store( be, db, k2, tmp3 );
|
||||
|
||||
idl_free( tmp2 );
|
||||
|
|
@ -760,11 +644,7 @@ split:
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( k2 );
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
idl_free( tmp );
|
||||
idl_free( idl );
|
||||
return( rc );
|
||||
|
|
@ -839,9 +719,6 @@ idl_delete_key (
|
|||
ID_BLOCK *idl;
|
||||
unsigned i;
|
||||
int j, nids;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *kstr;
|
||||
#endif
|
||||
|
||||
if ( (idl = idl_fetch_one( be, db, key ) ) == NULL )
|
||||
{
|
||||
|
|
@ -886,24 +763,12 @@ idl_delete_key (
|
|||
for ( nids = 0; !ID_BLOCK_NOID(idl, nids); nids++ )
|
||||
; /* NULL */
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_alloc( data, key );
|
||||
#else
|
||||
kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE );
|
||||
#endif
|
||||
|
||||
for ( j = 0; !ID_BLOCK_NOID(idl, j); j++ )
|
||||
{
|
||||
ID_BLOCK *tmp;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_id( data, ID_BLOCK_ID(idl, j) );
|
||||
#else
|
||||
ldbm_datum_init( data );
|
||||
sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX,
|
||||
ID_BLOCK_ID(idl, j), key.dptr );
|
||||
data.dptr = kstr;
|
||||
data.dsize = strlen( kstr ) + 1;
|
||||
#endif
|
||||
|
||||
if ( (tmp = idl_fetch_one( be, db, data )) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
|
|
@ -941,11 +806,7 @@ idl_delete_key (
|
|||
idl_store( be, db, key, idl );
|
||||
}
|
||||
idl_free( tmp );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( data );
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
idl_free( idl );
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -953,11 +814,7 @@ idl_delete_key (
|
|||
idl_free( tmp );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
cont_free( data );
|
||||
#else
|
||||
free( kstr );
|
||||
#endif
|
||||
idl_free( idl );
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static index_mask(
|
||||
Backend *be,
|
||||
AttributeDescription *desc,
|
||||
|
|
@ -304,30 +303,6 @@ int index_values(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
int index_change_values(
|
||||
Backend *be,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
char *desc,
|
||||
#endif
|
||||
struct berval **vals,
|
||||
ID id,
|
||||
unsigned int op
|
||||
);
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int change_value(Backend *be,
|
||||
DBCache *db,
|
||||
char *type,
|
||||
int indextype,
|
||||
char *val,
|
||||
ID id,
|
||||
int
|
||||
(*idl_func)(Backend *, DBCache *, Datum, ID));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
index_entry(
|
||||
|
|
@ -337,43 +312,15 @@ index_entry(
|
|||
Attribute *ap
|
||||
)
|
||||
{
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
struct berval bv;
|
||||
struct berval *bvals[2];
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> index_entry_%s( %ld, \"%s\" )\n",
|
||||
op == SLAP_INDEX_ADD_OP ? "add" : "del",
|
||||
e->e_id, e->e_dn );
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* dn index entry - make it look like an attribute so it works
|
||||
* with index_change_values() call
|
||||
*/
|
||||
|
||||
bv.bv_val = ch_strdup( e->e_ndn );
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
bvals[0] = &bv;
|
||||
bvals[1] = NULL;
|
||||
|
||||
/* add the dn to the indexes */
|
||||
{
|
||||
char *dn = ch_strdup("dn");
|
||||
index_change_values( be, dn, bvals, e->e_id, op );
|
||||
free( dn );
|
||||
}
|
||||
|
||||
free( bv.bv_val );
|
||||
#endif
|
||||
|
||||
/* add each attribute to the indexes */
|
||||
for ( ap; ap != NULL; ap = ap->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
index_values( be, ap->a_desc, ap->a_vals, e->e_id, op );
|
||||
#else
|
||||
index_change_values( be, ap->a_type, ap->a_vals, e->e_id, op );
|
||||
#endif
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= index_entry_%s( %ld, \"%s\" ) success\n",
|
||||
|
|
@ -383,356 +330,3 @@ index_entry(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
|
||||
ID_BLOCK *
|
||||
index_read(
|
||||
Backend *be,
|
||||
char *type,
|
||||
int indextype,
|
||||
char *val
|
||||
)
|
||||
{
|
||||
DBCache *db;
|
||||
Datum key;
|
||||
ID_BLOCK *idl;
|
||||
int indexmask;
|
||||
char prefix;
|
||||
char *realval, *tmpval;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
char *at_cn;
|
||||
|
||||
ldbm_datum_init( key );
|
||||
|
||||
prefix = slap_index2prefix( indextype );
|
||||
Debug( LDAP_DEBUG_TRACE, "=> index_read(\"%c%s\"->\"%s\")\n",
|
||||
prefix, type, val );
|
||||
|
||||
attr_mask( be->be_private, type, &indexmask );
|
||||
if ( ! (indextype & indexmask) ) {
|
||||
idl = idl_allids( be );
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"<= index_read %ld candidates (allids - not indexed)\n",
|
||||
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
|
||||
return( idl );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
at_cn = at_canonical_name( at_find( type ) );
|
||||
#else
|
||||
attr_normalize( type );
|
||||
at_cn = at_canonical_name( type );
|
||||
#endif
|
||||
|
||||
if ( at_cn == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"<= index_read no canonical name for type \"%s\"\n",
|
||||
type != NULL ? type : "(NULL)", 0, 0 );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if ( (db = ldbm_cache_open( be, at_cn, LDBM_SUFFIX, LDBM_WRCREAT ))
|
||||
== NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"<= index_read NULL (could not open %s%s)\n",
|
||||
at_cn, LDBM_SUFFIX, 0 );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
realval = val;
|
||||
tmpval = NULL;
|
||||
if ( prefix != UNKNOWN_PREFIX ) {
|
||||
unsigned int len = strlen( val );
|
||||
|
||||
if ( (len + 2) < sizeof(buf) ) {
|
||||
realval = buf;
|
||||
} else {
|
||||
/* value + prefix + null */
|
||||
tmpval = (char *) ch_malloc( len + 2 );
|
||||
realval = tmpval;
|
||||
}
|
||||
|
||||
realval[0] = prefix;
|
||||
strcpy( &realval[1], val );
|
||||
}
|
||||
|
||||
key.dptr = realval;
|
||||
key.dsize = strlen( realval ) + 1;
|
||||
|
||||
idl = idl_fetch( be, db, key );
|
||||
if ( tmpval != NULL ) {
|
||||
free( tmpval );
|
||||
}
|
||||
|
||||
ldbm_cache_close( be, db );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
|
||||
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
|
||||
return( idl );
|
||||
}
|
||||
|
||||
/* Add or remove stuff from index files */
|
||||
|
||||
static int
|
||||
change_value(
|
||||
Backend *be,
|
||||
DBCache *db,
|
||||
char *type,
|
||||
int indextype,
|
||||
char *val,
|
||||
ID id,
|
||||
int (*idl_func)(Backend *, DBCache *, Datum, ID)
|
||||
)
|
||||
{
|
||||
int rc;
|
||||
Datum key;
|
||||
char *tmpval = NULL;
|
||||
char *realval = val;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
char prefix = slap_index2prefix( indextype );
|
||||
|
||||
ldbm_datum_init( key );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"=> change_value( \"%c%s\", op=%s )\n",
|
||||
prefix, val, (idl_func == idl_insert_key ? "ADD":"DELETE") );
|
||||
|
||||
if ( prefix != UNKNOWN_PREFIX ) {
|
||||
unsigned int len = strlen( val );
|
||||
|
||||
if ( (len + 2) < sizeof(buf) ) {
|
||||
realval = buf;
|
||||
} else {
|
||||
/* value + prefix + null */
|
||||
tmpval = (char *) ch_malloc( len + 2 );
|
||||
realval = tmpval;
|
||||
}
|
||||
realval[0] = prefix;
|
||||
strcpy( &realval[1], val );
|
||||
}
|
||||
|
||||
key.dptr = realval;
|
||||
key.dsize = strlen( realval ) + 1;
|
||||
|
||||
rc = idl_func( be, db, key, id );
|
||||
|
||||
if ( tmpval != NULL ) {
|
||||
free( tmpval );
|
||||
}
|
||||
|
||||
ldap_pvt_thread_yield();
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= change_value %d\n", rc, 0, 0 );
|
||||
|
||||
return( rc );
|
||||
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static
|
||||
#endif
|
||||
int
|
||||
index_change_values(
|
||||
Backend *be,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
char *desc,
|
||||
#endif
|
||||
struct berval **vals,
|
||||
ID id,
|
||||
unsigned int op
|
||||
)
|
||||
{
|
||||
char *val, *p, *code, *w;
|
||||
unsigned i, j, len;
|
||||
int indexmask, syntax;
|
||||
char buf[SUBLEN + 1];
|
||||
char vbuf[BUFSIZ];
|
||||
char *bigbuf;
|
||||
DBCache *db;
|
||||
|
||||
int (*idl_funct)(Backend *,
|
||||
DBCache *,
|
||||
Datum, ID);
|
||||
char *at_cn; /* Attribute canonical name */
|
||||
int mode;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *type = desc->ad_cname->bv_val;
|
||||
#else
|
||||
char *type = desc;
|
||||
#endif
|
||||
|
||||
if( vals == NULL ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"=> index_change_values( %s, NULL, %ld, op=%s )\n",
|
||||
type, id, ((op == SLAP_INDEX_ADD_OP) ? "ADD" : "DELETE" ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"=> index_change_values( \"%s\", %ld, op=%s )\n",
|
||||
type, id, ((op == SLAP_INDEX_ADD_OP) ? "ADD" : "DELETE" ) );
|
||||
|
||||
|
||||
if (op == SLAP_INDEX_ADD_OP) {
|
||||
/* Add values */
|
||||
idl_funct = idl_insert_key;
|
||||
mode = LDBM_WRCREAT;
|
||||
|
||||
} else {
|
||||
/* Delete values */
|
||||
idl_funct = idl_delete_key;
|
||||
mode = LDBM_WRITER;
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
attr_normalize(type);
|
||||
#endif
|
||||
attr_mask( be->be_private, desc, &indexmask );
|
||||
|
||||
if ( indexmask == 0 ) {
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
at_cn = at_canonical_name( at_find( type ) );
|
||||
#else
|
||||
syntax = attr_syntax( type );
|
||||
at_cn = at_canonical_name( type );
|
||||
#endif
|
||||
|
||||
if ( at_cn == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"<= index_change_values no canonical name for type \"%s\"\n",
|
||||
type != NULL ? type : "(NULL)", 0, 0 );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if ( (db = ldbm_cache_open( be, at_cn, LDBM_SUFFIX, mode ))
|
||||
== NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"<= index_change_values (couldn't open(%s%s),md=%s)\n",
|
||||
at_cn, LDBM_SUFFIX,
|
||||
((mode==LDBM_WRCREAT)?"LDBM_WRCREAT":"LDBM_WRITER") );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/*
|
||||
* presence index entry
|
||||
*/
|
||||
if ( indexmask & SLAP_INDEX_PRESENT ) {
|
||||
change_value( be, db, at_cn, SLAP_INDEX_PRESENT,
|
||||
"*", id, idl_funct );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( syntax & SYNTAX_BIN ) {
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( i = 0; vals[i] != NULL; i++ ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"index_change_values syntax 0x%x\n",
|
||||
syntax, 0, 0 );
|
||||
|
||||
bigbuf = NULL;
|
||||
len = vals[i]->bv_len;
|
||||
|
||||
/* value + null */
|
||||
if ( len + 2 > sizeof(vbuf) ) {
|
||||
bigbuf = (char *) ch_malloc( len + 1 );
|
||||
val = bigbuf;
|
||||
} else {
|
||||
val = vbuf;
|
||||
}
|
||||
(void) memcpy( val, vals[i]->bv_val, len );
|
||||
val[len] = '\0';
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
value_normalize( val, syntax );
|
||||
#endif
|
||||
|
||||
/* value_normalize could change the length of val */
|
||||
len = strlen( val );
|
||||
|
||||
/*
|
||||
* equality index entry
|
||||
*/
|
||||
if ( indexmask & SLAP_INDEX_EQUALITY ) {
|
||||
change_value( be, db, at_cn, SLAP_INDEX_EQUALITY,
|
||||
val, id, idl_funct);
|
||||
}
|
||||
|
||||
/*
|
||||
* approximate index entry
|
||||
*/
|
||||
if ( indexmask & SLAP_INDEX_APPROX ) {
|
||||
for ( w = first_word( val ); w != NULL;
|
||||
w = next_word( w ) ) {
|
||||
if ( (code = phonetic( w )) != NULL ) {
|
||||
change_value( be,
|
||||
db,
|
||||
at_cn,
|
||||
SLAP_INDEX_APPROX,
|
||||
code,
|
||||
id,
|
||||
idl_funct );
|
||||
free( code );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* substrings index entry
|
||||
*/
|
||||
if ( indexmask & SLAP_INDEX_SUBSTR ) {
|
||||
/* leading and trailing */
|
||||
if ( len > SUBLEN - 2 ) {
|
||||
buf[0] = '^';
|
||||
for ( j = 0; j < SUBLEN - 1; j++ ) {
|
||||
buf[j + 1] = val[j];
|
||||
}
|
||||
buf[SUBLEN] = '\0';
|
||||
|
||||
change_value( be, db, at_cn, SLAP_INDEX_SUBSTR,
|
||||
buf, id, idl_funct );
|
||||
|
||||
p = val + len - SUBLEN + 1;
|
||||
for ( j = 0; j < SUBLEN - 1; j++ ) {
|
||||
buf[j] = p[j];
|
||||
}
|
||||
buf[SUBLEN - 1] = '$';
|
||||
buf[SUBLEN] = '\0';
|
||||
|
||||
change_value( be, db, at_cn, SLAP_INDEX_SUBSTR,
|
||||
buf, id, idl_funct );
|
||||
}
|
||||
|
||||
/* any */
|
||||
for ( p = val; p < (val + len - SUBLEN + 1); p++ ) {
|
||||
for ( j = 0; j < SUBLEN; j++ ) {
|
||||
buf[j] = p[j];
|
||||
}
|
||||
buf[SUBLEN] = '\0';
|
||||
|
||||
change_value( be, db, at_cn, SLAP_INDEX_SUBSTR,
|
||||
buf, id, idl_funct );
|
||||
}
|
||||
}
|
||||
|
||||
if ( bigbuf != NULL ) {
|
||||
free( bigbuf );
|
||||
}
|
||||
}
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
done:
|
||||
#endif
|
||||
ldbm_cache_close( be, db );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -78,9 +78,6 @@ ldbm_back_initialize(
|
|||
bi->bi_tool_entry_get = ldbm_tool_entry_get;
|
||||
bi->bi_tool_entry_put = ldbm_tool_entry_put;
|
||||
bi->bi_tool_index_attr = ldbm_tool_index_attr;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
bi->bi_tool_index_change = ldbm_tool_index_change;
|
||||
#endif
|
||||
bi->bi_tool_sync = ldbm_tool_sync;
|
||||
|
||||
#ifdef HAVE_CYRUS_SASL
|
||||
|
|
|
|||
|
|
@ -268,7 +268,6 @@ add_values(
|
|||
int i;
|
||||
Attribute *a;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* char *desc = mod->sm_desc->ad_cname->bv_val; */
|
||||
MatchingRule *mr = mod->sm_desc->ad_type->sat_equality;
|
||||
|
||||
|
|
@ -276,16 +275,12 @@ add_values(
|
|||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
|
||||
#else
|
||||
/* char *desc = mod->mod_type; */
|
||||
#endif
|
||||
|
||||
a = attr_find( e->e_attrs, mod->sm_desc );
|
||||
|
||||
/* check if the values we're adding already exist */
|
||||
if ( a != NULL ) {
|
||||
for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
int j;
|
||||
const char *text = NULL;
|
||||
|
|
@ -311,12 +306,6 @@ add_values(
|
|||
}
|
||||
|
||||
ber_bvfree( asserted );
|
||||
#else
|
||||
if ( value_find( a->a_vals, mod->sm_bvalues[i],
|
||||
a->a_syntax, 3 ) == 0 ) {
|
||||
return( LDAP_TYPE_OR_VALUE_EXISTS );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -338,16 +327,12 @@ delete_values(
|
|||
{
|
||||
int i, j, k, found;
|
||||
Attribute *a;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *desc = mod->sm_desc->ad_cname->bv_val;
|
||||
MatchingRule *mr = mod->sm_desc->ad_type->sat_equality;
|
||||
|
||||
if( mr == NULL || !mr->smr_match ) {
|
||||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
#else
|
||||
char *desc = mod->mod_type;
|
||||
#endif
|
||||
|
||||
/* delete the entire attribute */
|
||||
if ( mod->sm_bvalues == NULL ) {
|
||||
|
|
@ -367,7 +352,6 @@ delete_values(
|
|||
|
||||
/* find each value to delete */
|
||||
for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
const char *text = NULL;
|
||||
|
||||
|
|
@ -380,20 +364,14 @@ delete_values(
|
|||
&text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) return rc;
|
||||
#endif
|
||||
|
||||
found = 0;
|
||||
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int match;
|
||||
int rc = value_match( &match, mod->sm_desc, mr,
|
||||
a->a_vals[j], asserted, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match != 0 )
|
||||
#else
|
||||
if ( value_cmp( mod->mod_bvalues[i], a->a_vals[j],
|
||||
a->a_syntax, 3 ) != 0 )
|
||||
#endif
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -412,9 +390,7 @@ delete_values(
|
|||
"removing entire attribute %s\n",
|
||||
desc, 0, 0 );
|
||||
if ( attr_delete( &e->e_attrs, mod->sm_desc ) ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ber_bvfree( asserted );
|
||||
#endif
|
||||
return LDAP_NO_SUCH_ATTRIBUTE;
|
||||
}
|
||||
}
|
||||
|
|
@ -422,9 +398,7 @@ delete_values(
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ber_bvfree( asserted );
|
||||
#endif
|
||||
|
||||
/* looked through them all w/o finding it */
|
||||
if ( ! found ) {
|
||||
|
|
|
|||
|
|
@ -44,11 +44,7 @@ ldbm_back_modrdn(
|
|||
const char *newSuperior
|
||||
)
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *children = slap_schema.si_ad_children;
|
||||
#else
|
||||
static const char *children = "children";
|
||||
#endif
|
||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||
char *p_dn = NULL, *p_ndn = NULL;
|
||||
char *new_dn = NULL, *new_ndn = NULL;
|
||||
|
|
@ -357,7 +353,6 @@ ldbm_back_modrdn(
|
|||
add_bv.bv_val = new_rdn_val;
|
||||
add_bv.bv_len = strlen(new_rdn_val);
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
@ -373,9 +368,6 @@ ldbm_back_modrdn(
|
|||
goto return_results;
|
||||
}
|
||||
}
|
||||
#else
|
||||
mod[0].sml_type = new_rdn_type;
|
||||
#endif
|
||||
mod[0].sml_bvalues = add_bvals;
|
||||
mod[0].sml_op = SLAP_MOD_SOFTADD;
|
||||
mod[0].sml_next = NULL;
|
||||
|
|
@ -404,7 +396,6 @@ ldbm_back_modrdn(
|
|||
del_bv.bv_val = old_rdn_val;
|
||||
del_bv.bv_len = strlen(old_rdn_val);
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
@ -420,9 +411,6 @@ ldbm_back_modrdn(
|
|||
goto return_results;
|
||||
}
|
||||
}
|
||||
#else
|
||||
mod[1].sml_type = old_rdn_type;
|
||||
#endif
|
||||
mod[0].sml_next = &mod[1];
|
||||
mod[1].sml_bvalues = del_bvals;
|
||||
mod[1].sml_op = LDAP_MOD_DELETE;
|
||||
|
|
|
|||
|
|
@ -40,11 +40,7 @@ ldbm_back_exop_passwd(
|
|||
|
||||
char *dn;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *entry = slap_schema.si_ad_entry;
|
||||
#else
|
||||
static const char *entry = "entry";
|
||||
#endif
|
||||
|
||||
assert( reqoid != NULL );
|
||||
assert( strcmp( LDAP_EXOP_X_MODIFY_PASSWD, reqoid ) == 0 );
|
||||
|
|
@ -126,11 +122,7 @@ ldbm_back_exop_passwd(
|
|||
vals[0] = hash;
|
||||
vals[1] = NULL;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ml.sml_desc = slap_schema.si_ad_userPassword;
|
||||
#else
|
||||
ml.sml_type = ch_strdup("userPassword");
|
||||
#endif
|
||||
ml.sml_bvalues = vals;
|
||||
ml.sml_op = LDAP_MOD_REPLACE;
|
||||
ml.sml_next = NULL;
|
||||
|
|
@ -138,9 +130,6 @@ ldbm_back_exop_passwd(
|
|||
rc = ldbm_modify_internal( be,
|
||||
conn, op, op->o_ndn, &ml, e, text );
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ch_free(ml.ml_type);
|
||||
#endif
|
||||
}
|
||||
|
||||
if( rc == LDAP_SUCCESS ) {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ ID idl_nextid LDAP_P(( ID_BLOCK *idl, ID *cursor ));
|
|||
/*
|
||||
* index.c
|
||||
*/
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
extern int
|
||||
index_param LDAP_P((
|
||||
Backend *be,
|
||||
|
|
@ -150,23 +149,11 @@ index_values LDAP_P((
|
|||
struct berval **vals,
|
||||
ID id,
|
||||
int op ));
|
||||
#endif
|
||||
|
||||
int index_entry LDAP_P(( Backend *be, int r, Entry *e, Attribute *ap ));
|
||||
#define index_entry_add(be,e,ap) index_entry((be),SLAP_INDEX_ADD_OP,(e),(ap))
|
||||
#define index_entry_del(be,e,ap) index_entry((be),SLAP_INDEX_DELETE_OP,(e),(ap))
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int index_change_values LDAP_P((
|
||||
Backend *be,
|
||||
char *desc,
|
||||
struct berval **vals,
|
||||
ID id,
|
||||
unsigned int op
|
||||
));
|
||||
ID_BLOCK * index_read LDAP_P(( Backend *be,
|
||||
char *desc, int indextype, char *val ));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* key.c
|
||||
|
|
|
|||
|
|
@ -401,100 +401,7 @@ search_candidates(
|
|||
)
|
||||
{
|
||||
ID_BLOCK *candidates;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
candidates = filter_candidates( be, filter );
|
||||
#else
|
||||
|
||||
Filter rf, rf_or, af, af_or, lf, lf_and;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
#endif
|
||||
|
||||
Debug(LDAP_DEBUG_TRACE, "search_candidates: base=\"%s\" s=%d d=%d\n",
|
||||
e->e_ndn, scope, deref );
|
||||
#endif
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( !manageDSAit ) {
|
||||
/* match referrals */
|
||||
rf.f_next = NULL;
|
||||
rf.f_choice = LDAP_FILTER_OR;
|
||||
rf.f_or = &rf_or;
|
||||
rf.f_or->f_choice = LDAP_FILTER_EQUALITY;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rf.f_or->f_av_desc = ad_objectClass;
|
||||
rf.f_or->f_av_value = ber_bvstrdup("REFERRAL");
|
||||
#else
|
||||
rf.f_or->f_avtype = ch_strdup( "objectclass" );
|
||||
rf.f_or->f_avvalue.bv_val = ch_strdup( "REFERRAL" );
|
||||
rf.f_or->f_avvalue.bv_len = sizeof("REFERRAL")-1;
|
||||
#endif
|
||||
rf.f_or->f_next = filter;
|
||||
filter = &rf;
|
||||
} else {
|
||||
rf.f_or = NULL;
|
||||
}
|
||||
|
||||
if( deref & LDAP_DEREF_SEARCHING ) {
|
||||
/* match aliases */
|
||||
af.f_next = NULL;
|
||||
af.f_choice = LDAP_FILTER_OR;
|
||||
af.f_or = &af_or;
|
||||
af.f_or->f_choice = LDAP_FILTER_EQUALITY;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
af.f_or->f_av_desc = objectClass;
|
||||
af.f_or->f_av_value = ber_bvstrdup("ALIAS");
|
||||
#else
|
||||
af.f_or->f_avtype = ch_strdup( "objectclass" );
|
||||
af.f_or->f_avvalue.bv_val = ch_strdup( "ALIAS" );
|
||||
af.f_or->f_avvalue.bv_len = sizeof("ALIAS")-1;
|
||||
#endif
|
||||
af.f_or->f_next = filter;
|
||||
filter = ⁡
|
||||
} else {
|
||||
af.f_or = NULL;
|
||||
}
|
||||
|
||||
if ( scope == LDAP_SCOPE_SUBTREE ) {
|
||||
lf.f_next = NULL;
|
||||
lf.f_choice = LDAP_FILTER_AND;
|
||||
lf.f_and = &lf_and;
|
||||
lf.f_and->f_choice = SLAPD_FILTER_DN_SUBTREE;
|
||||
lf.f_and->f_dn = e->e_ndn;
|
||||
lf.f_and->f_next = filter;
|
||||
filter = &lf;
|
||||
|
||||
} else if ( scope == LDAP_SCOPE_ONELEVEL ) {
|
||||
lf.f_next = NULL;
|
||||
lf.f_choice = LDAP_FILTER_AND;
|
||||
lf.f_and = &lf_and;
|
||||
lf.f_and->f_choice = SLAPD_FILTER_DN_ONE;
|
||||
lf.f_and->f_dn = e->e_ndn;
|
||||
lf.f_and->f_next = filter;
|
||||
filter = &lf;
|
||||
}
|
||||
|
||||
candidates = filter_candidates( be, filter );
|
||||
|
||||
/* free dynamically allocated bits */
|
||||
if( af.f_or != NULL ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ber_bvfree( af.f_or->f_av_value );
|
||||
#else
|
||||
free( af.f_or->f_avtype );
|
||||
free( af.f_or->f_avvalue.bv_val );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( rf.f_or != NULL ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ber_bvfree( rf.f_or->f_av_value );
|
||||
#else
|
||||
free( rf.f_or->f_avtype );
|
||||
free( rf.f_or->f_avvalue.bv_val );
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
return( candidates );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,35 +194,16 @@ ID ldbm_tool_entry_put(
|
|||
|
||||
int ldbm_tool_index_attr(
|
||||
BackendDB *be,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc
|
||||
#else
|
||||
char* type
|
||||
#endif
|
||||
)
|
||||
{
|
||||
static DBCache *db = NULL;
|
||||
slap_index indexmask;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *desc;
|
||||
#endif
|
||||
char *at_cname;
|
||||
|
||||
assert( slapMode & SLAP_TOOL_MODE );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
at_cname = desc->ad_cname->bv_val;
|
||||
#else
|
||||
attr_normalize( type );
|
||||
at_cname = desc = at_canonical_name( type );
|
||||
|
||||
if( desc == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"<= index_attr NULL (attribute type %s has no canonical name)\n",
|
||||
type, 0, 0 );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
assert( desc != NULL );
|
||||
attr_mask( be->be_private, at_cname, &indexmask );
|
||||
|
|
@ -243,23 +224,14 @@ int ldbm_tool_index_attr(
|
|||
|
||||
int ldbm_tool_index_change(
|
||||
BackendDB *be,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc,
|
||||
#else
|
||||
char* desc,
|
||||
#endif
|
||||
struct berval **bv,
|
||||
ID id,
|
||||
int op )
|
||||
{
|
||||
assert( slapMode & SLAP_TOOL_MODE );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
index_values( be, desc, bv, id, op );
|
||||
#else
|
||||
index_change_values( be,
|
||||
desc, bv, id, op );
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,11 +51,7 @@ passwd_back_search(
|
|||
char *matched = NULL;
|
||||
char *user = NULL;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
#else
|
||||
static char *ad_objectClass = "objectClass";
|
||||
#endif
|
||||
|
||||
tlimit = (tlimit > be->be_timelimit || tlimit < 1) ? be->be_timelimit
|
||||
: tlimit;
|
||||
|
|
@ -82,11 +78,7 @@ passwd_back_search(
|
|||
|
||||
if( scope != LDAP_SCOPE_ONELEVEL ) {
|
||||
char *type;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc = NULL;
|
||||
#else
|
||||
char *desc;
|
||||
#endif
|
||||
|
||||
/* Create an entry corresponding to the base DN */
|
||||
e = (Entry *) ch_calloc(1, sizeof(Entry));
|
||||
|
|
@ -109,7 +101,6 @@ passwd_back_search(
|
|||
|
||||
type = rdn_attr_type(rdn);
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
{
|
||||
int rc;
|
||||
const char *text;
|
||||
|
|
@ -121,15 +112,10 @@ passwd_back_search(
|
|||
goto done;
|
||||
}
|
||||
}
|
||||
#else
|
||||
desc = type;
|
||||
#endif
|
||||
|
||||
attr_merge( e, desc, vals );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad_free( desc, 1 );
|
||||
#endif
|
||||
|
||||
free(rdn);
|
||||
rdn = NULL;
|
||||
|
|
@ -262,7 +248,6 @@ pw2entry( Backend *be, struct passwd *pw, char *rdn )
|
|||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
const char *text;
|
||||
|
||||
|
|
@ -284,13 +269,6 @@ pw2entry( Backend *be, struct passwd *pw, char *rdn )
|
|||
rc = slap_str2ad( "description", &ad_description, &text );
|
||||
if(rc != LDAP_SUCCESS) return NULL;
|
||||
|
||||
#else
|
||||
static char *ad_objectClass = "objectClass";
|
||||
static char *ad_cn = "cn";
|
||||
static char *ad_sn = "sn";
|
||||
static char *ad_uid = "uid";
|
||||
static char *ad_description = "description";
|
||||
#endif
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
|
|
|
|||
|
|
@ -635,13 +635,8 @@ backend_group(
|
|||
Entry *target,
|
||||
const char *gr_ndn,
|
||||
const char *op_ndn,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ObjectClass *group_oc,
|
||||
AttributeDescription *group_at
|
||||
#else
|
||||
const char *group_oc,
|
||||
const char *group_at
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if( strcmp( target->e_ndn, gr_ndn ) != 0 ) {
|
||||
|
|
@ -668,12 +663,7 @@ Attribute *backend_operational(
|
|||
Entry *e )
|
||||
{
|
||||
Attribute *a = ch_malloc( sizeof( Attribute ) );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
a->a_desc = ad_dup( slap_schema.si_ad_subschemaSubentry );
|
||||
#else
|
||||
a->a_type = ch_strdup("subschemasubentry");
|
||||
a->a_syntax = SYNTAX_DN | SYNTAX_CIS;
|
||||
#endif
|
||||
|
||||
/* Should be backend specific */
|
||||
a->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
|
||||
|
|
|
|||
|
|
@ -33,12 +33,8 @@ do_compare(
|
|||
char *dn = NULL, *ndn=NULL;
|
||||
struct berval desc;
|
||||
struct berval value;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
struct berval *nvalue;
|
||||
AttributeAssertion ava;
|
||||
#else
|
||||
Ava ava;
|
||||
#endif
|
||||
Backend *be;
|
||||
int rc = LDAP_SUCCESS;
|
||||
const char *text = NULL;
|
||||
|
|
@ -97,7 +93,6 @@ do_compare(
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ava.aa_desc = NULL;
|
||||
rc = slap_bv2ad( &desc, &ava.aa_desc, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -129,18 +124,6 @@ do_compare(
|
|||
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n",
|
||||
op->o_connid, op->o_opid, dn, ava.aa_desc->ad_cname, 0 );
|
||||
|
||||
#else
|
||||
ava.ava_type = desc.bv_val;
|
||||
ava.ava_value = value;
|
||||
attr_normalize( ava.ava_type );
|
||||
value_normalize( ava.ava_value.bv_val, attr_syntax( ava.ava_type ) );
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
|
||||
dn, ava.ava_type, ava.ava_value.bv_val );
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n",
|
||||
op->o_connid, op->o_opid, dn, ava.ava_type, 0 );
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -179,11 +162,9 @@ cleanup:
|
|||
free( ndn );
|
||||
free( desc.bv_val );
|
||||
free( value.bv_val );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( ava.aa_desc != NULL ) {
|
||||
ad_free( ava.aa_desc, 1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -455,13 +455,9 @@ read_config( const char *fname )
|
|||
p = strchr(saveline,'(');
|
||||
parse_oc( fname, lineno, p, 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
|
||||
}
|
||||
|
||||
/* specify an attribute type */
|
||||
|
|
@ -473,14 +469,9 @@ read_config( const char *fname )
|
|||
p = strchr(saveline,'(');
|
||||
parse_at( fname, lineno, p, cargv );
|
||||
} else {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: old attribute type format not supported.\n",
|
||||
fname, lineno, 0 );
|
||||
#else
|
||||
at_config( fname, lineno, cargc - 1,
|
||||
&cargv[1] );
|
||||
#endif
|
||||
}
|
||||
|
||||
/* turn on/off schema checking */
|
||||
|
|
|
|||
|
|
@ -39,14 +39,8 @@ str2entry( char *s )
|
|||
char *type;
|
||||
struct berval value;
|
||||
struct berval *vals[2];
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad;
|
||||
const char *text;
|
||||
#else
|
||||
int nvals = 0;
|
||||
int maxvals = 0;
|
||||
char ptype[64]; /* fixed size buffer */
|
||||
#endif
|
||||
char *next;
|
||||
|
||||
/*
|
||||
|
|
@ -87,9 +81,6 @@ str2entry( char *s )
|
|||
/* dn + attributes */
|
||||
vals[0] = &value;
|
||||
vals[1] = NULL;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ptype[0] = '\0';
|
||||
#endif
|
||||
|
||||
next = s;
|
||||
while ( (s = ldif_getline( &next )) != NULL ) {
|
||||
|
|
@ -103,15 +94,6 @@ str2entry( char *s )
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( strcasecmp( type, ptype ) != 0 ) {
|
||||
strncpy( ptype, type, sizeof(ptype) - 1 );
|
||||
nvals = 0;
|
||||
maxvals = 0;
|
||||
a = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
if ( strcasecmp( type, "dn" ) == 0 ) {
|
||||
free( type );
|
||||
|
||||
|
|
@ -128,7 +110,6 @@ str2entry( char *s )
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad = NULL;
|
||||
rc = slap_str2ad( type, &ad, &text );
|
||||
|
||||
|
|
@ -144,9 +125,6 @@ str2entry( char *s )
|
|||
rc = attr_merge( e, ad, vals );
|
||||
|
||||
ad_free( ad, 1 );
|
||||
#else
|
||||
rc = attr_merge_fast( e, type, vals, nvals, 1, &maxvals, &a );
|
||||
#endif
|
||||
|
||||
if( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
|
|
@ -159,9 +137,6 @@ str2entry( char *s )
|
|||
|
||||
free( type );
|
||||
free( value.bv_val );
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
nvals++;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check to make sure there was a dn: line */
|
||||
|
|
@ -226,18 +201,10 @@ entry2str(
|
|||
/* put "<type>:[:] <value>" line for each value */
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
bv = a->a_vals[i];
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
tmplen = a->a_desc->ad_cname->bv_len;
|
||||
#else
|
||||
tmplen = strlen( a->a_type );
|
||||
#endif
|
||||
MAKE_SPACE( LDIF_SIZE_NEEDED( tmplen, bv->bv_len ));
|
||||
ldif_sput( (char **) &ecur, LDIF_PUT_VALUE,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
a->a_desc->ad_cname->bv_val,
|
||||
#else
|
||||
a->a_type,
|
||||
#endif
|
||||
bv->bv_val, bv->bv_len );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,16 +95,11 @@ get_filter(
|
|||
case LDAP_FILTER_EQUALITY:
|
||||
Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY, text );
|
||||
#else
|
||||
err = get_ava( ber, &f->f_ava, text );
|
||||
#endif
|
||||
if ( err != LDAP_SUCCESS ) {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
assert( f->f_ava != NULL );
|
||||
|
||||
*fstr = ch_malloc( sizeof("(=)")
|
||||
|
|
@ -115,13 +110,6 @@ get_filter(
|
|||
f->f_av_desc->ad_cname->bv_val,
|
||||
f->f_av_value->bv_val );
|
||||
|
||||
#else
|
||||
*fstr = ch_malloc( sizeof("(=)")
|
||||
+ strlen( f->f_avtype )
|
||||
+ f->f_avvalue.bv_len);
|
||||
sprintf( *fstr, "(%s=%s)", f->f_avtype,
|
||||
f->f_avvalue.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_SUBSTRINGS:
|
||||
|
|
@ -132,16 +120,11 @@ get_filter(
|
|||
case LDAP_FILTER_GE:
|
||||
Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
|
||||
#else
|
||||
err = get_ava( ber, &f->f_ava, text );
|
||||
#endif
|
||||
if ( err != LDAP_SUCCESS ) {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
*fstr = ch_malloc( sizeof("(>=)")
|
||||
+ f->f_av_desc->ad_cname->bv_len
|
||||
+ f->f_av_value->bv_len );
|
||||
|
|
@ -150,29 +133,17 @@ get_filter(
|
|||
f->f_av_desc->ad_cname->bv_val,
|
||||
f->f_av_value->bv_val );
|
||||
|
||||
#else
|
||||
*fstr = ch_malloc( sizeof("(>=)")
|
||||
+ strlen( f->f_avtype )
|
||||
+ f->f_avvalue.bv_len);
|
||||
sprintf( *fstr, "(%s>=%s)", f->f_avtype,
|
||||
f->f_avvalue.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_LE:
|
||||
Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
|
||||
#else
|
||||
err = get_ava( ber, &f->f_ava, text );
|
||||
#endif
|
||||
if ( err != LDAP_SUCCESS ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
*fstr = ch_malloc( sizeof("(<=)")
|
||||
+ f->f_av_desc->ad_cname->bv_len
|
||||
+ f->f_av_value->bv_len );
|
||||
|
|
@ -181,13 +152,6 @@ get_filter(
|
|||
f->f_av_desc->ad_cname->bv_val,
|
||||
f->f_av_value->bv_val );
|
||||
|
||||
#else
|
||||
*fstr = ch_malloc( sizeof("(<=)")
|
||||
+ strlen( f->f_avtype )
|
||||
+ f->f_avvalue.bv_len);
|
||||
sprintf( *fstr, "(%s<=%s)", f->f_avtype,
|
||||
f->f_avvalue.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_PRESENT: {
|
||||
|
|
@ -201,7 +165,6 @@ get_filter(
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
f->f_desc = NULL;
|
||||
err = slap_bv2ad( &type, &f->f_desc, text );
|
||||
|
||||
|
|
@ -217,29 +180,16 @@ get_filter(
|
|||
sprintf( *fstr, "(%s=*)",
|
||||
f->f_desc->ad_cname->bv_val );
|
||||
|
||||
#else
|
||||
f->f_type = type.bv_val;
|
||||
err = LDAP_SUCCESS;
|
||||
attr_normalize( f->f_type );
|
||||
*fstr = ch_malloc( sizeof("(=*)")
|
||||
+ strlen( f->f_type ) );
|
||||
sprintf( *fstr, "(%s=*)", f->f_type );
|
||||
#endif
|
||||
} break;
|
||||
|
||||
case LDAP_FILTER_APPROX:
|
||||
Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY_APPROX, text );
|
||||
#else
|
||||
err = get_ava( ber, &f->f_ava, text );
|
||||
#endif
|
||||
if ( err != LDAP_SUCCESS ) {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
*fstr = ch_malloc( sizeof("(~=)")
|
||||
+ f->f_av_desc->ad_cname->bv_len
|
||||
+ f->f_av_value->bv_len );
|
||||
|
|
@ -248,13 +198,6 @@ get_filter(
|
|||
f->f_av_desc->ad_cname->bv_val,
|
||||
f->f_av_value->bv_val );
|
||||
|
||||
#else
|
||||
*fstr = ch_malloc( sizeof("(~=)")
|
||||
+ strlen( f->f_avtype )
|
||||
+ f->f_avvalue.bv_len);
|
||||
sprintf( *fstr, "(%s~=%s)", f->f_avtype,
|
||||
f->f_avvalue.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_AND:
|
||||
|
|
@ -391,11 +334,7 @@ get_substring_filter(
|
|||
struct berval *value;
|
||||
char *last;
|
||||
struct berval type;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
struct berval *nvalue;
|
||||
#else
|
||||
int syntax;
|
||||
#endif
|
||||
*text = "error decoding filter";
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );
|
||||
|
|
@ -404,7 +343,6 @@ get_substring_filter(
|
|||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
f->f_sub = ch_calloc( 1, sizeof(SubstringsAssertion) );
|
||||
f->f_sub_desc = NULL;
|
||||
rc = slap_bv2ad( &type, &f->f_sub_desc, text );
|
||||
|
|
@ -419,37 +357,21 @@ get_substring_filter(
|
|||
*fstr = ch_strdup( "(undefined)" );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#else
|
||||
f->f_sub_type = type.bv_val;
|
||||
attr_normalize( f->f_sub_type );
|
||||
|
||||
/* should get real syntax and see if we have a substring matching rule */
|
||||
syntax = attr_syntax( f->f_sub_type );
|
||||
#endif
|
||||
|
||||
f->f_sub_initial = NULL;
|
||||
f->f_sub_any = NULL;
|
||||
f->f_sub_final = NULL;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( fstr ) {
|
||||
*fstr = ch_malloc( sizeof("(=" /*)*/) +
|
||||
f->f_sub_desc->ad_cname->bv_len );
|
||||
sprintf( *fstr, "(%s=" /*)*/, f->f_sub_desc->ad_cname->bv_val );
|
||||
}
|
||||
#else
|
||||
if( fstr ) {
|
||||
*fstr = ch_malloc( strlen( f->f_sub_type ) + 3 );
|
||||
sprintf( *fstr, "(%s=" /*)*/, f->f_sub_type );
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
|
||||
tag = ber_next_element( ber, &len, last ) )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
unsigned usage;
|
||||
#endif
|
||||
|
||||
rc = ber_scanf( ber, "O", &value );
|
||||
if ( rc == LBER_ERROR ) {
|
||||
|
|
@ -463,7 +385,6 @@ get_substring_filter(
|
|||
goto return_error;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
switch ( tag ) {
|
||||
case LDAP_SUBSTRING_INITIAL:
|
||||
usage = SLAP_MR_SUBSTR_INITIAL;
|
||||
|
|
@ -496,13 +417,6 @@ get_substring_filter(
|
|||
}
|
||||
|
||||
value = nvalue;
|
||||
#else
|
||||
|
||||
/* we should call a substring syntax normalization routine */
|
||||
value_normalize( value->bv_val, syntax );
|
||||
/* this is bogus, value_normalize should take a berval */
|
||||
value->bv_len = strlen( value->bv_val );
|
||||
#endif
|
||||
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
|
||||
|
|
@ -570,17 +484,11 @@ return_error:
|
|||
*fstr = NULL;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad_free( f->f_sub_desc, 1 );
|
||||
#else
|
||||
ch_free( f->f_sub_type );
|
||||
#endif
|
||||
ber_bvfree( f->f_sub_initial );
|
||||
ber_bvecfree( f->f_sub_any );
|
||||
ber_bvfree( f->f_sub_final );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ch_free( f->f_sub );
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
|
@ -608,28 +516,17 @@ filter_free( Filter *f )
|
|||
|
||||
switch ( f->f_choice ) {
|
||||
case LDAP_FILTER_PRESENT:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad_free( f->f_desc, 1 );
|
||||
#else
|
||||
if ( f->f_type != NULL ) {
|
||||
free( f->f_type );
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
case LDAP_FILTER_GE:
|
||||
case LDAP_FILTER_LE:
|
||||
case LDAP_FILTER_APPROX:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ava_free( f->f_ava, 1 );
|
||||
#else
|
||||
ava_free( &f->f_ava, 0 );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_SUBSTRINGS:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad_free( f->f_sub_desc, 1 );
|
||||
if ( f->f_sub_initial != NULL ) {
|
||||
ber_bvfree( f->f_sub_initial );
|
||||
|
|
@ -638,18 +535,6 @@ filter_free( Filter *f )
|
|||
if ( f->f_sub_final != NULL ) {
|
||||
ber_bvfree( f->f_sub_final );
|
||||
}
|
||||
#else
|
||||
if ( f->f_sub_type != NULL ) {
|
||||
free( f->f_sub_type );
|
||||
}
|
||||
if ( f->f_sub_initial != NULL ) {
|
||||
ber_bvfree( f->f_sub_initial );
|
||||
}
|
||||
ber_bvecfree( f->f_sub_any );
|
||||
if ( f->f_sub_final != NULL ) {
|
||||
ber_bvfree( f->f_sub_final );
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_AND:
|
||||
|
|
@ -687,61 +572,32 @@ filter_print( Filter *f )
|
|||
|
||||
switch ( f->f_choice ) {
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, "(%s=%s)",
|
||||
f->f_av_desc->ad_cname->bv_val,
|
||||
f->f_av_value->bv_val );
|
||||
#else
|
||||
fprintf( stderr, "(%s=%s)",
|
||||
f->f_ava.ava_type,
|
||||
f->f_ava.ava_value.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_GE:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, "(%s>=%s)",
|
||||
f->f_av_desc->ad_cname->bv_val,
|
||||
f->f_av_value->bv_val );
|
||||
#else
|
||||
fprintf( stderr, "(%s>=%s)",
|
||||
f->f_ava.ava_type,
|
||||
f->f_ava.ava_value.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_LE:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, "(%s<=%s)",
|
||||
f->f_ava->aa_desc->ad_cname->bv_val,
|
||||
f->f_ava->aa_value->bv_val );
|
||||
#else
|
||||
fprintf( stderr, "(%s<=%s)",
|
||||
f->f_ava.ava_type,
|
||||
f->f_ava.ava_value.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_APPROX:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, "(%s~=%s)",
|
||||
f->f_ava->aa_desc->ad_cname->bv_val,
|
||||
f->f_ava->aa_value->bv_val );
|
||||
#else
|
||||
fprintf( stderr, "(%s~=%s)",
|
||||
f->f_ava.ava_type,
|
||||
f->f_ava.ava_value.bv_val );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_SUBSTRINGS:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, "(%s=" /*)*/,
|
||||
f->f_sub_desc->ad_cname->bv_val );
|
||||
#else
|
||||
fprintf( stderr, "(%s=" /*)*/,
|
||||
f->f_sub_type );
|
||||
#endif
|
||||
if ( f->f_sub_initial != NULL ) {
|
||||
fprintf( stderr, "%s",
|
||||
f->f_sub_initial->bv_val );
|
||||
|
|
@ -760,13 +616,8 @@ filter_print( Filter *f )
|
|||
break;
|
||||
|
||||
case LDAP_FILTER_PRESENT:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
fprintf( stderr, "(%s=*)",
|
||||
f->f_desc->ad_cname->bv_val );
|
||||
#else
|
||||
fprintf( stderr, "(%s=*)",
|
||||
f->f_type );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_AND:
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
#include <ac/regex.h>
|
||||
#endif
|
||||
|
||||
#include "slap.h"
|
||||
|
||||
|
|
@ -27,7 +24,6 @@ static int test_filter_or( Backend *be,
|
|||
static int test_substring_filter( Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, Filter *f);
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int test_ava_filter( Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, AttributeAssertion *ava, int type );
|
||||
|
|
@ -37,17 +33,6 @@ static int test_mra_filter( Backend *be,
|
|||
static int test_presence_filter( Backend *be,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e, AttributeDescription *desc );
|
||||
#else
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -73,7 +58,6 @@ test_filter(
|
|||
Debug( LDAP_DEBUG_FILTER, "=> test_filter\n", 0, 0, 0 );
|
||||
|
||||
switch ( f->f_choice ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
case SLAPD_FILTER_COMPUTED:
|
||||
Debug( LDAP_DEBUG_FILTER, " COMPUTED %s (%d)\n",
|
||||
f->f_result == LDAP_COMPARE_FALSE ? "false" :
|
||||
|
|
@ -82,17 +66,11 @@ test_filter(
|
|||
f->f_result, 0 );
|
||||
rc = f->f_result;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
Debug( LDAP_DEBUG_FILTER, " EQUALITY\n", 0, 0, 0 );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = test_ava_filter( be, conn, op, e, f->f_ava,
|
||||
LDAP_FILTER_EQUALITY );
|
||||
#else
|
||||
rc = test_ava_filter( be, conn, op, e, &f->f_ava,
|
||||
LDAP_FILTER_EQUALITY );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_SUBSTRINGS:
|
||||
|
|
@ -101,44 +79,24 @@ test_filter(
|
|||
break;
|
||||
|
||||
case LDAP_FILTER_GE:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = test_ava_filter( be, conn, op, e, f->f_ava,
|
||||
LDAP_FILTER_GE );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_FILTER, " GE\n", 0, 0, 0 );
|
||||
rc = test_ava_filter( be, conn, op, e, &f->f_ava,
|
||||
LDAP_FILTER_GE );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_LE:
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = test_ava_filter( be, conn, op, e, f->f_ava,
|
||||
LDAP_FILTER_LE );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_FILTER, " LE\n", 0, 0, 0 );
|
||||
rc = test_ava_filter( be, conn, op, e, &f->f_ava,
|
||||
LDAP_FILTER_LE );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_PRESENT:
|
||||
Debug( LDAP_DEBUG_FILTER, " PRESENT\n", 0, 0, 0 );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = test_presence_filter( be, conn, op, e, f->f_desc );
|
||||
#else
|
||||
rc = test_presence_filter( be, conn, op, e, f->f_type );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_APPROX:
|
||||
Debug( LDAP_DEBUG_FILTER, " APPROX\n", 0, 0, 0 );
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = test_ava_filter( be, conn, op, e, f->f_ava,
|
||||
LDAP_FILTER_APPROX );
|
||||
#else
|
||||
rc = test_approx_filter( be, conn, op, e, &f->f_ava );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_AND:
|
||||
|
|
@ -193,39 +151,23 @@ test_ava_filter(
|
|||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeAssertion *ava,
|
||||
#else
|
||||
Ava *ava,
|
||||
#endif
|
||||
int type
|
||||
)
|
||||
{
|
||||
int i;
|
||||
Attribute *a;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( be != NULL && ! access_allowed( be, conn, op, e,
|
||||
ava->aa_desc, ava->aa_value, ACL_SEARCH ) )
|
||||
#else
|
||||
|
||||
if ( be != NULL && ! access_allowed( be, conn, op, e,
|
||||
ava->ava_type, &ava->ava_value, ACL_SEARCH ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_INSUFFICIENT_ACCESS;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
for(a = attrs_find( e->e_attrs, ava->aa_desc );
|
||||
a != NULL;
|
||||
a = attrs_find( a->a_next, ava->aa_desc ) )
|
||||
#else
|
||||
a = attr_find( e->e_attrs, ava->ava_type );
|
||||
if ( a != NULL )
|
||||
#endif
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
MatchingRule *mr;
|
||||
|
||||
switch ( type ) {
|
||||
|
|
@ -249,15 +191,9 @@ test_ava_filter(
|
|||
if( mr == NULL ) {
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if ( a->a_syntax == 0 ) {
|
||||
a->a_syntax = attr_syntax( ava->ava_type );
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
int ret;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
const char *text;
|
||||
|
||||
|
|
@ -268,10 +204,6 @@ test_ava_filter(
|
|||
if( rc != LDAP_SUCCESS ) {
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
ret = value_cmp( a->a_vals[i], &ava->ava_value, a->a_syntax,
|
||||
3 );
|
||||
#endif
|
||||
|
||||
switch ( type ) {
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
|
|
@ -306,11 +238,7 @@ test_presence_filter(
|
|||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc
|
||||
#else
|
||||
char *desc
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if ( be != NULL && ! access_allowed( be, conn, op, e,
|
||||
|
|
@ -319,91 +247,10 @@ test_presence_filter(
|
|||
return LDAP_INSUFFICIENT_ACCESS;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return attrs_find( e->e_attrs, desc ) != NULL
|
||||
#else
|
||||
return attr_find( e->e_attrs, desc ) != NULL
|
||||
#endif
|
||||
? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE;
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int
|
||||
test_approx_filter(
|
||||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
Ava *ava
|
||||
)
|
||||
{
|
||||
char *w1, *w2, *c1, *c2;
|
||||
int i;
|
||||
Attribute *a;
|
||||
|
||||
if ( be != NULL && ! access_allowed( be, conn, op, e,
|
||||
ava->ava_type, NULL, ACL_SEARCH ) )
|
||||
{
|
||||
return LDAP_INSUFFICIENT_ACCESS;
|
||||
}
|
||||
|
||||
a = attr_find( e->e_attrs, ava->ava_type );
|
||||
if ( a != NULL ) {
|
||||
/* for each value in the attribute */
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
/*
|
||||
* try to match words in the filter value in order
|
||||
* in the attribute value.
|
||||
*/
|
||||
|
||||
w2 = a->a_vals[i]->bv_val;
|
||||
/* for each word in the filter value */
|
||||
for ( w1 = first_word( ava->ava_value.bv_val ); w1 != NULL;
|
||||
w1 = next_word( w1 ) ) {
|
||||
if ( (c1 = phonetic( w1 )) == NULL ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* for each word in the attribute value from
|
||||
* where we left off...
|
||||
*/
|
||||
for ( w2 = first_word( w2 ); w2 != NULL;
|
||||
w2 = next_word( w2 ) ) {
|
||||
c2 = phonetic( w2 );
|
||||
if ( strcmp( c1, c2 ) == 0 ) {
|
||||
free( c2 );
|
||||
break;
|
||||
}
|
||||
free( c2 );
|
||||
}
|
||||
free( c1 );
|
||||
|
||||
/*
|
||||
* if we stopped because we ran out of words
|
||||
* before making a match, go on to the next
|
||||
* value. otherwise try to keep matching
|
||||
* words in this value from where we left off.
|
||||
*/
|
||||
if ( w2 == NULL ) {
|
||||
break;
|
||||
} else {
|
||||
w2 = next_word( w2 );
|
||||
}
|
||||
}
|
||||
/*
|
||||
* if we stopped because we ran out of words we
|
||||
* have a match.
|
||||
*/
|
||||
if ( w1 == NULL ) {
|
||||
return LDAP_COMPARE_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return LDAP_COMPARE_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
test_filter_and(
|
||||
|
|
@ -465,35 +312,6 @@ test_filter_or(
|
|||
return rtn;
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static void
|
||||
strcpy_regex( char *d, char *s )
|
||||
{
|
||||
for ( ; *s; s++ ) {
|
||||
switch ( *s ) {
|
||||
case '^':
|
||||
case '.':
|
||||
case '[':
|
||||
case ']': /* ? */
|
||||
case '$':
|
||||
case '(':
|
||||
case ')': /* ? */
|
||||
case '|':
|
||||
case '*':
|
||||
case '+':
|
||||
case '?':
|
||||
case '{':
|
||||
case '}': /* ? */
|
||||
case '\\':
|
||||
*d++ = '\\';
|
||||
/* FALL */
|
||||
default:
|
||||
*d++ = *s;
|
||||
}
|
||||
}
|
||||
*d = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
test_substring_filter(
|
||||
|
|
@ -505,14 +323,6 @@ test_substring_filter(
|
|||
)
|
||||
{
|
||||
Attribute *a;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int i, rc;
|
||||
char *p, *end, *realval, *tmp;
|
||||
char pat[BUFSIZ];
|
||||
char buf[BUFSIZ];
|
||||
struct berval *val;
|
||||
regex_t re;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "begin test_substring_filter\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -522,16 +332,10 @@ test_substring_filter(
|
|||
return LDAP_INSUFFICIENT_ACCESS;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
for(a = attrs_find( e->e_attrs, f->f_sub_desc );
|
||||
a != NULL;
|
||||
a = attrs_find( a->a_next, f->f_sub_desc ) )
|
||||
#else
|
||||
a = attr_find( e->e_attrs, f->f_sub_type );
|
||||
if ( a != NULL )
|
||||
#endif
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int i;
|
||||
MatchingRule *mr = a->a_desc->ad_type->sat_substr;
|
||||
|
||||
|
|
@ -556,101 +360,6 @@ test_substring_filter(
|
|||
return LDAP_COMPARE_TRUE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ( a->a_syntax & SYNTAX_BIN ) {
|
||||
Debug( LDAP_DEBUG_FILTER, "test_substring_filter bin attr\n",
|
||||
0, 0, 0 );
|
||||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
|
||||
/*
|
||||
* construct a regular expression corresponding to the
|
||||
* filter and let regex do the work
|
||||
*/
|
||||
|
||||
pat[0] = '\0';
|
||||
p = pat;
|
||||
end = pat + sizeof(pat) - 2; /* leave room for null */
|
||||
if ( f->f_sub_initial != NULL ) {
|
||||
strcpy( p, "^" );
|
||||
p = strchr( p, '\0' );
|
||||
/* 2 * in case every char is special */
|
||||
if ( p + 2 * f->f_sub_initial->bv_len > end ) {
|
||||
Debug( LDAP_DEBUG_ANY, "not enough pattern space\n",
|
||||
0, 0, 0 );
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
strcpy_regex( p, f->f_sub_initial->bv_val );
|
||||
p = strchr( p, '\0' );
|
||||
}
|
||||
if ( f->f_sub_any != NULL ) {
|
||||
for ( i = 0; f->f_sub_any[i] != NULL; i++ ) {
|
||||
/* ".*" + value */
|
||||
if ( p + 2 * f->f_sub_any[i]->bv_len + 2 > end ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"not enough pattern space\n", 0, 0, 0 );
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
strcpy( p, ".*" );
|
||||
p = strchr( p, '\0' );
|
||||
strcpy_regex( p, f->f_sub_any[i]->bv_val );
|
||||
p = strchr( p, '\0' );
|
||||
}
|
||||
}
|
||||
if ( f->f_sub_final != NULL ) {
|
||||
/* ".*" + value */
|
||||
if ( p + 2 * f->f_sub_final->bv_len + 2 > end ) {
|
||||
Debug( LDAP_DEBUG_ANY, "not enough pattern space\n",
|
||||
0, 0, 0 );
|
||||
return( -1 );
|
||||
}
|
||||
strcpy( p, ".*" );
|
||||
p = strchr( p, '\0' );
|
||||
strcpy_regex( p, f->f_sub_final->bv_val );
|
||||
p = strchr( p, '\0' );
|
||||
strcpy( p, "$" );
|
||||
}
|
||||
|
||||
/* compile the regex */
|
||||
Debug( LDAP_DEBUG_FILTER, "test_substring_filter: regcomp pat: %s\n",
|
||||
pat, 0, 0 );
|
||||
if ((rc = regcomp(&re, pat, REG_EXTENDED|REG_NOSUB))) {
|
||||
char error[512];
|
||||
|
||||
regerror(rc, &re, error, sizeof(error));
|
||||
Debug( LDAP_DEBUG_ANY, "regcomp failed (%s) %s\n",
|
||||
p, error, 0 );
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
/* for each value in the attribute see if regex matches */
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
val = a->a_vals[i];
|
||||
tmp = NULL;
|
||||
if ( val->bv_len < sizeof(buf) ) {
|
||||
strcpy( buf, val->bv_val );
|
||||
realval = buf;
|
||||
} else {
|
||||
tmp = (char *) ch_malloc( val->bv_len + 1 );
|
||||
strcpy( tmp, val->bv_val );
|
||||
realval = tmp;
|
||||
}
|
||||
|
||||
value_normalize( realval, a->a_syntax );
|
||||
|
||||
rc = !regexec(&re, realval, 0, NULL, 0);
|
||||
|
||||
if ( tmp != NULL ) {
|
||||
free( tmp );
|
||||
}
|
||||
if ( rc == 1 ) {
|
||||
regfree(&re);
|
||||
return LDAP_COMPARE_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
regfree(&re);
|
||||
#endif
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "end test_substring_filter 1\n", 0, 0, 0 );
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
#include "slap.h"
|
||||
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int add_modified_attrs( Operation *op, Modifications **modlist );
|
||||
#endif
|
||||
|
||||
int
|
||||
do_modify(
|
||||
|
|
@ -133,9 +130,6 @@ do_modify(
|
|||
|
||||
(*modtail)->ml_op = mop;
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
attr_normalize( (*modtail)->ml_type );
|
||||
#endif
|
||||
|
||||
modtail = &(*modtail)->ml_next;
|
||||
}
|
||||
|
|
@ -217,7 +211,6 @@ do_modify(
|
|||
#endif
|
||||
{
|
||||
int update = be->be_update_ndn != NULL;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
const char *text;
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text );
|
||||
|
||||
|
|
@ -226,15 +219,10 @@ do_modify(
|
|||
NULL, text, NULL, NULL );
|
||||
goto cleanup;
|
||||
}
|
||||
#else
|
||||
mods = modlist;
|
||||
modlist = NULL;
|
||||
#endif
|
||||
|
||||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && !update )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
Modifications **modstail;
|
||||
for( modstail = &mods;
|
||||
*modstail != NULL;
|
||||
|
|
@ -243,10 +231,6 @@ do_modify(
|
|||
/* empty */
|
||||
}
|
||||
rc = slap_mods_opattrs( op, modstail, &text );
|
||||
#else
|
||||
char *text = "no-user-modification attribute type";
|
||||
rc = add_modified_attrs( op, &mods );
|
||||
#endif
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
|
|
@ -289,7 +273,6 @@ cleanup:
|
|||
return rc;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* convert a raw list of modifications to internal format
|
||||
* Do basic attribute type checking and syntax validation.
|
||||
|
|
@ -475,61 +458,6 @@ int slap_mods_opattrs(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
static int
|
||||
add_modified_attrs( Operation *op, Modifications **modlist )
|
||||
{
|
||||
char buf[22];
|
||||
struct berval bv;
|
||||
struct berval *bvals[2];
|
||||
Modifications *m;
|
||||
struct tm *ltm;
|
||||
time_t currenttime;
|
||||
|
||||
bvals[0] = &bv;
|
||||
bvals[1] = NULL;
|
||||
|
||||
/* remove any attempts by the user to modify these attrs */
|
||||
for ( m = *modlist; m != NULL; m = m->ml_next ) {
|
||||
if ( oc_check_op_no_usermod_attr( m->ml_type ) ) {
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
}
|
||||
|
||||
if ( op->o_dn == NULL || op->o_dn[0] == '\0' ) {
|
||||
bv.bv_val = SLAPD_ANONYMOUS;
|
||||
bv.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
|
||||
} else {
|
||||
bv.bv_val = op->o_dn;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
}
|
||||
m = (Modifications *) ch_calloc( 1, sizeof(Modifications) );
|
||||
m->ml_type = ch_strdup( "modifiersname" );
|
||||
m->ml_op = LDAP_MOD_REPLACE;
|
||||
m->ml_bvalues = (struct berval **) ch_calloc(2, sizeof(struct berval *));
|
||||
m->ml_bvalues[0] = ber_bvdup( &bv );
|
||||
m->ml_next = *modlist;
|
||||
*modlist = m;
|
||||
|
||||
currenttime = slap_get_time();
|
||||
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
|
||||
ltm = gmtime( ¤ttime );
|
||||
strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
|
||||
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
|
||||
|
||||
bv.bv_val = buf;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
m = (Modifications *) ch_calloc( 1, sizeof(Modifications) );
|
||||
m->ml_type = ch_strdup( "modifytimestamp" );
|
||||
m->ml_op = LDAP_MOD_REPLACE;
|
||||
m->ml_bvalues = (struct berval **) ch_calloc(2, sizeof(struct berval *));
|
||||
m->ml_bvalues[0] = ber_bvdup( &bv );
|
||||
m->ml_next = *modlist;
|
||||
*modlist = m;
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
slap_mod_free(
|
||||
|
|
@ -537,13 +465,7 @@ slap_mod_free(
|
|||
int freeit
|
||||
)
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ad_free( mod->sm_desc, 1 );
|
||||
#else
|
||||
if (mod->sm_desc) {
|
||||
free( mod->sm_desc );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( mod->sm_bvalues != NULL )
|
||||
ber_bvecfree( mod->sm_bvalues );
|
||||
|
|
|
|||
|
|
@ -198,11 +198,7 @@ int mr_schema_info( Entry *e )
|
|||
struct berval *vals[2];
|
||||
MatchingRule *mr;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_matchingRules = slap_schema.si_ad_matchingRules;
|
||||
#else
|
||||
char *ad_matchingRules = "matchingRules";
|
||||
#endif
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
|
|
|
|||
|
|
@ -41,28 +41,15 @@ int is_object_subclass(
|
|||
|
||||
int is_entry_objectclass(
|
||||
Entry* e,
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ObjectClass *oc
|
||||
#else
|
||||
const char* oc
|
||||
#endif
|
||||
)
|
||||
{
|
||||
Attribute *attr;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int i;
|
||||
AttributeDescription *objectClass = slap_schema.si_ad_objectClass;
|
||||
assert(!( e == NULL || oc == NULL ));
|
||||
#else
|
||||
struct berval bv;
|
||||
static const char *objectClass = "objectclass";
|
||||
assert(!( e == NULL || oc == NULL || *oc == '\0' ));
|
||||
#endif
|
||||
|
||||
if( e == NULL || oc == NULL
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
|| *oc == '\0'
|
||||
#endif
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -81,7 +68,6 @@ int is_entry_objectclass(
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
for( i=0; attr->a_vals[i]; i++ ) {
|
||||
ObjectClass *objectClass = oc_find( attr->a_vals[i]->bv_val );
|
||||
|
||||
|
|
@ -92,125 +78,9 @@ int is_entry_objectclass(
|
|||
|
||||
return 0;
|
||||
|
||||
#else
|
||||
bv.bv_val = (char *) oc;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
|
||||
if( value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) {
|
||||
/* entry is not of this objectclass */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* these shouldn't be hardcoded */
|
||||
|
||||
static char *oc_op_usermod_attrs[] = {
|
||||
/*
|
||||
* these are operational attributes which are
|
||||
* not defined as NO-USER_MODIFICATION and
|
||||
* which slapd supports modification of.
|
||||
*
|
||||
* Currently none.
|
||||
* Likely candidate, "OpenLDAPaci"
|
||||
*/
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *oc_op_attrs[] = {
|
||||
/*
|
||||
* these are operational attributes
|
||||
* most could be user modifiable
|
||||
*/
|
||||
"objectClasses",
|
||||
"attributeTypes",
|
||||
"matchingRules",
|
||||
"matchingRuleUse",
|
||||
"dITStructureRules",
|
||||
"dITContentRules",
|
||||
"nameForms",
|
||||
"ldapSyntaxes",
|
||||
"namingContexts",
|
||||
"supportedExtension",
|
||||
"supportedControl",
|
||||
"supportedSASLMechanisms",
|
||||
"supportedLDAPversion",
|
||||
"subschemaSubentry", /* NO USER MOD */
|
||||
NULL
|
||||
|
||||
};
|
||||
|
||||
/* this list should be extensible */
|
||||
static char *oc_op_no_usermod_attrs[] = {
|
||||
/*
|
||||
* Operational and 'no user modification' attributes
|
||||
* which are STORED in the directory server.
|
||||
*/
|
||||
|
||||
/* RFC2252, 3.2.1 */
|
||||
"creatorsName",
|
||||
"createTimestamp",
|
||||
"modifiersName",
|
||||
"modifyTimestamp",
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* check to see if attribute is 'operational' or not.
|
||||
*/
|
||||
int
|
||||
oc_check_op_attr( const char *type )
|
||||
{
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return charray_inlist( oc_op_attrs, type )
|
||||
|| charray_inlist( oc_op_usermod_attrs, type )
|
||||
|| charray_inlist( oc_op_no_usermod_attrs, type );
|
||||
#else
|
||||
AttributeType *at = at_find( type );
|
||||
|
||||
if( at == NULL ) return 0;
|
||||
|
||||
return at->sat_usage != LDAP_SCHEMA_USER_APPLICATIONS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* check to see if attribute can be user modified or not.
|
||||
*/
|
||||
int
|
||||
oc_check_op_usermod_attr( const char *type )
|
||||
{
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return charray_inlist( oc_op_usermod_attrs, type );
|
||||
#else
|
||||
/* not (yet) in schema */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* check to see if attribute is 'no user modification' or not.
|
||||
*/
|
||||
int
|
||||
oc_check_op_no_usermod_attr( const char *type )
|
||||
{
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return charray_inlist( oc_op_no_usermod_attrs, type );
|
||||
#else
|
||||
AttributeType *at = at_find( type );
|
||||
|
||||
if( at == NULL ) return 0;
|
||||
|
||||
return at->sat_no_user_mod;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
struct oindexrec {
|
||||
|
|
@ -519,11 +389,7 @@ oc_schema_info( Entry *e )
|
|||
struct berval *vals[2];
|
||||
ObjectClass *oc;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClasses = slap_schema.si_ad_objectClasses;
|
||||
#else
|
||||
char *ad_objectClasses = "objectClasses";
|
||||
#endif
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
LDAP_BEGIN_DECL
|
||||
|
||||
LIBSLAPD_F( int ) schema_init_done;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F( struct slap_internal_schema ) slap_schema;
|
||||
|
||||
LIBSLAPD_F (int) slap_str2ad LDAP_P((
|
||||
|
|
@ -41,25 +40,15 @@ LIBSLAPD_F (int) is_ad_subtype LDAP_P((
|
|||
LIBSLAPD_F (int) ad_inlist LDAP_P((
|
||||
AttributeDescription *desc,
|
||||
char **attrs ));
|
||||
#else
|
||||
#define ad_inlist(d,a) charray_inlist(a,d)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* acl.c
|
||||
*/
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (int) access_allowed LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
Entry *e, AttributeDescription *desc, struct berval *val,
|
||||
slap_access_t access ));
|
||||
#else
|
||||
LIBSLAPD_F (int) access_allowed LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
Entry *e, const char *attr, struct berval *val,
|
||||
slap_access_t access ));
|
||||
#endif
|
||||
LIBSLAPD_F (int) acl_check_modlist LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
Entry *e, Modifications *ml ));
|
||||
|
|
@ -93,7 +82,6 @@ LIBSLAPD_F (int) at_delete_from_list LDAP_P(( int pos, AttributeType ***listp ))
|
|||
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_NOT_COMPAT
|
||||
LIBSLAPD_F (int) is_at_subtype LDAP_P((
|
||||
AttributeType *sub,
|
||||
AttributeType *super ));
|
||||
|
|
@ -103,10 +91,6 @@ LIBSLAPD_F (int) is_at_syntax LDAP_P((
|
|||
const char *oid ));
|
||||
|
||||
# define at_canonical_name(at) ((at)->sat_cname)
|
||||
#else
|
||||
LIBSLAPD_F (int) at_fake_if_needed LDAP_P(( const char *name ));
|
||||
LIBSLAPD_F (char *) at_canonical_name LDAP_P(( const char * a_type ));
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -116,24 +100,12 @@ LIBSLAPD_F (char *) at_canonical_name LDAP_P(( const char * a_type ));
|
|||
LIBSLAPD_F (void) attr_free LDAP_P(( Attribute *a ));
|
||||
LIBSLAPD_F (Attribute *) attr_dup LDAP_P(( Attribute *a ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (int) attr_merge LDAP_P(( Entry *e,
|
||||
AttributeDescription *desc,
|
||||
struct berval **vals ));
|
||||
LIBSLAPD_F (Attribute *) attrs_find LDAP_P(( Attribute *a, AttributeDescription *desc ));
|
||||
LIBSLAPD_F (Attribute *) attr_find LDAP_P(( Attribute *a, AttributeDescription *desc ));
|
||||
LIBSLAPD_F (int) attr_delete LDAP_P(( Attribute **attrs, AttributeDescription *desc ));
|
||||
#else
|
||||
LIBSLAPD_F (char *) attr_normalize LDAP_P(( char *s ));
|
||||
LIBSLAPD_F (int) attr_merge LDAP_P(( Entry *e, const char *type,
|
||||
struct berval **vals ));
|
||||
LIBSLAPD_F (int) attr_merge_fast LDAP_P(( Entry *e, const char *type,
|
||||
struct berval **vals, int nvals, int naddvals, int *maxvals,
|
||||
Attribute ***a ));
|
||||
LIBSLAPD_F (Attribute *) attr_find LDAP_P(( Attribute *a, const char *type ));
|
||||
LIBSLAPD_F (int) attr_delete LDAP_P(( Attribute **attrs, const char *type ));
|
||||
LIBSLAPD_F (int) attr_syntax LDAP_P(( const char *type ));
|
||||
#endif
|
||||
|
||||
LIBSLAPD_F (void) attrs_free LDAP_P(( Attribute *a ));
|
||||
LIBSLAPD_F (Attribute *) attrs_dup LDAP_P(( Attribute *a ));
|
||||
|
|
@ -142,7 +114,6 @@ LIBSLAPD_F (Attribute *) attrs_dup LDAP_P(( Attribute *a ));
|
|||
/*
|
||||
* ava.c
|
||||
*/
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (int) get_ava LDAP_P((
|
||||
BerElement *ber,
|
||||
AttributeAssertion **ava,
|
||||
|
|
@ -151,13 +122,6 @@ LIBSLAPD_F (int) get_ava LDAP_P((
|
|||
LIBSLAPD_F (void) ava_free LDAP_P((
|
||||
AttributeAssertion *ava,
|
||||
int freeit ));
|
||||
#else
|
||||
LIBSLAPD_F (int) get_ava LDAP_P((
|
||||
BerElement *ber,
|
||||
Ava *ava,
|
||||
const char **text ));
|
||||
LIBSLAPD_F (void) ava_free LDAP_P(( Ava *ava, int freeit ));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* backend.c
|
||||
|
|
@ -194,7 +158,6 @@ 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_NOT_COMPAT
|
||||
LIBSLAPD_F (int) backend_group LDAP_P((Backend *be,
|
||||
Entry *target,
|
||||
const char *gr_ndn,
|
||||
|
|
@ -202,15 +165,6 @@ LIBSLAPD_F (int) backend_group LDAP_P((Backend *be,
|
|||
ObjectClass *group_oc,
|
||||
AttributeDescription *group_at
|
||||
));
|
||||
#else
|
||||
LIBSLAPD_F (int) backend_group LDAP_P((Backend *be,
|
||||
Entry *target,
|
||||
const char *gr_ndn,
|
||||
const char *op_ndn,
|
||||
const char *group_oc,
|
||||
const char *group_at
|
||||
));
|
||||
#endif
|
||||
|
||||
LIBSLAPD_F (Attribute *) backend_operational( Backend *, Entry * );
|
||||
|
||||
|
|
@ -413,7 +367,6 @@ LIBSLAPD_F( void ) slap_mod_free LDAP_P(( Modification *mod, int freeit ));
|
|||
LIBSLAPD_F( void ) slap_mods_free LDAP_P(( Modifications *mods ));
|
||||
LIBSLAPD_F( void ) slap_modlist_free LDAP_P(( LDAPModList *ml ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F( int ) slap_modlist2mods(
|
||||
LDAPModList *ml,
|
||||
int update,
|
||||
|
|
@ -424,7 +377,6 @@ LIBSLAPD_F( int ) slap_mods_opattrs(
|
|||
Operation *op,
|
||||
Modifications **modlist,
|
||||
const char **text );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* module.c
|
||||
|
|
@ -572,11 +524,6 @@ LIBSLAPD_F (int) syn_schema_info( Entry *e );
|
|||
* schema.c
|
||||
*/
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (int) oc_check_op_attr LDAP_P(( const char *type ));
|
||||
LIBSLAPD_F (int) oc_check_op_usermod_attr LDAP_P(( const char *type ));
|
||||
LIBSLAPD_F (int) oc_check_op_no_usermod_attr LDAP_P(( const char *type ));
|
||||
#endif
|
||||
LIBSLAPD_F (ObjectClass *) oc_find LDAP_P((
|
||||
const char *ocname));
|
||||
|
||||
|
|
@ -639,27 +586,18 @@ LIBSLAPD_F (int) register_matching_rule LDAP_P((
|
|||
|
||||
LIBSLAPD_F (int) schema_info LDAP_P(( Entry **entry, const char **text ));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (int) is_entry_objectclass LDAP_P((
|
||||
Entry *, ObjectClass *oc ));
|
||||
#define is_entry_alias(e) is_entry_objectclass((e), slap_schema.si_oc_alias)
|
||||
#define is_entry_referral(e) is_entry_objectclass((e), slap_schema.si_oc_referral)
|
||||
#else
|
||||
LIBSLAPD_F (int) is_entry_objectclass LDAP_P((
|
||||
Entry *, const char* objectclass ));
|
||||
#define is_entry_alias(e) is_entry_objectclass((e), "ALIAS")
|
||||
#define is_entry_referral(e) is_entry_objectclass((e), "REFERRAL")
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* schema_check.c
|
||||
*/
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int oc_check_allowed(
|
||||
AttributeType *type,
|
||||
struct berval **oclist );
|
||||
#endif
|
||||
LIBSLAPD_F (int) entry_schema_check LDAP_P((
|
||||
Entry *e, Attribute *attrs,
|
||||
const char** text ));
|
||||
|
|
@ -714,7 +652,6 @@ LIBSLAPD_F (char *) suffix_alias LDAP_P(( Backend *be, char *ndn ));
|
|||
/*
|
||||
* value.c
|
||||
*/
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
LIBSLAPD_F (int) value_normalize LDAP_P((
|
||||
AttributeDescription *ad,
|
||||
unsigned usage,
|
||||
|
|
@ -732,12 +669,6 @@ LIBSLAPD_F (int) value_find LDAP_P((
|
|||
AttributeDescription *ad,
|
||||
struct berval **values,
|
||||
struct berval *value ));
|
||||
#else
|
||||
LIBSLAPD_F (int) value_add_fast LDAP_P(( struct berval ***vals, struct berval **addvals, int nvals, int naddvals, int *maxvals ));
|
||||
LIBSLAPD_F (void) value_normalize LDAP_P(( char *s, int syntax ));
|
||||
LIBSLAPD_F (int) value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax, int normalize ));
|
||||
LIBSLAPD_F (int) value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax, int normalize ));
|
||||
#endif
|
||||
LIBSLAPD_F (int) value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -59,11 +59,7 @@ replog(
|
|||
ml = change;
|
||||
for ( ; ml != NULL; ml = ml->sml_next ) {
|
||||
char *type;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
type = ml->sml_desc->ad_cname->bv_val;
|
||||
#else
|
||||
type = ml->sml_type;
|
||||
#endif
|
||||
switch ( ml->sml_op ) {
|
||||
case LDAP_MOD_ADD:
|
||||
fprintf( fp, "add: %s\n", type );
|
||||
|
|
|
|||
|
|
@ -125,11 +125,7 @@ struct berval **get_entry_referrals(
|
|||
struct berval **refs;
|
||||
unsigned i, j;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
|
||||
#else
|
||||
static const char *ad_ref = "ref";
|
||||
#endif
|
||||
|
||||
attr = attr_find( e->e_attrs, ad_ref );
|
||||
|
||||
|
|
@ -648,11 +644,7 @@ send_search_entry(
|
|||
int userattrs;
|
||||
int opattrs;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
|
||||
#else
|
||||
static const char *ad_entry = "entry";
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> send_search_entry: \"%s\"\n", e->e_dn, 0, 0 );
|
||||
|
||||
|
|
@ -695,32 +687,19 @@ send_search_entry(
|
|||
: charray_inlist( attrs, LDAP_ALL_OPERATIONAL_ATTRIBUTES );
|
||||
|
||||
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc = a->a_desc;
|
||||
char *type = desc->ad_cname->bv_val;
|
||||
#else
|
||||
char *desc = a->a_type;
|
||||
char *type = a->a_type;
|
||||
#endif
|
||||
|
||||
if ( attrs == NULL ) {
|
||||
/* all addrs request, skip operational attributes */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( is_at_operational( desc->ad_type ) )
|
||||
#else
|
||||
if( oc_check_op_attr( desc ) )
|
||||
#endif
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* specific addrs requested */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( is_at_operational( desc->ad_type ) )
|
||||
#else
|
||||
if ( oc_check_op_attr( desc ) )
|
||||
#endif
|
||||
{
|
||||
if( !opattrs && !ad_inlist( desc, attrs ) ) {
|
||||
continue;
|
||||
|
|
@ -782,30 +761,18 @@ send_search_entry(
|
|||
aa = backend_operational( be, e );
|
||||
|
||||
for (a = aa ; a == NULL; a = a->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc = a->a_desc;
|
||||
#else
|
||||
char *desc = a->a_type;
|
||||
#endif
|
||||
|
||||
if ( attrs == NULL ) {
|
||||
/* all addrs request, skip operational attributes */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( is_at_operational( desc->ad_type ) )
|
||||
#else
|
||||
if( oc_check_op_attr( desc ) )
|
||||
#endif
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* specific addrs requested */
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( is_at_operational( desc->ad_type ) )
|
||||
#else
|
||||
if( oc_check_op_attr( desc ) )
|
||||
#endif
|
||||
{
|
||||
if( !opattrs && !ad_inlist( desc, attrs ) )
|
||||
{
|
||||
|
|
@ -920,13 +887,8 @@ send_search_reference(
|
|||
int rc;
|
||||
int bytes;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
|
||||
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
|
||||
#else
|
||||
static const char *ad_ref = "ref";
|
||||
static const char *ad_entry = "entry";
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> send_search_reference (%s)\n", e->e_dn, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ root_dse_info( Entry **entry, const char **text )
|
|||
struct berval *vals[2];
|
||||
int i, j;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
AttributeDescription *ad_namingContexts = slap_schema.si_ad_namingContexts;
|
||||
AttributeDescription *ad_supportedControl = slap_schema.si_ad_supportedControl;
|
||||
|
|
@ -34,15 +33,6 @@ root_dse_info( Entry **entry, const char **text )
|
|||
AttributeDescription *ad_supportedLDAPVersion = slap_schema.si_ad_supportedLDAPVersion;
|
||||
AttributeDescription *ad_supportedSASLMechanisms = slap_schema.si_ad_supportedSASLMechanisms;
|
||||
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
|
||||
#else
|
||||
char *ad_objectClass = "objectClass";
|
||||
char *ad_namingContexts = "namingContexts";
|
||||
char *ad_supportedControl = "supportedControl";
|
||||
char *ad_supportedExtension = "supportedExtension";
|
||||
char *ad_supportedLDAPVersion = "supportedLDAPVersion";
|
||||
char *ad_supportedSASLMechanisms = "supportedSASLMechanisms";
|
||||
char *ad_ref = "ref";
|
||||
#endif
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@
|
|||
int
|
||||
schema_info( Entry **entry, const char **text )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
#else
|
||||
char *ad_objectClass = "objectClass";
|
||||
#endif
|
||||
|
||||
Entry *e;
|
||||
struct berval val;
|
||||
|
|
@ -60,12 +56,8 @@ schema_info( Entry **entry, const char **text )
|
|||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
AttributeDescription *desc = NULL;
|
||||
#else
|
||||
char *desc;
|
||||
#endif
|
||||
char *rdn = ch_strdup( SLAPD_SCHEMA_DN );
|
||||
val.bv_val = strchr( rdn, '=' );
|
||||
|
||||
|
|
@ -78,7 +70,6 @@ schema_info( Entry **entry, const char **text )
|
|||
*val.bv_val = '\0';
|
||||
val.bv_len = strlen( ++val.bv_val );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_str2ad( rdn, &desc, text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -87,9 +78,6 @@ schema_info( Entry **entry, const char **text )
|
|||
*text = "improperly configured subschema subentry";
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
#else
|
||||
desc = rdn;
|
||||
#endif
|
||||
|
||||
attr_merge( e, desc, vals );
|
||||
free( rdn );
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
#include "slap.h"
|
||||
#include "ldap_pvt.h"
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int oc_check_allowed(char *type, struct berval **oclist);
|
||||
#endif
|
||||
static char * oc_check_required(Entry *e, struct berval *ocname);
|
||||
|
||||
/*
|
||||
|
|
@ -36,11 +33,7 @@ entry_schema_check(
|
|||
ObjectClass *oc;
|
||||
int i;
|
||||
int ret;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
#else
|
||||
static const char *ad_objectClass = "objectclass";
|
||||
#endif
|
||||
int extensible = 0;
|
||||
|
||||
if( !global_schemacheck ) return LDAP_SUCCESS;
|
||||
|
|
@ -76,11 +69,7 @@ entry_schema_check(
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( oc == slap_schema.si_oc_extensibleObject )
|
||||
#else
|
||||
if( !strcmp( aoc->a_vals[i]->bv_val, "extensibleObject" ) == 0 )
|
||||
#endif
|
||||
{
|
||||
extensible=1;
|
||||
}
|
||||
|
|
@ -98,17 +87,9 @@ entry_schema_check(
|
|||
|
||||
/* check that each attr in the entry is allowed by some oc */
|
||||
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ret = oc_check_allowed( a->a_desc->ad_type, aoc->a_vals );
|
||||
#else
|
||||
ret = oc_check_allowed( a->a_type, aoc->a_vals );
|
||||
#endif
|
||||
if ( ret != 0 ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *type = a->a_desc->ad_cname->bv_val;
|
||||
#else
|
||||
char *type = a->a_type;
|
||||
#endif
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"Entry (%s), attr \"%s\" not allowed\n",
|
||||
e->e_dn, type, 0 );
|
||||
|
|
@ -147,66 +128,26 @@ oc_check_required( Entry *e, struct berval *ocname )
|
|||
at = oc->soc_required[i];
|
||||
/* see if it's in the entry */
|
||||
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( a->a_desc->ad_type == at ) {
|
||||
break;
|
||||
}
|
||||
#else
|
||||
char **pp;
|
||||
|
||||
if ( at->sat_oid &&
|
||||
strcmp( a->a_type, at->sat_oid ) == 0 ) {
|
||||
break;
|
||||
}
|
||||
pp = at->sat_names;
|
||||
if ( pp == NULL ) {
|
||||
/* Empty name list => not found */
|
||||
a = NULL;
|
||||
break;
|
||||
}
|
||||
while ( *pp ) {
|
||||
if ( strcasecmp( a->a_type, *pp ) == 0 ) {
|
||||
break;
|
||||
}
|
||||
pp++;
|
||||
}
|
||||
if ( *pp ) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* not there => schema violation */
|
||||
if ( a == NULL ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
return at->sat_cname;
|
||||
#else
|
||||
if ( at->sat_names && at->sat_names[0] ) {
|
||||
return at->sat_names[0];
|
||||
} else {
|
||||
return at->sat_oid;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static
|
||||
#endif
|
||||
int oc_check_allowed(
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeType *at,
|
||||
#else
|
||||
char *type,
|
||||
#endif
|
||||
struct berval **ocl )
|
||||
{
|
||||
ObjectClass *oc;
|
||||
int i, j;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"oc_check_allowed type \"%s\"\n",
|
||||
at->sat_cname, 0, 0 );
|
||||
|
|
@ -216,54 +157,13 @@ int oc_check_allowed(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
AttributeType *at;
|
||||
char **pp;
|
||||
char *p;
|
||||
char *t;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"oc_check_allowed type \"%s\"\n", type, 0, 0 );
|
||||
|
||||
/* always allow objectclass attribute */
|
||||
if ( strcasecmp( type, "objectclass" ) == 0 ) {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* All operational attributions are allowed by schema rules.
|
||||
*/
|
||||
if( is_at_operational(at) ) {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* The "type" we have received is actually an AttributeDescription.
|
||||
* Let's find out the corresponding type.
|
||||
*/
|
||||
p = strchr( type, ';' );
|
||||
if ( p ) {
|
||||
t = ch_malloc( p-type+1 );
|
||||
strncpy( t, type, p-type );
|
||||
t[p-type] = '\0';
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"oc_check_allowed type \"%s\" from \"%s\"\n",
|
||||
t, type, 0 );
|
||||
|
||||
} else
|
||||
{
|
||||
t = type;
|
||||
}
|
||||
|
||||
/*
|
||||
* All operational attributions are allowed by schema rules.
|
||||
*/
|
||||
if ( oc_check_op_attr( t ) ) {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check that the type appears as req or opt in at least one oc */
|
||||
for ( i = 0; ocl[i] != NULL; i++ ) {
|
||||
|
|
@ -273,60 +173,17 @@ int oc_check_allowed(
|
|||
for ( j = 0; oc->soc_required != NULL &&
|
||||
oc->soc_required[j] != NULL; j++ )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( at == oc->soc_required[j] ) {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#else
|
||||
at = oc->soc_required[j];
|
||||
if ( at->sat_oid &&
|
||||
strcmp(at->sat_oid, t ) == 0 ) {
|
||||
if ( t != type )
|
||||
ldap_memfree( t );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
pp = at->sat_names;
|
||||
if ( pp == NULL )
|
||||
continue;
|
||||
while ( *pp ) {
|
||||
if ( strcasecmp( *pp, t ) == 0 ) {
|
||||
if ( t != type )
|
||||
ldap_memfree( t );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
pp++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* does it allow the type? */
|
||||
for ( j = 0; oc->soc_allowed != NULL &&
|
||||
oc->soc_allowed[j] != NULL; j++ )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( at == oc->soc_allowed[j] ) {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#else
|
||||
at = oc->soc_allowed[j];
|
||||
if ( at->sat_oid &&
|
||||
strcmp( at->sat_oid, t ) == 0 ) {
|
||||
if ( t != type )
|
||||
ldap_memfree( t );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
pp = at->sat_names;
|
||||
if ( pp == NULL )
|
||||
continue;
|
||||
while ( *pp ) {
|
||||
if ( strcasecmp( *pp, t ) == 0 ||
|
||||
strcmp( *pp, "*" ) == 0 ) {
|
||||
if ( t != type )
|
||||
ldap_memfree( t );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
pp++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* maybe the next oc allows it */
|
||||
|
||||
|
|
@ -340,10 +197,6 @@ int oc_check_allowed(
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if ( t != type )
|
||||
ldap_memfree( t );
|
||||
#endif
|
||||
|
||||
/* not allowed by any oc */
|
||||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
|
|
|
|||
|
|
@ -521,7 +521,6 @@ caseExactIA5Match(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static int
|
||||
caseExactIA5SubstringsMatch(
|
||||
int *matchp,
|
||||
|
|
@ -638,7 +637,6 @@ done:
|
|||
*matchp = match;
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
caseIgnoreIA5Match(
|
||||
|
|
@ -654,7 +652,6 @@ caseIgnoreIA5Match(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static char *strcasechr( const char *str, int c )
|
||||
{
|
||||
char *lower = strchr( str, TOLOWER(c) );
|
||||
|
|
@ -783,7 +780,6 @@ done:
|
|||
*matchp = match;
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Index generation function */
|
||||
int caseIgnoreIA5Indexer(
|
||||
|
|
@ -1123,10 +1119,6 @@ struct mrule_defs_rec {
|
|||
* 2.5.13.44 attributeIntegrityMatch
|
||||
*/
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
#define caseIgnoreIA5SubstringsMatch NULL
|
||||
#define caseExactIA5SubstringsMatch NULL
|
||||
#endif
|
||||
|
||||
/* recycled matching functions */
|
||||
#define caseIgnoreMatch caseIgnoreIA5Match
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
int schema_init_done = 0;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
struct slap_internal_schema slap_schema;
|
||||
|
||||
static int
|
||||
|
|
@ -121,18 +120,14 @@ struct slap_schema_ad_map {
|
|||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
schema_prep( void )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int i;
|
||||
#endif
|
||||
/* we should only be called once after schema_init() was called */
|
||||
assert( schema_init_done == 1 );
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
for( i=0; oc_map[i].ssom_name; i++ ) {
|
||||
ObjectClass ** ocp = (ObjectClass **)
|
||||
&(((char *) &slap_schema)[oc_map[i].ssom_offset]);
|
||||
|
|
@ -170,7 +165,6 @@ schema_prep( void )
|
|||
(*adp)->ad_type->sat_equality->smr_match = ad_map[i].ssam_match;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
++schema_init_done;
|
||||
return LDAP_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@
|
|||
|
||||
int global_schemacheck = 1; /* schemacheck on is default */
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static void oc_usage_old(void) LDAP_GCCATTR((noreturn));
|
||||
#endif
|
||||
static void oc_usage(void) LDAP_GCCATTR((noreturn));
|
||||
static void at_usage(void) LDAP_GCCATTR((noreturn));
|
||||
|
||||
|
|
@ -50,105 +47,6 @@ scherr2str(int code)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
void
|
||||
parse_oc_old(
|
||||
Backend *be,
|
||||
const char *fname,
|
||||
int lineno,
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
int i;
|
||||
char last;
|
||||
LDAP_OBJECT_CLASS *oc;
|
||||
int code;
|
||||
const char *err;
|
||||
char **namep;
|
||||
|
||||
oc = (LDAP_OBJECT_CLASS *) ch_calloc( 1, sizeof(LDAP_OBJECT_CLASS) );
|
||||
oc->oc_names = ch_calloc( 2, sizeof(char *) );
|
||||
oc->oc_names[0] = ch_strdup( argv[1] );
|
||||
oc->oc_names[1] = NULL;
|
||||
|
||||
if ( strcasecmp( oc->oc_names[0], "top" ) ) {
|
||||
/*
|
||||
* no way to distinguish "auxiliary" from "structural"
|
||||
* This may lead to future problems.
|
||||
*/
|
||||
oc->oc_kind = LDAP_SCHEMA_STRUCTURAL;
|
||||
}
|
||||
for ( i = 2; i < argc; i++ ) {
|
||||
/* required attributes */
|
||||
if ( strcasecmp( argv[i], "requires" ) == 0 ) {
|
||||
do {
|
||||
i++;
|
||||
if ( i < argc ) {
|
||||
char **s = str2charray( argv[i], "," );
|
||||
last = argv[i][strlen( argv[i] ) - 1];
|
||||
charray_merge( &oc->oc_at_oids_must, s );
|
||||
charray_free( s );
|
||||
}
|
||||
} while ( i < argc && last == ',' );
|
||||
|
||||
/* optional attributes */
|
||||
} else if ( strcasecmp( argv[i], "allows" ) == 0 ) {
|
||||
do {
|
||||
i++;
|
||||
if ( i < argc ) {
|
||||
char **s = str2charray( argv[i], "," );
|
||||
last = argv[i][strlen( argv[i] ) - 1];
|
||||
|
||||
charray_merge( &oc->oc_at_oids_may, s );
|
||||
charray_free( s );
|
||||
}
|
||||
} while ( i < argc && last == ',' );
|
||||
|
||||
} else {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: expecting \"requires\" or \"allows\" got \"%s\"\n",
|
||||
fname, lineno, argv[i] );
|
||||
oc_usage_old();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* There was no requirement in the old schema that all attributes
|
||||
* types were defined before use and they would just default to
|
||||
* SYNTAX_CIS. To support this, we need to make attribute types
|
||||
* out of thin air.
|
||||
*/
|
||||
if ( oc->oc_at_oids_must ) {
|
||||
for( namep = oc->oc_at_oids_must; *namep ; namep++ ) {
|
||||
code = at_fake_if_needed( *namep );
|
||||
if ( code ) {
|
||||
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
||||
fname, lineno, scherr2str(code), *namep);
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( oc->oc_at_oids_may ) {
|
||||
for( namep = oc->oc_at_oids_may; *namep; namep++ ) {
|
||||
code = at_fake_if_needed( *namep );
|
||||
if ( code ) {
|
||||
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
||||
fname, lineno, scherr2str(code), *namep);
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code = oc_add(oc,&err);
|
||||
if ( code ) {
|
||||
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
||||
fname, lineno, scherr2str(code), err);
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
ldap_memfree(oc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* OID Macros */
|
||||
|
||||
|
|
@ -322,16 +220,6 @@ oc_usage( void )
|
|||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
static void
|
||||
oc_usage_old( void )
|
||||
{
|
||||
fprintf( stderr, "<oc clause> ::= objectclass <ocname>\n" );
|
||||
fprintf( stderr, " [ requires <attrlist> ]\n" );
|
||||
fprintf( stderr, " [ allows <attrlist> ]\n" );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
at_usage( void )
|
||||
|
|
|
|||
|
|
@ -147,9 +147,6 @@ do_search(
|
|||
|
||||
if ( attrs != NULL ) {
|
||||
for ( i = 0; attrs[i] != NULL; i++ ) {
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
attr_normalize( attrs[i] );
|
||||
#endif
|
||||
Debug( LDAP_DEBUG_ARGS, " %s", attrs[i], 0, 0 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,9 +289,7 @@ typedef struct slap_matching_rule {
|
|||
} MatchingRule;
|
||||
|
||||
typedef struct slap_attribute_type {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *sat_cname;
|
||||
#endif
|
||||
LDAP_ATTRIBUTE_TYPE sat_atype;
|
||||
struct slap_attribute_type *sat_sup;
|
||||
struct slap_attribute_type **sat_subtypes;
|
||||
|
|
@ -300,10 +298,6 @@ typedef struct slap_attribute_type {
|
|||
MatchingRule *sat_ordering;
|
||||
MatchingRule *sat_substr;
|
||||
Syntax *sat_syntax;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* The next one is created to help in the transition */
|
||||
int sat_syntax_compat;
|
||||
#endif
|
||||
struct slap_attribute_type *sat_next;
|
||||
#define sat_oid sat_atype.at_oid
|
||||
#define sat_names sat_atype.at_names
|
||||
|
|
@ -344,7 +338,6 @@ typedef struct slap_object_class {
|
|||
} ObjectClass;
|
||||
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* represents a recognized attribute description ( type + options )
|
||||
*/
|
||||
|
|
@ -435,27 +428,6 @@ typedef struct slap_mr_assertion {
|
|||
struct berval *ma_value; /* required */
|
||||
} MatchingRuleAssertion;
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* represents an attribute value assertion (i.e., attr;option=value)
|
||||
*/
|
||||
typedef struct slap_ava {
|
||||
char *ava_type; /* attribute description */
|
||||
struct berval ava_value;
|
||||
} Ava;
|
||||
|
||||
/*
|
||||
* represents an matching rule assertion
|
||||
*/
|
||||
typedef struct slap_mra {
|
||||
char *mra_rule; /* optional */
|
||||
char *mra_type; /* attribute description -- optional */
|
||||
int mra_dnattrs;
|
||||
struct berval *mra_value;
|
||||
} Mra;
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* represents a search filter
|
||||
|
|
@ -472,7 +444,6 @@ typedef struct slap_filter {
|
|||
/* precomputed result */
|
||||
ber_int_t f_un_result;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* DN */
|
||||
char *f_un_dn;
|
||||
|
||||
|
|
@ -503,42 +474,6 @@ typedef struct slap_filter {
|
|||
#define f_mr_desc f_un.f_un_mra->ma_desc
|
||||
#define f_mr_value f_un.f_un_mra->ma_value
|
||||
#define f_mr_dnaddrs f_un.f_un_mra->ma_dnattrs
|
||||
#else
|
||||
/* present */
|
||||
char *f_un_type;
|
||||
|
||||
/* equality, lessorequal, greaterorequal, approx */
|
||||
Ava f_un_ava;
|
||||
|
||||
/* extensible */
|
||||
Mra f_un_fra;
|
||||
|
||||
/* substrings */
|
||||
struct sub {
|
||||
char *f_un_sub_type;
|
||||
|
||||
struct berval *f_un_sub_initial;
|
||||
struct berval **f_un_sub_any;
|
||||
struct berval *f_un_sub_final;
|
||||
} f_un_sub;
|
||||
|
||||
#define f_dn f_un.f_un_type /* used for DN indices */
|
||||
#define f_type f_un.f_un_type
|
||||
#define f_desc f_type
|
||||
#define f_ava f_un.f_un_ava
|
||||
#define f_avtype f_un.f_un_ava.ava_type
|
||||
#define f_avvalue f_un.f_un_ava.ava_value
|
||||
#define f_mra f_un.f_un_mra
|
||||
#define f_mrtype f_un.f_un_mra.mra_type
|
||||
#define f_mrvalue f_un.f_un_mra.mra_value
|
||||
#define f_mrdnaddrs f_un.f_un_mra.mra_dnattrs
|
||||
#define f_sub f_un.f_un_sub
|
||||
#define f_sub_type f_un.f_un_sub.f_un_sub_type
|
||||
#define f_sub_desc f_sub_type
|
||||
#define f_sub_initial f_un.f_un_sub.f_un_sub_initial
|
||||
#define f_sub_any f_un.f_un_sub.f_un_sub_any
|
||||
#define f_sub_final f_un.f_un_sub.f_un_sub_final
|
||||
#endif
|
||||
|
||||
/* and, or, not */
|
||||
struct slap_filter *f_un_complex;
|
||||
|
|
@ -560,27 +495,11 @@ typedef struct slap_filter {
|
|||
* represents an attribute (description + values)
|
||||
*/
|
||||
typedef struct slap_attr {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *a_desc;
|
||||
#else
|
||||
char *a_type; /* description */
|
||||
int a_syntax;
|
||||
#endif
|
||||
struct berval **a_vals;
|
||||
struct slap_attr *a_next;
|
||||
} Attribute;
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/*
|
||||
* the attr_syntax() routine returns one of these values
|
||||
* telling what kind of syntax an attribute supports.
|
||||
*/
|
||||
#define SYNTAX_CIS 0x01 /* case insensitive string */
|
||||
#define SYNTAX_CES 0x02 /* case sensitive string */
|
||||
#define SYNTAX_BIN 0x04 /* binary data */
|
||||
#define SYNTAX_TEL 0x08 /* telephone number string */
|
||||
#define SYNTAX_DN 0x10 /* dn string */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* the id used in the indexes to refer to an entry
|
||||
|
|
@ -610,31 +529,20 @@ typedef struct slap_entry {
|
|||
/*
|
||||
* A list of LDAPMods
|
||||
*/
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
typedef struct slap_mod {
|
||||
int sm_op;
|
||||
AttributeDescription *sm_desc;
|
||||
struct berval **sm_bvalues;
|
||||
} Modification;
|
||||
#else
|
||||
#define Modification LDAPMod
|
||||
#define sm_op mod_op
|
||||
#define sm_desc mod_type
|
||||
#define sm_bvalues mod_bvalues
|
||||
#endif
|
||||
|
||||
typedef struct slap_mod_list {
|
||||
Modification sml_mod;
|
||||
#define sml_op sml_mod.sm_op
|
||||
#define sml_desc sml_mod.sm_desc
|
||||
#define sml_bvalues sml_mod.sm_bvalues
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
#define sml_type sml_mod.sm_desc
|
||||
#endif
|
||||
struct slap_mod_list *sml_next;
|
||||
} Modifications;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
typedef struct slap_ldap_modlist {
|
||||
LDAPMod ml_mod;
|
||||
struct slap_ldap_modlist *ml_next;
|
||||
|
|
@ -643,15 +551,6 @@ typedef struct slap_ldap_modlist {
|
|||
#define ml_values ml_mod.mod_values
|
||||
#define ml_bvalues ml_mod.mod_bvalues
|
||||
} LDAPModList;
|
||||
#else
|
||||
#define LDAPModList Modifications
|
||||
#define ml_mod sml_mod
|
||||
#define ml_op sml_mod.mod_op
|
||||
#define ml_type sml_mod.mod_type
|
||||
#define ml_values sml_mod.mod_values
|
||||
#define ml_bvalues sml_mod.mod_bvalues
|
||||
#define ml_next sml_next
|
||||
#endif
|
||||
|
||||
/*
|
||||
* represents an access control list
|
||||
|
|
@ -740,11 +639,7 @@ typedef struct slap_access {
|
|||
slap_access_mask_t a_mask;
|
||||
|
||||
char *a_dn_pat;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *a_dn_at;
|
||||
#else
|
||||
char *a_dn_at;
|
||||
#endif
|
||||
int a_dn_self;
|
||||
|
||||
char *a_peername_pat;
|
||||
|
|
@ -754,22 +649,13 @@ typedef struct slap_access {
|
|||
char *a_sockurl_pat;
|
||||
|
||||
#ifdef SLAPD_ACI_ENABLED
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *a_aci_at;
|
||||
#else
|
||||
char *a_aci_at;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ACL Groups */
|
||||
char *a_group_pat;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
ObjectClass *a_group_oc;
|
||||
AttributeDescription *a_group_at;
|
||||
#else
|
||||
char *a_group_oc;
|
||||
char *a_group_at;
|
||||
#endif
|
||||
|
||||
struct slap_access *a_next;
|
||||
} Access;
|
||||
|
|
@ -981,17 +867,10 @@ struct slap_backend_info {
|
|||
int slimit, int tlimit,
|
||||
Filter *f, const char *filterstr,
|
||||
char **attrs, int attrsonly));
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int (*bi_op_compare)LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
const char *dn, const char *ndn,
|
||||
AttributeAssertion *ava));
|
||||
#else
|
||||
int (*bi_op_compare)LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
const char *dn, const char *ndn,
|
||||
Ava *ava));
|
||||
#endif
|
||||
int (*bi_op_modify) LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
const char *dn, const char *ndn, Modifications *m));
|
||||
|
|
@ -1016,17 +895,10 @@ struct slap_backend_info {
|
|||
/* Auxilary Functions */
|
||||
int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw));
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int (*bi_acl_group) LDAP_P((Backend *bd,
|
||||
Entry *e, const char *bdn, const char *edn,
|
||||
ObjectClass *group_oc,
|
||||
AttributeDescription *group_at ));
|
||||
#else
|
||||
int (*bi_acl_group) LDAP_P((Backend *bd,
|
||||
Entry *e, const char *bdn, const char *edn,
|
||||
const char *group_oc,
|
||||
const char *group_at ));
|
||||
#endif
|
||||
|
||||
int (*bi_connection_init) LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c));
|
||||
|
|
@ -1040,19 +912,11 @@ struct slap_backend_info {
|
|||
ID (*bi_tool_entry_next) LDAP_P(( BackendDB *be ));
|
||||
Entry* (*bi_tool_entry_get) LDAP_P(( BackendDB *be, ID id ));
|
||||
ID (*bi_tool_entry_put) LDAP_P(( BackendDB *be, Entry *e ));
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int (*bi_tool_index_attr) LDAP_P(( BackendDB *be,
|
||||
AttributeDescription *desc ));
|
||||
int (*bi_tool_index_change) LDAP_P(( BackendDB *be,
|
||||
AttributeDescription *desc,
|
||||
struct berval **bv, ID id, int op ));
|
||||
#else
|
||||
int (*bi_tool_index_attr) LDAP_P(( BackendDB *be,
|
||||
char* type ));
|
||||
int (*bi_tool_index_change) LDAP_P(( BackendDB *be,
|
||||
char* type,
|
||||
struct berval **bv, ID id, int op ));
|
||||
#endif
|
||||
int (*bi_tool_sync) LDAP_P(( BackendDB *be ));
|
||||
|
||||
#ifdef HAVE_CYRUS_SASL
|
||||
|
|
|
|||
|
|
@ -145,10 +145,8 @@ str2simple( const char *str )
|
|||
Filter *f;
|
||||
char *s;
|
||||
char *value, savechar;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
const char *text;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "str2simple \"%s\"\n", str, 0, 0 );
|
||||
|
||||
|
|
@ -188,7 +186,6 @@ str2simple( const char *str )
|
|||
f->f_choice = LDAP_FILTER_PRESENT;
|
||||
} else {
|
||||
f->f_choice = LDAP_FILTER_SUBSTRINGS;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
f->f_sub = ch_calloc( 1, sizeof( SubstringsAssertion ) );
|
||||
rc = slap_str2ad( str, &f->f_sub_desc, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -196,9 +193,6 @@ str2simple( const char *str )
|
|||
*(value-1) = '=';
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
f->f_sub_type = ch_strdup( str );
|
||||
#endif
|
||||
if ( str2subvals( value, f ) != 0 ) {
|
||||
filter_free( f );
|
||||
*(value-1) = '=';
|
||||
|
|
@ -211,18 +205,13 @@ str2simple( const char *str )
|
|||
}
|
||||
|
||||
if ( f->f_choice == LDAP_FILTER_PRESENT ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
rc = slap_str2ad( str, &f->f_desc, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
filter_free( f );
|
||||
*(value-1) = '=';
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
f->f_type = ch_strdup( str );
|
||||
#endif
|
||||
} else {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
char *tmp;
|
||||
|
||||
f->f_ava = ch_calloc( 1, sizeof( AttributeAssertion ) );
|
||||
|
|
@ -237,12 +226,6 @@ str2simple( const char *str )
|
|||
tmp = ch_strdup( value );
|
||||
ldap_pvt_filter_value_unescape( tmp );
|
||||
f->f_av_value = ber_bvstr( tmp );
|
||||
#else
|
||||
f->f_avtype = ch_strdup( str );
|
||||
f->f_avvalue.bv_val = ch_strdup( value );
|
||||
ldap_pvt_filter_value_unescape( f->f_avvalue.bv_val );
|
||||
f->f_avvalue.bv_len = strlen( value );
|
||||
#endif
|
||||
}
|
||||
|
||||
*s = savechar;
|
||||
|
|
|
|||
|
|
@ -174,11 +174,7 @@ syn_schema_info( Entry *e )
|
|||
struct berval *vals[2];
|
||||
Syntax *syn;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_ldapSyntaxes = slap_schema.si_ad_ldapSyntaxes;
|
||||
#else
|
||||
char *ad_ldapSyntaxes = "ldapSyntaxes";
|
||||
#endif
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
|
|
|
|||
|
|
@ -20,12 +20,8 @@ int
|
|||
main( int argc, char **argv )
|
||||
{
|
||||
char *type;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc;
|
||||
const char *text;
|
||||
#else
|
||||
char *desc;
|
||||
#endif
|
||||
ID id;
|
||||
int rc = EXIT_SUCCESS;
|
||||
|
||||
|
|
@ -44,7 +40,6 @@ main( int argc, char **argv )
|
|||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
type = argv[argc - 1];
|
||||
|
||||
rc = slap_str2ad( type, &desc, &text );
|
||||
|
|
@ -54,9 +49,6 @@ main( int argc, char **argv )
|
|||
progname, text );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
#else
|
||||
desc = type = attr_normalize( argv[argc - 1] );
|
||||
#endif
|
||||
|
||||
if ( !be->be_index_attr( be, desc ) ) {
|
||||
fprintf( stderr, "attribute type \"%s\": no indices to generate\n",
|
||||
|
|
@ -89,43 +81,12 @@ main( int argc, char **argv )
|
|||
id, e->e_dn );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
if( strcasecmp( type, "dn" ) == 0 )
|
||||
{
|
||||
struct berval **values;
|
||||
struct berval bv;
|
||||
struct berval *bvals[2];
|
||||
|
||||
bv.bv_val = e->e_ndn;
|
||||
bv.bv_len = strlen( bv.bv_val );
|
||||
bvals[0] = &bv;
|
||||
bvals[1] = NULL;
|
||||
|
||||
values = bvals;
|
||||
|
||||
if ( be->be_index_change( be,
|
||||
desc, values, id, SLAP_INDEX_ADD_OP ) )
|
||||
{
|
||||
rc = EXIT_FAILURE;
|
||||
|
||||
if( !continuemode ) {
|
||||
entry_free( e );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
Attribute *attr;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
for( attr = attrs_find( e->e_attrs, desc );
|
||||
attr != NULL;
|
||||
attr = attrs_find( attr->a_next, desc ) )
|
||||
#else
|
||||
if (( attr = attr_find( e->e_attrs, type )) != NULL )
|
||||
#endif
|
||||
{
|
||||
|
||||
if ( be->be_index_change( be,
|
||||
|
|
|
|||
|
|
@ -51,41 +51,7 @@ value_add(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int
|
||||
value_add_fast(
|
||||
struct berval ***vals,
|
||||
struct berval **addvals,
|
||||
int nvals,
|
||||
int naddvals,
|
||||
int *maxvals
|
||||
)
|
||||
{
|
||||
int need, i, j;
|
||||
|
||||
if ( *maxvals == 0 ) {
|
||||
*maxvals = 1;
|
||||
}
|
||||
need = nvals + naddvals + 1;
|
||||
while ( *maxvals < need ) {
|
||||
*maxvals *= 2;
|
||||
*vals = (struct berval **) ch_realloc( (char *) *vals,
|
||||
*maxvals * sizeof(struct berval *) );
|
||||
}
|
||||
|
||||
for ( i = 0, j = 0; i < naddvals; i++ ) {
|
||||
if ( addvals[i]->bv_len > 0 ) {
|
||||
(*vals)[nvals + j] = ber_bvdup( addvals[i] );
|
||||
if( (*vals)[nvals + j] != NULL ) j++;
|
||||
}
|
||||
}
|
||||
(*vals)[nvals + j] = NULL;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int
|
||||
value_normalize(
|
||||
AttributeDescription *ad,
|
||||
|
|
@ -153,36 +119,7 @@ value_normalize(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
value_normalize(
|
||||
char *s,
|
||||
int syntax
|
||||
)
|
||||
{
|
||||
char *d, *save;
|
||||
|
||||
if ( ! (syntax & SYNTAX_CIS) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( syntax & SYNTAX_DN ) {
|
||||
(void) dn_normalize( s );
|
||||
return;
|
||||
}
|
||||
|
||||
save = s;
|
||||
for ( d = s; *s; s++ ) {
|
||||
if ( (syntax & SYNTAX_TEL) && (*s == ' ' || *s == '-') ) {
|
||||
continue;
|
||||
}
|
||||
*d++ = TOUPPER( (unsigned char) *s );
|
||||
}
|
||||
*d = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int
|
||||
value_match(
|
||||
int *match,
|
||||
|
|
@ -219,72 +156,13 @@ value_match(
|
|||
return rc;
|
||||
}
|
||||
|
||||
#else
|
||||
int
|
||||
value_cmp(
|
||||
struct berval *v1,
|
||||
struct berval *v2,
|
||||
int syntax,
|
||||
int normalize /* 1 => arg 1; 2 => arg 2; 3 => both */
|
||||
)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if ( normalize & 1 ) {
|
||||
v1 = ber_bvdup( v1 );
|
||||
value_normalize( v1->bv_val, syntax );
|
||||
}
|
||||
if ( normalize & 2 ) {
|
||||
v2 = ber_bvdup( v2 );
|
||||
value_normalize( v2->bv_val, syntax );
|
||||
}
|
||||
|
||||
switch ( syntax ) {
|
||||
case SYNTAX_CIS:
|
||||
case (SYNTAX_CIS | SYNTAX_TEL):
|
||||
case (SYNTAX_CIS | SYNTAX_DN):
|
||||
rc = strcasecmp( v1->bv_val, v2->bv_val );
|
||||
break;
|
||||
|
||||
case SYNTAX_CES:
|
||||
rc = strcmp( v1->bv_val, v2->bv_val );
|
||||
break;
|
||||
|
||||
default: /* Unknown syntax */
|
||||
case SYNTAX_BIN:
|
||||
rc = (v1->bv_len == v2->bv_len
|
||||
? memcmp( v1->bv_val, v2->bv_val, v1->bv_len )
|
||||
: v1->bv_len > v2->bv_len ? 1 : -1);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( normalize & 1 ) {
|
||||
ber_bvfree( v1 );
|
||||
}
|
||||
if ( normalize & 2 ) {
|
||||
ber_bvfree( v2 );
|
||||
}
|
||||
|
||||
return( rc );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int value_find(
|
||||
AttributeDescription *ad,
|
||||
struct berval **vals,
|
||||
struct berval *val )
|
||||
#else
|
||||
int
|
||||
value_find(
|
||||
struct berval **vals,
|
||||
struct berval *v,
|
||||
int syntax,
|
||||
int normalize )
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
struct berval *nval = NULL;
|
||||
MatchingRule *mr = ad->ad_type->sat_equality;
|
||||
|
|
@ -301,10 +179,8 @@ value_find(
|
|||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( i = 0; vals[i] != NULL; i++ ) {
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int match;
|
||||
const char *text;
|
||||
|
||||
|
|
@ -312,9 +188,6 @@ value_find(
|
|||
nval == NULL ? val : nval, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match == 0 )
|
||||
#else
|
||||
if ( value_cmp( vals[i], v, syntax, normalize ) == 0 )
|
||||
#endif
|
||||
{
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue