return( value_add( &(*a)->a_vals, vals ) );
}
+int
+attr_merge_one(
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val )
+{
+ Attribute **a;
+
+ for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
+ if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) {
+ break;
+ }
+ }
+
+ if ( *a == NULL ) {
+ *a = (Attribute *) ch_malloc( sizeof(Attribute) );
+ (*a)->a_desc = desc;
+ (*a)->a_vals = NULL;
+ (*a)->a_next = NULL;
+ (*a)->a_flags = 0;
+ }
+
+ return( value_add_one( &(*a)->a_vals, val ) );
+}
+
/*
* attrs_find - find attribute(s) by AttributeDescription
* returns next attribute which is subtype of provided description.
#include <ac/time.h>
#include "slap.h"
+#include "lber_pvt.h"
/*
* read-only global variables or variables only written by the listener
BerVarray default_referral = NULL;
+struct berval AllUser = BER_BVC( LDAP_ALL_USER_ATTRIBUTES );
+struct berval AllOper = BER_BVC( LDAP_ALL_OPERATIONAL_ATTRIBUTES );
+struct berval NoAttrs = BER_BVC( LDAP_NO_ATTRS );
+
/*
* global variables that need mutex protection
*/
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 ));
LDAP_SLAPD_F (Attribute *) attrs_find LDAP_P((
Attribute *a, AttributeDescription *desc ));
LDAP_SLAPD_F (Attribute *) attr_find LDAP_P((
LDAP_SLAPD_F (int) value_add LDAP_P((
BerVarray *vals,
BerVarray addvals ));
+LDAP_SLAPD_F (int) value_add_one LDAP_P((
+ BerVarray *vals,
+ struct berval *addval ));
/*
* Other...
LDAP_SLAPD_V (int) use_reverse_lookup;
+LDAP_SLAPD_V (struct berval) AllUser;
+LDAP_SLAPD_V (struct berval) AllOper;
+LDAP_SLAPD_V (struct berval) NoAttrs;
+
/*
* operations
*/
}
}
-static struct berval AllUser = { sizeof(LDAP_ALL_USER_ATTRIBUTES)-1,
- LDAP_ALL_USER_ATTRIBUTES };
-static struct berval AllOper = { sizeof(LDAP_ALL_OPERATIONAL_ATTRIBUTES)-1,
- LDAP_ALL_OPERATIONAL_ATTRIBUTES };
-
int
send_search_entry(
Backend *be,
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
#endif
ber_free_buf( ber );
- return;
+ return( 1 );
}
}
if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2) {
return LDAP_SUCCESS;
}
+int
+value_add_one(
+ BerVarray *vals,
+ struct berval *addval
+)
+{
+ int n;
+ BerVarray v2;
+
+ if ( *vals == NULL ) {
+ *vals = (BerVarray) ch_malloc( 2 * sizeof(struct berval) );
+ n = 0;
+ } else {
+ for ( n = 0; (*vals)[n].bv_val != NULL; n++ ) {
+ ; /* Empty */
+ }
+ *vals = (BerVarray) ch_realloc( (char *) *vals,
+ (n + 2) * sizeof(struct berval) );
+ }
+
+ v2 = *vals + n;
+ ber_dupbv(v2, addval);
+
+ v2++;
+ v2->bv_val = NULL;
+ v2->bv_len = 0;
+
+ return LDAP_SUCCESS;
+}
+
int
value_validate(
MatchingRule *mr,