return -1;
}
- attr_merge( e, ad_attributeTypes, vals );
+ if( attr_merge( e, ad_attributeTypes, vals ) )
+ return -1;
ldap_memfree( vals[0].bv_val );
}
return 0;
vals[0].bv_val = cargv[1];
vals[0].bv_len = strlen( vals[0].bv_val );
- value_add( &default_referral, vals );
+ if( value_add( &default_referral, vals ) )
+ return LDAP_OTHER;
#ifdef NEW_LOGGING
} else if ( strcasecmp( cargv[0], "logfile" ) == 0 ) {
vals[0].bv_val = cargv[1];
vals[0].bv_len = strlen( vals[0].bv_val );
- value_add( &be->be_update_refs, vals );
+ if( value_add( &be->be_update_refs, vals ) )
+ return LDAP_OTHER;
/* replication log file to which changes are appended */
} else if ( strcasecmp( cargv[0], "replogfile" ) == 0 ) {
Debug( LDAP_DEBUG_TRACE, "Merging cr [%ld] %s\n",
(long) vals[0].bv_len, vals[0].bv_val, 0 );
#endif
- attr_merge( e, ad_ditContentRules, vals );
+ if( attr_merge( e, ad_ditContentRules, vals ) )
+ return -1;
ldap_memfree( vals[0].bv_val );
}
#endif
Debug( LDAP_DEBUG_TRACE, "Merging mr [%lu] %s\n",
mr->smr_str.bv_len, mr->smr_str.bv_val, 0 );
#endif
- attr_merge_one( e, ad_matchingRules, &mr->smr_str );
+ if( attr_merge_one( e, ad_matchingRules, &mr->smr_str ) )
+ return -1;
}
return 0;
}
Debug( LDAP_DEBUG_TRACE, "Merging mru [%lu] %s\n",
mru->smru_str.bv_len, mru->smru_str.bv_val, 0 );
#endif
- attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str );
+ if( attr_merge_one( e, ad_matchingRuleUse, &mru->smru_str ) )
+ return -1;
}
return 0;
}
Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s\n",
(long) vals[0].bv_len, vals[0].bv_val, 0 );
#endif
- attr_merge( e, ad_objectClasses, vals );
+ if( attr_merge( e, ad_objectClasses, vals ) )
+ return -1;
ldap_memfree( vals[0].bv_val );
}
return 0;
if( op->o_protocol < LDAP_VERSION3 ) {
/* save the references for the result */
if( refs[0].bv_val != NULL ) {
- value_add( v2refs, refs );
+ if( value_add( v2refs, refs ) )
+ return LDAP_OTHER;
}
return 0;
}
vals[0].bv_val = "top";
vals[0].bv_len = sizeof("top")-1;
- attr_merge( e, ad_objectClass, vals );
+ if( attr_merge( e, ad_objectClass, vals ) )
+ return LDAP_OTHER;
vals[0].bv_val = "OpenLDAProotDSE";
vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
- attr_merge( e, ad_objectClass, vals );
- attr_merge( e, ad_structuralObjectClass, vals );
+ if( attr_merge( e, ad_objectClass, vals ) )
+ return LDAP_OTHER;
+ if( attr_merge( e, ad_structuralObjectClass, vals ) )
+ return LDAP_OTHER;
for ( i = 0; i < nbackends; i++ ) {
if ( backends[i].be_flags & SLAP_BFLAG_MONITOR ) {
vals[0] = backends[i].be_suffix[0];
- attr_merge( e, ad_monitorContext, vals );
+ if( attr_merge( e, ad_monitorContext, vals ) )
+ return LDAP_OTHER;
continue;
}
if ( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE ) {
}
for ( j = 0; backends[i].be_suffix[j].bv_val != NULL; j++ ) {
vals[0] = backends[i].be_suffix[j];
- attr_merge( e, ad_namingContexts, vals );
+ if( attr_merge( e, ad_namingContexts, vals ) )
+ return LDAP_OTHER;
}
}
/* supportedControl */
for ( i=0; (vals[0].bv_val = get_supported_ctrl(i)) != NULL; i++ ) {
vals[0].bv_len = strlen( vals[0].bv_val );
- attr_merge( e, ad_supportedControl, vals );
+ if( attr_merge( e, ad_supportedControl, vals ) )
+ return LDAP_OTHER;
}
/* supportedExtension */
for ( i=0; (bv = get_supported_extop(i)) != NULL; i++ ) {
vals[0] = *bv;
- attr_merge( e, ad_supportedExtension, vals );
+ if( attr_merge( e, ad_supportedExtension, vals ) )
+ return LDAP_OTHER;
}
/* supportedFeatures */
- attr_merge( e, ad_supportedFeatures, supportedFeatures );
+ if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
+ return LDAP_OTHER;
/* supportedLDAPVersion */
for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
snprintf(buf, sizeof buf, "%d", i);
vals[0].bv_val = buf;
vals[0].bv_len = strlen( vals[0].bv_val );
- attr_merge( e, ad_supportedLDAPVersion, vals );
+ if( attr_merge( e, ad_supportedLDAPVersion, vals ) )
+ return LDAP_OTHER;
}
/* supportedSASLMechanism */
for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
vals[0].bv_val = supportedSASLMechanisms[i];
vals[0].bv_len = strlen( vals[0].bv_val );
- attr_merge( e, ad_supportedSASLMechanisms, vals );
+ if( attr_merge( e, ad_supportedSASLMechanisms, vals ) )
+ return LDAP_OTHER;
}
ldap_charray_free( supportedSASLMechanisms );
}
if ( default_referral != NULL ) {
- attr_merge( e, ad_ref, default_referral );
+ if( attr_merge( e, ad_ref, default_referral ) )
+ return LDAP_OTHER;
}
if( usr_attr != NULL) {
Attribute *a;
for( a = usr_attr->e_attrs; a != NULL; a = a->a_next ) {
- attr_merge( e, a->a_desc, a->a_vals );
+ if( attr_merge( e, a->a_desc, a->a_vals ) )
+ return LDAP_OTHER;
}
}
*/
for(a = e->e_attrs; a != NULL; a = a->a_next) {
- attr_merge( usr_attr, a->a_desc, a->a_vals );
+ if( attr_merge( usr_attr, a->a_desc, a->a_vals ) )
+ return LDAP_OTHER;
}
entry_free( e );
Entry *e;
struct berval vals[5];
- e = (Entry *) ch_calloc( 1, sizeof(Entry) );
+ e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
+ if( e == NULL ) {
+ /* Out of memory, do something about it */
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "schema_info: SLAP_CALLOC failed - out of memory.\n", 0, 0,0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "schema_info: SLAP_CALLOC failed - out of memory.\n", 0, 0, 0 );
+#endif
+ *text = "out of memory";
+ return LDAP_OTHER;
+ }
e->e_attrs = NULL;
/* backend-specific schema info should be created by the
vals[0].bv_val = "subentry";
vals[0].bv_len = sizeof("subentry")-1;
- attr_merge_one( e, ad_structuralObjectClass, vals );
+ if( attr_merge_one( e, ad_structuralObjectClass, vals ) ) {
+ /* Out of memory, do something about it */
+ entry_free( e );
+ *text = "out of memory";
+ return LDAP_OTHER;
+ }
vals[0].bv_val = "top";
vals[0].bv_len = sizeof("top")-1;
vals[3].bv_val = "extensibleObject";
vals[3].bv_len = sizeof("extensibleObject")-1;
vals[4].bv_val = NULL;
- attr_merge( e, ad_objectClass, vals );
+ if( attr_merge( e, ad_objectClass, vals ) ) {
+ /* Out of memory, do something about it */
+ entry_free( e );
+ *text = "out of memory";
+ return LDAP_OTHER;
+ }
{
int rc;
return LDAP_OTHER;
}
- attr_merge_one( e, desc, vals );
+ if( attr_merge_one( e, desc, vals ) ) {
+ /* Out of memory, do something about it */
+ entry_free( e );
+ *text = "out of memory";
+ return LDAP_OTHER;
+ }
}
{
vals[0].bv_val = timebuf;
vals[0].bv_len = strlen( timebuf );
- attr_merge_one( e, ad_createTimestamp, vals );
- attr_merge_one( e, ad_modifyTimestamp, vals );
+ if( attr_merge_one( e, ad_createTimestamp, vals ) ) {
+ /* 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 ) ) {
+ /* Out of memory, do something about it */
+ entry_free( e );
+ *text = "out of memory";
+ return LDAP_OTHER;
+ }
}
if ( syn_schema_info( e )
#endif
#endif
- attr_merge( e, ad_ldapSyntaxes, vals );
+ if( attr_merge( e, ad_ldapSyntaxes, vals ) )
+ return -1;
ldap_memfree( vals[0].bv_val );
}
return 0;
; /* NULL */
if ( *vals == NULL ) {
- *vals = (BerVarray) ch_malloc( (nn + 1)
+ *vals = (BerVarray) SLAP_MALLOC( (nn + 1)
* sizeof(struct berval) );
+ if( *vals == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "value_add: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_TRACE,
+ "value_add: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#endif
+ return LBER_ERROR_MEMORY;
+ }
n = 0;
} else {
for ( n = 0; (*vals)[n].bv_val != NULL; n++ ) {
; /* Empty */
}
- *vals = (BerVarray) ch_realloc( (char *) *vals,
+ *vals = (BerVarray) SLAP_REALLOC( (char *) *vals,
(n + nn + 1) * sizeof(struct berval) );
+ if( *vals == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "value_add: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_TRACE,
+ "value_add: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#endif
+ return LBER_ERROR_MEMORY;
+ }
}
v2 = *vals + n;
BerVarray v2;
if ( *vals == NULL ) {
- *vals = (BerVarray) ch_malloc( 2 * sizeof(struct berval) );
+ *vals = (BerVarray) SLAP_MALLOC( 2 * sizeof(struct berval) );
+ if( *vals == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "value_add_one: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_TRACE,
+ "value_add_one: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#endif
+ return LBER_ERROR_MEMORY;
+ }
n = 0;
} else {
for ( n = 0; (*vals)[n].bv_val != NULL; n++ ) {
; /* Empty */
}
- *vals = (BerVarray) ch_realloc( (char *) *vals,
+ *vals = (BerVarray) SLAP_REALLOC( (char *) *vals,
(n + 2) * sizeof(struct berval) );
+ if( *vals == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "value_add_one: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_TRACE,
+ "value_add_one: SLAP_MALLOC failed.\n", 0, 0, 0 );
+#endif
+ return LBER_ERROR_MEMORY;
+ }
}
v2 = *vals + n;