mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Round one of SLAP_NVALUES code
This commit is contained in:
parent
5b4e69a564
commit
8502301b00
@ -602,8 +602,14 @@ at_schema_info( Entry *e )
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_attributeTypes, vals, NULL /* FIXME */ ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_attributeTypes, vals ) )
|
||||
#endif
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
return 0;
|
||||
|
@ -32,6 +32,9 @@ void
|
||||
attr_free( Attribute *a )
|
||||
{
|
||||
ber_bvarray_free( a->a_vals );
|
||||
#ifdef SLAP_NVALUES
|
||||
ber_bvarray_free( a->a_nvals );
|
||||
#endif
|
||||
free( a );
|
||||
}
|
||||
|
||||
@ -62,16 +65,29 @@ Attribute *attr_dup( Attribute *a )
|
||||
}
|
||||
|
||||
tmp->a_vals = ch_malloc((i+1) * sizeof(struct berval));
|
||||
#ifdef SLAP_NVALUES
|
||||
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;
|
||||
#ifdef SLAP_NVALUES
|
||||
ber_dupbv( &tmp->a_nvals[i], &a->a_nvals[i] );
|
||||
if( tmp->a_nvals[i].bv_val == NULL ) break;
|
||||
#endif
|
||||
}
|
||||
|
||||
tmp->a_vals[i].bv_val = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
tmp->a_nvals[i].bv_val = NULL;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
tmp->a_vals = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
tmp->a_nvals = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
tmp->a_desc = a->a_desc;
|
||||
@ -112,8 +128,13 @@ int
|
||||
attr_merge(
|
||||
Entry *e,
|
||||
AttributeDescription *desc,
|
||||
BerVarray vals )
|
||||
{
|
||||
BerVarray vals
|
||||
#ifdef SLAP_NVALUES
|
||||
, BerVarray nvals
|
||||
#endif
|
||||
) {
|
||||
int rc;
|
||||
|
||||
Attribute **a;
|
||||
|
||||
for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
|
||||
@ -126,19 +147,32 @@ attr_merge(
|
||||
*a = (Attribute *) ch_malloc( sizeof(Attribute) );
|
||||
(*a)->a_desc = desc;
|
||||
(*a)->a_vals = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
(*a)->a_nvals = NULL;
|
||||
#endif
|
||||
(*a)->a_next = NULL;
|
||||
(*a)->a_flags = 0;
|
||||
}
|
||||
|
||||
return( value_add( &(*a)->a_vals, vals ) );
|
||||
rc = value_add( &(*a)->a_vals, vals );
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
if( !rc && nvals ) rc = value_add( &(*a)->a_nvals, nvals );
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
attr_merge_one(
|
||||
Entry *e,
|
||||
AttributeDescription *desc,
|
||||
struct berval *val )
|
||||
{
|
||||
struct berval *val
|
||||
#ifdef SLAP_NVALUES
|
||||
, BerVarray nval
|
||||
#endif
|
||||
) {
|
||||
int rc;
|
||||
Attribute **a;
|
||||
|
||||
for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
|
||||
@ -151,11 +185,19 @@ attr_merge_one(
|
||||
*a = (Attribute *) ch_malloc( sizeof(Attribute) );
|
||||
(*a)->a_desc = desc;
|
||||
(*a)->a_vals = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
(*a)->a_nvals = NULL;
|
||||
#endif
|
||||
(*a)->a_next = NULL;
|
||||
(*a)->a_flags = 0;
|
||||
}
|
||||
|
||||
return( value_add_one( &(*a)->a_vals, val ) );
|
||||
rc = value_add_one( &(*a)->a_vals, val );
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
if( !rc && nval ) rc = value_add_one( &(*a)->a_nvals, nval );
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -401,7 +401,8 @@ cr_schema_info( Entry *e )
|
||||
struct berval vals[2];
|
||||
ContentRule *cr;
|
||||
|
||||
AttributeDescription *ad_ditContentRules = slap_schema.si_ad_ditContentRules;
|
||||
AttributeDescription *ad_ditContentRules
|
||||
= slap_schema.si_ad_ditContentRules;
|
||||
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
@ -418,8 +419,14 @@ cr_schema_info( Entry *e )
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging cr [%ld] %s\n",
|
||||
(long) vals[0].bv_len, vals[0].bv_val, 0 );
|
||||
#endif
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_ditContentRules, vals, NULL ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_ditContentRules, vals ) )
|
||||
#endif
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
#endif
|
||||
|
@ -43,6 +43,9 @@ str2entry( char *s )
|
||||
Entry *e;
|
||||
char *type;
|
||||
struct berval vals[2];
|
||||
#ifdef SLAP_NVALUES
|
||||
struct berval nvals[2];
|
||||
#endif
|
||||
AttributeDescription *ad;
|
||||
const char *text;
|
||||
char *next;
|
||||
@ -233,7 +236,15 @@ str2entry( char *s )
|
||||
}
|
||||
}
|
||||
|
||||
rc = attr_merge( e, ad, vals );
|
||||
#ifdef SLAP_NVALUES
|
||||
/* normalize here */
|
||||
#endif
|
||||
|
||||
rc = attr_merge( e, ad, vals
|
||||
#ifdef SLAP_NVALUES
|
||||
, nvals
|
||||
#endif
|
||||
);
|
||||
if( rc != 0 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, DETAIL1,
|
||||
@ -250,6 +261,9 @@ str2entry( char *s )
|
||||
|
||||
free( type );
|
||||
free( vals[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
free( nvals[0].bv_val );
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check to make sure there was a dn: line */
|
||||
|
@ -444,7 +444,12 @@ modify_add_values(
|
||||
}
|
||||
|
||||
/* no - add them */
|
||||
if( attr_merge( e, mod->sm_desc, mod->sm_bvalues ) != 0 ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, mod->sm_desc, mod->sm_values, mod->sm_nvalues ) != 0 )
|
||||
#else
|
||||
if( attr_merge( e, mod->sm_desc, mod->sm_bvalues ) != 0 )
|
||||
#endif
|
||||
{
|
||||
/* this should return result of attr_merge */
|
||||
*text = textbuf;
|
||||
snprintf( textbuf, textlen,
|
||||
@ -669,12 +674,11 @@ slap_mod_free(
|
||||
int freeit
|
||||
)
|
||||
{
|
||||
#if 0
|
||||
if ( mod->sm_type.bv_val)
|
||||
free( mod->sm_type.bv_val );
|
||||
if ( mod->sm_values != NULL ) ber_bvarray_free( mod->sm_values );
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
if ( mod->sm_nvalues != NULL ) ber_bvarray_free( mod->sm_nvalues );
|
||||
#endif
|
||||
if ( mod->sm_bvalues != NULL )
|
||||
ber_bvarray_free( mod->sm_bvalues );
|
||||
|
||||
if( freeit )
|
||||
free( mod );
|
||||
|
@ -461,8 +461,14 @@ int mr_schema_info( Entry *e )
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging mr [%lu] %s\n",
|
||||
mr->smr_str.bv_len, mr->smr_str.bv_val, 0 );
|
||||
#endif
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge_one( e, ad_matchingRules, &mr->smr_str, NULL /* FIXME */ ) )
|
||||
#else
|
||||
if( attr_merge_one( e, ad_matchingRules, &mr->smr_str ) )
|
||||
#endif
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -489,8 +495,14 @@ int mru_schema_info( Entry *e )
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging mru [%lu] %s\n",
|
||||
mru->smru_str.bv_len, mru->smru_str.bv_val, 0 );
|
||||
#endif
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str, NULL /* FIXME */ ) )
|
||||
#else
|
||||
if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str ) )
|
||||
#endif
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -497,8 +497,14 @@ oc_schema_info( Entry *e )
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s\n",
|
||||
(long) vals[0].bv_len, vals[0].bv_val, 0 );
|
||||
#endif
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_objectClasses, vals, NULL /* FIXME */ ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_objectClasses, vals ) )
|
||||
#endif
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
return 0;
|
||||
|
@ -132,12 +132,23 @@ LDAP_SLAPD_F (int) at_next LDAP_P(( AttributeType **at ));
|
||||
LDAP_SLAPD_F (void) attr_free LDAP_P(( Attribute *a ));
|
||||
LDAP_SLAPD_F (Attribute *) attr_dup LDAP_P(( Attribute *a ));
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
LDAP_SLAPD_F (int) attr_merge LDAP_P(( Entry *e,
|
||||
AttributeDescription *desc,
|
||||
BerVarray vals,
|
||||
BerVarray nvals ));
|
||||
LDAP_SLAPD_F (int) attr_merge_one LDAP_P(( Entry *e,
|
||||
AttributeDescription *desc,
|
||||
struct berval *val,
|
||||
struct berval *nval ));
|
||||
#else
|
||||
LDAP_SLAPD_F (int) attr_merge LDAP_P(( Entry *e,
|
||||
AttributeDescription *desc,
|
||||
BerVarray vals ));
|
||||
LDAP_SLAPD_F (int) attr_merge_one LDAP_P(( Entry *e,
|
||||
AttributeDescription *desc,
|
||||
struct berval *val ));
|
||||
#endif
|
||||
LDAP_SLAPD_F (Attribute *) attrs_find LDAP_P((
|
||||
Attribute *a, AttributeDescription *desc ));
|
||||
LDAP_SLAPD_F (Attribute *) attr_find LDAP_P((
|
||||
|
@ -42,7 +42,10 @@ root_dse_info(
|
||||
const char **text )
|
||||
{
|
||||
Entry *e;
|
||||
struct berval vals[2], *bv;
|
||||
struct berval vals[2], *bv;
|
||||
#ifdef SLAP_NVALUES
|
||||
struct berval nvals[2];
|
||||
#endif
|
||||
int i, j;
|
||||
char ** supportedSASLMechanisms;
|
||||
|
||||
@ -68,6 +71,9 @@ root_dse_info(
|
||||
= slap_schema.si_ad_ref;
|
||||
|
||||
vals[1].bv_val = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
nvals[1].bv_val = NULL;
|
||||
#endif
|
||||
|
||||
e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
|
||||
|
||||
@ -96,21 +102,41 @@ root_dse_info(
|
||||
|
||||
vals[0].bv_val = "top";
|
||||
vals[0].bv_len = sizeof("top")-1;
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_objectClass, vals, vals ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_objectClass, vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
vals[0].bv_val = "OpenLDAProotDSE";
|
||||
vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_objectClass, vals, vals ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_objectClass, vals ) )
|
||||
#endif
|
||||
return LDAP_OTHER;
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_structuralObjectClass, vals, vals ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_structuralObjectClass, vals ) )
|
||||
#endif
|
||||
return LDAP_OTHER;
|
||||
|
||||
for ( i = 0; i < nbackends; i++ ) {
|
||||
if ( backends[i].be_flags & SLAP_BFLAG_MONITOR ) {
|
||||
vals[0] = backends[i].be_suffix[0];
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_monitorContext, vals, nvals ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_monitorContext, vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE ) {
|
||||
@ -118,8 +144,14 @@ root_dse_info(
|
||||
}
|
||||
for ( j = 0; backends[i].be_suffix[j].bv_val != NULL; j++ ) {
|
||||
vals[0] = backends[i].be_suffix[j];
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_namingContexts, vals, NULL ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_namingContexts, vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,28 +160,54 @@ root_dse_info(
|
||||
/* supportedControl */
|
||||
for ( i=0; (vals[0].bv_val = get_supported_ctrl(i)) != NULL; i++ ) {
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_supportedControl, vals, NULL ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_supportedControl, vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
/* supportedExtension */
|
||||
for ( i=0; (bv = get_supported_extop(i)) != NULL; i++ ) {
|
||||
vals[0] = *bv;
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_supportedExtension, vals, NULL ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_supportedExtension, vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LDAP_SLAPI
|
||||
/* netscape supportedExtension */
|
||||
for ( i = 0; (bv = ns_get_supported_extop(i)) != NULL; i++ ) {
|
||||
vals[0] = *bv;
|
||||
attr_merge( e, ad_supportedExtension, vals );
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_supportedExtension, vals, NULL ))
|
||||
#else
|
||||
if( attr_merge( e, ad_supportedExtension, vals ))
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
#endif /* LDAP_SLAPI */
|
||||
|
||||
/* supportedFeatures */
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_supportedFeatures,
|
||||
supportedFeatures, supportedFeatures ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
/* supportedLDAPVersion */
|
||||
for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
|
||||
@ -163,8 +221,14 @@ root_dse_info(
|
||||
snprintf(buf, sizeof buf, "%d", i);
|
||||
vals[0].bv_val = buf;
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_supportedLDAPVersion, vals, NULL ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_supportedLDAPVersion, vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
/* supportedSASLMechanism */
|
||||
@ -174,22 +238,40 @@ root_dse_info(
|
||||
for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
|
||||
vals[0].bv_val = supportedSASLMechanisms[i];
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_supportedSASLMechanisms, vals, NULL ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_supportedSASLMechanisms, vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
ldap_charray_free( supportedSASLMechanisms );
|
||||
}
|
||||
|
||||
if ( default_referral != NULL ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_ref, default_referral, NULL /* FIXME */ ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_ref, default_referral ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
if( usr_attr != NULL) {
|
||||
Attribute *a;
|
||||
for( a = usr_attr->e_attrs; a != NULL; a = a->a_next ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, a->a_desc, a->a_vals, a->a_nvals ) )
|
||||
#else
|
||||
if( attr_merge( e, a->a_desc, a->a_vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,8 +342,14 @@ int read_root_dse_file( const char *fname )
|
||||
*/
|
||||
|
||||
for(a = e->e_attrs; a != NULL; a = a->a_next) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( usr_attr, a->a_desc, a->a_vals, a->a_nvals ) )
|
||||
#else
|
||||
if( attr_merge( usr_attr, a->a_desc, a->a_vals ) )
|
||||
#endif
|
||||
{
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
entry_free( e );
|
||||
|
@ -32,6 +32,9 @@ schema_info( Entry **entry, const char **text )
|
||||
|
||||
Entry *e;
|
||||
struct berval vals[5];
|
||||
#ifdef SLAP_NVALUES
|
||||
struct berval nvals[5];
|
||||
#endif
|
||||
|
||||
e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
|
||||
if( e == NULL ) {
|
||||
@ -57,7 +60,12 @@ schema_info( Entry **entry, const char **text )
|
||||
|
||||
vals[0].bv_val = "subentry";
|
||||
vals[0].bv_len = sizeof("subentry")-1;
|
||||
if( attr_merge_one( e, ad_structuralObjectClass, vals ) ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge_one( e, ad_structuralObjectClass, vals, vals ) )
|
||||
#else
|
||||
if( attr_merge_one( e, ad_structuralObjectClass, vals ) )
|
||||
#endif
|
||||
{
|
||||
/* Out of memory, do something about it */
|
||||
entry_free( e );
|
||||
*text = "out of memory";
|
||||
@ -73,7 +81,12 @@ schema_info( Entry **entry, const char **text )
|
||||
vals[3].bv_val = "extensibleObject";
|
||||
vals[3].bv_len = sizeof("extensibleObject")-1;
|
||||
vals[4].bv_val = NULL;
|
||||
if( attr_merge( e, ad_objectClass, vals ) ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_objectClass, vals, vals ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_objectClass, vals ) )
|
||||
#endif
|
||||
{
|
||||
/* Out of memory, do something about it */
|
||||
entry_free( e );
|
||||
*text = "out of memory";
|
||||
@ -103,7 +116,17 @@ schema_info( Entry **entry, const char **text )
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
if( attr_merge_one( e, desc, vals ) ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
nvals[0].bv_val = strchr( global_schemandn.bv_val, '=' );
|
||||
nvals[0].bv_val++;
|
||||
nvals[0].bv_len = global_schemandn.bv_len -
|
||||
(nvals[0].bv_val - global_schemandn.bv_val);
|
||||
|
||||
if( attr_merge_one( e, desc, vals, nvals ) )
|
||||
#else
|
||||
if( attr_merge_one( e, desc, vals ) )
|
||||
#endif
|
||||
{
|
||||
/* Out of memory, do something about it */
|
||||
entry_free( e );
|
||||
*text = "out of memory";
|
||||
@ -134,13 +157,23 @@ schema_info( Entry **entry, const char **text )
|
||||
vals[0].bv_val = timebuf;
|
||||
vals[0].bv_len = strlen( timebuf );
|
||||
|
||||
if( attr_merge_one( e, ad_createTimestamp, vals ) ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge_one( e, ad_createTimestamp, vals, vals ) )
|
||||
#else
|
||||
if( attr_merge_one( e, ad_createTimestamp, vals ) )
|
||||
#endif
|
||||
{
|
||||
/* Out of memory, do something about it */
|
||||
entry_free( e );
|
||||
*text = "out of memory";
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
if( attr_merge_one( e, ad_modifyTimestamp, vals ) ) {
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge_one( e, ad_modifyTimestamp, vals, vals ) )
|
||||
#else
|
||||
if( attr_merge_one( e, ad_modifyTimestamp, vals ) )
|
||||
#endif
|
||||
{
|
||||
/* Out of memory, do something about it */
|
||||
entry_free( e );
|
||||
*text = "out of memory";
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "ldap_queue.h"
|
||||
|
||||
#ifdef LDAP_DEVEL
|
||||
/* #define SLAP_NVALUES 1 */
|
||||
#define SLAP_EXTENDED_SCHEMA 1
|
||||
#endif
|
||||
|
||||
@ -882,7 +883,10 @@ typedef struct slap_valuesreturnfilter {
|
||||
*/
|
||||
typedef struct slap_attr {
|
||||
AttributeDescription *a_desc;
|
||||
BerVarray a_vals;
|
||||
BerVarray a_vals; /* preserved values */
|
||||
#ifdef SLAP_NVALUES
|
||||
BerVarray a_nvals; /* normalized values */
|
||||
#endif
|
||||
struct slap_attr *a_next;
|
||||
unsigned a_flags;
|
||||
#define SLAP_ATTR_IXADD 0x1U
|
||||
@ -931,7 +935,11 @@ typedef struct slap_mod {
|
||||
int sm_op;
|
||||
AttributeDescription *sm_desc;
|
||||
struct berval sm_type;
|
||||
BerVarray sm_bvalues;
|
||||
#define sm_bvalues sm_values
|
||||
BerVarray sm_values;
|
||||
#ifdef SLAP_NVALUES
|
||||
BerVarray sm_nvalues;
|
||||
#endif
|
||||
} Modification;
|
||||
|
||||
typedef struct slap_mod_list {
|
||||
|
@ -238,8 +238,14 @@ syn_schema_info( Entry *e )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef SLAP_NVALUES
|
||||
if( attr_merge( e, ad_ldapSyntaxes, vals, NULL /* FIXME */ ) )
|
||||
#else
|
||||
if( attr_merge( e, ad_ldapSyntaxes, vals ) )
|
||||
#endif
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
return 0;
|
||||
|
@ -136,8 +136,12 @@ main( int argc, char **argv )
|
||||
}
|
||||
|
||||
vals[1].bv_val = NULL;
|
||||
attr_merge( e, slap_schema.si_ad_structuralObjectClass,
|
||||
vals );
|
||||
#ifdef SLAP_NVALUES
|
||||
attr_merge( e, slap_schema.si_ad_structuralObjectClass, vals,
|
||||
NULL /* FIXME */ );
|
||||
#else
|
||||
attr_merge( e, slap_schema.si_ad_structuralObjectClass, vals );
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check schema */
|
||||
@ -160,9 +164,22 @@ main( int argc, char **argv )
|
||||
struct berval vals[ 2 ];
|
||||
|
||||
struct berval name, timestamp, csn;
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
struct berval nvals[ 2 ];
|
||||
struct berval nname;
|
||||
#endif
|
||||
char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
|
||||
|
||||
vals[1].bv_len = 0;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
#ifdef SLAP_NVALUES
|
||||
nvals[1].bv_len = 0;
|
||||
nvals[1].bv_val = NULL;
|
||||
#endif
|
||||
|
||||
ltm = gmtime(&now);
|
||||
lutil_gentime( timebuf, sizeof(timebuf), ltm );
|
||||
|
||||
@ -175,8 +192,15 @@ main( int argc, char **argv )
|
||||
if ( be->be_rootndn.bv_len == 0 ) {
|
||||
name.bv_val = SLAPD_ANONYMOUS;
|
||||
name.bv_len = sizeof(SLAPD_ANONYMOUS) - 1;
|
||||
#ifdef SLAP_NVALUES
|
||||
nname.bv_val = SLAPD_ANONYMOUS;
|
||||
nname.bv_len = sizeof(SLAPD_ANONYMOUS) - 1;
|
||||
#endif
|
||||
} else {
|
||||
name = be->be_rootndn;
|
||||
name = be->be_rootdn;
|
||||
#ifdef SLAP_NVALUES
|
||||
nname = be->be_rootndn;
|
||||
#endif
|
||||
}
|
||||
|
||||
if( attr_find( e->e_attrs, slap_schema.si_ad_entryUUID )
|
||||
@ -184,54 +208,68 @@ main( int argc, char **argv )
|
||||
{
|
||||
vals[0].bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
|
||||
vals[0].bv_val = uuidbuf;
|
||||
vals[1].bv_len = 0;
|
||||
vals[1].bv_val = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
attr_merge( e, slap_schema.si_ad_entryUUID, vals, vals );
|
||||
#else
|
||||
attr_merge( e, slap_schema.si_ad_entryUUID, vals );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( attr_find( e->e_attrs, slap_schema.si_ad_creatorsName )
|
||||
== NULL )
|
||||
{
|
||||
vals[0] = name;
|
||||
vals[1].bv_len = 0;
|
||||
vals[1].bv_val = NULL;
|
||||
attr_merge( e, slap_schema.si_ad_creatorsName, vals);
|
||||
#ifdef SLAP_NVALUES
|
||||
nvals[0] = nname;
|
||||
attr_merge( e, slap_schema.si_ad_creatorsName, vals, nvals );
|
||||
#else
|
||||
attr_merge( e, slap_schema.si_ad_creatorsName, vals );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( attr_find( e->e_attrs, slap_schema.si_ad_modifiersName )
|
||||
== NULL )
|
||||
{
|
||||
vals[0] = name;
|
||||
vals[1].bv_len = 0;
|
||||
vals[1].bv_val = NULL;
|
||||
attr_merge( e, slap_schema.si_ad_modifiersName, vals);
|
||||
#ifdef SLAP_NVALUES
|
||||
nvals[0] = nname;
|
||||
attr_merge( e, slap_schema.si_ad_modifiersName, vals, nvals );
|
||||
#else
|
||||
attr_merge( e, slap_schema.si_ad_modifiersName, vals );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( attr_find( e->e_attrs, slap_schema.si_ad_createTimestamp )
|
||||
== NULL )
|
||||
{
|
||||
vals[0] = timestamp;
|
||||
vals[1].bv_len = 0;
|
||||
vals[1].bv_val = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
attr_merge( e, slap_schema.si_ad_createTimestamp, vals, NULL );
|
||||
#else
|
||||
attr_merge( e, slap_schema.si_ad_createTimestamp, vals );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( attr_find( e->e_attrs, slap_schema.si_ad_modifyTimestamp )
|
||||
== NULL )
|
||||
{
|
||||
vals[0] = timestamp;
|
||||
vals[1].bv_len = 0;
|
||||
vals[1].bv_val = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
attr_merge( e, slap_schema.si_ad_modifyTimestamp, vals, NULL );
|
||||
#else
|
||||
attr_merge( e, slap_schema.si_ad_modifyTimestamp, vals );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( attr_find( e->e_attrs, slap_schema.si_ad_entryCSN )
|
||||
== NULL )
|
||||
{
|
||||
vals[0] = csn;
|
||||
vals[1].bv_len = 0;
|
||||
vals[1].bv_val = NULL;
|
||||
#ifdef SLAP_NVALUES
|
||||
attr_merge( e, slap_schema.si_ad_entryCSN, vals, NULL );
|
||||
#else
|
||||
attr_merge( e, slap_schema.si_ad_entryCSN, vals );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user