mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-16 00:58:02 -05:00
SLAP_NVALUES, round 3
This commit is contained in:
parent
46a2616b83
commit
dd66e6e929
14 changed files with 87 additions and 57 deletions
|
|
@ -191,8 +191,7 @@ int slap_bv2ad(
|
|||
desc.ad_flags |= SLAP_DESC_BINARY;
|
||||
continue;
|
||||
|
||||
} else if ( ad_find_option_definition( opt, optlen ) )
|
||||
{
|
||||
} else if ( ad_find_option_definition( opt, optlen ) ) {
|
||||
int i;
|
||||
|
||||
if( opt[optlen-1] == '-' ) {
|
||||
|
|
@ -325,6 +324,7 @@ done:;
|
|||
}
|
||||
|
||||
d2 = ch_malloc(sizeof(AttributeDescription) + dlen);
|
||||
d2->ad_next = NULL;
|
||||
d2->ad_type = desc.ad_type;
|
||||
d2->ad_flags = desc.ad_flags;
|
||||
d2->ad_cname.bv_len = desc.ad_type->sat_cname.bv_len;
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ at_insert(
|
|||
struct aindexrec *air;
|
||||
char **names;
|
||||
|
||||
LDAP_SLIST_NEXT( sat, sat_next ) = NULL;
|
||||
LDAP_SLIST_INSERT_HEAD( &attr_list, sat, sat_next );
|
||||
|
||||
if ( sat->sat_oid ) {
|
||||
|
|
|
|||
|
|
@ -65,30 +65,23 @@ Attribute *attr_dup( Attribute *a )
|
|||
}
|
||||
|
||||
tmp->a_vals = ch_malloc((i+1) * sizeof(struct berval));
|
||||
#ifdef SLAP_NVALUES
|
||||
if( a->a_nvals != NULL ) {
|
||||
tmp->a_nvals = ch_malloc((i+1) * sizeof(struct berval));
|
||||
}
|
||||
#endif
|
||||
|
||||
for( i=0; a->a_vals[i].bv_val != NULL; i++ ) {
|
||||
ber_dupbv( &tmp->a_vals[i], &a->a_vals[i] );
|
||||
if( tmp->a_vals[i].bv_val == NULL ) break;
|
||||
}
|
||||
tmp->a_vals[i].bv_val = NULL;
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
if( a->a_nvals ) {
|
||||
if( a->a_nvals != NULL ) {
|
||||
tmp->a_nvals = ch_malloc((i+1) * sizeof(struct berval));
|
||||
for( i=0; a->a_nvals[i].bv_val != NULL; i++ ) {
|
||||
ber_dupbv( &tmp->a_nvals[i], &a->a_nvals[i] );
|
||||
if( tmp->a_nvals[i].bv_val == NULL ) break;
|
||||
} else {
|
||||
tmp->a_nvals = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
tmp->a_vals[i].bv_val = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
if( tmp->a_nvals != NULL ) {
|
||||
tmp->a_nvals[i].bv_val = NULL;
|
||||
|
||||
} else {
|
||||
tmp->a_nvals = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ int bdb_modify_internal(
|
|||
for ( ap = save_attrs; ap != NULL; ap = ap->a_next ) {
|
||||
if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
|
||||
rc = bdb_index_values( be, tid, ap->a_desc, ap->a_vals,
|
||||
e->e_id, SLAP_INDEX_DELETE_OP );
|
||||
e->e_id, SLAP_INDEX_DELETE_OP );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
attrs_free( e->e_attrs );
|
||||
e->e_attrs = save_attrs;
|
||||
|
|
@ -233,7 +233,7 @@ int bdb_modify_internal(
|
|||
for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) {
|
||||
if (ap->a_flags & SLAP_ATTR_IXADD) {
|
||||
rc = bdb_index_values( be, tid, ap->a_desc, ap->a_vals,
|
||||
e->e_id, SLAP_INDEX_ADD_OP );
|
||||
e->e_id, SLAP_INDEX_ADD_OP );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
attrs_free( e->e_attrs );
|
||||
e->e_attrs = save_attrs;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ cr_insert(
|
|||
struct cindexrec *cir;
|
||||
char **names;
|
||||
|
||||
LDAP_SLIST_NEXT( scr, scr_next ) = NULL;
|
||||
LDAP_SLIST_INSERT_HEAD(&cr_list, scr, scr_next);
|
||||
|
||||
if ( scr->scr_oid ) {
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ int slap_mods_check(
|
|||
ad->ad_type->sat_syntax->ssyn_normalize )
|
||||
{
|
||||
ml->sml_nvalues = ch_malloc( (nvals+1)*sizeof(struct berval) );
|
||||
for( nvals = 0; ml->sml_nvalues[nvals].bv_val; nvals++ ) {
|
||||
for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
|
||||
rc = ad->ad_type->sat_syntax->ssyn_normalize(
|
||||
ad->ad_type->sat_syntax,
|
||||
&ml->sml_values[nvals], &ml->sml_nvalues[nvals] );
|
||||
|
|
@ -665,6 +665,9 @@ int slap_mods_opattrs(
|
|||
char *textbuf, size_t textlen )
|
||||
{
|
||||
struct berval name, timestamp, csn;
|
||||
#ifdef SLAP_NVALUES
|
||||
struct berval nname;
|
||||
#endif
|
||||
char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
|
||||
Modifications *mod;
|
||||
|
|
@ -693,8 +696,14 @@ int slap_mods_opattrs(
|
|||
if( op->o_dn.bv_len == 0 ) {
|
||||
name.bv_val = SLAPD_ANONYMOUS;
|
||||
name.bv_len = sizeof(SLAPD_ANONYMOUS)-1;
|
||||
#ifdef SLAP_NVALUES
|
||||
nname = name;
|
||||
#endif
|
||||
} else {
|
||||
name = op->o_dn;
|
||||
#ifdef SLAP_NVALUES
|
||||
nname = op->o_ndn;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -712,13 +721,20 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues = NULL;
|
||||
#endif
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
mod->sml_values =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &tmpval );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_nvalues[0], &tmpval );
|
||||
mod->sml_nvalues[1].bv_len = 0;
|
||||
mod->sml_nvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_nvalues[0].bv_val );
|
||||
#endif
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
|
|
@ -733,13 +749,15 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_entryUUID;
|
||||
mod->sml_values =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &tmpval );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues = NULL;
|
||||
#endif
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &tmpval );
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
|
|
@ -747,13 +765,19 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_creatorsName;
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues = NULL;
|
||||
#endif
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &name );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_nvalues[0], &nname );
|
||||
mod->sml_nvalues[1].bv_len = 0;
|
||||
mod->sml_nvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_nvalues[0].bv_val );
|
||||
#endif
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
|
|
@ -761,13 +785,14 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_createTimestamp;
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], ×tamp );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues = NULL;
|
||||
#endif
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], ×tamp );
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
|
|
@ -778,13 +803,14 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_entryCSN;
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &csn );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues = NULL;
|
||||
#endif
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &csn );
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
|
|
@ -792,13 +818,19 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_modifiersName;
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues = NULL;
|
||||
#endif
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], &name );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues =
|
||||
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_nvalues[0], &nname );
|
||||
mod->sml_nvalues[1].bv_len = 0;
|
||||
mod->sml_nvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_nvalues[0].bv_val );
|
||||
#endif
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
|
|
@ -806,13 +838,14 @@ int slap_mods_opattrs(
|
|||
mod->sml_op = mop;
|
||||
mod->sml_type.bv_val = NULL;
|
||||
mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], ×tamp );
|
||||
mod->sml_values[1].bv_len = 0;
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
mod->sml_nvalues = NULL;
|
||||
#endif
|
||||
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_values[0], ×tamp );
|
||||
mod->sml_values[1].bv_val = NULL;
|
||||
assert( mod->sml_values[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -675,13 +675,14 @@ slap_mod_free(
|
|||
)
|
||||
{
|
||||
if ( mod->sm_values != NULL ) ber_bvarray_free( mod->sm_values );
|
||||
mod->sm_values = NULL;
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
if ( mod->sm_nvalues != NULL ) ber_bvarray_free( mod->sm_nvalues );
|
||||
mod->sm_nvalues = NULL;
|
||||
#endif
|
||||
|
||||
if( freeit )
|
||||
free( mod );
|
||||
if( freeit ) free( mod );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ mr_insert(
|
|||
struct mindexrec *mir;
|
||||
char **names;
|
||||
|
||||
LDAP_SLIST_NEXT( smr, smr_next ) = NULL;
|
||||
LDAP_SLIST_INSERT_HEAD(&mr_list, smr, smr_next);
|
||||
|
||||
if ( smr->smr_oid ) {
|
||||
|
|
|
|||
|
|
@ -355,6 +355,7 @@ oc_insert(
|
|||
struct oindexrec *oir;
|
||||
char **names;
|
||||
|
||||
LDAP_SLIST_NEXT( soc, soc_next ) = NULL;
|
||||
LDAP_SLIST_INSERT_HEAD( &oc_list, soc, soc_next );
|
||||
|
||||
if ( soc->soc_oid ) {
|
||||
|
|
|
|||
|
|
@ -90,8 +90,7 @@ parse_oidm(
|
|||
const char *fname,
|
||||
int lineno,
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
char **argv )
|
||||
{
|
||||
char *oid;
|
||||
OidMacro *om;
|
||||
|
|
@ -122,6 +121,7 @@ usage: fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
|
|||
return 1;
|
||||
}
|
||||
|
||||
LDAP_SLIST_NEXT( om, som_next ) = NULL;
|
||||
om->som_names = NULL;
|
||||
ldap_charray_add( &om->som_names, argv[1] );
|
||||
om->som_oid.bv_val = oidm_find( argv[2] );
|
||||
|
|
@ -139,6 +139,5 @@ usage: fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
|
|||
om->som_oid.bv_len = strlen( om->som_oid.bv_val );
|
||||
|
||||
LDAP_SLIST_INSERT_HEAD( &om_list, om, som_next );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1065,11 +1065,11 @@ LDAP_SLAPD_F (void) slap_init_user LDAP_P(( char *username, char *groupname ));
|
|||
/*
|
||||
* value.c
|
||||
*/
|
||||
LDAP_SLAPD_F (int) value_validate LDAP_P((
|
||||
LDAP_SLAPD_F (int) assertion_value_validate LDAP_P((
|
||||
MatchingRule *mr,
|
||||
struct berval *in,
|
||||
const char ** text ));
|
||||
LDAP_SLAPD_F (int) value_normalize LDAP_P((
|
||||
LDAP_SLAPD_F (int) attribute_value_normalize LDAP_P((
|
||||
AttributeDescription *ad,
|
||||
unsigned usage,
|
||||
struct berval *in,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include "ldap_queue.h"
|
||||
|
||||
#ifdef LDAP_DEVEL
|
||||
/* #define SLAP_NVALUES 1 */
|
||||
#define SLAP_NVALUES 1
|
||||
#define SLAP_EXTENDED_SCHEMA 1
|
||||
#endif
|
||||
|
||||
|
|
@ -903,7 +903,7 @@ typedef struct slap_attr {
|
|||
#ifdef SLAP_NVALUES
|
||||
BerVarray a_nvals; /* normalized values */
|
||||
#endif
|
||||
struct slap_attr *a_next;
|
||||
struct slap_attr *a_next;
|
||||
unsigned a_flags;
|
||||
#define SLAP_ATTR_IXADD 0x1U
|
||||
#define SLAP_ATTR_IXDEL 0x2U
|
||||
|
|
@ -975,7 +975,7 @@ typedef struct slap_ldap_modlist {
|
|||
#define ml_op ml_mod.mod_op
|
||||
#define ml_type ml_mod.mod_type
|
||||
#define ml_values ml_mod.mod_values
|
||||
#define ml_bvalues ml_mod.mod_bvalues
|
||||
#define ml_bvalues ml_mod.mod_values
|
||||
} LDAPModList;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ syn_insert(
|
|||
{
|
||||
struct sindexrec *sir;
|
||||
|
||||
LDAP_SLIST_NEXT( ssyn, ssyn_next ) = NULL;
|
||||
LDAP_SLIST_INSERT_HEAD( &syn_list, ssyn, ssyn_next );
|
||||
|
||||
if ( ssyn->ssyn_oid ) {
|
||||
|
|
|
|||
|
|
@ -309,7 +309,6 @@ value_validate_normalize(
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
value_match(
|
||||
int *match,
|
||||
|
|
|
|||
Loading…
Reference in a new issue