mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-27 01:59:38 -05:00
Change struct berval ** to BVarray
This commit is contained in:
parent
81e9e86861
commit
f52cc9bab5
78 changed files with 1137 additions and 1182 deletions
|
|
@ -58,7 +58,7 @@ typedef struct AciSetCookie {
|
|||
Operation *op;
|
||||
} AciSetCookie;
|
||||
|
||||
char **aci_set_gather (void *cookie, char *name, struct berval *attr);
|
||||
BVarray aci_set_gather (void *cookie, char *name, struct berval *attr);
|
||||
static int aci_match_set ( struct berval *subj, Backend *be,
|
||||
Entry *e, Connection *conn, Operation *op, int setref );
|
||||
|
||||
|
|
@ -1021,7 +1021,7 @@ acl_check_modlist(
|
|||
Modifications *mlist
|
||||
)
|
||||
{
|
||||
int i;
|
||||
struct berval *bv;
|
||||
|
||||
assert( be != NULL );
|
||||
|
||||
|
|
@ -1098,9 +1098,9 @@ acl_check_modlist(
|
|||
if ( mlist->sml_bvalues == NULL ) {
|
||||
break;
|
||||
}
|
||||
for ( i = 0; mlist->sml_bvalues[i] != NULL; i++ ) {
|
||||
for ( bv = mlist->sml_bvalues; bv->bv_val != NULL; bv++ ) {
|
||||
if ( ! access_allowed( be, conn, op, e,
|
||||
mlist->sml_desc, mlist->sml_bvalues[i], ACL_WRITE ) )
|
||||
mlist->sml_desc, bv, ACL_WRITE ) )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
|
|
@ -1116,9 +1116,9 @@ acl_check_modlist(
|
|||
}
|
||||
break;
|
||||
}
|
||||
for ( i = 0; mlist->sml_bvalues[i] != NULL; i++ ) {
|
||||
for ( bv = mlist->sml_bvalues; bv->bv_val != NULL; bv++ ) {
|
||||
if ( ! access_allowed( be, conn, op, e,
|
||||
mlist->sml_desc, mlist->sml_bvalues[i], ACL_WRITE ) )
|
||||
mlist->sml_desc, bv, ACL_WRITE ) )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
|
|
@ -1202,12 +1202,11 @@ aci_get_part(
|
|||
return(bv->bv_len);
|
||||
}
|
||||
|
||||
char **
|
||||
BVarray
|
||||
aci_set_gather (void *cookie, char *name, struct berval *attr)
|
||||
{
|
||||
AciSetCookie *cp = cookie;
|
||||
struct berval **bvals = NULL;
|
||||
char **vals = NULL;
|
||||
BVarray bvals = NULL;
|
||||
struct berval bv, ndn;
|
||||
int i;
|
||||
|
||||
|
|
@ -1224,21 +1223,10 @@ aci_set_gather (void *cookie, char *name, struct berval *attr)
|
|||
if (slap_bv2ad(attr, &desc, &text) == LDAP_SUCCESS) {
|
||||
backend_attribute(cp->be, NULL, NULL,
|
||||
cp->e, &ndn, desc, &bvals);
|
||||
if (bvals != NULL) {
|
||||
for (i = 0; bvals[i] != NULL; i++) { }
|
||||
vals = ch_calloc(i + 1, sizeof(char *));
|
||||
if (vals != NULL) {
|
||||
while (--i >= 0) {
|
||||
vals[i] = bvals[i]->bv_val;
|
||||
bvals[i]->bv_val = NULL;
|
||||
}
|
||||
}
|
||||
ber_bvecfree(bvals);
|
||||
}
|
||||
}
|
||||
free(ndn.bv_val);
|
||||
}
|
||||
return(vals);
|
||||
return(bvals);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1251,16 +1239,16 @@ aci_match_set (
|
|||
int setref
|
||||
)
|
||||
{
|
||||
char *set = NULL;
|
||||
struct berval set = { 0, NULL };
|
||||
int rc = 0;
|
||||
AciSetCookie cookie;
|
||||
|
||||
if (setref == 0) {
|
||||
set = aci_bvstrdup(subj);
|
||||
ber_dupbv( &set, subj );
|
||||
} else {
|
||||
struct berval subjdn, ndn = { 0, NULL };
|
||||
struct berval setat;
|
||||
struct berval **bvals;
|
||||
BVarray bvals;
|
||||
const char *text;
|
||||
AttributeDescription *desc = NULL;
|
||||
|
||||
|
|
@ -1289,9 +1277,15 @@ aci_match_set (
|
|||
backend_attribute(be, NULL, NULL, e,
|
||||
&ndn, desc, &bvals);
|
||||
if ( bvals != NULL ) {
|
||||
if ( bvals[0] != NULL )
|
||||
set = ch_strdup(bvals[0]->bv_val);
|
||||
ber_bvecfree(bvals);
|
||||
if ( bvals[0].bv_val != NULL ) {
|
||||
int i;
|
||||
set = bvals[0];
|
||||
bvals[0].bv_val = NULL;
|
||||
for (i=1;bvals[i].bv_val;i++);
|
||||
bvals[0].bv_val = bvals[i-1].bv_val;
|
||||
bvals[i-1].bv_val = NULL;
|
||||
}
|
||||
bvarray_free(bvals);
|
||||
}
|
||||
}
|
||||
if (ndn.bv_val)
|
||||
|
|
@ -1300,13 +1294,13 @@ aci_match_set (
|
|||
ch_free(subjdn.bv_val);
|
||||
}
|
||||
|
||||
if (set != NULL) {
|
||||
if (set.bv_val != NULL) {
|
||||
cookie.be = be;
|
||||
cookie.e = e;
|
||||
cookie.conn = conn;
|
||||
cookie.op = op;
|
||||
rc = (set_filter(aci_set_gather, &cookie, set, op->o_ndn.bv_val, e->e_ndn, NULL) > 0);
|
||||
ch_free(set);
|
||||
rc = (set_filter(aci_set_gather, &cookie, &set, op->o_ndn.bv_val, e->e_ndn, NULL) > 0);
|
||||
ch_free(set.bv_val);
|
||||
}
|
||||
return(rc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -552,13 +552,11 @@ parse_acl(
|
|||
|
||||
{
|
||||
int rc;
|
||||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
|
||||
val.bv_val = b->a_group_oc->soc_oid;
|
||||
val.bv_len = strlen(val.bv_val);
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[0].bv_val = b->a_group_oc->soc_oid;
|
||||
vals[0].bv_len = strlen(vals[0].bv_val);
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
|
||||
rc = oc_check_allowed( b->a_group_at->ad_type, vals, NULL );
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ do_add( Connection *conn, Operation *op )
|
|||
ber_tag_t tag;
|
||||
Entry *e;
|
||||
Backend *be;
|
||||
LDAPModList *modlist = NULL;
|
||||
LDAPModList **modtail = &modlist;
|
||||
Modifications *mods = NULL;
|
||||
Modifications *modlist = NULL;
|
||||
Modifications **modtail = &modlist;
|
||||
Modifications tmp;
|
||||
const char *text;
|
||||
int rc = LDAP_SUCCESS;
|
||||
int manageDSAit;
|
||||
|
|
@ -112,11 +112,9 @@ do_add( Connection *conn, Operation *op )
|
|||
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
|
||||
tag = ber_next_element( ber, &len, last ) )
|
||||
{
|
||||
LDAPModList *mod = (LDAPModList *) ch_malloc( sizeof(LDAPModList) );
|
||||
mod->ml_op = LDAP_MOD_ADD;
|
||||
mod->ml_next = NULL;
|
||||
Modifications *mod;
|
||||
|
||||
rc = ber_scanf( ber, "{a{V}}", &mod->ml_type, &mod->ml_bvalues );
|
||||
rc = ber_scanf( ber, "{o{W}}", &tmp.sml_type, &tmp.sml_bvalues );
|
||||
|
||||
if ( rc == LBER_ERROR ) {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -128,28 +126,36 @@ do_add( Connection *conn, Operation *op )
|
|||
send_ldap_disconnect( conn, op,
|
||||
LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rc = -1;
|
||||
free( mod );
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( mod->ml_bvalues == NULL ) {
|
||||
if ( tmp.sml_bvalues == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
|
||||
"do_add: conn %d no values for type %s\n",
|
||||
conn->c_connid, mod->ml_type ));
|
||||
conn->c_connid, tmp.sml_type.bv_val ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY, "no values for type %s\n",
|
||||
mod->ml_type, 0, 0 );
|
||||
tmp.sml_type.bv_val, 0, 0 );
|
||||
#endif
|
||||
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
|
||||
NULL, "no values for attribute type", NULL, NULL );
|
||||
free( mod->ml_type );
|
||||
free( mod );
|
||||
free( tmp.sml_type.bv_val );
|
||||
goto done;
|
||||
}
|
||||
mod = (Modifications *) ch_malloc( sizeof(Modifications)
|
||||
+ tmp.sml_type.bv_len + 1);
|
||||
|
||||
mod->sml_op = LDAP_MOD_ADD;
|
||||
mod->sml_next = NULL;
|
||||
mod->sml_desc = NULL;
|
||||
mod->sml_type.bv_val = (char *)(mod+1);
|
||||
strcpy(mod->sml_type.bv_val, tmp.sml_type.bv_val);
|
||||
mod->sml_type.bv_len = tmp.sml_type.bv_len;
|
||||
mod->sml_bvalues = tmp.sml_bvalues;
|
||||
|
||||
*modtail = mod;
|
||||
modtail = &mod->ml_next;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
|
||||
if ( ber_scanf( ber, /*{*/ "}") == LBER_ERROR ) {
|
||||
|
|
@ -184,7 +190,7 @@ do_add( Connection *conn, Operation *op )
|
|||
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d ADD dn=\"%s\"\n",
|
||||
op->o_connid, op->o_opid, e->e_dn, 0, 0 );
|
||||
|
||||
if( e->e_ndn == NULL || *e->e_ndn == '\0' ) {
|
||||
if( e->e_nname.bv_len == 0 ) {
|
||||
/* protocolError may be a more appropriate error */
|
||||
send_ldap_result( conn, op, rc = LDAP_ALREADY_EXISTS,
|
||||
NULL, "root DSE already exists",
|
||||
|
|
@ -209,13 +215,13 @@ do_add( Connection *conn, Operation *op )
|
|||
*/
|
||||
be = select_backend( &e->e_nname, manageDSAit, 0 );
|
||||
if ( be == NULL ) {
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
NULL, NULL, ref ? ref : default_referral, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +256,7 @@ do_add( Connection *conn, Operation *op )
|
|||
char textbuf[SLAP_TEXT_BUFLEN];
|
||||
size_t textlen = sizeof textbuf;
|
||||
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text,
|
||||
rc = slap_mods_check( modlist, update, &text,
|
||||
textbuf, textlen );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -262,15 +268,14 @@ do_add( Connection *conn, Operation *op )
|
|||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && !repl_user )
|
||||
{
|
||||
Modifications **modstail;
|
||||
for( modstail = &mods;
|
||||
*modstail != NULL;
|
||||
modstail = &(*modstail)->sml_next )
|
||||
for( modtail = &modlist;
|
||||
*modtail != NULL;
|
||||
modtail = &(*modtail)->sml_next )
|
||||
{
|
||||
assert( (*modstail)->sml_op == LDAP_MOD_ADD );
|
||||
assert( (*modstail)->sml_desc != NULL );
|
||||
assert( (*modtail)->sml_op == LDAP_MOD_ADD );
|
||||
assert( (*modtail)->sml_desc != NULL );
|
||||
}
|
||||
rc = slap_mods_opattrs( op, mods, modstail, &text,
|
||||
rc = slap_mods_opattrs( op, modlist, modtail, &text,
|
||||
textbuf, textlen );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
|
|
@ -279,7 +284,7 @@ do_add( Connection *conn, Operation *op )
|
|||
}
|
||||
}
|
||||
|
||||
rc = slap_mods2entry( mods, &e, &text );
|
||||
rc = slap_mods2entry( modlist, &e, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
NULL, text, NULL, NULL );
|
||||
|
|
@ -299,15 +304,15 @@ do_add( Connection *conn, Operation *op )
|
|||
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
} else {
|
||||
struct berval **defref = be->be_update_refs
|
||||
BVarray defref = be->be_update_refs
|
||||
? be->be_update_refs : default_referral;
|
||||
struct berval **ref = referral_rewrite( defref,
|
||||
BVarray ref = referral_rewrite( defref,
|
||||
NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
ref ? ref : defref, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
|
|
@ -325,10 +330,7 @@ done:
|
|||
free( dn.bv_val );
|
||||
|
||||
if( modlist != NULL ) {
|
||||
slap_modlist_free( modlist );
|
||||
}
|
||||
if( mods != NULL ) {
|
||||
slap_mods_free( mods );
|
||||
slap_mods_free( modlist );
|
||||
}
|
||||
if( e != NULL ) {
|
||||
entry_free( e );
|
||||
|
|
@ -358,20 +360,20 @@ static int slap_mods2entry(
|
|||
#ifdef SLURPD_FRIENDLY
|
||||
ber_len_t i,j;
|
||||
|
||||
for( i=0; attr->a_vals[i]; i++ ) {
|
||||
for( i=0; attr->a_vals[i].bv_val; i++ ) {
|
||||
/* count them */
|
||||
}
|
||||
for( j=0; mods->sml_bvalues[j]; j++ ) {
|
||||
for( j=0; mods->sml_bvalues[j].bv_val; j++ ) {
|
||||
/* count them */
|
||||
}
|
||||
j++; /* NULL */
|
||||
|
||||
attr->a_vals = ch_realloc( attr->a_vals,
|
||||
sizeof( struct berval * ) * (i+j) );
|
||||
sizeof( struct berval ) * (i+j) );
|
||||
|
||||
/* should check for duplicates */
|
||||
AC_MEMCPY( &attr->a_vals[i], mods->sml_bvalues,
|
||||
sizeof( struct berval * ) * j );
|
||||
sizeof( struct berval ) * j );
|
||||
|
||||
/* trim the mods array */
|
||||
ch_free( mods->sml_bvalues );
|
||||
|
|
|
|||
|
|
@ -402,25 +402,23 @@ at_index_print( void )
|
|||
int
|
||||
at_schema_info( Entry *e )
|
||||
{
|
||||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
AttributeType *at;
|
||||
|
||||
AttributeDescription *ad_attributeTypes = slap_schema.si_ad_attributeTypes;
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
for ( at = attr_list; at; at = at->sat_next ) {
|
||||
if ( ldap_attributetype2bv( &at->sat_atype, &val ) == NULL ) {
|
||||
if ( ldap_attributetype2bv( &at->sat_atype, vals ) == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging at [%ld] %s\n",
|
||||
(long) val.bv_len, val.bv_val, 0 );
|
||||
(long) vals[0].bv_len, vals[0].bv_val, 0 );
|
||||
#endif
|
||||
attr_merge( e, ad_attributeTypes, vals );
|
||||
ldap_memfree( val.bv_val );
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ static void at_index_print( void ) {};
|
|||
void
|
||||
attr_free( Attribute *a )
|
||||
{
|
||||
ber_bvecfree( a->a_vals );
|
||||
bvarray_free( a->a_vals );
|
||||
free( a );
|
||||
}
|
||||
|
||||
|
|
@ -55,19 +55,18 @@ Attribute *attr_dup( Attribute *a )
|
|||
if( a->a_vals != NULL ) {
|
||||
int i;
|
||||
|
||||
for( i=0; a->a_vals[i] != NULL; i++ ) {
|
||||
for( i=0; a->a_vals[i].bv_val != NULL; i++ ) {
|
||||
/* EMPTY */ ;
|
||||
}
|
||||
|
||||
tmp->a_vals = ch_malloc((i+1) * sizeof(struct berval*));
|
||||
tmp->a_vals = ch_malloc((i+1) * sizeof(struct berval));
|
||||
|
||||
for( i=0; a->a_vals[i] != NULL; i++ ) {
|
||||
tmp->a_vals[i] = ber_bvdup( a->a_vals[i] );
|
||||
|
||||
if( tmp->a_vals[i] == NULL ) break;
|
||||
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] = NULL;
|
||||
tmp->a_vals[i].bv_val = NULL;
|
||||
|
||||
} else {
|
||||
tmp->a_vals = NULL;
|
||||
|
|
@ -110,7 +109,7 @@ int
|
|||
attr_merge(
|
||||
Entry *e,
|
||||
AttributeDescription *desc,
|
||||
struct berval **vals )
|
||||
BVarray vals )
|
||||
{
|
||||
Attribute **a;
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ retry: rc = txn_abort( ltid );
|
|||
|
||||
if ( p == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -141,7 +141,7 @@ retry: rc = txn_abort( ltid );
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
ch_free( matched_dn );
|
||||
|
||||
goto done;
|
||||
|
|
@ -169,7 +169,7 @@ retry: rc = txn_abort( ltid );
|
|||
if ( is_entry_referral( p ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
char *matched_dn = ch_strdup( p->e_dn );
|
||||
struct berval **refs = is_entry_referral( p )
|
||||
BVarray refs = is_entry_referral( p )
|
||||
? get_entry_referrals( be, conn, op, p )
|
||||
: NULL;
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ retry: rc = txn_abort( ltid );
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ bdb_attribute(
|
|||
Entry *target,
|
||||
struct berval *entry_ndn,
|
||||
AttributeDescription *entry_at,
|
||||
struct berval ***vals )
|
||||
BVarray *vals )
|
||||
{
|
||||
struct bdbinfo *li = (struct bdbinfo *) be->be_private;
|
||||
Entry *e;
|
||||
int i, j, rc;
|
||||
Attribute *attr;
|
||||
struct berval **v;
|
||||
BVarray v;
|
||||
const char *entry_at_name = entry_at->ad_cname.bv_val;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -159,23 +159,23 @@ bdb_attribute(
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
for ( i = 0; attr->a_vals[i] != NULL; i++ ) {
|
||||
for ( i = 0; attr->a_vals[i].bv_val != NULL; i++ ) {
|
||||
/* count them */
|
||||
}
|
||||
|
||||
v = (struct berval **) ch_malloc( sizeof(struct berval *) * (i+1) );
|
||||
v = (BVarray) ch_malloc( sizeof(struct berval) * (i+1) );
|
||||
|
||||
for ( i=0, j=0; attr->a_vals[i] != NULL; i++ ) {
|
||||
for ( i=0, j=0; attr->a_vals[i].bv_val != NULL; i++ ) {
|
||||
if( conn != NULL
|
||||
&& op != NULL
|
||||
&& access_allowed(be, conn, op, e, entry_at,
|
||||
attr->a_vals[i], ACL_READ) == 0)
|
||||
&attr->a_vals[i], ACL_READ) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
v[j] = ber_bvdup( attr->a_vals[i] );
|
||||
ber_dupbv( &v[j], &attr->a_vals[i] );
|
||||
|
||||
if( v[j] != NULL ) j++;
|
||||
if( v[j].bv_val != NULL ) j++;
|
||||
}
|
||||
|
||||
if( j == 0 ) {
|
||||
|
|
@ -183,7 +183,8 @@ bdb_attribute(
|
|||
*vals = NULL;
|
||||
rc = LDAP_INSUFFICIENT_ACCESS;
|
||||
} else {
|
||||
v[j] = NULL;
|
||||
v[j].bv_val = NULL;
|
||||
v[j].bv_len = 0;
|
||||
*vals = v;
|
||||
rc = LDAP_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ bdb_bind(
|
|||
/* get entry with reader lock */
|
||||
if ( e == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
if( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -100,7 +100,7 @@ bdb_bind(
|
|||
NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
return rc;
|
||||
|
|
@ -123,7 +123,7 @@ bdb_bind(
|
|||
|
||||
if ( is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow bind */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
|
||||
|
|
@ -138,7 +138,7 @@ bdb_bind(
|
|||
NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ bdb_compare(
|
|||
|
||||
if ( e == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -64,7 +64,7 @@ bdb_compare(
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
goto done;
|
||||
|
|
@ -72,7 +72,7 @@ bdb_compare(
|
|||
|
||||
if (!manageDSAit && is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
|
||||
|
|
@ -81,7 +81,7 @@ bdb_compare(
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ retry: /* transaction retry */
|
|||
|
||||
if ( e == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS,
|
||||
"<=- bdb_delete: no such object %s\n",
|
||||
|
|
@ -110,7 +110,7 @@ retry: /* transaction retry */
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
rc = -1;
|
||||
|
|
@ -196,7 +196,7 @@ retry: /* transaction retry */
|
|||
if ( !manageDSAit && is_entry_referral( e ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
/* parent is an alias, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
|
|
@ -206,7 +206,7 @@ retry: /* transaction retry */
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
|
||||
rc = 1;
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ bdb_extended(
|
|||
struct berval **rspdata,
|
||||
LDAPControl *** rspctrls,
|
||||
const char** text,
|
||||
struct berval *** refs
|
||||
BVarray *refs
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ static int indexer(
|
|||
DB_TXN *txn,
|
||||
char *dbname,
|
||||
struct berval *atname,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op,
|
||||
slap_mask_t mask )
|
||||
|
|
@ -253,7 +253,7 @@ static int index_at_values(
|
|||
DB_TXN *txn,
|
||||
AttributeType *type,
|
||||
struct berval *lang,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op,
|
||||
char ** dbnamep,
|
||||
|
|
@ -334,7 +334,7 @@ int bdb_index_values(
|
|||
Backend *be,
|
||||
DB_TXN *txn,
|
||||
AttributeDescription *desc,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ retry: /* transaction retry */
|
|||
/* acquire and lock entry */
|
||||
if ( e == NULL ) {
|
||||
char* matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -248,7 +248,7 @@ retry: /* transaction retry */
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
return rc;
|
||||
|
|
@ -257,7 +257,7 @@ retry: /* transaction retry */
|
|||
if ( !manageDSAit && is_entry_referral( e ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
/* parent is an alias, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
|
|
@ -267,7 +267,7 @@ retry: /* transaction retry */
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ add_values(
|
|||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
|
||||
for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
|
||||
for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
|
||||
int rc;
|
||||
int j;
|
||||
const char *text = NULL;
|
||||
|
|
@ -376,17 +376,17 @@ add_values(
|
|||
|
||||
rc = value_normalize( mod->sm_desc,
|
||||
SLAP_MR_EQUALITY,
|
||||
mod->sm_bvalues[i],
|
||||
&mod->sm_bvalues[i],
|
||||
&asserted,
|
||||
&text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) return rc;
|
||||
|
||||
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
|
||||
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
|
||||
int match;
|
||||
int rc = value_match( &match, mod->sm_desc, mr,
|
||||
SLAP_MR_VALUE_SYNTAX_MATCH,
|
||||
a->a_vals[j], &asserted, &text );
|
||||
&a->a_vals[j], &asserted, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match == 0 ) {
|
||||
free( asserted.bv_val );
|
||||
|
|
@ -400,7 +400,7 @@ add_values(
|
|||
|
||||
/* no - add them */
|
||||
if( attr_merge( e, mod->sm_desc, mod->sm_bvalues ) != 0 ) {
|
||||
/* this should return result return of attr_merge */
|
||||
/* this should return result of attr_merge */
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
|
|
@ -443,7 +443,7 @@ delete_values(
|
|||
}
|
||||
|
||||
/* find each value to delete */
|
||||
for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
|
||||
for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
|
||||
int rc;
|
||||
const char *text = NULL;
|
||||
|
||||
|
|
@ -451,18 +451,18 @@ delete_values(
|
|||
|
||||
rc = value_normalize( mod->sm_desc,
|
||||
SLAP_MR_EQUALITY,
|
||||
mod->sm_bvalues[i],
|
||||
&mod->sm_bvalues[i],
|
||||
&asserted,
|
||||
&text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) return rc;
|
||||
|
||||
found = 0;
|
||||
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
|
||||
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
|
||||
int match;
|
||||
int rc = value_match( &match, mod->sm_desc, mr,
|
||||
SLAP_MR_VALUE_SYNTAX_MATCH,
|
||||
a->a_vals[j], &asserted, &text );
|
||||
&a->a_vals[j], &asserted, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match != 0 ) {
|
||||
continue;
|
||||
|
|
@ -472,11 +472,12 @@ delete_values(
|
|||
found = 1;
|
||||
|
||||
/* delete it */
|
||||
ber_bvfree( a->a_vals[j] );
|
||||
for ( k = j + 1; a->a_vals[k] != NULL; k++ ) {
|
||||
free( a->a_vals[j].bv_val );
|
||||
for ( k = j + 1; a->a_vals[k].bv_val != NULL; k++ ) {
|
||||
a->a_vals[k - 1] = a->a_vals[k];
|
||||
}
|
||||
a->a_vals[k - 1] = NULL;
|
||||
a->a_vals[k - 1].bv_val = NULL;
|
||||
a->a_vals[k - 1].bv_len = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -493,7 +494,7 @@ delete_values(
|
|||
}
|
||||
|
||||
/* if no values remain, delete the entire attribute */
|
||||
if ( a->a_vals[0] == NULL ) {
|
||||
if ( a->a_vals[0].bv_val == NULL ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_modify_delete: removing entire attribute %s\n",
|
||||
desc, 0, 0 );
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ retry: /* transaction retry */
|
|||
|
||||
if ( e == NULL ) {
|
||||
char* matched_dn = NULL;
|
||||
struct berval** refs;
|
||||
BVarray refs;
|
||||
|
||||
if( matched != NULL ) {
|
||||
matched_dn = strdup( matched->e_dn );
|
||||
|
|
@ -137,7 +137,7 @@ retry: /* transaction retry */
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
goto done;
|
||||
|
|
@ -146,7 +146,7 @@ retry: /* transaction retry */
|
|||
if (!manageDSAit && is_entry_referral( e ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
/* parent is an alias, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry %s is referral\n",
|
||||
|
|
@ -155,7 +155,7 @@ retry: /* transaction retry */
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -480,11 +480,11 @@ retry: /* transaction retry */
|
|||
|
||||
/* Apply modification */
|
||||
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
|
||||
+ 2 * sizeof( struct berval * ) );
|
||||
+ 2 * sizeof( struct berval ) );
|
||||
mod_tmp->sml_desc = desc;
|
||||
mod_tmp->sml_bvalues = ( struct berval ** )( mod_tmp + 1 );
|
||||
mod_tmp->sml_bvalues[ 0 ] = &new_rdn[0][ a_cnt ]->la_value;
|
||||
mod_tmp->sml_bvalues[ 1 ] = NULL;
|
||||
mod_tmp->sml_bvalues = ( BVarray )( mod_tmp + 1 );
|
||||
mod_tmp->sml_bvalues[ 0 ] = new_rdn[0][ a_cnt ]->la_value;
|
||||
mod_tmp->sml_bvalues[ 1 ].bv_val = NULL;
|
||||
mod_tmp->sml_op = SLAP_MOD_SOFTADD;
|
||||
mod_tmp->sml_next = mod;
|
||||
mod = mod_tmp;
|
||||
|
|
@ -530,11 +530,11 @@ retry: /* transaction retry */
|
|||
|
||||
/* Apply modification */
|
||||
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
|
||||
+ 2 * sizeof ( struct berval * ) );
|
||||
+ 2 * sizeof ( struct berval ) );
|
||||
mod_tmp->sml_desc = desc;
|
||||
mod_tmp->sml_bvalues = ( struct berval ** )(mod_tmp+1);
|
||||
mod_tmp->sml_bvalues[ 0 ] = &old_rdn[0][ d_cnt ]->la_value;
|
||||
mod_tmp->sml_bvalues[ 1 ] = NULL;
|
||||
mod_tmp->sml_bvalues = ( BVarray )(mod_tmp+1);
|
||||
mod_tmp->sml_bvalues[ 0 ] = old_rdn[0][ d_cnt ]->la_value;
|
||||
mod_tmp->sml_bvalues[ 1 ].bv_val = NULL;
|
||||
mod_tmp->sml_op = LDAP_MOD_DELETE;
|
||||
mod_tmp->sml_next = mod;
|
||||
mod = mod_tmp;
|
||||
|
|
|
|||
|
|
@ -24,19 +24,19 @@ bdb_exop_passwd(
|
|||
struct berval **rspdata,
|
||||
LDAPControl *** rspctrls,
|
||||
const char **text,
|
||||
struct berval *** refs )
|
||||
BVarray *refs )
|
||||
{
|
||||
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
|
||||
int rc;
|
||||
Entry *e = NULL;
|
||||
struct berval *hash = NULL;
|
||||
struct berval hash = { 0, NULL };
|
||||
DB_TXN *ltid = NULL;
|
||||
struct bdb_op_info opinfo;
|
||||
char textbuf[SLAP_TEXT_BUFLEN];
|
||||
size_t textlen = sizeof textbuf;
|
||||
|
||||
struct berval *id = NULL;
|
||||
struct berval *new = NULL;
|
||||
struct berval id = { 0, NULL };
|
||||
struct berval new = { 0, NULL };
|
||||
|
||||
struct berval *dn;
|
||||
|
||||
|
|
@ -47,36 +47,36 @@ bdb_exop_passwd(
|
|||
&id, NULL, &new, text );
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS, "==> bdb_exop_passwd: \"%s\"\n",
|
||||
id ? id->bv_val : "", 0, 0 );
|
||||
id.bv_val ? id.bv_val : "", 0, 0 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if( new == NULL || new->bv_len == 0 ) {
|
||||
new = slap_passwd_generate();
|
||||
if( new.bv_len == 0 ) {
|
||||
slap_passwd_generate(&new);
|
||||
|
||||
if( new == NULL || new->bv_len == 0 ) {
|
||||
if( new.bv_len == 0 ) {
|
||||
*text = "password generation failed.";
|
||||
rc = LDAP_OTHER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
*rspdata = slap_passwd_return( new );
|
||||
*rspdata = slap_passwd_return( &new );
|
||||
}
|
||||
|
||||
hash = slap_passwd_hash( new );
|
||||
slap_passwd_hash( &new, &hash );
|
||||
|
||||
if( hash == NULL || hash->bv_len == 0 ) {
|
||||
if( hash.bv_len == 0 ) {
|
||||
*text = "password hash failed";
|
||||
rc = LDAP_OTHER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
dn = id ? id : &op->o_dn;
|
||||
dn = id.bv_val ? &id : &op->o_dn;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: \"%s\"%s\n",
|
||||
dn->bv_val, id ? " (proxy)" : "", 0 );
|
||||
dn->bv_val, id.bv_val ? " (proxy)" : "", 0 );
|
||||
|
||||
if( dn->bv_len == 0 ) {
|
||||
*text = "No password is associated with the Root DSE";
|
||||
|
|
@ -156,10 +156,10 @@ retry: /* transaction retry */
|
|||
|
||||
{
|
||||
Modifications ml;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
|
||||
vals[0] = hash;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
ml.sml_desc = slap_schema.si_ad_userPassword;
|
||||
ml.sml_bvalues = vals;
|
||||
|
|
@ -214,16 +214,16 @@ done:
|
|||
bdb_entry_return( be, e );
|
||||
}
|
||||
|
||||
if( id != NULL ) {
|
||||
ber_bvfree( id );
|
||||
if( id.bv_val != NULL ) {
|
||||
free( id.bv_val );
|
||||
}
|
||||
|
||||
if( new != NULL ) {
|
||||
ber_bvfree( new );
|
||||
if( new.bv_val != NULL ) {
|
||||
free( new.bv_val );
|
||||
}
|
||||
|
||||
if( hash != NULL ) {
|
||||
ber_bvfree( hash );
|
||||
if( hash.bv_val != NULL ) {
|
||||
free( hash.bv_val );
|
||||
}
|
||||
|
||||
if( ltid != NULL ) {
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ bdb_index_values LDAP_P((
|
|||
Backend *be,
|
||||
DB_TXN *txn,
|
||||
AttributeDescription *desc,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op ));
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ bdb_referrals(
|
|||
|
||||
if ( e == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs = NULL;
|
||||
BVarray refs = NULL;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -80,7 +80,7 @@ bdb_referrals(
|
|||
/* send referrals */
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
} else if ( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc, matched_dn,
|
||||
matched_dn ? "bad referral object" : NULL,
|
||||
|
|
@ -93,9 +93,8 @@ bdb_referrals(
|
|||
|
||||
if ( is_entry_referral( e ) ) {
|
||||
/* entry is a referral */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
struct berval **rrefs = referral_rewrite(
|
||||
BVarray refs = get_entry_referrals( be, conn, op, e );
|
||||
BVarray rrefs = referral_rewrite(
|
||||
refs, &e->e_name, dn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
|
|
@ -105,13 +104,13 @@ bdb_referrals(
|
|||
if( rrefs != NULL ) {
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
e->e_dn, NULL, rrefs, NULL );
|
||||
ber_bvecfree( rrefs );
|
||||
bvarray_free( rrefs );
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_OTHER, e->e_dn,
|
||||
"bad referral object", NULL, NULL );
|
||||
}
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
}
|
||||
|
||||
bdb_entry_return( be, e );
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ bdb_search(
|
|||
int slimit,
|
||||
int tlimit,
|
||||
Filter *filter,
|
||||
const char *filterstr,
|
||||
struct berval *filterstr,
|
||||
AttributeName *attrs,
|
||||
int attrsonly )
|
||||
{
|
||||
|
|
@ -51,7 +51,7 @@ bdb_search(
|
|||
ID id, cursor;
|
||||
ID candidates[BDB_IDL_UM_SIZE];
|
||||
Entry *e = NULL;
|
||||
struct berval **v2refs = NULL;
|
||||
BVarray v2refs = NULL;
|
||||
Entry *matched = NULL;
|
||||
struct berval realbase = { 0, NULL };
|
||||
int nentries = 0;
|
||||
|
|
@ -93,10 +93,10 @@ bdb_search(
|
|||
|
||||
if ( e == NULL ) {
|
||||
struct berval *matched_dn = NULL;
|
||||
struct berval **refs = NULL;
|
||||
BVarray refs = NULL;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
struct berval **erefs;
|
||||
BVarray erefs;
|
||||
matched_dn = ber_bvdup( &matched->e_name );
|
||||
|
||||
erefs = is_entry_referral( matched )
|
||||
|
|
@ -109,7 +109,7 @@ bdb_search(
|
|||
if( erefs ) {
|
||||
refs = referral_rewrite( erefs, matched_dn,
|
||||
base, scope );
|
||||
ber_bvecfree( erefs );
|
||||
bvarray_free( erefs );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -120,7 +120,7 @@ bdb_search(
|
|||
send_ldap_result( conn, op, rc=LDAP_REFERRAL ,
|
||||
matched_dn ? matched_dn->bv_val : NULL, text, refs, NULL );
|
||||
|
||||
if ( refs ) ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
if ( matched_dn ) ber_bvfree( matched_dn );
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -128,9 +128,8 @@ bdb_search(
|
|||
if (!manageDSAit && e != &slap_entry_root && is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow add */
|
||||
struct berval *matched_dn = ber_bvdup( &e->e_name );
|
||||
struct berval **erefs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
struct berval **refs = NULL;
|
||||
BVarray erefs = get_entry_referrals( be, conn, op, e );
|
||||
BVarray refs = NULL;
|
||||
|
||||
bdb_entry_return( be, e );
|
||||
e = NULL;
|
||||
|
|
@ -138,7 +137,7 @@ bdb_search(
|
|||
if( erefs ) {
|
||||
refs = referral_rewrite( erefs, matched_dn,
|
||||
base, scope );
|
||||
ber_bvecfree( erefs );
|
||||
bvarray_free( erefs );
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "bdb_search: entry is referral\n",
|
||||
|
|
@ -149,7 +148,7 @@ bdb_search(
|
|||
refs ? NULL : "bad referral object",
|
||||
refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
ber_bvfree( matched_dn );
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -353,9 +352,9 @@ bdb_search(
|
|||
if ( !manageDSAit && scope != LDAP_SCOPE_BASE &&
|
||||
is_entry_referral( e ) )
|
||||
{
|
||||
struct berval **erefs = get_entry_referrals(
|
||||
BVarray erefs = get_entry_referrals(
|
||||
be, conn, op, e );
|
||||
struct berval **refs = referral_rewrite( erefs,
|
||||
BVarray refs = referral_rewrite( erefs,
|
||||
&e->e_name, NULL,
|
||||
scope == LDAP_SCOPE_SUBTREE
|
||||
? LDAP_SCOPE_SUBTREE
|
||||
|
|
@ -364,7 +363,7 @@ bdb_search(
|
|||
send_search_reference( be, conn, op,
|
||||
e, refs, NULL, &v2refs );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
|
||||
goto loop_continue;
|
||||
}
|
||||
|
|
@ -445,7 +444,7 @@ loop_continue:
|
|||
rc = 0;
|
||||
|
||||
done:
|
||||
ber_bvecfree( v2refs );
|
||||
if( v2refs ) bvarray_free( v2refs );
|
||||
if( realbase.bv_val ) ch_free( realbase.bv_val );
|
||||
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ ldap_back_add(
|
|||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
|
||||
struct ldapconn *lc;
|
||||
int i;
|
||||
int i, j;
|
||||
Attribute *a;
|
||||
LDAPMod **attrs;
|
||||
char *mapped;
|
||||
struct berval mapped;
|
||||
struct berval mdn = { 0, NULL };
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -133,8 +133,8 @@ ldap_back_add(
|
|||
}
|
||||
#endif
|
||||
|
||||
mapped = ldap_back_map(&li->at_map, a->a_desc->ad_cname.bv_val, 0);
|
||||
if (mapped == NULL) {
|
||||
ldap_back_map(&li->at_map, &a->a_desc->ad_cname, &mapped, 0);
|
||||
if (mapped.bv_val == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ ldap_back_add(
|
|||
}
|
||||
|
||||
attrs[i]->mod_op = LDAP_MOD_BVALUES;
|
||||
attrs[i]->mod_type = mapped;
|
||||
attrs[i]->mod_type = mapped.bv_val;
|
||||
|
||||
#ifdef ENABLE_REWRITE
|
||||
/*
|
||||
|
|
@ -158,14 +158,19 @@ ldap_back_add(
|
|||
}
|
||||
#endif /* ENABLE_REWRITE */
|
||||
|
||||
attrs[i]->mod_vals.modv_bvals = a->a_vals;
|
||||
for (j=0; a->a_vals[j].bv_val; j++);
|
||||
attrs[i]->mod_vals.modv_bvals = ch_malloc((j+1)*sizeof(struct berval *));
|
||||
for (j=0; a->a_vals[j].bv_val; j++)
|
||||
attrs[i]->mod_vals.modv_bvals[j] = &a->a_vals[j];
|
||||
i++;
|
||||
}
|
||||
attrs[i] = NULL;
|
||||
|
||||
ldap_add_s(lc->ld, mdn.bv_val, attrs);
|
||||
for (--i; i>= 0; --i)
|
||||
for (--i; i>= 0; --i) {
|
||||
free(attrs[i]->mod_vals.modv_bvals);
|
||||
free(attrs[i]);
|
||||
}
|
||||
free(attrs);
|
||||
if ( mdn.bv_val != e->e_dn ) {
|
||||
free( mdn.bv_val );
|
||||
|
|
|
|||
|
|
@ -27,14 +27,15 @@ ldap_back_attribute(
|
|||
Entry *target,
|
||||
struct berval *ndn,
|
||||
AttributeDescription *entry_at,
|
||||
struct berval ***vals
|
||||
BVarray *vals
|
||||
)
|
||||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
|
||||
int rc = 1, i, j, count, is_oc;
|
||||
Attribute *attr;
|
||||
struct berval **abv, **v;
|
||||
char **vs, *mapped;
|
||||
BVarray abv, v;
|
||||
struct berval mapped;
|
||||
char **vs;
|
||||
LDAPMessage *result, *e;
|
||||
char *gattr[2];
|
||||
LDAP *ld;
|
||||
|
|
@ -47,24 +48,24 @@ ldap_back_attribute(
|
|||
if ((attr = attr_find(target->e_attrs, entry_at)) == NULL)
|
||||
return(1);
|
||||
|
||||
for ( count = 0; attr->a_vals[count] != NULL; count++ ) { }
|
||||
v = (struct berval **) ch_calloc( (count + 1), sizeof(struct berval *) );
|
||||
for ( count = 0; attr->a_vals[count].bv_val != NULL; count++ ) { }
|
||||
v = (BVarray) ch_calloc( (count + 1), sizeof(struct berval) );
|
||||
if (v != NULL) {
|
||||
for ( j = 0, abv = attr->a_vals; --count >= 0; abv++ ) {
|
||||
if ( (*abv)->bv_len > 0 ) {
|
||||
v[j] = ber_bvdup( *abv );
|
||||
if( v[j] == NULL )
|
||||
if ( abv->bv_len > 0 ) {
|
||||
ber_dupbv( &v[j], abv );
|
||||
if( v[j].bv_val == NULL )
|
||||
break;
|
||||
}
|
||||
}
|
||||
v[j] = NULL;
|
||||
v[j].bv_val = NULL;
|
||||
*vals = v;
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
mapped = ldap_back_map(&li->at_map, entry_at->ad_cname.bv_val, 0);
|
||||
if (mapped == NULL)
|
||||
ldap_back_map(&li->at_map, &entry_at->ad_cname, &mapped, 0);
|
||||
if (mapped.bv_val == NULL)
|
||||
return(1);
|
||||
|
||||
if (ldap_initialize(&ld, li->url) != LDAP_SUCCESS) {
|
||||
|
|
@ -72,42 +73,39 @@ ldap_back_attribute(
|
|||
}
|
||||
|
||||
if (ldap_bind_s(ld, li->binddn, li->bindpw, LDAP_AUTH_SIMPLE) == LDAP_SUCCESS) {
|
||||
gattr[0] = mapped;
|
||||
gattr[0] = mapped.bv_val;
|
||||
gattr[1] = NULL;
|
||||
if (ldap_search_ext_s(ld, ndn->bv_val, LDAP_SCOPE_BASE, "(objectclass=*)",
|
||||
gattr, 0, NULL, NULL, LDAP_NO_LIMIT,
|
||||
LDAP_NO_LIMIT, &result) == LDAP_SUCCESS)
|
||||
{
|
||||
if ((e = ldap_first_entry(ld, result)) != NULL) {
|
||||
vs = ldap_get_values(ld, e, mapped);
|
||||
vs = ldap_get_values(ld, e, mapped.bv_val);
|
||||
if (vs != NULL) {
|
||||
for ( count = 0; vs[count] != NULL; count++ ) { }
|
||||
v = (struct berval **) ch_calloc( (count + 1), sizeof(struct berval *) );
|
||||
v = (BVarray) ch_calloc( (count + 1), sizeof(struct berval) );
|
||||
if (v == NULL) {
|
||||
ldap_value_free(vs);
|
||||
} else {
|
||||
is_oc = (strcasecmp("objectclass", mapped) == 0);
|
||||
is_oc = (strcasecmp("objectclass", mapped.bv_val) == 0);
|
||||
for ( i = 0, j = 0; i < count; i++) {
|
||||
ber_str2bv(vs[i], 0, 0, &v[j] );
|
||||
if (!is_oc) {
|
||||
v[j] = ber_bvstr( vs[i] );
|
||||
if( v[j] == NULL )
|
||||
if( v[j].bv_val == NULL )
|
||||
ch_free(vs[i]);
|
||||
else
|
||||
j++;
|
||||
} else {
|
||||
mapped = ldap_back_map(&li->oc_map, vs[i], 1);
|
||||
if (mapped) {
|
||||
mapped = ch_strdup( mapped );
|
||||
if (mapped) {
|
||||
v[j] = ber_bvstr( mapped );
|
||||
if (v[j])
|
||||
j++;
|
||||
}
|
||||
ldap_back_map(&li->oc_map, &v[j], &mapped, 1);
|
||||
if (mapped.bv_val) {
|
||||
ber_dupbv( &v[j], &mapped );
|
||||
if (v[j].bv_val)
|
||||
j++;
|
||||
}
|
||||
ch_free(vs[i]);
|
||||
}
|
||||
}
|
||||
v[j] = NULL;
|
||||
v[j].bv_val = NULL;
|
||||
*vals = v;
|
||||
rc = 0;
|
||||
ch_free(vs);
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ struct ldapmap {
|
|||
};
|
||||
|
||||
struct ldapmapping {
|
||||
char *src;
|
||||
char *dst;
|
||||
struct berval src;
|
||||
struct berval dst;
|
||||
};
|
||||
|
||||
struct ldapinfo {
|
||||
|
|
@ -101,12 +101,13 @@ extern int ldap_back_conn_dup( void *c1, void *c2 );
|
|||
int mapping_cmp (const void *, const void *);
|
||||
int mapping_dup (void *, void *);
|
||||
|
||||
char *ldap_back_map ( struct ldapmap *map, char *s, int remap );
|
||||
void ldap_back_map ( struct ldapmap *map, struct berval *s, struct berval *m,
|
||||
int remap );
|
||||
char *
|
||||
ldap_back_map_filter(
|
||||
struct ldapmap *at_map,
|
||||
struct ldapmap *oc_map,
|
||||
char *f,
|
||||
struct berval *f,
|
||||
int remap
|
||||
);
|
||||
char **
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ ldap_back_compare(
|
|||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
|
||||
struct ldapconn *lc;
|
||||
char *mapped_oc, *mapped_at;
|
||||
struct berval mapped_oc, mapped_at;
|
||||
struct berval mdn = { 0, NULL };
|
||||
|
||||
lc = ldap_back_getconn(li, conn, op);
|
||||
|
|
@ -101,15 +101,15 @@ ldap_back_compare(
|
|||
}
|
||||
#endif /* !ENABLE_REWRITE */
|
||||
|
||||
mapped_oc = ldap_back_map(&li->oc_map, ava->aa_desc->ad_cname.bv_val, 0);
|
||||
if (mapped_oc == NULL)
|
||||
ldap_back_map(&li->oc_map, &ava->aa_desc->ad_cname, &mapped_oc, 0);
|
||||
if (mapped_oc.bv_val == NULL)
|
||||
return( -1 );
|
||||
|
||||
mapped_at = ldap_back_map(&li->at_map, ava->aa_value.bv_val, 0);
|
||||
if (mapped_at == NULL)
|
||||
ldap_back_map(&li->at_map, &ava->aa_value, &mapped_at, 0);
|
||||
if (mapped_at.bv_val == NULL)
|
||||
return( -1 );
|
||||
|
||||
ldap_compare_s( lc->ld, mdn.bv_val, mapped_oc, mapped_at );
|
||||
ldap_compare_s( lc->ld, mdn.bv_val, mapped_oc.bv_val, mapped_at.bv_val );
|
||||
|
||||
if ( mdn.bv_val != dn->bv_val ) {
|
||||
free( mdn.bv_val );
|
||||
|
|
|
|||
|
|
@ -264,8 +264,8 @@ ldap_back_db_config(
|
|||
fname, lineno );
|
||||
return( 1 );
|
||||
}
|
||||
mapping->src = ch_strdup(src);
|
||||
mapping->dst = ch_strdup(dst);
|
||||
ber_str2bv( src, 0, 1, &mapping->src );
|
||||
ber_str2bv( dst, 0, 1, &mapping->dst );
|
||||
if ( *dst != 0 ) {
|
||||
mapping[1].src = mapping->dst;
|
||||
mapping[1].dst = mapping->src;
|
||||
|
|
@ -302,8 +302,9 @@ mapping_cmp ( const void *c1, const void *c2 )
|
|||
{
|
||||
struct ldapmapping *map1 = (struct ldapmapping *)c1;
|
||||
struct ldapmapping *map2 = (struct ldapmapping *)c2;
|
||||
|
||||
return ( strcasecmp(map1->src, map2->src) );
|
||||
int rc = map1->src.bv_len - map2->src.bv_len;
|
||||
if (rc) return rc;
|
||||
return ( strcasecmp(map1->src.bv_val, map2->src.bv_val) );
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -312,11 +313,12 @@ mapping_dup ( void *c1, void *c2 )
|
|||
struct ldapmapping *map1 = (struct ldapmapping *)c1;
|
||||
struct ldapmapping *map2 = (struct ldapmapping *)c2;
|
||||
|
||||
return( ( strcasecmp(map1->src, map2->src) == 0 ) ? -1 : 0 );
|
||||
return( ( strcasecmp(map1->src.bv_val, map2->src.bv_val) == 0 ) ? -1 : 0 );
|
||||
}
|
||||
|
||||
char *
|
||||
ldap_back_map ( struct ldapmap *map, char *s, int remap )
|
||||
void
|
||||
ldap_back_map ( struct ldapmap *map, struct berval *s, struct berval *bv,
|
||||
int remap )
|
||||
{
|
||||
Avlnode *tree;
|
||||
struct ldapmapping *mapping, fmapping;
|
||||
|
|
@ -326,35 +328,38 @@ ldap_back_map ( struct ldapmap *map, char *s, int remap )
|
|||
else
|
||||
tree = map->map;
|
||||
|
||||
fmapping.src = s;
|
||||
bv->bv_len = 0;
|
||||
bv->bv_val = NULL;
|
||||
fmapping.src = *s;
|
||||
mapping = (struct ldapmapping *)avl_find( tree, (caddr_t)&fmapping, mapping_cmp );
|
||||
if (mapping != NULL) {
|
||||
if ( *mapping->dst == 0 )
|
||||
return(NULL);
|
||||
return(mapping->dst);
|
||||
if ( mapping->dst.bv_val )
|
||||
*bv = mapping->dst;
|
||||
return;
|
||||
}
|
||||
|
||||
if (map->drop_missing)
|
||||
return(NULL);
|
||||
if (!map->drop_missing)
|
||||
*bv = *s;
|
||||
|
||||
return(s);
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
ldap_back_map_filter(
|
||||
struct ldapmap *at_map,
|
||||
struct ldapmap *oc_map,
|
||||
char *f,
|
||||
struct berval *f,
|
||||
int remap
|
||||
)
|
||||
{
|
||||
char *nf, *m, *p, *q, *s, c;
|
||||
char *nf, *p, *q, *s, c;
|
||||
int len, extra, plen, in_quote;
|
||||
struct berval m, tmp;
|
||||
|
||||
if (f == NULL)
|
||||
return(NULL);
|
||||
|
||||
len = strlen(f);
|
||||
len = f->bv_len;
|
||||
extra = len;
|
||||
len *= 2;
|
||||
nf = ch_malloc( len + 1 );
|
||||
|
|
@ -368,7 +373,7 @@ ldap_back_map_filter(
|
|||
s = nf;
|
||||
q = NULL;
|
||||
in_quote = 0;
|
||||
for (p = f; (c = *p); p++) {
|
||||
for (p = f->bv_val; (c = *p); p++) {
|
||||
if (c == '"') {
|
||||
in_quote = !in_quote;
|
||||
if (q != NULL) {
|
||||
|
|
@ -392,14 +397,16 @@ ldap_back_map_filter(
|
|||
} else {
|
||||
if (q != NULL) {
|
||||
*p = 0;
|
||||
m = ldap_back_map(at_map, q, remap);
|
||||
if (m == NULL)
|
||||
m = ldap_back_map(oc_map, q, remap);
|
||||
if (m == NULL) {
|
||||
m = q;
|
||||
tmp.bv_len = p - q;
|
||||
tmp.bv_val = q;
|
||||
ldap_back_map(at_map, &tmp, &m, remap);
|
||||
if (m.bv_val == NULL)
|
||||
ldap_back_map(oc_map, &tmp, &m, remap);
|
||||
if (m.bv_val == NULL) {
|
||||
m = tmp;
|
||||
}
|
||||
extra += p - q;
|
||||
plen = strlen(m);
|
||||
plen = m.bv_len;
|
||||
extra -= plen;
|
||||
if (extra < 0) {
|
||||
while (extra < 0) {
|
||||
|
|
@ -414,7 +421,7 @@ ldap_back_map_filter(
|
|||
}
|
||||
s += (long)nf;
|
||||
}
|
||||
memcpy(s, m, plen);
|
||||
memcpy(s, m.bv_val, plen);
|
||||
s += plen;
|
||||
*p = c;
|
||||
q = NULL;
|
||||
|
|
@ -434,8 +441,9 @@ ldap_back_map_attrs(
|
|||
)
|
||||
{
|
||||
int i;
|
||||
char *mapped, **na;
|
||||
char **na;
|
||||
AttributeName *an;
|
||||
struct berval mapped;
|
||||
|
||||
if (a == NULL)
|
||||
return(NULL);
|
||||
|
|
@ -449,9 +457,9 @@ ldap_back_map_attrs(
|
|||
return(NULL);
|
||||
|
||||
for (i = 0, an=a; an; an=an->an_next) {
|
||||
mapped = ldap_back_map(at_map, an->an_name.bv_val, remap);
|
||||
if (mapped != NULL) {
|
||||
na[i] = mapped;
|
||||
ldap_back_map(at_map, &an->an_name, &mapped, remap);
|
||||
if (mapped.bv_val != NULL) {
|
||||
na[i] = mapped.bv_val;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,14 +43,16 @@ ldap_back_group(
|
|||
struct berval mop_ndn = { 0, NULL }, mgr_ndn = { 0, NULL };
|
||||
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
char *group_oc_name = NULL;
|
||||
char *group_at_name = group_at->ad_cname.bv_val;
|
||||
struct berval group_oc_name = {0, NULL};
|
||||
struct berval group_at_name = group_at->ad_cname;
|
||||
|
||||
if( group_oc->soc_names && group_oc->soc_names[0] ) {
|
||||
group_oc_name = group_oc->soc_names[0];
|
||||
group_oc_name.bv_val = group_oc->soc_names[0];
|
||||
} else {
|
||||
group_oc_name = group_oc->soc_oid;
|
||||
group_oc_name.bv_val = group_oc->soc_oid;
|
||||
}
|
||||
if (group_oc_name.bv_val)
|
||||
group_oc_name.bv_len = strlen(group_oc_name.bv_val);
|
||||
|
||||
if (target != NULL && target->e_nname.bv_len == gr_ndn->bv_len &&
|
||||
strcmp(target->e_nname.bv_val, gr_ndn->bv_val) == 0) {
|
||||
|
|
@ -152,16 +154,16 @@ ldap_back_group(
|
|||
}
|
||||
#endif /* !ENABLE_REWRITE */
|
||||
|
||||
group_oc_name = ldap_back_map(&li->oc_map, group_oc_name, 0);
|
||||
if (group_oc_name == NULL)
|
||||
ldap_back_map(&li->oc_map, &group_oc_name, &group_oc_name, 0);
|
||||
if (group_oc_name.bv_val == NULL)
|
||||
goto cleanup;
|
||||
group_at_name = ldap_back_map(&li->at_map, group_at_name, 0);
|
||||
if (group_at_name == NULL)
|
||||
ldap_back_map(&li->at_map, &group_at_name, &group_at_name, 0);
|
||||
if (group_at_name.bv_val == NULL)
|
||||
goto cleanup;
|
||||
|
||||
filter = ch_malloc(sizeof("(&(objectclass=)(=))")
|
||||
+ strlen(group_oc_name)
|
||||
+ strlen(group_at_name)
|
||||
+ group_oc_name.bv_len
|
||||
+ group_at_name.bv_len
|
||||
+ mop_ndn.bv_len + 1);
|
||||
if (filter == NULL)
|
||||
goto cleanup;
|
||||
|
|
@ -176,9 +178,9 @@ ldap_back_group(
|
|||
}
|
||||
|
||||
ptr = slap_strcopy(filter, "(&(objectclass=");
|
||||
ptr = slap_strcopy(ptr, group_oc_name);
|
||||
ptr = slap_strcopy(ptr, group_oc_name.bv_val);
|
||||
ptr = slap_strcopy(ptr, ")(");
|
||||
ptr = slap_strcopy(ptr, group_at_name);
|
||||
ptr = slap_strcopy(ptr, group_at_name.bv_val);
|
||||
ptr = slap_strcopy(ptr, "=");
|
||||
ptr = slap_strcopy(ptr, mop_ndn.bv_val);
|
||||
strcpy(ptr, "))");
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ ldap_back_db_init(
|
|||
|
||||
mapping = (struct ldapmapping *)ch_calloc( 2, sizeof(struct ldapmapping) );
|
||||
if ( mapping != NULL ) {
|
||||
mapping->src = ch_strdup("objectclass");
|
||||
mapping->dst = ch_strdup("objectclass");
|
||||
ber_str2bv( "objectclass", sizeof("objectclass")-1, 1, &mapping->src);
|
||||
ber_dupbv( &mapping->dst, &mapping->src );
|
||||
mapping[1].src = mapping->src;
|
||||
mapping[1].dst = mapping->dst;
|
||||
|
||||
|
|
@ -151,8 +151,8 @@ conn_free(
|
|||
void
|
||||
mapping_free ( struct ldapmapping *mapping )
|
||||
{
|
||||
ch_free( mapping->src );
|
||||
ch_free( mapping->dst );
|
||||
ch_free( mapping->src.bv_val );
|
||||
ch_free( mapping->dst.bv_val );
|
||||
ch_free( mapping );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ ldap_back_modify(
|
|||
LDAPMod **modv = NULL;
|
||||
LDAPMod *mods;
|
||||
Modifications *ml;
|
||||
int i;
|
||||
char *mapped;
|
||||
int i, j;
|
||||
struct berval mapped;
|
||||
struct berval mdn = { 0, NULL };
|
||||
|
||||
lc = ldap_back_getconn(li, conn, op);
|
||||
|
|
@ -114,14 +114,14 @@ ldap_back_modify(
|
|||
}
|
||||
|
||||
for (i=0, ml=modlist; ml; ml=ml->sml_next) {
|
||||
mapped = ldap_back_map(&li->at_map, ml->sml_desc->ad_cname.bv_val, 0);
|
||||
if (mapped == NULL) {
|
||||
ldap_back_map(&li->at_map, &ml->sml_desc->ad_cname, &mapped, 0);
|
||||
if (mapped.bv_val == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
modv[i] = &mods[i];
|
||||
mods[i].mod_op = ml->sml_op | LDAP_MOD_BVALUES;
|
||||
mods[i].mod_type = mapped;
|
||||
mods[i].mod_type = mapped.bv_val;
|
||||
|
||||
#ifdef ENABLE_REWRITE
|
||||
/*
|
||||
|
|
@ -136,7 +136,12 @@ ldap_back_modify(
|
|||
}
|
||||
#endif /* ENABLE_REWRITE */
|
||||
|
||||
mods[i].mod_bvalues = ml->sml_bvalues;
|
||||
for (j = 0; ml->sml_bvalues[j].bv_val; j++);
|
||||
mods[i].mod_bvalues = (struct berval **)ch_malloc((j+1) *
|
||||
sizeof(struct berval *));
|
||||
for (j = 0; ml->sml_bvalues[j].bv_val; j++)
|
||||
mods[i].mod_bvalues[j] = &ml->sml_bvalues[j];
|
||||
mods[i].mod_bvalues[j] = NULL;
|
||||
i++;
|
||||
}
|
||||
modv[i] = 0;
|
||||
|
|
@ -151,6 +156,8 @@ cleanup:;
|
|||
#ifdef ENABLE_REWRITE
|
||||
}
|
||||
#endif /* ENABLE_REWRITE */
|
||||
for (i=0; modv[i]; i++)
|
||||
free(modv[i]->mod_bvalues);
|
||||
free(mods);
|
||||
free(modv);
|
||||
return( ldap_back_op_result( lc, op ));
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "slap.h"
|
||||
#include "back-ldap.h"
|
||||
#include "../../../libraries/libldap/ldap-int.h"
|
||||
|
||||
static void ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
|
||||
LDAPMessage *e, AttributeName *attrs, int attrsonly );
|
||||
|
|
@ -61,7 +62,7 @@ ldap_back_search(
|
|||
int slimit,
|
||||
int tlimit,
|
||||
Filter *filter,
|
||||
const char *filterstr,
|
||||
struct berval *filterstr,
|
||||
AttributeName *attrs,
|
||||
int attrsonly
|
||||
)
|
||||
|
|
@ -75,7 +76,8 @@ ldap_back_search(
|
|||
char *mapped_filter = NULL, **mapped_attrs = NULL;
|
||||
struct berval mbase;
|
||||
#ifdef ENABLE_REWRITE
|
||||
char *mfilter = NULL, *mmatch = NULL;
|
||||
char *mmatch = NULL;
|
||||
struct berval mfilter = { 0, NULL };
|
||||
#endif /* ENABLE_REWRITE */
|
||||
struct slap_limits_set *limit = NULL;
|
||||
int isroot = 0;
|
||||
|
|
@ -176,22 +178,22 @@ ldap_back_search(
|
|||
* Rewrite the search filter, if required
|
||||
*/
|
||||
switch ( rewrite_session( li->rwinfo, "searchFilter",
|
||||
filterstr, conn, &mfilter ) ) {
|
||||
filterstr->bv_val, conn, &mfilter.bv_val ) ) {
|
||||
case REWRITE_REGEXEC_OK:
|
||||
if ( mfilter == NULL || mfilter[0] == '\0') {
|
||||
if ( mfilter != NULL ) {
|
||||
free( mfilter );
|
||||
if ( mfilter.bv_val == NULL || mfilter.bv_val[0] == '\0') {
|
||||
if ( mfilter.bv_val != NULL ) {
|
||||
free( mfilter.bv_val );
|
||||
}
|
||||
mfilter = ( char * )filterstr;
|
||||
mfilter = *filterstr;
|
||||
}
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
|
||||
"[rw] searchFilter: \"%s\" -> \"%s\"\n",
|
||||
filterstr, mfilter ));
|
||||
filterstr->bv_val, mfilter.bv_val ));
|
||||
#else /* !NEW_LOGGING */
|
||||
Debug( LDAP_DEBUG_ARGS,
|
||||
"rw> searchFilter: \"%s\" -> \"%s\"\n%s",
|
||||
filterstr, mfilter, "" );
|
||||
filterstr->bv_val, mfilter.bv_val, "" );
|
||||
#endif /* !NEW_LOGGING */
|
||||
break;
|
||||
|
||||
|
|
@ -208,16 +210,16 @@ ldap_back_search(
|
|||
|
||||
mapped_filter = ldap_back_map_filter(&li->at_map, &li->oc_map,
|
||||
#ifdef ENABLE_REWRITE
|
||||
(char *)mfilter,
|
||||
&mfilter,
|
||||
#else /* !ENABLE_REWRITE */
|
||||
(char *)filterstr,
|
||||
filterstr,
|
||||
#endif /* !ENABLE_REWRITE */
|
||||
0);
|
||||
if ( mapped_filter == NULL ) {
|
||||
#ifdef ENABLE_REWRITE
|
||||
mapped_filter = (char *)mfilter;
|
||||
mapped_filter = mfilter.bv_val;
|
||||
#else /* !ENABLE_REWRITE */
|
||||
mapped_filter = (char *)filterstr;
|
||||
mapped_filter = filterstr->bv_val;
|
||||
#endif /* !ENABLE_REWRITE */
|
||||
}
|
||||
|
||||
|
|
@ -341,14 +343,14 @@ finish:;
|
|||
free( mapped_attrs );
|
||||
}
|
||||
#ifdef ENABLE_REWRITE
|
||||
if ( mapped_filter != mfilter ) {
|
||||
if ( mapped_filter != mfilter.bv_val ) {
|
||||
free( mapped_filter );
|
||||
}
|
||||
if ( mfilter != filterstr ) {
|
||||
free( mfilter );
|
||||
if ( mfilter.bv_val != filterstr.bv_val ) {
|
||||
free( mfilter.bv_val );
|
||||
}
|
||||
#else /* !ENABLE_REWRITE */
|
||||
if ( mapped_filter != filterstr ) {
|
||||
if ( mapped_filter != filterstr->bv_val ) {
|
||||
free( mapped_filter );
|
||||
}
|
||||
#endif /* !ENABLE_REWRITE */
|
||||
|
|
@ -371,44 +373,41 @@ ldap_send_entry(
|
|||
)
|
||||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
|
||||
char *a, *mapped;
|
||||
struct berval a, mapped;
|
||||
Entry ent;
|
||||
BerElement *ber = NULL;
|
||||
BerElement ber = *e->lm_ber;
|
||||
Attribute *attr, **attrp;
|
||||
struct berval *dummy = NULL;
|
||||
struct berval dummy = { 0, NULL };
|
||||
struct berval *bv, bdn;
|
||||
const char *text;
|
||||
|
||||
#ifdef ENABLE_REWRITE
|
||||
char *dn;
|
||||
|
||||
dn = ldap_get_dn(lc->ld, e);
|
||||
if ( dn == NULL ) {
|
||||
if ( ber_scanf( &ber, "{o", &bdn ) == LBER_ERROR ) {
|
||||
return;
|
||||
}
|
||||
#ifdef ENABLE_REWRITE
|
||||
|
||||
/*
|
||||
* Rewrite the dn of the result, if needed
|
||||
*/
|
||||
switch ( rewrite_session( li->rwinfo, "searchResult",
|
||||
dn, lc->conn, &ent.e_name.bv_val ) ) {
|
||||
dn.bv_val, lc->conn, &ent.e_name.bv_val ) ) {
|
||||
case REWRITE_REGEXEC_OK:
|
||||
if ( ent.e_name.bv_val == NULL ) {
|
||||
ent.e_name.bv_val = dn;
|
||||
ent.e_name = bdn;
|
||||
|
||||
} else {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
|
||||
"[rw] searchResult: \"%s\""
|
||||
" -> \"%s\"\n", dn, ent.e_dn ));
|
||||
" -> \"%s\"\n", dn.bv_val, ent.e_dn ));
|
||||
#else /* !NEW_LOGGING */
|
||||
Debug( LDAP_DEBUG_ARGS, "rw> searchResult: \"%s\""
|
||||
" -> \"%s\"\n%s", dn, ent.e_dn, "" );
|
||||
" -> \"%s\"\n%s", dn.bv_val, ent.e_dn, "" );
|
||||
#endif /* !NEW_LOGGING */
|
||||
free( dn );
|
||||
dn = NULL;
|
||||
free( dn.bv_val );
|
||||
dn.bv_val = NULL;
|
||||
ent.e_name.bv_len = strlen( ent.e_name.bv_val );
|
||||
}
|
||||
ent.e_name.bv_len = strlen( ent.e_name.bv_val );
|
||||
break;
|
||||
|
||||
case REWRITE_REGEXEC_ERR:
|
||||
|
|
@ -417,7 +416,6 @@ ldap_send_entry(
|
|||
return;
|
||||
}
|
||||
#else /* !ENABLE_REWRITE */
|
||||
ber_str2bv( ldap_get_dn(lc->ld, e), 0, 0, &bdn );
|
||||
ldap_back_dn_massage( li, &bdn, &ent.e_name, 0, 0 );
|
||||
#endif /* !ENABLE_REWRITE */
|
||||
|
||||
|
|
@ -427,54 +425,50 @@ ldap_send_entry(
|
|||
ent.e_private = 0;
|
||||
attrp = &ent.e_attrs;
|
||||
|
||||
for ( a = ldap_first_attribute(lc->ld, e, &ber);
|
||||
a != NULL;
|
||||
a = ldap_next_attribute(lc->ld, e, ber))
|
||||
{
|
||||
mapped = ldap_back_map(&li->at_map, a, 1);
|
||||
if (mapped == NULL)
|
||||
while ( ber_scanf( &ber, "{{o", &a ) != LBER_ERROR ) {
|
||||
ldap_back_map(&li->at_map, &a, &mapped, 1);
|
||||
if (mapped.bv_val == NULL)
|
||||
continue;
|
||||
attr = (Attribute *)ch_malloc( sizeof(Attribute) );
|
||||
if (attr == NULL)
|
||||
continue;
|
||||
attr->a_next = 0;
|
||||
attr->a_desc = NULL;
|
||||
if (slap_str2ad(mapped, &attr->a_desc, &text) != LDAP_SUCCESS) {
|
||||
if (slap_str2undef_ad(mapped, &attr->a_desc, &text)
|
||||
if (slap_bv2ad(&mapped, &attr->a_desc, &text) != LDAP_SUCCESS) {
|
||||
if (slap_bv2undef_ad(&mapped, &attr->a_desc, &text)
|
||||
!= LDAP_SUCCESS) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
|
||||
"slap_str2undef_ad(%s): "
|
||||
"%s\n", mapped, text ));
|
||||
"%s\n", mapped.bv_val, text ));
|
||||
#else /* !NEW_LOGGING */
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"slap_str2undef_ad(%s): "
|
||||
"%s\n%s", mapped, text, "" );
|
||||
"%s\n%s", mapped.bv_val, text, "" );
|
||||
#endif /* !NEW_LOGGING */
|
||||
|
||||
ch_free(attr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
attr->a_vals = ldap_get_values_len(lc->ld, e, a);
|
||||
if (!attr->a_vals) {
|
||||
if (ber_scanf( &ber, "[W]", &attr->a_vals ) == LBER_ERROR ) {
|
||||
attr->a_vals = &dummy;
|
||||
} else if ( strcasecmp( mapped, "objectclass" ) == 0 ) {
|
||||
} else if ( strcasecmp( mapped.bv_val, "objectclass" ) == 0 ) {
|
||||
int i, last;
|
||||
for ( last = 0; attr->a_vals[last]; last++ ) ;
|
||||
for ( i = 0; ( bv = attr->a_vals[i] ); i++ ) {
|
||||
mapped = ldap_back_map(&li->oc_map, bv->bv_val, 1);
|
||||
if (mapped == NULL) {
|
||||
ber_bvfree(attr->a_vals[i]);
|
||||
attr->a_vals[i] = NULL;
|
||||
for ( last = 0; attr->a_vals[last].bv_val; last++ ) ;
|
||||
for ( i = 0; ( bv = &attr->a_vals[i] ); i++ ) {
|
||||
ldap_back_map(&li->oc_map, bv, &mapped, 1);
|
||||
if (mapped.bv_val == NULL) {
|
||||
free(attr->a_vals[i].bv_val);
|
||||
attr->a_vals[i].bv_val = NULL;
|
||||
if (--last < 0)
|
||||
break;
|
||||
attr->a_vals[i] = attr->a_vals[last];
|
||||
attr->a_vals[last] = NULL;
|
||||
attr->a_vals[last].bv_val = NULL;
|
||||
i--;
|
||||
} else if ( mapped != bv->bv_val ) {
|
||||
} else if ( mapped.bv_val != bv->bv_val ) {
|
||||
ch_free(bv->bv_val);
|
||||
ber_str2bv( mapped, 0, 1, bv );
|
||||
ber_dupbv( bv, &mapped );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +487,7 @@ ldap_send_entry(
|
|||
} else if ( strcmp( attr->a_desc->ad_type->sat_syntax->ssyn_oid,
|
||||
SLAPD_DN_SYNTAX ) == 0 ) {
|
||||
int i;
|
||||
for ( i = 0; ( bv = attr->a_vals[ i ] ); i++ ) {
|
||||
for ( i = 0; ( bv = &attr->a_vals[ i ] ); i++ ) {
|
||||
char *newval;
|
||||
|
||||
switch ( rewrite_session( li->rwinfo,
|
||||
|
|
@ -548,11 +542,9 @@ ldap_send_entry(
|
|||
attr = ent.e_attrs;
|
||||
ent.e_attrs = attr->a_next;
|
||||
if (attr->a_vals != &dummy)
|
||||
ber_bvecfree(attr->a_vals);
|
||||
bvarray_free(attr->a_vals);
|
||||
free(attr);
|
||||
}
|
||||
if (ber)
|
||||
ber_free(ber,0);
|
||||
|
||||
if ( ent.e_dn )
|
||||
free( ent.e_dn );
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ ldbm_back_add(
|
|||
/* get parent with writer lock */
|
||||
if ( (p = dn2entry_w( be, &pdn, &matched )) == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ ldbm_back_add(
|
|||
refs == NULL ? "parent does not exist" : "parent is referral",
|
||||
refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
return -1;
|
||||
|
|
@ -176,7 +176,7 @@ ldbm_back_add(
|
|||
if ( is_entry_referral( p ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
char *matched_dn = ch_strdup( p->e_dn );
|
||||
struct berval **refs = is_entry_referral( p )
|
||||
BVarray refs = is_entry_referral( p )
|
||||
? get_entry_referrals( be, conn, op, p )
|
||||
: NULL;
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ ldbm_back_add(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ static int get_alias_dn(
|
|||
/*
|
||||
* aliasedObjectName should be SINGLE-VALUED with a single value.
|
||||
*/
|
||||
if ( a->a_vals[0] == NULL || a->a_vals[0]->bv_val == NULL ) {
|
||||
if ( a->a_vals[0].bv_val == NULL ) {
|
||||
/*
|
||||
* there was an aliasedobjectname defined but no data.
|
||||
*/
|
||||
|
|
@ -237,13 +237,13 @@ static int get_alias_dn(
|
|||
return -1;
|
||||
}
|
||||
|
||||
if( a->a_vals[1] != NULL ) {
|
||||
if( a->a_vals[1].bv_val != NULL ) {
|
||||
*err = LDAP_ALIAS_PROBLEM;
|
||||
*errmsg = "alias has multivalued aliasedObjectName";
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = dnNormalize2( NULL, a->a_vals[0], ndn );
|
||||
rc = dnNormalize2( NULL, &a->a_vals[0], ndn );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
*err = LDAP_ALIAS_PROBLEM;
|
||||
*errmsg = "alias aliasedObjectName value is invalid";
|
||||
|
|
|
|||
|
|
@ -28,14 +28,15 @@ ldbm_back_attribute(
|
|||
Entry *target,
|
||||
struct berval *entry_ndn,
|
||||
AttributeDescription *entry_at,
|
||||
struct berval ***vals )
|
||||
BVarray *vals )
|
||||
{
|
||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||
Entry *e;
|
||||
int i, j, rc;
|
||||
Attribute *attr;
|
||||
struct berval **v;
|
||||
BVarray v;
|
||||
const char *entry_at_name = entry_at->ad_cname.bv_val;
|
||||
struct berval *iv, *jv;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_ARGS,
|
||||
|
|
@ -157,31 +158,31 @@ ldbm_back_attribute(
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
for ( i = 0; attr->a_vals[i] != NULL; i++ ) {
|
||||
for ( i = 0; attr->a_vals[i].bv_val != NULL; i++ ) {
|
||||
/* count them */
|
||||
}
|
||||
|
||||
v = (struct berval **) ch_malloc( sizeof(struct berval *) * (i+1) );
|
||||
v = (BVarray) ch_malloc( sizeof(struct berval) * (i+1) );
|
||||
|
||||
for ( i=0, j=0; attr->a_vals[i] != NULL; i++ ) {
|
||||
for ( iv=attr->a_vals, jv=v; iv->bv_val; iv++ ) {
|
||||
if( conn != NULL
|
||||
&& op != NULL
|
||||
&& access_allowed(be, conn, op, e, entry_at,
|
||||
attr->a_vals[i], ACL_READ) == 0)
|
||||
iv, ACL_READ) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
v[j] = ber_bvdup( attr->a_vals[i] );
|
||||
ber_dupbv( jv, iv );
|
||||
|
||||
if( v[j] != NULL ) j++;
|
||||
if( jv->bv_val != NULL ) jv++;
|
||||
}
|
||||
|
||||
if( j == 0 ) {
|
||||
if( jv == v ) {
|
||||
ch_free( v );
|
||||
*vals = NULL;
|
||||
rc = LDAP_INSUFFICIENT_ACCESS;
|
||||
} else {
|
||||
v[j] = NULL;
|
||||
jv->bv_val = NULL;
|
||||
*vals = v;
|
||||
rc = LDAP_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ ldbm_back_bind(
|
|||
/* get entry with reader lock */
|
||||
if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs = NULL;
|
||||
BVarray refs = NULL;
|
||||
|
||||
if( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -97,7 +97,7 @@ ldbm_back_bind(
|
|||
NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
if ( refs ) ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
if ( matched_dn ) free( matched_dn );
|
||||
return( rc );
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ ldbm_back_bind(
|
|||
|
||||
if ( is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow bind */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -147,7 +147,7 @@ ldbm_back_bind(
|
|||
NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
|
||||
rc = 1;
|
||||
goto return_results;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ ldbm_back_compare(
|
|||
/* get entry with reader lock */
|
||||
if ( (e = dn2entry_r( be, ndn, &matched )) == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs = NULL;
|
||||
BVarray refs = NULL;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -52,7 +52,7 @@ ldbm_back_compare(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
return( 1 );
|
||||
|
|
@ -60,7 +60,7 @@ ldbm_back_compare(
|
|||
|
||||
if (!manageDSAit && is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -75,7 +75,7 @@ ldbm_back_compare(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if (refs ) bvarray_free( refs );
|
||||
|
||||
rc = 1;
|
||||
goto return_results;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ ldbm_back_delete(
|
|||
/* get entry with writer lock */
|
||||
if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
|
||||
|
|
@ -69,7 +69,7 @@ ldbm_back_delete(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
return( -1 );
|
||||
|
|
@ -78,7 +78,7 @@ ldbm_back_delete(
|
|||
if ( !manageDSAit && is_entry_referral( e ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
/* parent is an alias, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -93,7 +93,7 @@ ldbm_back_delete(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
|
||||
rc = 1;
|
||||
goto return_results;
|
||||
|
|
|
|||
|
|
@ -227,8 +227,9 @@ dn2idl(
|
|||
*idlp = NULL;
|
||||
|
||||
if ( prefix == DN_SUBTREE_PREFIX && be_issuffix(be, dn->bv_val) ) {
|
||||
*idlp = ch_malloc( sizeof(ID) );
|
||||
**idlp = ID_BLOCK_ALLIDS_VALUE;
|
||||
*idlp = ch_malloc( 2*sizeof(ID) );
|
||||
(*idlp)[0] = ID_BLOCK_ALLIDS_VALUE;
|
||||
(*idlp)[1] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ ldbm_back_extended(
|
|||
struct berval **rspdata,
|
||||
LDAPControl *** rspctrls,
|
||||
const char** text,
|
||||
struct berval *** refs
|
||||
BVarray *refs
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ static int indexer(
|
|||
Backend *be,
|
||||
char *dbname,
|
||||
struct berval *atname,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op,
|
||||
slap_mask_t mask )
|
||||
|
|
@ -222,7 +222,7 @@ static int index_at_values(
|
|||
Backend *be,
|
||||
AttributeType *type,
|
||||
struct berval *lang,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op,
|
||||
char ** dbnamep,
|
||||
|
|
@ -292,7 +292,7 @@ static int index_at_values(
|
|||
int index_values(
|
||||
Backend *be,
|
||||
AttributeDescription *desc,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ ldbm_back_modify(
|
|||
/* acquire and lock entry */
|
||||
if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) {
|
||||
char* matched_dn = NULL;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -286,7 +286,7 @@ ldbm_back_modify(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
return( -1 );
|
||||
|
|
@ -295,7 +295,7 @@ ldbm_back_modify(
|
|||
if ( !manageDSAit && is_entry_referral( e ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
/* parent is an alias, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -310,7 +310,7 @@ ldbm_back_modify(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
|
||||
goto error_return;
|
||||
}
|
||||
|
|
@ -369,7 +369,7 @@ add_values(
|
|||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
|
||||
for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
|
||||
for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
|
||||
int rc;
|
||||
int j;
|
||||
const char *text = NULL;
|
||||
|
|
@ -377,17 +377,17 @@ add_values(
|
|||
|
||||
rc = value_normalize( mod->sm_desc,
|
||||
SLAP_MR_EQUALITY,
|
||||
mod->sm_bvalues[i],
|
||||
&mod->sm_bvalues[i],
|
||||
&asserted,
|
||||
&text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) return rc;
|
||||
|
||||
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
|
||||
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
|
||||
int match;
|
||||
int rc = value_match( &match, mod->sm_desc, mr,
|
||||
SLAP_MR_VALUE_SYNTAX_MATCH,
|
||||
a->a_vals[j], &asserted, &text );
|
||||
&a->a_vals[j], &asserted, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match == 0 ) {
|
||||
free( asserted.bv_val );
|
||||
|
|
@ -455,7 +455,7 @@ delete_values(
|
|||
}
|
||||
|
||||
/* find each value to delete */
|
||||
for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
|
||||
for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
|
||||
int rc;
|
||||
const char *text = NULL;
|
||||
|
||||
|
|
@ -463,18 +463,18 @@ delete_values(
|
|||
|
||||
rc = value_normalize( mod->sm_desc,
|
||||
SLAP_MR_EQUALITY,
|
||||
mod->sm_bvalues[i],
|
||||
&mod->sm_bvalues[i],
|
||||
&asserted,
|
||||
&text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) return rc;
|
||||
|
||||
found = 0;
|
||||
for ( j = 0; a->a_vals[j] != NULL; j++ ) {
|
||||
for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
|
||||
int match;
|
||||
int rc = value_match( &match, mod->sm_desc, mr,
|
||||
SLAP_MR_VALUE_SYNTAX_MATCH,
|
||||
a->a_vals[j], &asserted, &text );
|
||||
&a->a_vals[j], &asserted, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match != 0 ) {
|
||||
continue;
|
||||
|
|
@ -484,11 +484,11 @@ delete_values(
|
|||
found = 1;
|
||||
|
||||
/* delete it */
|
||||
ber_bvfree( a->a_vals[j] );
|
||||
for ( k = j + 1; a->a_vals[k] != NULL; k++ ) {
|
||||
free( a->a_vals[j].bv_val );
|
||||
for ( k = j + 1; a->a_vals[k].bv_val != NULL; k++ ) {
|
||||
a->a_vals[k - 1] = a->a_vals[k];
|
||||
}
|
||||
a->a_vals[k - 1] = NULL;
|
||||
a->a_vals[k - 1].bv_val = NULL;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -511,7 +511,7 @@ delete_values(
|
|||
}
|
||||
|
||||
/* if no values remain, delete the entire attribute */
|
||||
if ( a->a_vals[0] == NULL ) {
|
||||
if ( a->a_vals[0].bv_val == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
|
||||
"delete_values: removing entire attribute %s\n", desc ));
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ ldbm_back_modrdn(
|
|||
/* get entry with writer lock */
|
||||
if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) {
|
||||
char* matched_dn = NULL;
|
||||
struct berval** refs;
|
||||
BVarray refs;
|
||||
|
||||
if( matched != NULL ) {
|
||||
matched_dn = strdup( matched->e_dn );
|
||||
|
|
@ -107,7 +107,7 @@ ldbm_back_modrdn(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
free( matched_dn );
|
||||
|
||||
return( -1 );
|
||||
|
|
@ -116,7 +116,7 @@ ldbm_back_modrdn(
|
|||
if (!manageDSAit && is_entry_referral( e ) ) {
|
||||
/* parent is a referral, don't allow add */
|
||||
/* parent is an alias, don't allow add */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
BVarray refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -130,7 +130,7 @@ ldbm_back_modrdn(
|
|||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
e->e_dn, NULL, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
if ( refs ) bvarray_free( refs );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
|
|
@ -608,11 +608,11 @@ ldbm_back_modrdn(
|
|||
}
|
||||
|
||||
mod_tmp = (Modifications *)ch_malloc( sizeof( Modifications )
|
||||
+ 2 * sizeof( struct berval * ) );
|
||||
+ 2 * sizeof( struct berval ) );
|
||||
mod_tmp->sml_desc = desc;
|
||||
mod_tmp->sml_bvalues = (struct berval **)( mod_tmp + 1 );
|
||||
mod_tmp->sml_bvalues[0] = &new_rdn[0][a_cnt]->la_value;
|
||||
mod_tmp->sml_bvalues[1] = NULL;
|
||||
mod_tmp->sml_bvalues = (BVarray)( mod_tmp + 1 );
|
||||
mod_tmp->sml_bvalues[0] = new_rdn[0][a_cnt]->la_value;
|
||||
mod_tmp->sml_bvalues[1].bv_val = NULL;
|
||||
mod_tmp->sml_op = SLAP_MOD_SOFTADD;
|
||||
mod_tmp->sml_next = mod;
|
||||
mod = mod_tmp;
|
||||
|
|
@ -682,11 +682,11 @@ ldbm_back_modrdn(
|
|||
|
||||
/* Remove old value of rdn as an attribute. */
|
||||
mod_tmp = (Modifications *)ch_malloc( sizeof( Modifications )
|
||||
+ 2 * sizeof( struct berval * ) );
|
||||
+ 2 * sizeof( struct berval ) );
|
||||
mod_tmp->sml_desc = desc;
|
||||
mod_tmp->sml_bvalues = (struct berval **)(mod_tmp+1);
|
||||
mod_tmp->sml_bvalues[0] = &old_rdn[0][d_cnt]->la_value;
|
||||
mod_tmp->sml_bvalues[1] = NULL;
|
||||
mod_tmp->sml_bvalues = (BVarray)(mod_tmp+1);
|
||||
mod_tmp->sml_bvalues[0] = old_rdn[0][d_cnt]->la_value;
|
||||
mod_tmp->sml_bvalues[1].bv_val = NULL;
|
||||
mod_tmp->sml_op = LDAP_MOD_DELETE;
|
||||
mod_tmp->sml_next = mod;
|
||||
mod = mod_tmp;
|
||||
|
|
|
|||
|
|
@ -27,16 +27,16 @@ ldbm_back_exop_passwd(
|
|||
struct berval **rspdata,
|
||||
LDAPControl *** rspctrls,
|
||||
const char **text,
|
||||
struct berval *** refs
|
||||
BVarray *refs
|
||||
)
|
||||
{
|
||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||
int rc;
|
||||
Entry *e = NULL;
|
||||
struct berval *hash = NULL;
|
||||
struct berval hash = { 0, NULL };
|
||||
|
||||
struct berval *id = NULL;
|
||||
struct berval *new = NULL;
|
||||
struct berval id = { 0, NULL };
|
||||
struct berval new = { 0, NULL };
|
||||
|
||||
struct berval dn;
|
||||
struct berval ndn;
|
||||
|
|
@ -50,10 +50,10 @@ ldbm_back_exop_passwd(
|
|||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
|
||||
"ldbm_back_exop_passwd: \"%s\"\n",
|
||||
id ? id->bv_val : "" ));
|
||||
id.bv_val ? id.bv_val : "" ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ARGS, "==> ldbm_back_exop_passwd: \"%s\"\n",
|
||||
id ? id->bv_val : "", 0, 0 );
|
||||
id.bv_val ? id.bv_val : "", 0, 0 );
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -61,28 +61,28 @@ ldbm_back_exop_passwd(
|
|||
goto done;
|
||||
}
|
||||
|
||||
if( new == NULL || new->bv_len == 0 ) {
|
||||
new = slap_passwd_generate();
|
||||
if( new.bv_len == 0 ) {
|
||||
slap_passwd_generate(&new);
|
||||
|
||||
if( new == NULL || new->bv_len == 0 ) {
|
||||
if( new.bv_len == 0 ) {
|
||||
*text = "password generation failed.";
|
||||
rc = LDAP_OTHER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
*rspdata = slap_passwd_return( new );
|
||||
*rspdata = slap_passwd_return( &new );
|
||||
}
|
||||
|
||||
hash = slap_passwd_hash( new );
|
||||
slap_passwd_hash( &new, &hash );
|
||||
|
||||
if( hash == NULL || hash->bv_len == 0 ) {
|
||||
if( hash.bv_len == 0 ) {
|
||||
*text = "password hash failed";
|
||||
rc = LDAP_OTHER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if( id ) {
|
||||
dn = *id;
|
||||
if( id.bv_len ) {
|
||||
dn = id;
|
||||
} else {
|
||||
dn = op->o_dn;
|
||||
}
|
||||
|
|
@ -90,10 +90,10 @@ ldbm_back_exop_passwd(
|
|||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
|
||||
"ldbm_back_exop_passwd: \"%s\"%s\n",
|
||||
dn.bv_val, id ? " (proxy)" : "" ));
|
||||
dn.bv_val, id.bv_len ? " (proxy)" : "" ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "passwd: \"%s\"%s\n",
|
||||
dn.bv_val, id ? " (proxy)" : "", 0 );
|
||||
dn.bv_val, id.bv_len ? " (proxy)" : "", 0 );
|
||||
#endif
|
||||
|
||||
if( dn.bv_len == 0 ) {
|
||||
|
|
@ -132,11 +132,11 @@ ldbm_back_exop_passwd(
|
|||
|
||||
{
|
||||
Modifications ml;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
char textbuf[SLAP_TEXT_BUFLEN]; /* non-returnable */
|
||||
|
||||
vals[0] = hash;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
ml.sml_desc = slap_schema.si_ad_userPassword;
|
||||
ml.sml_bvalues = vals;
|
||||
|
|
@ -175,16 +175,16 @@ done:
|
|||
cache_return_entry_w( &li->li_cache, e );
|
||||
}
|
||||
|
||||
if( id != NULL ) {
|
||||
ber_bvfree( id );
|
||||
if( id.bv_val != NULL ) {
|
||||
free( id.bv_val );
|
||||
}
|
||||
|
||||
if( new != NULL ) {
|
||||
ber_bvfree( new );
|
||||
if( new.bv_val != NULL ) {
|
||||
free( new.bv_val );
|
||||
}
|
||||
|
||||
if( hash != NULL ) {
|
||||
ber_bvfree( hash );
|
||||
if( hash.bv_val != NULL ) {
|
||||
free( hash.bv_val );
|
||||
}
|
||||
|
||||
if( ndn.bv_val != NULL ) {
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ extern int
|
|||
index_values LDAP_P((
|
||||
Backend *be,
|
||||
AttributeDescription *desc,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
ID id,
|
||||
int op ));
|
||||
|
||||
|
|
@ -180,16 +180,7 @@ key_read LDAP_P((
|
|||
/*
|
||||
* passwd.c
|
||||
*/
|
||||
extern int ldbm_back_exop_passwd LDAP_P(( BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
const char *reqoid,
|
||||
struct berval *reqdata,
|
||||
char **rspoid,
|
||||
struct berval **rspdata,
|
||||
LDAPControl ***rspctrls,
|
||||
const char **text,
|
||||
struct berval *** refs ));
|
||||
|
||||
extern BI_op_extended ldbm_back_exop_passwd;
|
||||
|
||||
/*
|
||||
* modify.c
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ ldbm_back_referrals(
|
|||
e = dn2entry_r( be, ndn, &matched );
|
||||
if ( e == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs = NULL;
|
||||
BVarray refs = NULL;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
matched_dn = ch_strdup( matched->e_dn );
|
||||
|
|
@ -74,7 +74,7 @@ ldbm_back_referrals(
|
|||
/* send referrals */
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
matched_dn, NULL, refs, NULL );
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
|
||||
} else if ( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc, matched_dn,
|
||||
|
|
@ -88,9 +88,8 @@ ldbm_back_referrals(
|
|||
|
||||
if ( is_entry_referral( e ) ) {
|
||||
/* entry is a referral */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
struct berval **rrefs = referral_rewrite(
|
||||
BVarray refs = get_entry_referrals( be, conn, op, e );
|
||||
BVarray rrefs = referral_rewrite(
|
||||
refs, &e->e_name, dn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -107,14 +106,14 @@ ldbm_back_referrals(
|
|||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
e->e_dn, NULL, rrefs, NULL );
|
||||
|
||||
ber_bvecfree( rrefs );
|
||||
bvarray_free( rrefs );
|
||||
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_OTHER, e->e_dn,
|
||||
"bad referral object", NULL, NULL );
|
||||
}
|
||||
|
||||
if( refs != NULL ) ber_bvecfree( refs );
|
||||
if( refs != NULL ) bvarray_free( refs );
|
||||
}
|
||||
|
||||
cache_return_entry_r( &li->li_cache, e );
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ ldbm_back_search(
|
|||
int slimit,
|
||||
int tlimit,
|
||||
Filter *filter,
|
||||
const char *filterstr,
|
||||
struct berval *filterstr,
|
||||
AttributeName *attrs,
|
||||
int attrsonly )
|
||||
{
|
||||
|
|
@ -47,7 +47,7 @@ ldbm_back_search(
|
|||
ID_BLOCK *candidates;
|
||||
ID id, cursor;
|
||||
Entry *e;
|
||||
struct berval **v2refs = NULL;
|
||||
BVarray v2refs = NULL;
|
||||
Entry *matched = NULL;
|
||||
struct berval realbase = { 0, NULL };
|
||||
int nentries = 0;
|
||||
|
|
@ -92,10 +92,10 @@ ldbm_back_search(
|
|||
|
||||
if ( e == NULL ) {
|
||||
struct berval *matched_dn = NULL;
|
||||
struct berval **refs = NULL;
|
||||
BVarray refs = NULL;
|
||||
|
||||
if ( matched != NULL ) {
|
||||
struct berval **erefs;
|
||||
BVarray erefs;
|
||||
matched_dn = ber_bvdup( &matched->e_name );
|
||||
|
||||
erefs = is_entry_referral( matched )
|
||||
|
|
@ -108,7 +108,7 @@ ldbm_back_search(
|
|||
refs = referral_rewrite( erefs, matched_dn,
|
||||
base, scope );
|
||||
|
||||
ber_bvecfree( erefs );
|
||||
bvarray_free( erefs );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -120,7 +120,7 @@ ldbm_back_search(
|
|||
matched_dn ? matched_dn->bv_val : NULL,
|
||||
text, refs, NULL );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
ber_bvfree( matched_dn );
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -128,9 +128,8 @@ ldbm_back_search(
|
|||
if (!manageDSAit && is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow add */
|
||||
struct berval *matched_dn = ber_bvdup( &e->e_name );
|
||||
struct berval **erefs = get_entry_referrals( be,
|
||||
conn, op, e );
|
||||
struct berval **refs = NULL;
|
||||
BVarray erefs = get_entry_referrals( be, conn, op, e );
|
||||
BVarray refs = NULL;
|
||||
|
||||
cache_return_entry_r( &li->li_cache, e );
|
||||
|
||||
|
|
@ -148,13 +147,13 @@ ldbm_back_search(
|
|||
refs = referral_rewrite( erefs, matched_dn,
|
||||
base, scope );
|
||||
|
||||
ber_bvecfree( erefs );
|
||||
bvarray_free( erefs );
|
||||
}
|
||||
|
||||
if( refs ) {
|
||||
send_ldap_result( conn, op, LDAP_REFERRAL,
|
||||
matched_dn->bv_val, NULL, refs, NULL );
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
|
||||
} else {
|
||||
send_ldap_result( conn, op, LDAP_OTHER,
|
||||
|
|
@ -393,9 +392,9 @@ searchit:
|
|||
}
|
||||
|
||||
if( scopeok ) {
|
||||
struct berval **erefs = get_entry_referrals(
|
||||
BVarray erefs = get_entry_referrals(
|
||||
be, conn, op, e );
|
||||
struct berval **refs = referral_rewrite( erefs,
|
||||
BVarray refs = referral_rewrite( erefs,
|
||||
&e->e_name, NULL,
|
||||
scope == LDAP_SCOPE_SUBTREE
|
||||
? LDAP_SCOPE_SUBTREE
|
||||
|
|
@ -404,7 +403,7 @@ searchit:
|
|||
send_search_reference( be, conn, op,
|
||||
e, refs, NULL, &v2refs );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
|
||||
} else {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -510,7 +509,7 @@ done:
|
|||
if( candidates != NULL )
|
||||
idl_free( candidates );
|
||||
|
||||
if( v2refs ) ber_bvecfree( v2refs );
|
||||
if( v2refs ) bvarray_free( v2refs );
|
||||
if( realbase.bv_val ) free( realbase.bv_val );
|
||||
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -1049,7 +1049,7 @@ backend_attribute(
|
|||
Entry *target,
|
||||
struct berval *edn,
|
||||
AttributeDescription *entry_at,
|
||||
struct berval ***vals
|
||||
BVarray *vals
|
||||
)
|
||||
{
|
||||
if( target == NULL || target->e_nname.bv_len != edn->bv_len ||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ typedef struct glue_state {
|
|||
int matchlen;
|
||||
char *matched;
|
||||
int nrefs;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
} glue_state;
|
||||
|
||||
static void
|
||||
|
|
@ -181,7 +181,7 @@ glue_back_response (
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **ref,
|
||||
BVarray ref,
|
||||
const char *resoid,
|
||||
struct berval *resdata,
|
||||
struct berval *sasldata,
|
||||
|
|
@ -208,21 +208,21 @@ glue_back_response (
|
|||
}
|
||||
if (ref) {
|
||||
int i, j, k;
|
||||
struct berval **new;
|
||||
BVarray new;
|
||||
|
||||
for (i=0; ref[i]; i++);
|
||||
for (i=0; ref[i].bv_val; i++);
|
||||
|
||||
j = gs->nrefs;
|
||||
if (!j) {
|
||||
new = ch_malloc ((i+1)*sizeof(struct berval *));
|
||||
new = ch_malloc ((i+1)*sizeof(struct berval));
|
||||
} else {
|
||||
new = ch_realloc(gs->refs,
|
||||
(j+i+1)*sizeof(struct berval *));
|
||||
(j+i+1)*sizeof(struct berval));
|
||||
}
|
||||
for (k=0; k<i; j++,k++) {
|
||||
new[j] = ber_bvdup(ref[k]);
|
||||
ber_dupbv( &new[j], &ref[k] );
|
||||
}
|
||||
new[j] = NULL;
|
||||
new[j].bv_val = NULL;
|
||||
gs->nrefs = j;
|
||||
gs->refs = new;
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ glue_back_sresult (
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
int nentries
|
||||
)
|
||||
|
|
@ -259,7 +259,7 @@ glue_back_search (
|
|||
int slimit,
|
||||
int tlimit,
|
||||
Filter *filter,
|
||||
const char *filterstr,
|
||||
struct berval *filterstr,
|
||||
AttributeName *attrs,
|
||||
int attrsonly
|
||||
)
|
||||
|
|
@ -360,7 +360,7 @@ done:
|
|||
if (gs.matched)
|
||||
free (gs.matched);
|
||||
if (gs.refs)
|
||||
ber_bvecfree(gs.refs);
|
||||
bvarray_free(gs.refs);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -575,7 +575,7 @@ glue_back_attribute (
|
|||
Entry *target,
|
||||
struct berval *ndn,
|
||||
AttributeDescription *ad,
|
||||
struct berval ***vals
|
||||
BVarray *vals
|
||||
)
|
||||
{
|
||||
BackendDB *be;
|
||||
|
|
|
|||
|
|
@ -440,13 +440,13 @@ do_bind(
|
|||
|
||||
if ( (be = select_backend( &ndn, 0, 0 )) == NULL ) {
|
||||
if ( default_referral ) {
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
NULL, NULL, ref ? ref : default_referral, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
|
||||
} else {
|
||||
/* noSuchObject is not allowed to be returned by bind */
|
||||
|
|
|
|||
|
|
@ -222,13 +222,13 @@ do_compare(
|
|||
* if we don't hold it.
|
||||
*/
|
||||
if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
NULL, NULL, ref ? ref : default_referral, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
rc = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,14 +76,12 @@ read_config( const char *fname )
|
|||
char *cargv[MAXARGS+1];
|
||||
int lineno, i;
|
||||
int rc;
|
||||
struct berval *vals[2];
|
||||
struct berval val;
|
||||
struct berval vals[2];
|
||||
|
||||
static BackendInfo *bi = NULL;
|
||||
static BackendDB *be = NULL;
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
if ( (fp = fopen( fname, "r" )) == NULL ) {
|
||||
ldap_syslog = 1;
|
||||
|
|
@ -1580,8 +1578,8 @@ read_config( const char *fname )
|
|||
return 1;
|
||||
}
|
||||
|
||||
vals[0]->bv_val = cargv[1];
|
||||
vals[0]->bv_len = strlen( vals[0]->bv_val );
|
||||
vals[0].bv_val = cargv[1];
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
value_add( &default_referral, vals );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -1917,8 +1915,8 @@ read_config( const char *fname )
|
|||
return 1;
|
||||
}
|
||||
|
||||
vals[0]->bv_val = cargv[1];
|
||||
vals[0]->bv_len = strlen( vals[0]->bv_val );
|
||||
vals[0].bv_val = cargv[1];
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
value_add( &be->be_update_refs, vals );
|
||||
|
||||
/* replication log file to which changes are appended */
|
||||
|
|
|
|||
|
|
@ -129,13 +129,13 @@ do_delete(
|
|||
* if we don't hold it.
|
||||
*/
|
||||
if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
NULL, NULL, ref ? ref : default_referral, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -179,15 +179,15 @@ do_delete(
|
|||
}
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
} else {
|
||||
struct berval **defref = be->be_update_refs
|
||||
BVarray defref = be->be_update_refs
|
||||
? be->be_update_refs : default_referral;
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
ref ? ref : defref, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ str2entry( char *s )
|
|||
int rc;
|
||||
Entry *e;
|
||||
char *type;
|
||||
struct berval value;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
AttributeDescription *ad;
|
||||
const char *text;
|
||||
char *next;
|
||||
|
|
@ -96,8 +95,7 @@ str2entry( char *s )
|
|||
e->e_private = NULL;
|
||||
|
||||
/* dn + attributes */
|
||||
vals[0] = &value;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
next = s;
|
||||
while ( (s = ldif_getline( &next )) != NULL ) {
|
||||
|
|
@ -105,7 +103,7 @@ str2entry( char *s )
|
|||
break;
|
||||
}
|
||||
|
||||
if ( ldif_parse_line( s, &type, &value.bv_val, &value.bv_len ) != 0 ) {
|
||||
if ( ldif_parse_line( s, &type, &vals[0].bv_val, &vals[0].bv_len ) != 0 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
|
||||
"str2entry: NULL (parse_line)\n" ));
|
||||
|
|
@ -126,20 +124,20 @@ str2entry( char *s )
|
|||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1, "str2entry: "
|
||||
"entry %ld has multiple DNs \"%s\" and \"%s\"\n",
|
||||
(long) e->e_id, e->e_dn,
|
||||
value.bv_val != NULL ? value.bv_val : "" ));
|
||||
vals[0].bv_val != NULL ? vals[0].bv_val : "" ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY, "str2entry: "
|
||||
"entry %ld has multiple DNs \"%s\" and \"%s\"\n",
|
||||
(long) e->e_id, e->e_dn,
|
||||
value.bv_val != NULL ? value.bv_val : "" );
|
||||
vals[0].bv_val != NULL ? vals[0].bv_val : "" );
|
||||
#endif
|
||||
if( value.bv_val != NULL ) free( value.bv_val );
|
||||
if( vals[0].bv_val != NULL ) free( vals[0].bv_val );
|
||||
entry_free( e );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = dnPrettyNormal( NULL, &value, &e->e_name, &e->e_nname );
|
||||
free( value.bv_val );
|
||||
rc = dnPrettyNormal( NULL, &vals[0], &e->e_name, &e->e_nname );
|
||||
free( vals[0].bv_val );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1, "str2entry: "
|
||||
|
|
@ -172,7 +170,7 @@ str2entry( char *s )
|
|||
#endif
|
||||
if( slapMode & SLAP_TOOL_MODE ) {
|
||||
entry_free( e );
|
||||
free( value.bv_val );
|
||||
free( vals[0].bv_val );
|
||||
free( type );
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -188,7 +186,7 @@ str2entry( char *s )
|
|||
type, text, 0 );
|
||||
#endif
|
||||
entry_free( e );
|
||||
free( value.bv_val );
|
||||
free( vals[0].bv_val );
|
||||
free( type );
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -203,13 +201,13 @@ str2entry( char *s )
|
|||
|
||||
if( pretty ) {
|
||||
rc = pretty( ad->ad_type->sat_syntax,
|
||||
&value, &pval );
|
||||
&vals[0], &pval );
|
||||
|
||||
} else if( validate ) {
|
||||
/*
|
||||
* validate value per syntax
|
||||
*/
|
||||
rc = validate( ad->ad_type->sat_syntax, &value );
|
||||
rc = validate( ad->ad_type->sat_syntax, &vals[0] );
|
||||
|
||||
} else {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -222,7 +220,7 @@ str2entry( char *s )
|
|||
ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
|
||||
#endif
|
||||
entry_free( e );
|
||||
free( value.bv_val );
|
||||
free( vals[0].bv_val );
|
||||
free( type );
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -238,14 +236,14 @@ str2entry( char *s )
|
|||
ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
|
||||
#endif
|
||||
entry_free( e );
|
||||
free( value.bv_val );
|
||||
free( vals[0].bv_val );
|
||||
free( type );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( pretty ) {
|
||||
free( value.bv_val );
|
||||
value = pval;
|
||||
free( vals[0].bv_val );
|
||||
vals[0] = pval;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -259,13 +257,13 @@ str2entry( char *s )
|
|||
"<= str2entry NULL (attr_merge)\n", 0, 0, 0 );
|
||||
#endif
|
||||
entry_free( e );
|
||||
free( value.bv_val );
|
||||
free( vals[0].bv_val );
|
||||
free( type );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
free( type );
|
||||
free( value.bv_val );
|
||||
free( vals[0].bv_val );
|
||||
}
|
||||
|
||||
/* check to make sure there was a dn: line */
|
||||
|
|
@ -335,8 +333,8 @@ entry2str(
|
|||
/* put the attributes */
|
||||
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
|
||||
/* put "<type>:[:] <value>" line for each value */
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
bv = a->a_vals[i];
|
||||
for ( i = 0; a->a_vals[i].bv_val != NULL; i++ ) {
|
||||
bv = &a->a_vals[i];
|
||||
tmplen = a->a_desc->ad_cname.bv_len;
|
||||
MAKE_SPACE( LDIF_SIZE_NEEDED( tmplen, bv->bv_len ));
|
||||
ldif_sput( (char **) &ecur, LDIF_PUT_VALUE,
|
||||
|
|
@ -401,6 +399,8 @@ int
|
|||
entry_dn_cmp( Entry *e1, Entry *e2 )
|
||||
{
|
||||
/* compare their normalized UPPERCASED dn's */
|
||||
int rc = e1->e_nname.bv_len - e2->e_nname.bv_len;
|
||||
if (rc) return rc;
|
||||
return( strcmp( e1->e_ndn, e2->e_ndn ) );
|
||||
}
|
||||
|
||||
|
|
@ -496,14 +496,13 @@ int entry_encode(Entry *e, struct berval *bv)
|
|||
siz += sizeof(Attribute);
|
||||
len += a->a_desc->ad_cname.bv_len+1;
|
||||
len += entry_lenlen(a->a_desc->ad_cname.bv_len);
|
||||
for (i=0; a->a_vals[i]; i++) {
|
||||
siz += sizeof(struct berval *);
|
||||
for (i=0; a->a_vals[i].bv_val; i++) {
|
||||
siz += sizeof(struct berval);
|
||||
len += a->a_vals[i]->bv_len + 1;
|
||||
len += entry_lenlen(a->a_vals[i]->bv_len);
|
||||
len += a->a_vals[i].bv_len + 1;
|
||||
len += entry_lenlen(a->a_vals[i].bv_len);
|
||||
}
|
||||
len += entry_lenlen(i);
|
||||
siz += sizeof(struct berval *); /* NULL pointer at end */
|
||||
siz += sizeof(struct berval); /* empty berval at end */
|
||||
}
|
||||
len += 1; /* NUL byte at end */
|
||||
len += entry_lenlen(siz);
|
||||
|
|
@ -527,13 +526,13 @@ int entry_encode(Entry *e, struct berval *bv)
|
|||
ptr += a->a_desc->ad_cname.bv_len;
|
||||
*ptr++ = '\0';
|
||||
if (a->a_vals) {
|
||||
for (i=0; a->a_vals[i]; i++);
|
||||
for (i=0; a->a_vals[i].bv_val; i++);
|
||||
entry_putlen(&ptr, i);
|
||||
for (i=0; a->a_vals[i]; i++) {
|
||||
entry_putlen(&ptr, a->a_vals[i]->bv_len);
|
||||
memcpy(ptr, a->a_vals[i]->bv_val,
|
||||
a->a_vals[i]->bv_len);
|
||||
ptr += a->a_vals[i]->bv_len;
|
||||
for (i=0; a->a_vals[i].bv_val; i++) {
|
||||
entry_putlen(&ptr, a->a_vals[i].bv_len);
|
||||
memcpy(ptr, a->a_vals[i].bv_val,
|
||||
a->a_vals[i].bv_len);
|
||||
ptr += a->a_vals[i].bv_len;
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
}
|
||||
|
|
@ -562,8 +561,7 @@ int entry_decode(struct berval *bv, Entry **e)
|
|||
const char *text;
|
||||
AttributeDescription *ad;
|
||||
unsigned char *ptr = (unsigned char *)bv->bv_val;
|
||||
struct berval **bptr;
|
||||
struct berval *vptr;
|
||||
BVarray bptr;
|
||||
|
||||
i = entry_getlen(&ptr);
|
||||
x = ch_malloc(i);
|
||||
|
|
@ -589,16 +587,17 @@ int entry_decode(struct berval *bv, Entry **e)
|
|||
* pointer can never be NULL
|
||||
*/
|
||||
x->e_attrs = (Attribute *)(x+1);
|
||||
bptr = (struct berval **)x->e_attrs;
|
||||
bptr = (BVarray)x->e_attrs;
|
||||
a = NULL;
|
||||
|
||||
while (i = entry_getlen(&ptr)) {
|
||||
struct berval bv = { i, ptr };
|
||||
if (a) {
|
||||
a->a_next = (Attribute *)bptr;
|
||||
}
|
||||
a = (Attribute *)bptr;
|
||||
ad = NULL;
|
||||
rc = slap_str2ad( ptr, &ad, &text );
|
||||
rc = slap_bv2ad( &bv, &ad, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -608,7 +607,7 @@ int entry_decode(struct berval *bv, Entry **e)
|
|||
Debug( LDAP_DEBUG_TRACE,
|
||||
"<= entry_decode: str2ad(%s): %s\n", ptr, text, 0 );
|
||||
#endif
|
||||
rc = slap_str2undef_ad( ptr, &ad, &text );
|
||||
rc = slap_bv2undef_ad( &bv, &ad, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -624,23 +623,19 @@ int entry_decode(struct berval *bv, Entry **e)
|
|||
}
|
||||
ptr += i + 1;
|
||||
a->a_desc = ad;
|
||||
bptr = (struct berval **)(a+1);
|
||||
bptr = (BVarray)(a+1);
|
||||
a->a_vals = bptr;
|
||||
j = entry_getlen(&ptr);
|
||||
a->a_vals[j] = NULL;
|
||||
vptr = (struct berval *)(bptr + j + 1);
|
||||
a->a_vals[j].bv_val = NULL;
|
||||
|
||||
while (j) {
|
||||
i = entry_getlen(&ptr);
|
||||
*bptr = vptr;
|
||||
vptr->bv_len = i;
|
||||
vptr->bv_val = (char *)ptr;
|
||||
bptr->bv_len = i;
|
||||
bptr->bv_val = (char *)ptr;
|
||||
ptr += i+1;
|
||||
bptr++;
|
||||
vptr++;
|
||||
j--;
|
||||
}
|
||||
bptr = (struct berval **)vptr;
|
||||
}
|
||||
if (a)
|
||||
a->a_next = NULL;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
typedef struct extop_list_t {
|
||||
struct extop_list_t *next;
|
||||
char *oid;
|
||||
SLAP_EXTOP_MAIN_FN ext_main;
|
||||
SLAP_EXTOP_MAIN_FN *ext_main;
|
||||
} extop_list_t;
|
||||
|
||||
extop_list_t *supp_ext_list = NULL;
|
||||
|
|
@ -49,7 +49,7 @@ extop_list_t *supp_ext_list = NULL;
|
|||
*/
|
||||
struct {
|
||||
char *oid;
|
||||
SLAP_EXTOP_MAIN_FN ext_main;
|
||||
SLAP_EXTOP_MAIN_FN *ext_main;
|
||||
} builtin_extops[] = {
|
||||
#ifdef HAVE_TLS
|
||||
{ LDAP_EXOP_START_TLS, starttls_extop },
|
||||
|
|
@ -88,7 +88,7 @@ do_extended(
|
|||
ber_len_t len;
|
||||
extop_list_t *ext;
|
||||
const char *text;
|
||||
struct berval **refs;
|
||||
BVarray refs;
|
||||
char *rspoid;
|
||||
struct berval *rspdata;
|
||||
LDAPControl **rspctrls;
|
||||
|
|
@ -195,7 +195,7 @@ do_extended(
|
|||
send_ldap_extended( conn, op, rc, NULL, text, refs,
|
||||
rspoid, rspdata, rspctrls );
|
||||
|
||||
ber_bvecfree( refs );
|
||||
bvarray_free( refs );
|
||||
}
|
||||
|
||||
if ( rspoid != NULL ) {
|
||||
|
|
@ -219,7 +219,7 @@ done:
|
|||
int
|
||||
load_extop(
|
||||
const char *ext_oid,
|
||||
SLAP_EXTOP_MAIN_FN ext_main )
|
||||
SLAP_EXTOP_MAIN_FN *ext_main )
|
||||
{
|
||||
extop_list_t *ext;
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,6 @@ static int test_mra_filter(
|
|||
Entry *e,
|
||||
MatchingRuleAssertion *mra )
|
||||
{
|
||||
int i;
|
||||
Attribute *a;
|
||||
|
||||
if( !access_allowed( be, conn, op, e,
|
||||
|
|
@ -249,14 +248,15 @@ static int test_mra_filter(
|
|||
a != NULL;
|
||||
a = attrs_find( a->a_next, mra->ma_desc ) )
|
||||
{
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
struct berval *bv;
|
||||
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
|
||||
int ret;
|
||||
int rc;
|
||||
const char *text;
|
||||
|
||||
rc = value_match( &ret, a->a_desc, mra->ma_rule,
|
||||
SLAP_MR_ASSERTION_SYNTAX_MATCH,
|
||||
a->a_vals[i], &mra->ma_value,
|
||||
bv, &mra->ma_value,
|
||||
&text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -282,7 +282,6 @@ test_ava_filter(
|
|||
int type
|
||||
)
|
||||
{
|
||||
int i;
|
||||
Attribute *a;
|
||||
|
||||
if ( !access_allowed( be, conn, op, e,
|
||||
|
|
@ -296,6 +295,7 @@ test_ava_filter(
|
|||
a = attrs_find( a->a_next, ava->aa_desc ) )
|
||||
{
|
||||
MatchingRule *mr;
|
||||
struct berval *bv;
|
||||
|
||||
switch ( type ) {
|
||||
case LDAP_FILTER_APPROX:
|
||||
|
|
@ -321,15 +321,14 @@ test_ava_filter(
|
|||
continue;
|
||||
}
|
||||
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
|
||||
int ret;
|
||||
int rc;
|
||||
const char *text;
|
||||
|
||||
rc = value_match( &ret, a->a_desc, mr,
|
||||
SLAP_MR_ASSERTION_SYNTAX_MATCH,
|
||||
a->a_vals[i], &ava->aa_value,
|
||||
&text );
|
||||
bv, &ava->aa_value, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
return rc;
|
||||
|
|
@ -501,22 +500,21 @@ test_substrings_filter(
|
|||
a != NULL;
|
||||
a = attrs_find( a->a_next, f->f_sub_desc ) )
|
||||
{
|
||||
int i;
|
||||
MatchingRule *mr = a->a_desc->ad_type->sat_substr;
|
||||
struct berval *bv;
|
||||
|
||||
if( mr == NULL ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
|
||||
int ret;
|
||||
int rc;
|
||||
const char *text;
|
||||
|
||||
rc = value_match( &ret, a->a_desc, mr,
|
||||
SLAP_MR_ASSERTION_SYNTAX_MATCH,
|
||||
a->a_vals[i], f->f_sub,
|
||||
&text );
|
||||
bv, f->f_sub, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ int ldap_syslog;
|
|||
int ldap_syslog_level = LOG_DEBUG;
|
||||
#endif
|
||||
|
||||
struct berval **default_referral = NULL;
|
||||
BVarray default_referral = NULL;
|
||||
|
||||
/*
|
||||
* global variables that need mutex protection
|
||||
|
|
|
|||
|
|
@ -39,12 +39,11 @@ do_modify(
|
|||
char *last;
|
||||
ber_tag_t tag;
|
||||
ber_len_t len;
|
||||
LDAPModList *modlist = NULL;
|
||||
LDAPModList **modtail = &modlist;
|
||||
Modifications *modlist = NULL;
|
||||
Modifications **modtail = &modlist;
|
||||
#ifdef LDAP_DEBUG
|
||||
LDAPModList *tmp;
|
||||
Modifications *tmp;
|
||||
#endif
|
||||
Modifications *mods = NULL;
|
||||
Backend *be;
|
||||
int rc;
|
||||
const char *text;
|
||||
|
|
@ -104,11 +103,11 @@ do_modify(
|
|||
tag = ber_next_element( op->o_ber, &len, last ) )
|
||||
{
|
||||
ber_int_t mop;
|
||||
Modifications tmp, *mod;
|
||||
|
||||
(*modtail) = (LDAPModList *) ch_calloc( 1, sizeof(LDAPModList) );
|
||||
|
||||
if ( ber_scanf( op->o_ber, "{i{a[V]}}", &mop,
|
||||
&(*modtail)->ml_type, &(*modtail)->ml_bvalues )
|
||||
if ( ber_scanf( op->o_ber, "{i{o[W]}}", &mop,
|
||||
&tmp.sml_type, &tmp.sml_bvalues )
|
||||
== LBER_ERROR )
|
||||
{
|
||||
send_ldap_disconnect( conn, op,
|
||||
|
|
@ -117,9 +116,18 @@ do_modify(
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
mod = (Modifications *) ch_malloc( sizeof(Modifications)
|
||||
+ tmp.sml_type.bv_len + 1);
|
||||
mod->sml_type.bv_val = (char *)(mod+1);
|
||||
strcpy(mod->sml_type.bv_val, tmp.sml_type.bv_val);
|
||||
mod->sml_type.bv_len = tmp.sml_type.bv_len;
|
||||
mod->sml_bvalues = tmp.sml_bvalues;
|
||||
mod->sml_desc = NULL;
|
||||
*modtail = mod;
|
||||
|
||||
switch( mop ) {
|
||||
case LDAP_MOD_ADD:
|
||||
if ( (*modtail)->ml_bvalues == NULL ) {
|
||||
if ( mod->sml_bvalues == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
|
||||
"do_modify: modify/add operation (%ld) requires values\n",
|
||||
|
|
@ -161,8 +169,8 @@ do_modify(
|
|||
}
|
||||
}
|
||||
|
||||
(*modtail)->ml_op = mop;
|
||||
modtail = &(*modtail)->ml_next;
|
||||
mod->sml_op = mop;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
*modtail = NULL;
|
||||
|
||||
|
|
@ -228,20 +236,20 @@ do_modify(
|
|||
Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
for ( tmp = modlist; tmp != NULL; tmp = tmp->ml_next ) {
|
||||
for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
|
||||
"\t%s: %s\n", tmp->ml_op == LDAP_MOD_ADD ?
|
||||
"add" : (tmp->ml_op == LDAP_MOD_DELETE ?
|
||||
"delete" : "replace"), tmp->ml_type ));
|
||||
"\t%s: %s\n", tmp->sml_op == LDAP_MOD_ADD ?
|
||||
"add" : (tmp->sml_op == LDAP_MOD_DELETE ?
|
||||
"delete" : "replace"), tmp->sml_type.bv_val ));
|
||||
|
||||
if ( tmp->ml_bvalues == NULL ) {
|
||||
if ( tmp->sml_bvalues == NULL ) {
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
|
||||
"\t\tno values" ));
|
||||
} else if ( tmp->ml_bvalues[0] == NULL ) {
|
||||
} else if ( tmp->sml_bvalues[0].bv_val == NULL ) {
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
|
||||
"\t\tzero values" ));
|
||||
} else if ( tmp->ml_bvalues[1] == NULL ) {
|
||||
} else if ( tmp->sml_bvalues[1].bv_val == NULL ) {
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
|
||||
"\t\tone value" ));
|
||||
} else {
|
||||
|
|
@ -251,19 +259,19 @@ do_modify(
|
|||
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
|
||||
tmp->ml_op == LDAP_MOD_ADD
|
||||
? "add" : (tmp->ml_op == LDAP_MOD_DELETE
|
||||
? "delete" : "replace"), tmp->ml_type, 0 );
|
||||
tmp->sml_op == LDAP_MOD_ADD
|
||||
? "add" : (tmp->sml_op == LDAP_MOD_DELETE
|
||||
? "delete" : "replace"), tmp->sml_type.bv_val, 0 );
|
||||
|
||||
if ( tmp->ml_bvalues == NULL ) {
|
||||
if ( tmp->sml_bvalues == NULL ) {
|
||||
Debug( LDAP_DEBUG_ARGS, "%s\n",
|
||||
"\t\tno values", NULL, NULL );
|
||||
} else if ( tmp->ml_bvalues[0] == NULL ) {
|
||||
} else if ( tmp->sml_bvalues[0].bv_val == NULL ) {
|
||||
Debug( LDAP_DEBUG_ARGS, "%s\n",
|
||||
"\t\tzero values", NULL, NULL );
|
||||
} else if ( tmp->ml_bvalues[1] == NULL ) {
|
||||
} else if ( tmp->sml_bvalues[1].bv_val == NULL ) {
|
||||
Debug( LDAP_DEBUG_ARGS, "%s, length %ld\n",
|
||||
"\t\tone value", (long) tmp->ml_bvalues[0]->bv_len, NULL );
|
||||
"\t\tone value", (long) tmp->sml_bvalues[0].bv_len, NULL );
|
||||
} else {
|
||||
Debug( LDAP_DEBUG_ARGS, "%s\n",
|
||||
"\t\tmultiple values", NULL, NULL );
|
||||
|
|
@ -283,13 +291,13 @@ do_modify(
|
|||
* if we don't hold it.
|
||||
*/
|
||||
if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
NULL, NULL, ref ? ref : default_referral, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -331,7 +339,7 @@ do_modify(
|
|||
char textbuf[SLAP_TEXT_BUFLEN];
|
||||
size_t textlen = sizeof textbuf;
|
||||
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text,
|
||||
rc = slap_mods_check( modlist, update, &text,
|
||||
textbuf, textlen );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -343,15 +351,14 @@ do_modify(
|
|||
if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
|
||||
global_lastmod == ON)) && !repl_user )
|
||||
{
|
||||
Modifications **modstail;
|
||||
for( modstail = &mods;
|
||||
*modstail != NULL;
|
||||
modstail = &(*modstail)->sml_next )
|
||||
for( modtail = &modlist;
|
||||
*modtail != NULL;
|
||||
modtail = &(*modtail)->sml_next )
|
||||
{
|
||||
/* empty */
|
||||
}
|
||||
|
||||
rc = slap_mods_opattrs( op, mods, modstail, &text,
|
||||
rc = slap_mods_opattrs( op, modlist, modtail, &text,
|
||||
textbuf, textlen );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
|
|
@ -361,27 +368,27 @@ do_modify(
|
|||
}
|
||||
}
|
||||
|
||||
if ( (*be->be_modify)( be, conn, op, &pdn, &ndn, mods ) == 0
|
||||
if ( (*be->be_modify)( be, conn, op, &pdn, &ndn, modlist ) == 0
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
&& !repl_user
|
||||
#endif
|
||||
) {
|
||||
/* but we log only the ones not from a replicator user */
|
||||
replog( be, op, &pdn, &ndn, mods );
|
||||
replog( be, op, &pdn, &ndn, modlist );
|
||||
}
|
||||
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
/* send a referral */
|
||||
} else {
|
||||
struct berval **defref = be->be_update_refs
|
||||
BVarray defref = be->be_update_refs
|
||||
? be->be_update_refs : default_referral;
|
||||
struct berval **ref = referral_rewrite( defref,
|
||||
BVarray ref = referral_rewrite( defref,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
ref ? ref : defref, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
|
|
@ -395,59 +402,44 @@ cleanup:
|
|||
free( pdn.bv_val );
|
||||
free( ndn.bv_val );
|
||||
if ( modlist != NULL )
|
||||
slap_modlist_free( modlist );
|
||||
if ( mods != NULL )
|
||||
slap_mods_free( mods );
|
||||
slap_mods_free( modlist );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* convert a raw list of modifications to internal format
|
||||
* Do basic attribute type checking and syntax validation.
|
||||
*/
|
||||
int slap_modlist2mods(
|
||||
LDAPModList *ml,
|
||||
int slap_mods_check(
|
||||
Modifications *ml,
|
||||
int update,
|
||||
Modifications **mods,
|
||||
const char **text,
|
||||
char *textbuf,
|
||||
size_t textlen )
|
||||
{
|
||||
int rc;
|
||||
Modifications **modtail = mods;
|
||||
|
||||
for( ; ml != NULL; ml = ml->ml_next ) {
|
||||
Modifications *mod;
|
||||
for( ; ml != NULL; ml = ml->sml_next ) {
|
||||
AttributeDescription *ad = NULL;
|
||||
|
||||
mod = (Modifications *)
|
||||
ch_calloc( 1, sizeof(Modifications) );
|
||||
|
||||
/* copy the op */
|
||||
mod->sml_op = ml->ml_op;
|
||||
|
||||
/* convert to attribute description */
|
||||
rc = slap_str2ad( ml->ml_type, &mod->sml_desc, text );
|
||||
rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
slap_mods_free( mod );
|
||||
snprintf( textbuf, textlen, "%s: %s",
|
||||
ml->ml_type, *text );
|
||||
ml->sml_type.bv_val, *text );
|
||||
*text = textbuf;
|
||||
return rc;
|
||||
}
|
||||
|
||||
ad = mod->sml_desc;
|
||||
ad = ml->sml_desc;
|
||||
|
||||
if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
|
||||
&& !slap_ad_is_binary( ad ))
|
||||
{
|
||||
/* attribute requires binary transfer */
|
||||
slap_mods_free( mod );
|
||||
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: requires ;binary transfer",
|
||||
ml->ml_type );
|
||||
ml->sml_type.bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_UNDEFINED_TYPE;
|
||||
}
|
||||
|
|
@ -456,35 +448,32 @@ int slap_modlist2mods(
|
|||
&& slap_ad_is_binary( ad ))
|
||||
{
|
||||
/* attribute requires binary transfer */
|
||||
slap_mods_free( mod );
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: disallows ;binary transfer",
|
||||
ml->ml_type );
|
||||
ml->sml_type.bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_UNDEFINED_TYPE;
|
||||
}
|
||||
|
||||
if (!update && is_at_no_user_mod( ad->ad_type )) {
|
||||
/* user modification disallowed */
|
||||
slap_mods_free( mod );
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: no user modification allowed",
|
||||
ml->ml_type );
|
||||
ml->sml_type.bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
|
||||
if ( is_at_obsolete( ad->ad_type ) &&
|
||||
( mod->sml_op == LDAP_MOD_ADD || ml->ml_bvalues != NULL ) )
|
||||
( ml->sml_op == LDAP_MOD_ADD || ml->sml_bvalues != NULL ) )
|
||||
{
|
||||
/*
|
||||
* attribute is obsolete,
|
||||
* only allow replace/delete with no values
|
||||
*/
|
||||
slap_mods_free( mod );
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: attribute is obsolete",
|
||||
ml->ml_type );
|
||||
ml->sml_type.bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
|
|
@ -492,7 +481,7 @@ int slap_modlist2mods(
|
|||
/*
|
||||
* check values
|
||||
*/
|
||||
if( ml->ml_bvalues != NULL ) {
|
||||
if( ml->sml_bvalues != NULL ) {
|
||||
ber_len_t nvals;
|
||||
slap_syntax_validate_func *validate =
|
||||
ad->ad_type->sat_syntax->ssyn_validate;
|
||||
|
|
@ -500,11 +489,10 @@ int slap_modlist2mods(
|
|||
ad->ad_type->sat_syntax->ssyn_pretty;
|
||||
|
||||
if( !pretty && !validate ) {
|
||||
slap_mods_free( mod );
|
||||
*text = "no validator for syntax";
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: no validator for syntax %s",
|
||||
ml->ml_type,
|
||||
ml->sml_type.bv_val,
|
||||
ad->ad_type->sat_syntax->ssyn_oid );
|
||||
*text = textbuf;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
|
|
@ -514,28 +502,27 @@ int slap_modlist2mods(
|
|||
* check that each value is valid per syntax
|
||||
* and pretty if appropriate
|
||||
*/
|
||||
for( nvals = 0; ml->ml_bvalues[nvals]; nvals++ ) {
|
||||
for( nvals = 0; ml->sml_bvalues[nvals].bv_val; nvals++ ) {
|
||||
struct berval pval;
|
||||
if( pretty ) {
|
||||
rc = pretty( ad->ad_type->sat_syntax,
|
||||
ml->ml_bvalues[nvals], &pval );
|
||||
&ml->sml_bvalues[nvals], &pval );
|
||||
} else {
|
||||
rc = validate( ad->ad_type->sat_syntax,
|
||||
ml->ml_bvalues[nvals] );
|
||||
&ml->sml_bvalues[nvals] );
|
||||
}
|
||||
|
||||
if( rc != 0 ) {
|
||||
slap_mods_free( mod );
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: value #%ld invalid per syntax",
|
||||
ml->ml_type, (long) nvals );
|
||||
ml->sml_type.bv_val, (long) nvals );
|
||||
*text = textbuf;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
if( pretty ) {
|
||||
ber_memfree( ml->ml_bvalues[nvals]->bv_val );
|
||||
*ml->ml_bvalues[nvals] = pval;
|
||||
ber_memfree( ml->sml_bvalues[nvals].bv_val );
|
||||
ml->sml_bvalues[nvals] = pval;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -543,23 +530,16 @@ int slap_modlist2mods(
|
|||
* a rough single value check... an additional check is needed
|
||||
* to catch add of single value to existing single valued attribute
|
||||
*/
|
||||
if( ( mod->sml_op == LDAP_MOD_ADD || mod->sml_op == LDAP_MOD_REPLACE )
|
||||
if( ( ml->sml_op == LDAP_MOD_ADD || ml->sml_op == LDAP_MOD_REPLACE )
|
||||
&& nvals > 1 && is_at_single_value( ad->ad_type ))
|
||||
{
|
||||
slap_mods_free( mod );
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: multiple value provided",
|
||||
ml->ml_type );
|
||||
ml->sml_type.bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
}
|
||||
|
||||
mod->sml_bvalues = ml->ml_bvalues;
|
||||
ml->ml_values = NULL;
|
||||
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
|
|
@ -613,13 +593,13 @@ int slap_mods_opattrs(
|
|||
return rc;
|
||||
}
|
||||
if ( tmpval.bv_len ) {
|
||||
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
|
||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||
mod->sml_op = mop;
|
||||
mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
|
||||
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
|
||||
mod->sml_bvalues[0] = ber_bvdup( &tmpval );
|
||||
mod->sml_bvalues[1] = NULL;
|
||||
assert( mod->sml_bvalues[0] );
|
||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
|
||||
mod->sml_bvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_bvalues[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
|
|
@ -627,67 +607,68 @@ int slap_mods_opattrs(
|
|||
tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
|
||||
tmpval.bv_val = uuidbuf;
|
||||
|
||||
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
|
||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||
mod->sml_op = mop;
|
||||
mod->sml_desc = slap_schema.si_ad_entryUUID;
|
||||
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
|
||||
mod->sml_bvalues[0] = ber_bvdup( &tmpval );
|
||||
mod->sml_bvalues[1] = NULL;
|
||||
assert( mod->sml_bvalues[0] );
|
||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_bvalues[0], &tmpval );
|
||||
mod->sml_bvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_bvalues[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
|
||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||
mod->sml_op = mop;
|
||||
mod->sml_desc = slap_schema.si_ad_creatorsName;
|
||||
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
|
||||
mod->sml_bvalues[0] = ber_bvdup( &name );
|
||||
mod->sml_bvalues[1] = NULL;
|
||||
assert( mod->sml_bvalues[0] );
|
||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_bvalues[0], &name );
|
||||
mod->sml_bvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_bvalues[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
|
||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||
mod->sml_op = mop;
|
||||
mod->sml_desc = slap_schema.si_ad_createTimestamp;
|
||||
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
|
||||
mod->sml_bvalues[0] = ber_bvdup( ×tamp );
|
||||
mod->sml_bvalues[1] = NULL;
|
||||
assert( mod->sml_bvalues[0] );
|
||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_bvalues[0], ×tamp );
|
||||
mod->sml_bvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_bvalues[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
}
|
||||
|
||||
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
|
||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||
mod->sml_op = mop;
|
||||
mod->sml_desc = slap_schema.si_ad_entryCSN;
|
||||
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof(struct berval *) );
|
||||
mod->sml_bvalues[0] = ber_bvdup( &csn );
|
||||
mod->sml_bvalues[1] = NULL;
|
||||
assert( mod->sml_bvalues[0] );
|
||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_bvalues[0], &csn );
|
||||
mod->sml_bvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_bvalues[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
|
||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||
mod->sml_op = mop;
|
||||
mod->sml_desc = slap_schema.si_ad_modifiersName;
|
||||
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof(struct berval *) );
|
||||
mod->sml_bvalues[0] = ber_bvdup( &name );
|
||||
mod->sml_bvalues[1] = NULL;
|
||||
assert( mod->sml_bvalues[0] );
|
||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_bvalues[0], &name );
|
||||
mod->sml_bvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_bvalues[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
|
||||
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
|
||||
mod->sml_op = mop;
|
||||
mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
|
||||
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof(struct berval *) );
|
||||
mod->sml_bvalues[0] = ber_bvdup( ×tamp );
|
||||
mod->sml_bvalues[1] = NULL;
|
||||
assert( mod->sml_bvalues[0] );
|
||||
mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_dupbv( &mod->sml_bvalues[0], ×tamp );
|
||||
mod->sml_bvalues[1].bv_val = NULL;
|
||||
assert( mod->sml_bvalues[0].bv_val );
|
||||
*modtail = mod;
|
||||
modtail = &mod->sml_next;
|
||||
|
||||
*modtail = NULL;
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -281,13 +281,13 @@ do_modrdn(
|
|||
* if we don't hold it.
|
||||
*/
|
||||
if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
NULL, NULL, ref ? ref : default_referral, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -357,15 +357,15 @@ do_modrdn(
|
|||
}
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
} else {
|
||||
struct berval **defref = be->be_update_refs
|
||||
BVarray defref = be->be_update_refs
|
||||
? be->be_update_refs : default_referral;
|
||||
struct berval **ref = referral_rewrite( defref,
|
||||
BVarray ref = referral_rewrite( defref,
|
||||
NULL, &pdn, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
|
||||
ref ? ref : defref, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ slap_mod_free(
|
|||
)
|
||||
{
|
||||
if ( mod->sm_bvalues != NULL )
|
||||
ber_bvecfree( mod->sm_bvalues );
|
||||
bvarray_free( mod->sm_bvalues );
|
||||
|
||||
if( freeit )
|
||||
free( mod );
|
||||
|
|
|
|||
|
|
@ -265,12 +265,12 @@ load_extop_module (
|
|||
const char *file_name
|
||||
)
|
||||
{
|
||||
SLAP_EXTOP_MAIN_FN ext_main;
|
||||
SLAP_EXTOP_MAIN_FN *ext_main;
|
||||
int (*ext_getoid)(int index, char *oid, int blen);
|
||||
char *oid;
|
||||
int rc;
|
||||
|
||||
ext_main = (SLAP_EXTOP_MAIN_FN)module_resolve(module, "ext_main");
|
||||
ext_main = (SLAP_EXTOP_MAIN_FN *)module_resolve(module, "ext_main");
|
||||
if (ext_main == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,14 +272,12 @@ register_matching_rule(
|
|||
|
||||
int mr_schema_info( Entry *e )
|
||||
{
|
||||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
MatchingRule *mr;
|
||||
|
||||
AttributeDescription *ad_matchingRules = slap_schema.si_ad_matchingRules;
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
for ( mr = mr_list; mr; mr = mr->smr_next ) {
|
||||
if ( ! mr->smr_match ) {
|
||||
|
|
@ -287,15 +285,15 @@ int mr_schema_info( Entry *e )
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( ldap_matchingrule2bv( &mr->smr_mrule, &val ) == NULL ) {
|
||||
if ( ldap_matchingrule2bv( &mr->smr_mrule, vals ) == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging mr [%ld] %s\n",
|
||||
(long) val.bv_len, val.bv_val, 0 );
|
||||
(long) vals[0].bv_len, vals[0].bv_val, 0 );
|
||||
#endif
|
||||
attr_merge( e, ad_matchingRules, vals );
|
||||
ldap_memfree( val.bv_val );
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int is_entry_objectclass(
|
|||
ObjectClass *oc )
|
||||
{
|
||||
Attribute *attr;
|
||||
int i;
|
||||
struct berval *bv;
|
||||
AttributeDescription *objectClass = slap_schema.si_ad_objectClass;
|
||||
assert(!( e == NULL || oc == NULL ));
|
||||
|
||||
|
|
@ -81,8 +81,8 @@ int is_entry_objectclass(
|
|||
return 0;
|
||||
}
|
||||
|
||||
for( i=0; attr->a_vals[i]; i++ ) {
|
||||
ObjectClass *objectClass = oc_bvfind( attr->a_vals[i] );
|
||||
for( bv=attr->a_vals; bv->bv_val; bv++ ) {
|
||||
ObjectClass *objectClass = oc_bvfind( bv );
|
||||
|
||||
if( objectClass == oc ) {
|
||||
return 1;
|
||||
|
|
@ -447,25 +447,23 @@ oc_print( ObjectClass *oc )
|
|||
int
|
||||
oc_schema_info( Entry *e )
|
||||
{
|
||||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
ObjectClass *oc;
|
||||
|
||||
AttributeDescription *ad_objectClasses = slap_schema.si_ad_objectClasses;
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
for ( oc = oc_list; oc; oc = oc->soc_next ) {
|
||||
if ( ldap_objectclass2bv( &oc->soc_oclass, &val ) == NULL ) {
|
||||
if ( ldap_objectclass2bv( &oc->soc_oclass, vals ) == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s\n",
|
||||
(long) val.bv_len, val.bv_val, 0 );
|
||||
(long) vals[0].bv_len, vals[0].bv_val, 0 );
|
||||
#endif
|
||||
attr_merge( e, ad_objectClasses, vals );
|
||||
ldap_memfree( val.bv_val );
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ slap_operational_subschemaSubentry( void )
|
|||
a->a_desc = slap_schema.si_ad_subschemaSubentry;
|
||||
|
||||
/* Should be backend specific */
|
||||
a->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
|
||||
a->a_vals[0] = ber_bvstrdup( SLAPD_SCHEMA_DN );
|
||||
a->a_vals[1] = NULL;
|
||||
a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1, a->a_vals );
|
||||
a->a_vals[1].bv_val = NULL;
|
||||
|
||||
a->a_next = NULL;
|
||||
|
||||
|
|
@ -40,9 +40,9 @@ slap_operational_hasSubordinate( int hs )
|
|||
a = ch_malloc( sizeof( Attribute ) );
|
||||
a->a_desc = slap_schema.si_ad_hasSubordinates;
|
||||
|
||||
a->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
|
||||
a->a_vals[0] = ber_bvstrdup( hs ? "TRUE" : "FALSE" );
|
||||
a->a_vals[1] = NULL;
|
||||
a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
|
||||
ber_str2bv( hs ? "TRUE" : "FALSE", 0, 1, a->a_vals );
|
||||
a->a_vals[1].bv_val = NULL;
|
||||
|
||||
a->a_next = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ int passwd_extop(
|
|||
struct berval **rspdata,
|
||||
LDAPControl ***rspctrls,
|
||||
const char **text,
|
||||
struct berval ***refs )
|
||||
BVarray *refs )
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
@ -66,9 +66,9 @@ int passwd_extop(
|
|||
}
|
||||
|
||||
int slap_passwd_parse( struct berval *reqdata,
|
||||
struct berval **id,
|
||||
struct berval **oldpass,
|
||||
struct berval **newpass,
|
||||
struct berval *id,
|
||||
struct berval *oldpass,
|
||||
struct berval *newpass,
|
||||
const char **text )
|
||||
{
|
||||
int rc = LDAP_SUCCESS;
|
||||
|
|
@ -116,7 +116,7 @@ int slap_passwd_parse( struct berval *reqdata,
|
|||
goto done;
|
||||
}
|
||||
|
||||
tag = ber_scanf( ber, "O", id );
|
||||
tag = ber_scanf( ber, "o", id );
|
||||
|
||||
if( tag == LBER_ERROR ) {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -148,7 +148,7 @@ int slap_passwd_parse( struct berval *reqdata,
|
|||
goto done;
|
||||
}
|
||||
|
||||
tag = ber_scanf( ber, "O", oldpass );
|
||||
tag = ber_scanf( ber, "o", oldpass );
|
||||
|
||||
if( tag == LBER_ERROR ) {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -180,7 +180,7 @@ int slap_passwd_parse( struct berval *reqdata,
|
|||
goto done;
|
||||
}
|
||||
|
||||
tag = ber_scanf( ber, "O", newpass );
|
||||
tag = ber_scanf( ber, "o", newpass );
|
||||
|
||||
if( tag == LBER_ERROR ) {
|
||||
#ifdef NEW_LOGGING
|
||||
|
|
@ -215,19 +215,19 @@ decoding_error:
|
|||
|
||||
done:
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
if( id != NULL ) {
|
||||
ber_bvfree( *id );
|
||||
*id = NULL;
|
||||
if( id && id->bv_val != NULL ) {
|
||||
free( id->bv_val );
|
||||
id->bv_val = NULL;
|
||||
}
|
||||
|
||||
if( oldpass != NULL ) {
|
||||
ber_bvfree( *oldpass );
|
||||
*oldpass = NULL;
|
||||
if( oldpass && oldpass->bv_val != NULL ) {
|
||||
free( oldpass->bv_val );
|
||||
oldpass->bv_val = NULL;
|
||||
}
|
||||
|
||||
if( newpass != NULL ) {
|
||||
ber_bvfree( *newpass );
|
||||
*newpass = NULL;
|
||||
if( newpass && newpass->bv_val != NULL ) {
|
||||
free( newpass->bv_val );
|
||||
newpass->bv_val = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,8 +274,8 @@ slap_passwd_check(
|
|||
Attribute *a,
|
||||
struct berval *cred )
|
||||
{
|
||||
int i;
|
||||
int result = 1;
|
||||
struct berval *bv;
|
||||
|
||||
#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
|
||||
ldap_pvt_thread_mutex_lock( &passwd_mutex );
|
||||
|
|
@ -284,8 +284,8 @@ slap_passwd_check(
|
|||
#endif
|
||||
#endif
|
||||
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
if( !lutil_passwd( a->a_vals[i], cred, NULL ) ) {
|
||||
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
|
||||
if( !lutil_passwd( bv, cred, NULL ) ) {
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
|
@ -301,26 +301,36 @@ slap_passwd_check(
|
|||
return result;
|
||||
}
|
||||
|
||||
struct berval * slap_passwd_generate( void )
|
||||
void
|
||||
slap_passwd_generate( struct berval *pass )
|
||||
{
|
||||
struct berval *tmp;
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
|
||||
"slap_passwd_generate: begin\n" ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "slap_passwd_generate\n", 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* generate passwords of only 8 characters as some getpass(3)
|
||||
* implementations truncate at 8 characters.
|
||||
*/
|
||||
return lutil_passwd_generate( 8 );
|
||||
tmp = lutil_passwd_generate( 8 );
|
||||
if (tmp) {
|
||||
*pass = *tmp;
|
||||
free(tmp);
|
||||
} else {
|
||||
pass->bv_val = NULL;
|
||||
pass->bv_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct berval * slap_passwd_hash(
|
||||
struct berval * cred )
|
||||
void
|
||||
slap_passwd_hash(
|
||||
struct berval * cred,
|
||||
struct berval * new )
|
||||
{
|
||||
struct berval *tmp;
|
||||
#ifdef LUTIL_SHA1_BYTES
|
||||
char* hash = default_passwd_hash ? default_passwd_hash : "{SSHA}";
|
||||
#else
|
||||
|
|
@ -328,17 +338,17 @@ struct berval * slap_passwd_hash(
|
|||
#endif
|
||||
|
||||
|
||||
struct berval *new;
|
||||
|
||||
#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
|
||||
ldap_pvt_thread_mutex_lock( &passwd_mutex );
|
||||
#endif
|
||||
|
||||
new = lutil_passwd_hash( cred , hash );
|
||||
tmp = lutil_passwd_hash( cred , hash );
|
||||
|
||||
#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
|
||||
ldap_pvt_thread_mutex_unlock( &passwd_mutex );
|
||||
#endif
|
||||
*new = *tmp;
|
||||
free( tmp );
|
||||
|
||||
return new;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ LDAP_SLAPD_F (Attribute *) attr_dup LDAP_P(( Attribute *a ));
|
|||
|
||||
LDAP_SLAPD_F (int) attr_merge LDAP_P(( Entry *e,
|
||||
AttributeDescription *desc,
|
||||
struct berval **vals ));
|
||||
BVarray vals ));
|
||||
LDAP_SLAPD_F (Attribute *) attrs_find LDAP_P((
|
||||
Attribute *a, AttributeDescription *desc ));
|
||||
LDAP_SLAPD_F (Attribute *) attr_find LDAP_P((
|
||||
|
|
@ -221,7 +221,7 @@ LDAP_SLAPD_F (int) backend_attribute LDAP_P((BackendDB *be,
|
|||
Entry *target,
|
||||
struct berval *entry_ndn,
|
||||
AttributeDescription *entry_at,
|
||||
struct berval ***vals
|
||||
BVarray *vals
|
||||
));
|
||||
|
||||
LDAP_SLAPD_F (Attribute *) backend_operational(
|
||||
|
|
@ -278,7 +278,7 @@ LDAP_SLAPD_F (char **) str2charray LDAP_P(( const char *str, const char *brkstr
|
|||
LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
|
||||
LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
|
||||
|
||||
LDAP_SLAPD_F (void) bvarray_add LDAP_P(( struct berval **a, struct berval *bv ));
|
||||
LDAP_SLAPD_F (void) bvarray_add LDAP_P(( BVarray *a, struct berval *bv ));
|
||||
LDAP_SLAPD_F (void) bvarray_free LDAP_P(( struct berval *a ));
|
||||
|
||||
LDAP_SLAPD_F (char *) slap_strcopy LDAP_P((
|
||||
|
|
@ -438,7 +438,7 @@ LDAP_SLAPD_F (int) entry_id_cmp LDAP_P(( Entry *a, Entry *b ));
|
|||
* extended.c
|
||||
*/
|
||||
|
||||
typedef int (*SLAP_EXTOP_MAIN_FN) LDAP_P((
|
||||
typedef int (SLAP_EXTOP_MAIN_FN) LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
const char * reqoid,
|
||||
struct berval * reqdata,
|
||||
|
|
@ -446,9 +446,9 @@ typedef int (*SLAP_EXTOP_MAIN_FN) LDAP_P((
|
|||
struct berval ** rspdata,
|
||||
LDAPControl *** rspctrls,
|
||||
const char ** text,
|
||||
struct berval *** refs ));
|
||||
BVarray *refs ));
|
||||
|
||||
typedef int (*SLAP_EXTOP_GETOID_FN) LDAP_P((
|
||||
typedef int (SLAP_EXTOP_GETOID_FN) LDAP_P((
|
||||
int index, char *oid, int blen ));
|
||||
|
||||
LDAP_SLAPD_F (int) load_extension LDAP_P((
|
||||
|
|
@ -457,7 +457,7 @@ LDAP_SLAPD_F (char *) get_supported_extension LDAP_P((int index));
|
|||
|
||||
LDAP_SLAPD_F (int) load_extop LDAP_P((
|
||||
const char *ext_oid,
|
||||
SLAP_EXTOP_MAIN_FN ext_main ));
|
||||
SLAP_EXTOP_MAIN_FN *ext_main ));
|
||||
|
||||
LDAP_SLAPD_F (int) extops_init LDAP_P(( void ));
|
||||
|
||||
|
|
@ -516,6 +516,12 @@ LDAP_SLAPD_F( void ) slap_mod_free( Modification *mod, int freeit );
|
|||
LDAP_SLAPD_F( void ) slap_mods_free( Modifications *mods );
|
||||
LDAP_SLAPD_F( void ) slap_modlist_free( LDAPModList *ml );
|
||||
|
||||
LDAP_SLAPD_F( int ) slap_mods_check(
|
||||
Modifications *ml,
|
||||
int update,
|
||||
const char **text,
|
||||
char *textbuf, size_t textlen );
|
||||
|
||||
LDAP_SLAPD_F( int ) slap_modlist2mods(
|
||||
LDAPModList *ml,
|
||||
int update,
|
||||
|
|
@ -605,11 +611,11 @@ LDAP_SLAPD_F (void) replog LDAP_P(( Backend *be, Operation *op,
|
|||
LDAP_SLAPD_F (int) validate_global_referral LDAP_P((
|
||||
const char *url ));
|
||||
|
||||
LDAP_SLAPD_F (struct berval **) get_entry_referrals LDAP_P((
|
||||
LDAP_SLAPD_F (BVarray) get_entry_referrals LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op, Entry *e ));
|
||||
|
||||
LDAP_SLAPD_F (struct berval **) referral_rewrite LDAP_P((
|
||||
struct berval **refs,
|
||||
LDAP_SLAPD_F (BVarray) referral_rewrite LDAP_P((
|
||||
BVarray refs,
|
||||
struct berval *base,
|
||||
struct berval *target,
|
||||
int scope ));
|
||||
|
|
@ -621,14 +627,14 @@ LDAP_SLAPD_F (struct berval **) referral_rewrite LDAP_P((
|
|||
LDAP_SLAPD_F (void) send_ldap_result LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *matched, const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls ));
|
||||
|
||||
LDAP_SLAPD_F (void) send_ldap_sasl LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
struct berval *cred ));
|
||||
|
||||
|
|
@ -639,7 +645,7 @@ LDAP_SLAPD_F (void) send_ldap_disconnect LDAP_P((
|
|||
LDAP_SLAPD_F (void) send_ldap_extended LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *matched,
|
||||
const char *text, struct berval **refs,
|
||||
const char *text, BVarray refs,
|
||||
const char *rspoid, struct berval *rspdata,
|
||||
LDAPControl **ctrls ));
|
||||
|
||||
|
|
@ -651,15 +657,15 @@ LDAP_SLAPD_F (void) send_ldap_partial LDAP_P((
|
|||
LDAP_SLAPD_F (void) send_search_result LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
ber_int_t err, const char *matched, const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
int nentries ));
|
||||
|
||||
LDAP_SLAPD_F (int) send_search_reference LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
Entry *e, struct berval **refs,
|
||||
Entry *e, BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
struct berval ***v2refs ));
|
||||
BVarray *v2refs ));
|
||||
|
||||
LDAP_SLAPD_F (int) send_search_entry LDAP_P((
|
||||
Backend *be, Connection *conn, Operation *op,
|
||||
|
|
@ -806,11 +812,11 @@ LDAP_SLAPD_F (int) is_entry_objectclass LDAP_P((
|
|||
*/
|
||||
LDAP_SLAPD_F( int ) oc_check_allowed(
|
||||
AttributeType *type,
|
||||
struct berval **oclist,
|
||||
BVarray oclist,
|
||||
ObjectClass *sc );
|
||||
|
||||
LDAP_SLAPD_F( int ) structural_class(
|
||||
struct berval **ocs,
|
||||
BVarray ocs,
|
||||
struct berval *scbv,
|
||||
const char **text,
|
||||
char *textbuf, size_t textlen );
|
||||
|
|
@ -852,16 +858,7 @@ LDAP_SLAPD_F (int) dscompare LDAP_P(( const char *s1, const char *s2del,
|
|||
/*
|
||||
* starttls.c
|
||||
*/
|
||||
|
||||
LDAP_SLAPD_F (int) starttls_extop LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
const char * reqoid,
|
||||
struct berval * reqdata,
|
||||
char ** rspoid,
|
||||
struct berval ** rspdata,
|
||||
LDAPControl ***rspctrls,
|
||||
const char ** text,
|
||||
struct berval *** refs ));
|
||||
LDAP_SLAPD_F (SLAP_EXTOP_MAIN_FN) starttls_extop;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -896,11 +893,11 @@ LDAP_SLAPD_F (int) value_match LDAP_P((
|
|||
LDAP_SLAPD_F (int) value_find_ex LDAP_P((
|
||||
AttributeDescription *ad,
|
||||
unsigned flags,
|
||||
struct berval **values,
|
||||
BVarray values,
|
||||
struct berval *value ));
|
||||
LDAP_SLAPD_F (int) value_add LDAP_P((
|
||||
struct berval ***vals,
|
||||
struct berval **addvals ));
|
||||
BVarray *vals,
|
||||
BVarray addvals ));
|
||||
|
||||
/*
|
||||
* user.c
|
||||
|
|
@ -912,34 +909,27 @@ LDAP_SLAPD_F (void) slap_init_user LDAP_P(( char *username, char *groupname ));
|
|||
/*
|
||||
* passwd.c
|
||||
*/
|
||||
LDAP_SLAPD_F (int) passwd_extop LDAP_P((
|
||||
Connection *conn, Operation *op,
|
||||
const char * reqoid,
|
||||
struct berval * reqdata,
|
||||
char ** rspoid,
|
||||
struct berval ** rspdata,
|
||||
LDAPControl *** rspctrls,
|
||||
const char ** text,
|
||||
struct berval *** refs ));
|
||||
LDAP_SLAPD_F (SLAP_EXTOP_MAIN_FN) passwd_extop;
|
||||
|
||||
LDAP_SLAPD_F (int) slap_passwd_check(
|
||||
Connection *conn,
|
||||
Attribute *attr,
|
||||
struct berval *cred );
|
||||
|
||||
LDAP_SLAPD_F (struct berval *) slap_passwd_generate( void );
|
||||
LDAP_SLAPD_F (void) slap_passwd_generate( struct berval * );
|
||||
|
||||
LDAP_SLAPD_F (struct berval *) slap_passwd_hash(
|
||||
struct berval *cred );
|
||||
LDAP_SLAPD_F (void) slap_passwd_hash(
|
||||
struct berval *cred,
|
||||
struct berval *hash );
|
||||
|
||||
LDAP_SLAPD_F (struct berval *) slap_passwd_return(
|
||||
struct berval *cred );
|
||||
|
||||
LDAP_SLAPD_F (int) slap_passwd_parse(
|
||||
struct berval *reqdata,
|
||||
struct berval **id,
|
||||
struct berval **oldpass,
|
||||
struct berval **newpass,
|
||||
struct berval *id,
|
||||
struct berval *oldpass,
|
||||
struct berval *newpass,
|
||||
const char **text );
|
||||
|
||||
/*
|
||||
|
|
@ -973,7 +963,7 @@ LDAP_SLAPD_V (slap_mask_t) global_disallows;
|
|||
LDAP_SLAPD_V (slap_mask_t) global_requires;
|
||||
LDAP_SLAPD_V (slap_ssf_set_t) global_ssf_set;
|
||||
|
||||
LDAP_SLAPD_V (struct berval **) default_referral;
|
||||
LDAP_SLAPD_V (BVarray) default_referral;
|
||||
LDAP_SLAPD_V (char *) replogfile;
|
||||
LDAP_SLAPD_V (const char) Versionstr[];
|
||||
LDAP_SLAPD_V (struct slap_limits_set) deflimit;
|
||||
|
|
|
|||
|
|
@ -213,31 +213,32 @@ int validate_global_referral( const char *url )
|
|||
return rc;
|
||||
}
|
||||
|
||||
struct berval ** referral_rewrite(
|
||||
struct berval **in,
|
||||
BVarray referral_rewrite(
|
||||
BVarray in,
|
||||
struct berval *base,
|
||||
struct berval *target,
|
||||
int scope )
|
||||
{
|
||||
int i, j;
|
||||
struct berval **refs;
|
||||
int i;
|
||||
BVarray refs;
|
||||
struct berval *iv, *jv;
|
||||
|
||||
if( in == NULL ) return NULL;
|
||||
|
||||
for( i=0; in[i] != NULL ; i++ ) {
|
||||
for( i=0; in[i].bv_val != NULL ; i++ ) {
|
||||
/* just count them */
|
||||
}
|
||||
|
||||
if( i < 1 ) return NULL;
|
||||
|
||||
refs = ch_malloc( (i+1) * sizeof( struct berval * ) );
|
||||
refs = ch_malloc( (i+1) * sizeof( struct berval ) );
|
||||
|
||||
for( i=0,j=0; in[i] != NULL ; i++ ) {
|
||||
for( iv=in,jv=refs; iv->bv_val != NULL ; iv++ ) {
|
||||
LDAPURLDesc *url;
|
||||
int rc = ldap_url_parse_ext( in[i]->bv_val, &url );
|
||||
int rc = ldap_url_parse_ext( iv->bv_val, &url );
|
||||
|
||||
if( rc == LDAP_URL_ERR_BADSCHEME ) {
|
||||
refs[j++] = ber_bvdup( in[i] );
|
||||
ber_dupbv( jv++, iv );
|
||||
continue;
|
||||
|
||||
} else if( rc != LDAP_URL_SUCCESS ) {
|
||||
|
|
@ -258,36 +259,35 @@ struct berval ** referral_rewrite(
|
|||
url->lud_scope = scope;
|
||||
}
|
||||
|
||||
refs[j] = ch_malloc( sizeof( struct berval ) );
|
||||
|
||||
refs[j]->bv_val = ldap_url_desc2str( url );
|
||||
refs[j]->bv_len = strlen( refs[j]->bv_val );
|
||||
jv->bv_val = ldap_url_desc2str( url );
|
||||
jv->bv_len = strlen( jv->bv_val );
|
||||
|
||||
ldap_free_urldesc( url );
|
||||
j++;
|
||||
jv++;
|
||||
}
|
||||
|
||||
if( j == 0 ) {
|
||||
if( jv == refs ) {
|
||||
ch_free( refs );
|
||||
refs = NULL;
|
||||
|
||||
} else {
|
||||
refs[j] = NULL;
|
||||
jv->bv_val = NULL;
|
||||
}
|
||||
|
||||
return refs;
|
||||
}
|
||||
|
||||
|
||||
struct berval **get_entry_referrals(
|
||||
BVarray get_entry_referrals(
|
||||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e )
|
||||
{
|
||||
Attribute *attr;
|
||||
struct berval **refs;
|
||||
unsigned i, j;
|
||||
BVarray refs;
|
||||
unsigned i;
|
||||
struct berval *iv, *jv;
|
||||
|
||||
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
|
||||
|
||||
|
|
@ -295,41 +295,40 @@ struct berval **get_entry_referrals(
|
|||
|
||||
if( attr == NULL ) return NULL;
|
||||
|
||||
for( i=0; attr->a_vals[i] != NULL; i++ ) {
|
||||
for( i=0; attr->a_vals[i].bv_val != NULL; i++ ) {
|
||||
/* count references */
|
||||
}
|
||||
|
||||
if( i < 1 ) return NULL;
|
||||
|
||||
refs = ch_malloc( (i + 1) * sizeof(struct berval *));
|
||||
refs = ch_malloc( (i + 1) * sizeof(struct berval));
|
||||
|
||||
for( i=0, j=0; attr->a_vals[i] != NULL; i++ ) {
|
||||
for( iv=attr->a_vals, jv=refs; iv->bv_val != NULL; iv++ ) {
|
||||
unsigned k;
|
||||
struct berval *ref = ber_bvdup( attr->a_vals[i] );
|
||||
ber_dupbv( jv, iv );
|
||||
|
||||
/* trim the label */
|
||||
for( k=0; k<ref->bv_len; k++ ) {
|
||||
if( isspace(ref->bv_val[k]) ) {
|
||||
ref->bv_val[k] = '\0';
|
||||
ref->bv_len = k;
|
||||
for( k=0; k<jv->bv_len; k++ ) {
|
||||
if( isspace(jv->bv_val[k]) ) {
|
||||
jv->bv_val[k] = '\0';
|
||||
jv->bv_len = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( ref->bv_len > 0 ) {
|
||||
refs[j++] = ref;
|
||||
|
||||
if( jv->bv_len > 0 ) {
|
||||
jv++;
|
||||
} else {
|
||||
ber_bvfree( ref );
|
||||
free( jv->bv_val );
|
||||
}
|
||||
}
|
||||
|
||||
if( j == 0 ) {
|
||||
ber_bvecfree( refs );
|
||||
if( jv == refs ) {
|
||||
free( refs );
|
||||
refs = NULL;
|
||||
|
||||
} else {
|
||||
refs[j] = NULL;
|
||||
jv->bv_val = NULL;
|
||||
}
|
||||
|
||||
/* we should check that a referral value exists... */
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ replog(
|
|||
ml = change;
|
||||
for ( ; ml != NULL; ml = ml->sml_next ) {
|
||||
char *type;
|
||||
struct berval *bv;
|
||||
type = ml->sml_desc->ad_cname.bv_val;
|
||||
switch ( ml->sml_op ) {
|
||||
case LDAP_MOD_ADD:
|
||||
|
|
@ -167,20 +168,18 @@ replog(
|
|||
break;
|
||||
}
|
||||
|
||||
for ( i = 0; ml->sml_bvalues != NULL &&
|
||||
ml->sml_bvalues[i] != NULL; i++ )
|
||||
for ( bv = ml->sml_bvalues; bv && bv->bv_val; bv++ )
|
||||
{
|
||||
char *buf, *bufp;
|
||||
|
||||
len = ml->sml_desc->ad_cname.bv_len;
|
||||
len = LDIF_SIZE_NEEDED( len,
|
||||
ml->sml_bvalues[i]->bv_len ) + 1;
|
||||
bv->bv_len ) + 1;
|
||||
buf = (char *) ch_malloc( len );
|
||||
|
||||
bufp = buf;
|
||||
ldif_sput( &bufp, LDIF_PUT_VALUE, type,
|
||||
ml->sml_bvalues[i]->bv_val,
|
||||
ml->sml_bvalues[i]->bv_len );
|
||||
bv->bv_val, bv->bv_len );
|
||||
*bufp = '\0';
|
||||
|
||||
fputs( buf, fp );
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
static char *v2ref( struct berval **ref, const char *text )
|
||||
static char *v2ref( BVarray ref, const char *text )
|
||||
{
|
||||
size_t len = 0, i = 0;
|
||||
char *v2;
|
||||
|
|
@ -49,12 +49,12 @@ static char *v2ref( struct berval **ref, const char *text )
|
|||
strcpy( v2+len, "Referral:" );
|
||||
len += sizeof("Referral:");
|
||||
|
||||
for( i=0; ref[i] != NULL; i++ ) {
|
||||
v2 = ch_realloc( v2, len + ref[i]->bv_len + 1 );
|
||||
for( i=0; ref[i].bv_val != NULL; i++ ) {
|
||||
v2 = ch_realloc( v2, len + ref[i].bv_len + 1 );
|
||||
v2[len-1] = '\n';
|
||||
AC_MEMCPY(&v2[len], ref[i]->bv_val, ref[i]->bv_len );
|
||||
len += ref[i]->bv_len;
|
||||
if (ref[i]->bv_val[ref[i]->bv_len-1] != '/') {
|
||||
AC_MEMCPY(&v2[len], ref[i].bv_val, ref[i].bv_len );
|
||||
len += ref[i].bv_len;
|
||||
if (ref[i].bv_val[ref[i].bv_len-1] != '/') {
|
||||
++len;
|
||||
}
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ send_ldap_response(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **ref,
|
||||
BVarray ref,
|
||||
const char *resoid,
|
||||
struct berval *resdata,
|
||||
struct berval *sasldata,
|
||||
|
|
@ -214,10 +214,10 @@ send_ldap_response(
|
|||
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
|
||||
"send_ldap_response: conn %d ref=\"%s\"\n",
|
||||
conn ? conn->c_connid : 0,
|
||||
ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL" ));
|
||||
ref[0].bv_val ? ref[0].bv_val : "NULL" ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ARGS, "send_ldap_response: ref=\"%s\"\n",
|
||||
ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL",
|
||||
ref[0].bv_val ? ref[0].bv_val : "NULL",
|
||||
NULL, NULL );
|
||||
#endif
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ send_ldap_response(
|
|||
if( rc != -1 ) {
|
||||
if ( ref != NULL ) {
|
||||
assert( err == LDAP_REFERRAL );
|
||||
rc = ber_printf( ber, "t{V}",
|
||||
rc = ber_printf( ber, "t{W}",
|
||||
LDAP_TAG_REFERRAL, ref );
|
||||
} else {
|
||||
assert( err != LDAP_REFERRAL );
|
||||
|
|
@ -383,7 +383,7 @@ send_ldap_result(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **ref,
|
||||
BVarray ref,
|
||||
LDAPControl **ctrls
|
||||
)
|
||||
{
|
||||
|
|
@ -418,11 +418,11 @@ send_ldap_result(
|
|||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
|
||||
"send_ldap_result: referral=\"%s\"\n",
|
||||
ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL" ));
|
||||
ref[0].bv_val ? ref[0].bv_val : "NULL" ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ARGS,
|
||||
"send_ldap_result: referral=\"%s\"\n",
|
||||
ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL",
|
||||
ref[0].bv_val ? ref[0].bv_val : "NULL",
|
||||
NULL, NULL );
|
||||
#endif
|
||||
}
|
||||
|
|
@ -467,7 +467,7 @@ send_ldap_sasl(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **ref,
|
||||
BVarray ref,
|
||||
LDAPControl **ctrls,
|
||||
struct berval *cred
|
||||
)
|
||||
|
|
@ -500,7 +500,7 @@ send_ldap_extended(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
const char *rspoid,
|
||||
struct berval *rspdata,
|
||||
LDAPControl **ctrls
|
||||
|
|
@ -539,7 +539,7 @@ send_search_result(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
int nentries
|
||||
)
|
||||
|
|
@ -766,9 +766,9 @@ send_search_entry(
|
|||
}
|
||||
|
||||
if ( ! attrsonly ) {
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
for ( i = 0; a->a_vals[i].bv_val != NULL; i++ ) {
|
||||
if ( ! access_allowed( be, conn, op, e,
|
||||
desc, a->a_vals[i], ACL_READ ) )
|
||||
desc, &a->a_vals[i], ACL_READ ) )
|
||||
{
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
|
||||
|
|
@ -783,7 +783,7 @@ send_search_entry(
|
|||
continue;
|
||||
}
|
||||
|
||||
if (( rc = ber_printf( ber, "O", a->a_vals[i] )) == -1 ) {
|
||||
if (( rc = ber_printf( ber, "O", &a->a_vals[i] )) == -1 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
|
||||
"send_search_entry: conn %d ber_printf failed.\n",
|
||||
|
|
@ -875,9 +875,9 @@ send_search_entry(
|
|||
}
|
||||
|
||||
if ( ! attrsonly ) {
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
for ( i = 0; a->a_vals[i].bv_val != NULL; i++ ) {
|
||||
if ( ! access_allowed( be, conn, op, e,
|
||||
desc, a->a_vals[i], ACL_READ ) )
|
||||
desc, &a->a_vals[i], ACL_READ ) )
|
||||
{
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
|
||||
|
|
@ -893,7 +893,7 @@ send_search_entry(
|
|||
}
|
||||
|
||||
|
||||
if (( rc = ber_printf( ber, "O", a->a_vals[i] )) == -1 ) {
|
||||
if (( rc = ber_printf( ber, "O", &a->a_vals[i] )) == -1 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
|
||||
"send_search_entry: conn %d ber_printf failed\n",
|
||||
|
|
@ -999,9 +999,9 @@ send_search_reference(
|
|||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
struct berval ***v2refs
|
||||
BVarray *v2refs
|
||||
)
|
||||
{
|
||||
char berbuf[256];
|
||||
|
|
@ -1071,7 +1071,7 @@ send_search_reference(
|
|||
|
||||
if( op->o_protocol < LDAP_VERSION3 ) {
|
||||
/* save the references for the result */
|
||||
if( *refs != NULL ) {
|
||||
if( refs[0].bv_val != NULL ) {
|
||||
value_add( v2refs, refs );
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1079,7 +1079,7 @@ send_search_reference(
|
|||
|
||||
ber_init_w_nullc( ber, LBER_USE_DER );
|
||||
|
||||
rc = ber_printf( ber, "{it{V}N}", op->o_msgid,
|
||||
rc = ber_printf( ber, "{it{W}N}", op->o_msgid,
|
||||
LDAP_RES_SEARCH_REFERENCE, refs );
|
||||
|
||||
if ( rc == -1 ) {
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ root_dse_info(
|
|||
{
|
||||
char buf[BUFSIZ];
|
||||
Entry *e;
|
||||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
int i, j;
|
||||
char ** supportedSASLMechanisms;
|
||||
|
||||
|
|
@ -60,8 +59,7 @@ root_dse_info(
|
|||
|
||||
Attribute *a;
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
|
||||
|
||||
|
|
@ -78,23 +76,23 @@ root_dse_info(
|
|||
|
||||
e->e_private = NULL;
|
||||
|
||||
val.bv_val = "OpenLDAProotDSE";
|
||||
val.bv_len = sizeof("OpenLDAProotDSE")-1;
|
||||
vals[0].bv_val = "OpenLDAProotDSE";
|
||||
vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
|
||||
attr_merge( e, ad_structuralObjectClass, vals );
|
||||
|
||||
val.bv_val = "top";
|
||||
val.bv_len = sizeof("top")-1;
|
||||
vals[0].bv_val = "top";
|
||||
vals[0].bv_len = sizeof("top")-1;
|
||||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
val.bv_val = "OpenLDAProotDSE";
|
||||
val.bv_len = sizeof("OpenLDAProotDSE")-1;
|
||||
vals[0].bv_val = "OpenLDAProotDSE";
|
||||
vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
|
||||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
for ( i = 0; i < nbackends; i++ ) {
|
||||
if ( backends[i].be_glueflags & SLAP_GLUE_SUBORDINATE )
|
||||
continue;
|
||||
for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
|
||||
val = *backends[i].be_suffix[j];
|
||||
vals[0] = *backends[i].be_suffix[j];
|
||||
attr_merge( e, ad_namingContexts, vals );
|
||||
}
|
||||
}
|
||||
|
|
@ -103,21 +101,21 @@ root_dse_info(
|
|||
|
||||
/* supportedControl */
|
||||
for ( i=0; supportedControls[i] != NULL; i++ ) {
|
||||
val.bv_val = supportedControls[i];
|
||||
val.bv_len = strlen( val.bv_val );
|
||||
vals[0].bv_val = supportedControls[i];
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
attr_merge( e, ad_supportedControl, vals );
|
||||
}
|
||||
|
||||
/* supportedExtension */
|
||||
for ( i=0; (val.bv_val = get_supported_extop(i)) != NULL; i++ ) {
|
||||
val.bv_len = strlen( val.bv_val );
|
||||
for ( i=0; (vals[0].bv_val = get_supported_extop(i)) != NULL; i++ ) {
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
attr_merge( e, ad_supportedExtension, vals );
|
||||
}
|
||||
|
||||
/* supportedFeatures */
|
||||
for ( i=0; supportedFeatures[i] != NULL; i++ ) {
|
||||
val.bv_val = supportedFeatures[i];
|
||||
val.bv_len = strlen( val.bv_val );
|
||||
vals[0].bv_val = supportedFeatures[i];
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
attr_merge( e, ad_supportedFeatures, vals );
|
||||
}
|
||||
|
||||
|
|
@ -130,8 +128,8 @@ root_dse_info(
|
|||
continue;
|
||||
}
|
||||
sprintf(buf,"%d",i);
|
||||
val.bv_val = buf;
|
||||
val.bv_len = strlen( val.bv_val );
|
||||
vals[0].bv_val = buf;
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
attr_merge( e, ad_supportedLDAPVersion, vals );
|
||||
}
|
||||
|
||||
|
|
@ -140,8 +138,8 @@ root_dse_info(
|
|||
|
||||
if( supportedSASLMechanisms != NULL ) {
|
||||
for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
|
||||
val.bv_val = supportedSASLMechanisms[i];
|
||||
val.bv_len = strlen( val.bv_val );
|
||||
vals[0].bv_val = supportedSASLMechanisms[i];
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
attr_merge( e, ad_supportedSASLMechanisms, vals );
|
||||
}
|
||||
charray_free( supportedSASLMechanisms );
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ slap_sasl_check_authz(char *searchDN, char *assertDN, char *attr, char *authc)
|
|||
{
|
||||
const char *errmsg;
|
||||
int i, rc;
|
||||
struct berval **vals=NULL;
|
||||
BVarray vals=NULL;
|
||||
AttributeDescription *ad=NULL;
|
||||
struct berval bv;
|
||||
|
||||
|
|
@ -587,15 +587,15 @@ slap_sasl_check_authz(char *searchDN, char *assertDN, char *attr, char *authc)
|
|||
goto COMPLETE;
|
||||
|
||||
/* Check if the *assertDN matches any **vals */
|
||||
for( i=0; vals[i] != NULL; i++ ) {
|
||||
rc = slap_sasl_match( vals[i]->bv_val, assertDN+3, authc );
|
||||
for( i=0; vals[i].bv_val != NULL; i++ ) {
|
||||
rc = slap_sasl_match( vals[i].bv_val, assertDN+3, authc );
|
||||
if ( rc == LDAP_SUCCESS )
|
||||
goto COMPLETE;
|
||||
}
|
||||
rc = LDAP_INAPPROPRIATE_AUTH;
|
||||
|
||||
COMPLETE:
|
||||
if( vals ) ber_bvecfree( vals );
|
||||
if( vals ) bvarray_free( vals );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ schema_info( Entry **entry, const char **text )
|
|||
= slap_schema.si_ad_objectClass;
|
||||
|
||||
Entry *e;
|
||||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
|
||||
|
||||
|
|
@ -41,24 +39,24 @@ schema_info( Entry **entry, const char **text )
|
|||
(void) dnNormalize2( NULL, &e->e_name, &e->e_nname );
|
||||
e->e_private = NULL;
|
||||
|
||||
val.bv_val = "LDAPsubentry";
|
||||
val.bv_len = sizeof("LDAPsubentry")-1;
|
||||
vals[0].bv_val = "LDAPsubentry";
|
||||
vals[0].bv_len = sizeof("LDAPsubentry")-1;
|
||||
attr_merge( e, ad_structuralObjectClass, vals );
|
||||
|
||||
val.bv_val = "top";
|
||||
val.bv_len = sizeof("top")-1;
|
||||
vals[0].bv_val = "top";
|
||||
vals[0].bv_len = sizeof("top")-1;
|
||||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
val.bv_val = "LDAPsubentry";
|
||||
val.bv_len = sizeof("LDAPsubentry")-1;
|
||||
vals[0].bv_val = "LDAPsubentry";
|
||||
vals[0].bv_len = sizeof("LDAPsubentry")-1;
|
||||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
val.bv_val = "subschema";
|
||||
val.bv_len = sizeof("subschema")-1;
|
||||
vals[0].bv_val = "subschema";
|
||||
vals[0].bv_len = sizeof("subschema")-1;
|
||||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
val.bv_val = "extensibleObject";
|
||||
val.bv_len = sizeof("extensibleObject")-1;
|
||||
vals[0].bv_val = "extensibleObject";
|
||||
vals[0].bv_len = sizeof("extensibleObject")-1;
|
||||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
{
|
||||
|
|
@ -66,16 +64,16 @@ schema_info( Entry **entry, const char **text )
|
|||
AttributeDescription *desc = NULL;
|
||||
struct berval rdn = { sizeof(SLAPD_SCHEMA_DN)-1,
|
||||
SLAPD_SCHEMA_DN };
|
||||
val.bv_val = strchr( rdn.bv_val, '=' );
|
||||
vals[0].bv_val = strchr( rdn.bv_val, '=' );
|
||||
|
||||
if( val.bv_val == NULL ) {
|
||||
if( vals[0].bv_val == NULL ) {
|
||||
*text = "improperly configured subschema subentry";
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
val.bv_val++;
|
||||
val.bv_len = rdn.bv_len - (val.bv_val - rdn.bv_val);
|
||||
rdn.bv_len -= val.bv_len + 1;
|
||||
vals[0].bv_val++;
|
||||
vals[0].bv_len = rdn.bv_len - (vals[0].bv_val - rdn.bv_val);
|
||||
rdn.bv_len -= vals[0].bv_len + 1;
|
||||
|
||||
rc = slap_bv2ad( &rdn, &desc, text );
|
||||
|
||||
|
|
@ -103,4 +101,3 @@ schema_info( Entry **entry, const char **text )
|
|||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ entry_schema_check(
|
|||
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
|
||||
/* there should be at least one value */
|
||||
assert( a->a_vals );
|
||||
assert( a->a_vals[0] != NULL );
|
||||
assert( a->a_vals[0].bv_val != NULL );
|
||||
|
||||
/* if single value type, check for multiple values */
|
||||
if( is_at_single_value( a->a_desc->ad_type ) &&
|
||||
a->a_vals[1] != NULL )
|
||||
a->a_vals[1].bv_val != NULL )
|
||||
{
|
||||
char *type = a->a_desc->ad_cname.bv_val;
|
||||
|
||||
|
|
@ -97,14 +97,14 @@ entry_schema_check(
|
|||
}
|
||||
|
||||
assert( asc->a_vals != NULL );
|
||||
assert( asc->a_vals[0] != NULL );
|
||||
assert( asc->a_vals[1] == NULL );
|
||||
assert( asc->a_vals[0].bv_val != NULL );
|
||||
assert( asc->a_vals[1].bv_val == NULL );
|
||||
|
||||
sc = oc_bvfind( asc->a_vals[0] );
|
||||
sc = oc_bvfind( &asc->a_vals[0] );
|
||||
if( sc == NULL ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"unrecognized structuralObjectClass '%s'",
|
||||
aoc->a_vals[0]->bv_val );
|
||||
aoc->a_vals[0].bv_val );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
|
||||
|
|
@ -122,7 +122,7 @@ entry_schema_check(
|
|||
if( sc->soc_kind != LDAP_SCHEMA_STRUCTURAL ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"structuralObjectClass '%s' is not STRUCTURAL",
|
||||
aoc->a_vals[0]->bv_val );
|
||||
aoc->a_vals[0].bv_val );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
|
||||
|
|
@ -154,7 +154,7 @@ entry_schema_check(
|
|||
}
|
||||
|
||||
assert( aoc->a_vals != NULL );
|
||||
assert( aoc->a_vals[0] != NULL );
|
||||
assert( aoc->a_vals[0].bv_val != NULL );
|
||||
|
||||
rc = structural_class( aoc->a_vals, &nsc, text, textbuf, textlen );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
@ -169,22 +169,22 @@ entry_schema_check(
|
|||
if ( oc == NULL ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"unrecognized objectClass '%s'",
|
||||
aoc->a_vals[i]->bv_val );
|
||||
aoc->a_vals[i].bv_val );
|
||||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
|
||||
} else if ( sc != oc ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"structuralObjectClass modification from '%s' to '%s' not allowed",
|
||||
asc->a_vals[0]->bv_val, nsc.bv_val );
|
||||
asc->a_vals[0].bv_val, nsc.bv_val );
|
||||
return LDAP_NO_OBJECT_CLASS_MODS;
|
||||
}
|
||||
|
||||
/* check that the entry has required attrs for each oc */
|
||||
for ( i = 0; aoc->a_vals[i] != NULL; i++ ) {
|
||||
if ( (oc = oc_bvfind( aoc->a_vals[i] )) == NULL ) {
|
||||
for ( i = 0; aoc->a_vals[i].bv_val != NULL; i++ ) {
|
||||
if ( (oc = oc_bvfind( &aoc->a_vals[i] )) == NULL ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"unrecognized objectClass '%s'",
|
||||
aoc->a_vals[i]->bv_val );
|
||||
aoc->a_vals[i].bv_val );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
|
||||
|
|
@ -205,13 +205,13 @@ entry_schema_check(
|
|||
{
|
||||
int j;
|
||||
ObjectClass *xc = NULL;
|
||||
for( j=0; aoc->a_vals[j]; j++ ) {
|
||||
for( j=0; aoc->a_vals[j].bv_val; j++ ) {
|
||||
if( i != j ) {
|
||||
xc = oc_bvfind( aoc->a_vals[i] );
|
||||
xc = oc_bvfind( &aoc->a_vals[i] );
|
||||
if( xc == NULL ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"unrecognized objectClass '%s'",
|
||||
aoc->a_vals[i]->bv_val );
|
||||
aoc->a_vals[i].bv_val );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
|
||||
|
|
@ -245,7 +245,7 @@ entry_schema_check(
|
|||
if( xc == NULL ) {
|
||||
snprintf( textbuf, textlen, "instanstantiation of "
|
||||
"abstract objectClass '%s' not allowed",
|
||||
aoc->a_vals[i]->bv_val );
|
||||
aoc->a_vals[i].bv_val );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
|
||||
|
|
@ -262,12 +262,12 @@ entry_schema_check(
|
|||
}
|
||||
|
||||
} else if ( oc->soc_kind != LDAP_SCHEMA_STRUCTURAL || oc == sc ) {
|
||||
char *s = oc_check_required( e, oc, aoc->a_vals[i] );
|
||||
char *s = oc_check_required( e, oc, &aoc->a_vals[i] );
|
||||
|
||||
if (s != NULL) {
|
||||
snprintf( textbuf, textlen,
|
||||
"object class '%s' requires attribute '%s'",
|
||||
aoc->a_vals[i]->bv_val, s );
|
||||
aoc->a_vals[i].bv_val, s );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
|
||||
|
|
@ -365,7 +365,7 @@ oc_check_required(
|
|||
|
||||
int oc_check_allowed(
|
||||
AttributeType *at,
|
||||
struct berval **ocl,
|
||||
BVarray ocl,
|
||||
ObjectClass *sc )
|
||||
{
|
||||
int i, j;
|
||||
|
|
@ -413,9 +413,9 @@ int oc_check_allowed(
|
|||
}
|
||||
|
||||
/* check that the type appears as req or opt in at least one oc */
|
||||
for ( i = 0; ocl[i] != NULL; i++ ) {
|
||||
for ( i = 0; ocl[i].bv_val != NULL; i++ ) {
|
||||
/* if we know about the oc */
|
||||
ObjectClass *oc = oc_bvfind( ocl[i] );
|
||||
ObjectClass *oc = oc_bvfind( &ocl[i] );
|
||||
if ( oc != NULL && oc->soc_kind != LDAP_SCHEMA_ABSTRACT &&
|
||||
( sc == NULL || oc->soc_kind == LDAP_SCHEMA_AUXILIARY ))
|
||||
{
|
||||
|
|
@ -446,7 +446,7 @@ int oc_check_allowed(
|
|||
* Determine the structural object class from a set of OIDs
|
||||
*/
|
||||
int structural_class(
|
||||
struct berval **ocs,
|
||||
BVarray ocs,
|
||||
struct berval *scbv,
|
||||
const char **text,
|
||||
char *textbuf, size_t textlen )
|
||||
|
|
@ -459,13 +459,13 @@ int structural_class(
|
|||
*text = "structural_class: internal error";
|
||||
scbv->bv_len = 0;
|
||||
|
||||
for( i=0; ocs[i]; i++ ) {
|
||||
oc = oc_bvfind( ocs[i] );
|
||||
for( i=0; ocs[i].bv_val; i++ ) {
|
||||
oc = oc_bvfind( &ocs[i] );
|
||||
|
||||
if( oc == NULL ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"unrecongized objectClass '%s'",
|
||||
ocs[i]->bv_val );
|
||||
ocs[i].bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
}
|
||||
|
|
@ -480,13 +480,13 @@ int structural_class(
|
|||
ObjectClass *xc = NULL;
|
||||
|
||||
/* find common superior */
|
||||
for( j=i+1; ocs[j]; j++ ) {
|
||||
xc = oc_bvfind( ocs[j] );
|
||||
for( j=i+1; ocs[j].bv_val; j++ ) {
|
||||
xc = oc_bvfind( &ocs[j] );
|
||||
|
||||
if( xc == NULL ) {
|
||||
snprintf( textbuf, textlen,
|
||||
"unrecongized objectClass '%s'",
|
||||
ocs[i]->bv_val );
|
||||
ocs[i].bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
}
|
||||
|
|
@ -510,7 +510,7 @@ int structural_class(
|
|||
/* no common subclass */
|
||||
snprintf( textbuf, textlen,
|
||||
"invalid structural object class chain (%s/%s)",
|
||||
ocs[scn]->bv_val, ocs[i]->bv_val );
|
||||
ocs[scn].bv_val, ocs[i].bv_val );
|
||||
*text = textbuf;
|
||||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
}
|
||||
|
|
@ -523,7 +523,7 @@ int structural_class(
|
|||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
}
|
||||
|
||||
*scbv = *ocs[scn];
|
||||
*scbv = ocs[scn];
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -553,7 +553,7 @@ int mods_structural_class(
|
|||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
}
|
||||
|
||||
if( ocmod->sml_bvalues == NULL || ocmod->sml_bvalues[0] == NULL ) {
|
||||
if( ocmod->sml_bvalues == NULL || ocmod->sml_bvalues[0].bv_val == NULL ) {
|
||||
*text = "objectClass attribute has no values";
|
||||
return LDAP_OBJECT_CLASS_VIOLATION;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,19 +123,19 @@ static int octetStringIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
int i;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval digest;
|
||||
digest.bv_val = HASHdigest;
|
||||
digest.bv_len = sizeof(HASHdigest);
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* just count them */
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ static int octetStringIndexer(
|
|||
slen = syntax->ssyn_oidlen;
|
||||
mlen = mr->smr_oidlen;
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
HASH_Init( &HASHcontext );
|
||||
if( prefix != NULL && prefix->bv_len > 0 ) {
|
||||
HASH_Update( &HASHcontext,
|
||||
|
|
@ -158,7 +158,7 @@ static int octetStringIndexer(
|
|||
HASH_Update( &HASHcontext,
|
||||
mr->smr_oid, mlen );
|
||||
HASH_Update( &HASHcontext,
|
||||
values[i]->bv_val, values[i]->bv_len );
|
||||
values[i].bv_val, values[i].bv_len );
|
||||
HASH_Final( HASHdigest, &HASHcontext );
|
||||
|
||||
ber_dupbv( &keys[i], &digest );
|
||||
|
|
@ -179,10 +179,10 @@ static int octetStringFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval *value = (struct berval *) assertValue;
|
||||
|
|
@ -771,16 +771,17 @@ approxIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
char *val, *c;
|
||||
int i,j, len, wordcount, keycount=0;
|
||||
struct berval *newkeys, *keys=NULL;
|
||||
struct berval *newkeys;
|
||||
BVarray keys=NULL;
|
||||
|
||||
for( j=0; values[j] != NULL; j++ ) {
|
||||
for( j=0; values[j].bv_val != NULL; j++ ) {
|
||||
/* Yes, this is necessary */
|
||||
val = UTF8normalize( values[j], UTF8_NOCASEFOLD );
|
||||
val = UTF8normalize( &values[j], UTF8_NOCASEFOLD );
|
||||
strip8bitChars( val );
|
||||
|
||||
/* Isolate how many words there are. There will be a key for each */
|
||||
|
|
@ -824,11 +825,11 @@ approxFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
char *val, *c;
|
||||
int i, count, len;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
|
||||
/* Yes, this is necessary */
|
||||
val = UTF8normalize( ((struct berval *)assertValue),
|
||||
|
|
@ -922,14 +923,14 @@ approxIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
int i;
|
||||
struct berval *keys;
|
||||
BVarray *keys;
|
||||
char *s;
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* empty - just count them */
|
||||
}
|
||||
|
||||
|
|
@ -939,9 +940,9 @@ approxIndexer(
|
|||
keys = (struct berval *)ch_malloc( sizeof( struct berval ) * (i+1) );
|
||||
|
||||
/* Copy each value and run it through phonetic() */
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* Yes, this is necessary */
|
||||
s = UTF8normalize( values[i], UTF8_NOCASEFOLD );
|
||||
s = UTF8normalize( &values[i], UTF8_NOCASEFOLD );
|
||||
|
||||
/* strip 8-bit chars and run through phonetic() */
|
||||
ber_str2bv( phonetic( strip8bitChars( s ) ), 0, 0, &keys[i] );
|
||||
|
|
@ -962,9 +963,9 @@ approxFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
char *s;
|
||||
|
||||
keys = (struct berval *)ch_malloc( sizeof( struct berval * ) * 2 );
|
||||
|
|
@ -1167,20 +1168,20 @@ static int caseExactIgnoreIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
int i;
|
||||
char casefold;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval digest;
|
||||
digest.bv_val = HASHdigest;
|
||||
digest.bv_len = sizeof(HASHdigest);
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* empty - just count them */
|
||||
}
|
||||
|
||||
|
|
@ -1195,9 +1196,9 @@ static int caseExactIgnoreIndexer(
|
|||
casefold = strcmp( mr->smr_oid, caseExactMatchOID )
|
||||
? UTF8_CASEFOLD : UTF8_NOCASEFOLD;
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
struct berval value;
|
||||
ber_str2bv( UTF8normalize( values[i], casefold ), 0, 0,
|
||||
ber_str2bv( UTF8normalize( &values[i], casefold ), 0, 0,
|
||||
&value );
|
||||
|
||||
HASH_Init( &HASHcontext );
|
||||
|
|
@ -1231,11 +1232,11 @@ static int caseExactIgnoreFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
char casefold;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval value;
|
||||
|
|
@ -1289,14 +1290,14 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
char casefold;
|
||||
ber_len_t i, nkeys;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
struct berval **nvalues;
|
||||
BVarray keys;
|
||||
BVarray nvalues;
|
||||
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
|
|
@ -1306,7 +1307,7 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
|
||||
nkeys=0;
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* empty - just count them */
|
||||
}
|
||||
|
||||
|
|
@ -1316,41 +1317,41 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
casefold = strcmp( mr->smr_oid, caseExactSubstringsMatchOID )
|
||||
? UTF8_CASEFOLD : UTF8_NOCASEFOLD;
|
||||
|
||||
nvalues = ch_malloc( sizeof( struct berval * ) * (i+1) );
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
nvalues[i] = ber_str2bv( UTF8normalize( values[i], casefold ),
|
||||
0, 0, NULL );
|
||||
nvalues = ch_malloc( sizeof( struct berval ) * (i+1) );
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
ber_str2bv( UTF8normalize( &values[i], casefold ),
|
||||
0, 0, &nvalues[i] );
|
||||
}
|
||||
nvalues[i] = NULL;
|
||||
nvalues[i].bv_val = NULL;
|
||||
values = nvalues;
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* count number of indices to generate */
|
||||
if( values[i]->bv_len < SLAP_INDEX_SUBSTR_MINLEN ) {
|
||||
if( values[i].bv_len < SLAP_INDEX_SUBSTR_MINLEN ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += SLAP_INDEX_SUBSTR_MAXLEN -
|
||||
( SLAP_INDEX_SUBSTR_MINLEN - 1);
|
||||
} else {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_ANY ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1 );
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += SLAP_INDEX_SUBSTR_MAXLEN -
|
||||
( SLAP_INDEX_SUBSTR_MINLEN - 1);
|
||||
} else {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1358,7 +1359,7 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
if( nkeys == 0 ) {
|
||||
/* no keys to generate */
|
||||
*keysp = NULL;
|
||||
ber_bvecfree( nvalues );
|
||||
bvarray_free( nvalues );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1368,16 +1369,16 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
mlen = mr->smr_oidlen;
|
||||
|
||||
nkeys=0;
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
ber_len_t j,max;
|
||||
|
||||
if( values[i]->bv_len < SLAP_INDEX_SUBSTR_MINLEN ) continue;
|
||||
if( values[i].bv_len < SLAP_INDEX_SUBSTR_MINLEN ) continue;
|
||||
|
||||
if( ( flags & SLAP_INDEX_SUBSTR_ANY ) &&
|
||||
( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) )
|
||||
( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) )
|
||||
{
|
||||
char pre = SLAP_INDEX_SUBSTR_PREFIX;
|
||||
max = values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1);
|
||||
max = values[i].bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1);
|
||||
|
||||
for( j=0; j<max; j++ ) {
|
||||
HASH_Init( &HASHcontext );
|
||||
|
|
@ -1393,7 +1394,7 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
HASH_Update( &HASHcontext,
|
||||
mr->smr_oid, mlen );
|
||||
HASH_Update( &HASHcontext,
|
||||
&values[i]->bv_val[j],
|
||||
&values[i].bv_val[j],
|
||||
SLAP_INDEX_SUBSTR_MAXLEN );
|
||||
HASH_Final( HASHdigest, &HASHcontext );
|
||||
|
||||
|
|
@ -1401,8 +1402,8 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
}
|
||||
}
|
||||
|
||||
max = SLAP_INDEX_SUBSTR_MAXLEN < values[i]->bv_len
|
||||
? SLAP_INDEX_SUBSTR_MAXLEN : values[i]->bv_len;
|
||||
max = SLAP_INDEX_SUBSTR_MAXLEN < values[i].bv_len
|
||||
? SLAP_INDEX_SUBSTR_MAXLEN : values[i].bv_len;
|
||||
|
||||
for( j=SLAP_INDEX_SUBSTR_MINLEN; j<=max; j++ ) {
|
||||
char pre;
|
||||
|
|
@ -1421,7 +1422,7 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
HASH_Update( &HASHcontext,
|
||||
mr->smr_oid, mlen );
|
||||
HASH_Update( &HASHcontext,
|
||||
values[i]->bv_val, j );
|
||||
values[i].bv_val, j );
|
||||
HASH_Final( HASHdigest, &HASHcontext );
|
||||
|
||||
ber_dupbv( &keys[nkeys++], &digest );
|
||||
|
|
@ -1441,7 +1442,7 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
HASH_Update( &HASHcontext,
|
||||
mr->smr_oid, mlen );
|
||||
HASH_Update( &HASHcontext,
|
||||
&values[i]->bv_val[values[i]->bv_len-j], j );
|
||||
&values[i].bv_val[values[i].bv_len-j], j );
|
||||
HASH_Final( HASHdigest, &HASHcontext );
|
||||
|
||||
ber_dupbv( &keys[nkeys++], &digest );
|
||||
|
|
@ -1459,7 +1460,7 @@ static int caseExactIgnoreSubstringsIndexer(
|
|||
*keysp = NULL;
|
||||
}
|
||||
|
||||
ber_bvecfree( nvalues );
|
||||
bvarray_free( nvalues );
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
|
@ -1471,13 +1472,13 @@ static int caseExactIgnoreSubstringsFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
SubstringsAssertion *sa;
|
||||
char pre, casefold;
|
||||
ber_len_t nkeys = 0;
|
||||
size_t slen, mlen, klen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval *value;
|
||||
|
|
@ -1867,23 +1868,23 @@ static int integerIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
int i;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
|
||||
/* we should have at least one value at this point */
|
||||
assert( values != NULL && values[0] != NULL );
|
||||
assert( values != NULL && values[0].bv_val != NULL );
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* empty -- just count them */
|
||||
}
|
||||
|
||||
keys = ch_malloc( sizeof( struct berval ) * (i+1) );
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
integerNormalize( syntax, values[i], &keys[i] );
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
integerNormalize( syntax, &values[i], &keys[i] );
|
||||
}
|
||||
|
||||
keys[i].bv_val = NULL;
|
||||
|
|
@ -1899,9 +1900,9 @@ static int integerFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
|
||||
keys = ch_malloc( sizeof( struct berval ) * 2 );
|
||||
integerNormalize( syntax, assertValue, &keys[0] );
|
||||
|
|
@ -2196,19 +2197,19 @@ static int caseExactIA5Indexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
int i;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval digest;
|
||||
digest.bv_val = HASHdigest;
|
||||
digest.bv_len = sizeof(HASHdigest);
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* empty - just count them */
|
||||
}
|
||||
|
||||
|
|
@ -2220,8 +2221,8 @@ static int caseExactIA5Indexer(
|
|||
slen = syntax->ssyn_oidlen;
|
||||
mlen = mr->smr_oidlen;
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
struct berval *value = values[i];
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
struct berval *value = &values[i];
|
||||
|
||||
HASH_Init( &HASHcontext );
|
||||
if( prefix != NULL && prefix->bv_len > 0 ) {
|
||||
|
|
@ -2252,10 +2253,10 @@ static int caseExactIA5Filter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval *value;
|
||||
|
|
@ -2297,12 +2298,12 @@ static int caseExactIA5SubstringsIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
ber_len_t i, nkeys;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval digest;
|
||||
|
|
@ -2310,36 +2311,36 @@ static int caseExactIA5SubstringsIndexer(
|
|||
digest.bv_len = sizeof(HASHdigest);
|
||||
|
||||
/* we should have at least one value at this point */
|
||||
assert( values != NULL && values[0] != NULL );
|
||||
assert( values != NULL && values[0].bv_val != NULL );
|
||||
|
||||
nkeys=0;
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* count number of indices to generate */
|
||||
if( values[i]->bv_len < SLAP_INDEX_SUBSTR_MINLEN ) {
|
||||
if( values[i].bv_len < SLAP_INDEX_SUBSTR_MINLEN ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += SLAP_INDEX_SUBSTR_MAXLEN -
|
||||
( SLAP_INDEX_SUBSTR_MINLEN - 1);
|
||||
} else {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_ANY ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1 );
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += SLAP_INDEX_SUBSTR_MAXLEN -
|
||||
( SLAP_INDEX_SUBSTR_MINLEN - 1);
|
||||
} else {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2356,11 +2357,11 @@ static int caseExactIA5SubstringsIndexer(
|
|||
mlen = mr->smr_oidlen;
|
||||
|
||||
nkeys=0;
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
ber_len_t j,max;
|
||||
struct berval *value;
|
||||
|
||||
value = values[i];
|
||||
value = &values[i];
|
||||
if( value->bv_len < SLAP_INDEX_SUBSTR_MINLEN ) continue;
|
||||
|
||||
if( ( flags & SLAP_INDEX_SUBSTR_ANY ) &&
|
||||
|
|
@ -2458,13 +2459,13 @@ static int caseExactIA5SubstringsFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
SubstringsAssertion *sa = assertValue;
|
||||
char pre;
|
||||
ber_len_t nkeys = 0;
|
||||
size_t slen, mlen, klen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval *value;
|
||||
|
|
@ -2762,12 +2763,12 @@ static int caseIgnoreIA5Indexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
int i;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval digest;
|
||||
|
|
@ -2775,9 +2776,9 @@ static int caseIgnoreIA5Indexer(
|
|||
digest.bv_len = sizeof(HASHdigest);
|
||||
|
||||
/* we should have at least one value at this point */
|
||||
assert( values != NULL && values[0] != NULL );
|
||||
assert( values != NULL && values[0].bv_val != NULL );
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* just count them */
|
||||
}
|
||||
|
||||
|
|
@ -2786,9 +2787,9 @@ static int caseIgnoreIA5Indexer(
|
|||
slen = syntax->ssyn_oidlen;
|
||||
mlen = mr->smr_oidlen;
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
struct berval value;
|
||||
ber_dupbv( &value, values[i] );
|
||||
ber_dupbv( &value, &values[i] );
|
||||
ldap_pvt_str2upper( value.bv_val );
|
||||
|
||||
HASH_Init( &HASHcontext );
|
||||
|
|
@ -2822,10 +2823,10 @@ static int caseIgnoreIA5Filter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval value;
|
||||
|
|
@ -2871,12 +2872,12 @@ static int caseIgnoreIA5SubstringsIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
ber_len_t i, nkeys;
|
||||
size_t slen, mlen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval digest;
|
||||
|
|
@ -2884,36 +2885,36 @@ static int caseIgnoreIA5SubstringsIndexer(
|
|||
digest.bv_len = sizeof(HASHdigest);
|
||||
|
||||
/* we should have at least one value at this point */
|
||||
assert( values != NULL && values[0] != NULL );
|
||||
assert( values != NULL && values[0].bv_val != NULL );
|
||||
|
||||
nkeys=0;
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* count number of indices to generate */
|
||||
if( values[i]->bv_len < SLAP_INDEX_SUBSTR_MINLEN ) {
|
||||
if( values[i].bv_len < SLAP_INDEX_SUBSTR_MINLEN ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += SLAP_INDEX_SUBSTR_MAXLEN -
|
||||
( SLAP_INDEX_SUBSTR_MINLEN - 1);
|
||||
} else {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_ANY ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1 );
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
|
||||
if( values[i]->bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
if( values[i].bv_len >= SLAP_INDEX_SUBSTR_MAXLEN ) {
|
||||
nkeys += SLAP_INDEX_SUBSTR_MAXLEN -
|
||||
( SLAP_INDEX_SUBSTR_MINLEN - 1);
|
||||
} else {
|
||||
nkeys += values[i]->bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
nkeys += values[i].bv_len - ( SLAP_INDEX_SUBSTR_MINLEN - 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2930,13 +2931,13 @@ static int caseIgnoreIA5SubstringsIndexer(
|
|||
mlen = mr->smr_oidlen;
|
||||
|
||||
nkeys=0;
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
int j,max;
|
||||
struct berval value;
|
||||
|
||||
if( values[i]->bv_len < SLAP_INDEX_SUBSTR_MINLEN ) continue;
|
||||
if( values[i].bv_len < SLAP_INDEX_SUBSTR_MINLEN ) continue;
|
||||
|
||||
ber_dupbv( &value, values[i] );
|
||||
ber_dupbv( &value, &values[i] );
|
||||
ldap_pvt_str2upper( value.bv_val );
|
||||
|
||||
if( ( flags & SLAP_INDEX_SUBSTR_ANY ) &&
|
||||
|
|
@ -3036,13 +3037,13 @@ static int caseIgnoreIA5SubstringsFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
SubstringsAssertion *sa = assertValue;
|
||||
char pre;
|
||||
ber_len_t nkeys = 0;
|
||||
size_t slen, mlen, klen;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
HASH_CONTEXT HASHcontext;
|
||||
unsigned char HASHdigest[HASH_BYTES];
|
||||
struct berval value;
|
||||
|
|
@ -3695,27 +3696,27 @@ static int certificateExactIndexer(
|
|||
Syntax *syntax,
|
||||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keysp )
|
||||
BVarray values,
|
||||
BVarray *keysp )
|
||||
{
|
||||
int i;
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
X509 *xcert;
|
||||
unsigned char *p;
|
||||
struct berval * serial;
|
||||
|
||||
/* we should have at least one value at this point */
|
||||
assert( values != NULL && values[0] != NULL );
|
||||
assert( values != NULL && values[0].bv_val != NULL );
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
/* empty -- just count them */
|
||||
}
|
||||
|
||||
keys = ch_malloc( sizeof( struct berval ) * (i+1) );
|
||||
|
||||
for( i=0; values[i] != NULL; i++ ) {
|
||||
p = values[i]->bv_val;
|
||||
xcert = d2i_X509(NULL, &p, values[i]->bv_len);
|
||||
for( i=0; values[i].bv_val != NULL; i++ ) {
|
||||
p = values[i].bv_val;
|
||||
xcert = d2i_X509(NULL, &p, values[i].bv_len);
|
||||
if ( !xcert ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
|
||||
|
|
@ -3763,9 +3764,9 @@ static int certificateExactFilter(
|
|||
MatchingRule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keysp )
|
||||
BVarray *keysp )
|
||||
{
|
||||
struct berval *keys;
|
||||
BVarray keys;
|
||||
struct berval *asserted_serial;
|
||||
struct berval *asserted_issuer_dn;
|
||||
|
||||
|
|
|
|||
|
|
@ -299,13 +299,13 @@ do_search(
|
|||
* if we don't hold it.
|
||||
*/
|
||||
if ( (be = select_backend( &nbase, manageDSAit, 1 )) == NULL ) {
|
||||
struct berval **ref = referral_rewrite( default_referral,
|
||||
BVarray ref = referral_rewrite( default_referral,
|
||||
NULL, &pbase, scope );
|
||||
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
NULL, NULL, ref ? ref : default_referral, NULL );
|
||||
|
||||
ber_bvecfree( ref );
|
||||
bvarray_free( ref );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ do_search(
|
|||
if ( be->be_search ) {
|
||||
(*be->be_search)( be, conn, op, &pbase, &nbase,
|
||||
scope, deref, sizelimit,
|
||||
timelimit, filter, fstr.bv_val, al, attrsonly );
|
||||
timelimit, filter, &fstr, al, attrsonly );
|
||||
} else {
|
||||
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
|
||||
NULL, "operation not supported within namingContext", NULL, NULL );
|
||||
|
|
|
|||
|
|
@ -12,78 +12,72 @@
|
|||
#include "slap.h"
|
||||
#include "sets.h"
|
||||
|
||||
static char **set_join (char **lset, int op, char **rset);
|
||||
static char **set_chase (SET_GATHER gatherer,
|
||||
void *cookie, char **set, char *attr, int attrlen, int closure);
|
||||
static BVarray set_join (BVarray lset, int op, BVarray rset);
|
||||
static BVarray set_chase (SET_GATHER gatherer,
|
||||
void *cookie, BVarray set, struct berval *attr, int closure);
|
||||
static int set_samedn (char *dn1, char *dn2);
|
||||
|
||||
long
|
||||
set_size (char **set)
|
||||
set_size (BVarray set)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (set != NULL) {
|
||||
while (set[i])
|
||||
while (set[i].bv_val)
|
||||
i++;
|
||||
}
|
||||
return(i);
|
||||
}
|
||||
|
||||
void
|
||||
set_dispose (char **set)
|
||||
set_dispose (BVarray set)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (set != NULL) {
|
||||
for (i = 0; set[i]; i++)
|
||||
ch_free(set[i]);
|
||||
ch_free(set);
|
||||
}
|
||||
bvarray_free(set);
|
||||
}
|
||||
|
||||
static char **
|
||||
set_join (char **lset, int op, char **rset)
|
||||
static BVarray
|
||||
set_join (BVarray lset, int op, BVarray rset)
|
||||
{
|
||||
char **set;
|
||||
BVarray set;
|
||||
long i, j, last;
|
||||
|
||||
set = NULL;
|
||||
if (op == '|') {
|
||||
if (lset == NULL || *lset == NULL) {
|
||||
if (lset == NULL || lset->bv_val == NULL) {
|
||||
if (rset == NULL) {
|
||||
if (lset == NULL)
|
||||
return(ch_calloc(1, sizeof(char *)));
|
||||
return(ch_calloc(1, sizeof(struct berval)));
|
||||
return(lset);
|
||||
}
|
||||
set_dispose(lset);
|
||||
return(rset);
|
||||
}
|
||||
if (rset == NULL || *rset == NULL) {
|
||||
if (rset == NULL || rset->bv_val == NULL) {
|
||||
set_dispose(rset);
|
||||
return(lset);
|
||||
}
|
||||
|
||||
i = set_size(lset) + set_size(rset) + 1;
|
||||
set = ch_calloc(i, sizeof(char *));
|
||||
set = ch_calloc(i, sizeof(struct berval));
|
||||
if (set != NULL) {
|
||||
/* set_chase() depends on this routine to
|
||||
* keep the first elements of the result
|
||||
* set the same (and in the same order)
|
||||
* as the left-set.
|
||||
*/
|
||||
for (i = 0; lset[i]; i++)
|
||||
for (i = 0; lset[i].bv_val; i++)
|
||||
set[i] = lset[i];
|
||||
ch_free(lset);
|
||||
for (i = 0; rset[i]; i++) {
|
||||
for (j = 0; set[j]; j++) {
|
||||
if (set_samedn(rset[i], set[j])) {
|
||||
ch_free(rset[i]);
|
||||
rset[i] = NULL;
|
||||
for (i = 0; rset[i].bv_val; i++) {
|
||||
for (j = 0; set[j].bv_val; j++) {
|
||||
if (set_samedn(rset[i].bv_val, set[j].bv_val)) {
|
||||
ch_free(rset[i].bv_val);
|
||||
rset[i].bv_val = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rset[i])
|
||||
if (rset[i].bv_val)
|
||||
set[j] = rset[i];
|
||||
}
|
||||
ch_free(rset);
|
||||
|
|
@ -92,21 +86,21 @@ set_join (char **lset, int op, char **rset)
|
|||
}
|
||||
|
||||
if (op == '&') {
|
||||
if (lset == NULL || *lset == NULL || rset == NULL || *rset == NULL) {
|
||||
set = ch_calloc(1, sizeof(char *));
|
||||
if (lset == NULL || lset->bv_val == NULL || rset == NULL || rset->bv_val == NULL) {
|
||||
set = ch_calloc(1, sizeof(struct berval));
|
||||
} else {
|
||||
set = lset;
|
||||
lset = NULL;
|
||||
last = set_size(set) - 1;
|
||||
for (i = 0; set[i]; i++) {
|
||||
for (j = 0; rset[j]; j++) {
|
||||
if (set_samedn(set[i], rset[j]))
|
||||
for (i = 0; set[i].bv_val; i++) {
|
||||
for (j = 0; rset[j].bv_val; j++) {
|
||||
if (set_samedn(set[i].bv_val, rset[j].bv_val))
|
||||
break;
|
||||
}
|
||||
if (rset[j] == NULL) {
|
||||
ch_free(set[i]);
|
||||
if (rset[j].bv_val == NULL) {
|
||||
ch_free(set[i].bv_val);
|
||||
set[i] = set[last];
|
||||
set[last] = NULL;
|
||||
set[last].bv_val = NULL;
|
||||
last--;
|
||||
i--;
|
||||
}
|
||||
|
|
@ -119,43 +113,43 @@ set_join (char **lset, int op, char **rset)
|
|||
return(set);
|
||||
}
|
||||
|
||||
static char **
|
||||
static BVarray
|
||||
set_chase (SET_GATHER gatherer,
|
||||
void *cookie, char **set, char *attr, int attrlen, int closure)
|
||||
void *cookie, BVarray set, struct berval *attr, int closure)
|
||||
{
|
||||
char **vals, **nset;
|
||||
BVarray vals, nset;
|
||||
char attrstr[32];
|
||||
struct berval bv = {attrlen, attrstr};
|
||||
struct berval bv = {attr->bv_len, attrstr};
|
||||
int i;
|
||||
|
||||
if (set == NULL)
|
||||
return(ch_calloc(1, sizeof(char *)));
|
||||
return(ch_calloc(1, sizeof(struct berval)));
|
||||
|
||||
if (*set == NULL)
|
||||
if (set->bv_val == NULL)
|
||||
return(set);
|
||||
|
||||
if (attrlen > (sizeof(attrstr) - 1)) {
|
||||
if (attr->bv_len > (sizeof(attrstr) - 1)) {
|
||||
set_dispose(set);
|
||||
return(NULL);
|
||||
}
|
||||
AC_MEMCPY(attrstr, attr, attrlen);
|
||||
attrstr[attrlen] = 0;
|
||||
AC_MEMCPY(attrstr, attr->bv_val, attr->bv_len);
|
||||
attrstr[attr->bv_len] = 0;
|
||||
|
||||
nset = ch_calloc(1, sizeof(char *));
|
||||
nset = ch_calloc(1, sizeof(struct berval));
|
||||
if (nset == NULL) {
|
||||
set_dispose(set);
|
||||
return(NULL);
|
||||
}
|
||||
for (i = 0; set[i]; i++) {
|
||||
vals = (gatherer)(cookie, set[i], &bv);
|
||||
for (i = 0; set[i].bv_val; i++) {
|
||||
vals = (gatherer)(cookie, set[i].bv_val, &bv);
|
||||
if (vals != NULL)
|
||||
nset = set_join(nset, '|', vals);
|
||||
}
|
||||
set_dispose(set);
|
||||
|
||||
if (closure) {
|
||||
for (i = 0; nset[i]; i++) {
|
||||
vals = (gatherer)(cookie, nset[i], &bv);
|
||||
for (i = 0; nset[i].bv_val; i++) {
|
||||
vals = (gatherer)(cookie, nset[i].bv_val, &bv);
|
||||
if (vals != NULL) {
|
||||
nset = set_join(nset, '|', vals);
|
||||
if (nset == NULL)
|
||||
|
|
@ -199,22 +193,22 @@ set_samedn (char *dn1, char *dn2)
|
|||
|
||||
int
|
||||
set_filter (SET_GATHER gatherer,
|
||||
void *cookie, char *filter, char *user, char *this, char ***results)
|
||||
void *cookie, struct berval *fbv, char *user, char *this, BVarray *results)
|
||||
{
|
||||
#define IS_SET(x) ( (long)(x) >= 256 )
|
||||
#define IS_OP(x) ( (long)(x) < 256 )
|
||||
#define SF_ERROR(x) do { rc = -1; goto _error; } while (0)
|
||||
#define SF_TOP() ( (char **)( (stp < 0) ? 0 : stack[stp] ) )
|
||||
#define SF_POP() ( (char **)( (stp < 0) ? 0 : stack[stp--] ) )
|
||||
#define SF_TOP() ( (BVarray)( (stp < 0) ? 0 : stack[stp] ) )
|
||||
#define SF_POP() ( (BVarray)( (stp < 0) ? 0 : stack[stp--] ) )
|
||||
#define SF_PUSH(x) do { \
|
||||
if (stp >= 63) SF_ERROR(overflow); \
|
||||
stack[++stp] = (char **)(long)(x); \
|
||||
stack[++stp] = (BVarray)(long)(x); \
|
||||
} while (0)
|
||||
|
||||
char c;
|
||||
char **set, **lset;
|
||||
BVarray set, lset;
|
||||
BVarray stack[64];
|
||||
int len, op, rc, stp;
|
||||
char **stack[64];
|
||||
char c, *filter = fbv->bv_val;
|
||||
|
||||
if (results)
|
||||
*results = NULL;
|
||||
|
|
@ -289,13 +283,14 @@ set_filter (SET_GATHER gatherer,
|
|||
if (c == 0)
|
||||
SF_ERROR(syntax);
|
||||
|
||||
set = ch_calloc(2, sizeof(char *));
|
||||
set = ch_calloc(2, sizeof(struct berval));
|
||||
if (set == NULL)
|
||||
SF_ERROR(memory);
|
||||
*set = ch_calloc(len + 1, sizeof(char));
|
||||
if (*set == NULL)
|
||||
set->bv_val = ch_calloc(len + 1, sizeof(char));
|
||||
if (set->bv_val == NULL)
|
||||
SF_ERROR(memory);
|
||||
AC_MEMCPY(*set, &filter[-len - 1], len);
|
||||
AC_MEMCPY(set->bv_val, &filter[-len - 1], len);
|
||||
set->bv_len = len;
|
||||
SF_PUSH(set);
|
||||
set = NULL;
|
||||
break;
|
||||
|
|
@ -332,29 +327,32 @@ set_filter (SET_GATHER gatherer,
|
|||
{
|
||||
if ((SF_TOP() == (void *)'/') || IS_SET(SF_TOP()))
|
||||
SF_ERROR(syntax);
|
||||
set = ch_calloc(2, sizeof(char *));
|
||||
set = ch_calloc(2, sizeof(struct berval));
|
||||
if (set == NULL)
|
||||
SF_ERROR(memory);
|
||||
*set = ch_strdup(this);
|
||||
if (*set == NULL)
|
||||
ber_str2bv( this, 0, 1, set );
|
||||
if (set->bv_val == NULL)
|
||||
SF_ERROR(memory);
|
||||
} else if (len == 4
|
||||
&& memcmp("user", filter, len) == 0)
|
||||
{
|
||||
if ((SF_TOP() == (void *)'/') || IS_SET(SF_TOP()))
|
||||
SF_ERROR(syntax);
|
||||
set = ch_calloc(2, sizeof(char *));
|
||||
set = ch_calloc(2, sizeof(struct berval));
|
||||
if (set == NULL)
|
||||
SF_ERROR(memory);
|
||||
*set = ch_strdup(user);
|
||||
if (*set == NULL)
|
||||
ber_str2bv( user, 0, 1, set );
|
||||
if (set->bv_val == NULL)
|
||||
SF_ERROR(memory);
|
||||
} else if (SF_TOP() != (void *)'/') {
|
||||
SF_ERROR(syntax);
|
||||
} else {
|
||||
SF_POP();
|
||||
struct berval fb2;
|
||||
fb2.bv_val = filter;
|
||||
fb2.bv_len = len;
|
||||
set = set_chase(gatherer,
|
||||
cookie, SF_POP(), filter, len, c == '*');
|
||||
cookie, SF_POP(), &fb2, c == '*');
|
||||
if (set == NULL)
|
||||
SF_ERROR(memory);
|
||||
if (c == '*')
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
* also return the syntax or some "comparison cookie"
|
||||
* that is used by set_filter.
|
||||
*/
|
||||
typedef char **(*SET_GATHER) (void *cookie, char *name, struct berval *attr);
|
||||
typedef BVarray (SET_GATHER) (void *cookie, char *name, struct berval *attr);
|
||||
|
||||
LDAP_SLAPD_F (long) set_size (char **set);
|
||||
LDAP_SLAPD_F (void) set_dispose (char **set);
|
||||
LDAP_SLAPD_F (long) set_size (BVarray set);
|
||||
LDAP_SLAPD_F (void) set_dispose (BVarray set);
|
||||
|
||||
LDAP_SLAPD_F (int)
|
||||
set_filter (SET_GATHER gatherer, void *cookie, char *filter,
|
||||
char *user, char *this, char ***results);
|
||||
set_filter (SET_GATHER gatherer, void *cookie, struct berval *filter,
|
||||
char *user, char *this, BVarray *results);
|
||||
|
||||
|
|
|
|||
|
|
@ -312,8 +312,8 @@ typedef int slap_mr_indexer_func LDAP_P((
|
|||
struct slap_syntax *syntax, /* syntax of stored value */
|
||||
struct slap_matching_rule *mr,
|
||||
struct berval *prefix,
|
||||
struct berval **values,
|
||||
struct berval **keys ));
|
||||
BVarray values,
|
||||
BVarray *keys ));
|
||||
|
||||
/* Filter index function */
|
||||
typedef int slap_mr_filter_func LDAP_P((
|
||||
|
|
@ -323,7 +323,7 @@ typedef int slap_mr_filter_func LDAP_P((
|
|||
struct slap_matching_rule *mr,
|
||||
struct berval *prefix,
|
||||
void * assertValue,
|
||||
struct berval **keys ));
|
||||
BVarray *keys ));
|
||||
|
||||
typedef struct slap_matching_rule {
|
||||
LDAPMatchingRule smr_mrule;
|
||||
|
|
@ -623,7 +623,7 @@ typedef struct slap_filter {
|
|||
*/
|
||||
typedef struct slap_attr {
|
||||
AttributeDescription *a_desc;
|
||||
struct berval **a_vals;
|
||||
BVarray a_vals;
|
||||
struct slap_attr *a_next;
|
||||
} Attribute;
|
||||
|
||||
|
|
@ -664,13 +664,15 @@ typedef struct slap_entry {
|
|||
typedef struct slap_mod {
|
||||
int sm_op;
|
||||
AttributeDescription *sm_desc;
|
||||
struct berval **sm_bvalues;
|
||||
struct berval sm_type;
|
||||
BVarray sm_bvalues;
|
||||
} Modification;
|
||||
|
||||
typedef struct slap_mod_list {
|
||||
Modification sml_mod;
|
||||
#define sml_op sml_mod.sm_op
|
||||
#define sml_desc sml_mod.sm_desc
|
||||
#define sml_type sml_mod.sm_type
|
||||
#define sml_bvalues sml_mod.sm_bvalues
|
||||
struct slap_mod_list *sml_next;
|
||||
} Modifications;
|
||||
|
|
@ -1009,7 +1011,7 @@ struct slap_backend_db {
|
|||
struct slap_replica_info **be_replica; /* replicas of this backend (in master) */
|
||||
char *be_replogfile; /* replication log file (in master) */
|
||||
struct berval be_update_ndn; /* allowed to make changes (in replicas) */
|
||||
struct berval **be_update_refs; /* where to refer modifying clients to */
|
||||
BVarray be_update_refs; /* where to refer modifying clients to */
|
||||
char *be_realm;
|
||||
int be_lastmod; /* keep track of lastmodified{by,time} */
|
||||
|
||||
|
|
@ -1052,7 +1054,7 @@ typedef int (BI_op_search) LDAP_P((BackendDB *bd,
|
|||
struct berval *base, struct berval *nbase,
|
||||
int scope, int deref,
|
||||
int slimit, int tlimit,
|
||||
Filter *f, const char *filterstr,
|
||||
Filter *f, struct berval *filterstr,
|
||||
AttributeName *attrs, int attrsonly));
|
||||
typedef int (BI_op_compare)LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
|
|
@ -1088,7 +1090,7 @@ typedef int (BI_op_extended) LDAP_P((
|
|||
struct berval ** rspdata,
|
||||
LDAPControl *** rspctrls,
|
||||
const char ** text,
|
||||
struct berval *** refs ));
|
||||
BVarray *refs ));
|
||||
|
||||
typedef int (BI_entry_release_rw) LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
|
|
@ -1111,7 +1113,7 @@ typedef int (BI_acl_attribute) LDAP_P((Backend *bd,
|
|||
struct slap_conn *c, struct slap_op *o,
|
||||
Entry *e, struct berval *edn,
|
||||
AttributeDescription *entry_at,
|
||||
struct berval ***vals ));
|
||||
BVarray *vals ));
|
||||
|
||||
typedef int (BI_operational) LDAP_P((Backend *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
|
|
@ -1255,11 +1257,11 @@ struct slap_conn;
|
|||
|
||||
typedef void (slap_response)( struct slap_conn *, struct slap_op *,
|
||||
ber_tag_t, ber_int_t, ber_int_t, const char *, const char *,
|
||||
struct berval **, const char *, struct berval *,
|
||||
BVarray, const char *, struct berval *,
|
||||
struct berval *, LDAPControl ** );
|
||||
|
||||
typedef void (slap_sresult)( struct slap_conn *, struct slap_op *,
|
||||
ber_int_t, const char *, const char *, struct berval **,
|
||||
ber_int_t, const char *, const char *, BVarray,
|
||||
LDAPControl **, int nentries);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ starttls_extop (
|
|||
struct berval ** rspdata,
|
||||
LDAPControl ***rspctrls,
|
||||
const char ** text,
|
||||
struct berval *** refs )
|
||||
BVarray * refs )
|
||||
{
|
||||
void *ctx;
|
||||
int rc;
|
||||
|
|
|
|||
|
|
@ -200,14 +200,12 @@ register_syntax(
|
|||
int
|
||||
syn_schema_info( Entry *e )
|
||||
{
|
||||
struct berval val;
|
||||
struct berval *vals[2];
|
||||
struct berval vals[2];
|
||||
Syntax *syn;
|
||||
|
||||
AttributeDescription *ad_ldapSyntaxes = slap_schema.si_ad_ldapSyntaxes;
|
||||
|
||||
vals[0] = &val;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
for ( syn = syn_list; syn; syn = syn->ssyn_next ) {
|
||||
if ( ! syn->ssyn_validate ) {
|
||||
|
|
@ -219,22 +217,22 @@ syn_schema_info( Entry *e )
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( ldap_syntax2bv( &syn->ssyn_syn, &val ) == NULL ) {
|
||||
if ( ldap_syntax2bv( &syn->ssyn_syn, vals ) == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
|
||||
"syn_schema_info: Merging syn [%ld] %s\n",
|
||||
(long)val.bv_len, val.bv_val ));
|
||||
(long)vals[0].bv_len, vals[0].bv_val ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "Merging syn [%ld] %s\n",
|
||||
(long) val.bv_len, val.bv_val, 0 );
|
||||
(long) vals[0].bv_len, vals[0].bv_val, 0 );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
attr_merge( e, ad_ldapSyntaxes, vals );
|
||||
ldap_memfree( val.bv_val );
|
||||
ldap_memfree( vals[0].bv_val );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ send_ldap_extended(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
const char *rspoid,
|
||||
struct berval *rspdata,
|
||||
LDAPControl **ctrls
|
||||
|
|
@ -65,7 +65,7 @@ send_ldap_sasl(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
struct berval *cred
|
||||
)
|
||||
|
|
@ -80,7 +80,7 @@ send_ldap_result(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls
|
||||
)
|
||||
{
|
||||
|
|
@ -94,7 +94,7 @@ send_search_result(
|
|||
ber_int_t err,
|
||||
const char *matched,
|
||||
const char *text,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
int nentries
|
||||
)
|
||||
|
|
@ -122,9 +122,9 @@ int send_search_reference(
|
|||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
struct berval **refs,
|
||||
BVarray refs,
|
||||
LDAPControl **ctrls,
|
||||
struct berval ***v2refs
|
||||
BVarray *v2refs
|
||||
)
|
||||
{
|
||||
assert(0);
|
||||
|
|
|
|||
|
|
@ -111,13 +111,12 @@ main( int argc, char **argv )
|
|||
}
|
||||
|
||||
if( sc == NULL ) {
|
||||
struct berval *vals[2];
|
||||
struct berval scbv;
|
||||
struct berval vals[2];
|
||||
|
||||
int ret = structural_class(
|
||||
oc->a_vals, &scbv, &text, textbuf, textlen );
|
||||
oc->a_vals, vals, &text, textbuf, textlen );
|
||||
|
||||
if( scbv.bv_len == 0 ) {
|
||||
if( vals[0].bv_len == 0 ) {
|
||||
fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
|
||||
progname, e->e_dn, lineno, text );
|
||||
rc = EXIT_FAILURE;
|
||||
|
|
@ -126,8 +125,7 @@ main( int argc, char **argv )
|
|||
break;
|
||||
}
|
||||
|
||||
vals[0] = &scbv;
|
||||
vals[1] = NULL;
|
||||
vals[1].bv_val = NULL;
|
||||
attr_merge( e, slap_schema.si_ad_structuralObjectClass,
|
||||
vals );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,32 +20,34 @@
|
|||
|
||||
int
|
||||
value_add(
|
||||
struct berval ***vals,
|
||||
struct berval **addvals
|
||||
BVarray *vals,
|
||||
BVarray addvals
|
||||
)
|
||||
{
|
||||
int n, nn, i, j;
|
||||
BVarray v2;
|
||||
|
||||
for ( nn = 0; addvals != NULL && addvals[nn] != NULL; nn++ )
|
||||
for ( nn = 0; addvals != NULL && addvals[nn].bv_val != NULL; nn++ )
|
||||
; /* NULL */
|
||||
|
||||
if ( *vals == NULL ) {
|
||||
*vals = (struct berval **) ch_malloc( (nn + 1)
|
||||
* sizeof(struct berval *) );
|
||||
*vals = (BVarray) ch_malloc( (nn + 1)
|
||||
* sizeof(struct berval) );
|
||||
n = 0;
|
||||
|
||||
} else {
|
||||
for ( n = 0; (*vals)[n] != NULL; n++ )
|
||||
for ( n = 0; (*vals)[n].bv_val != NULL; n++ )
|
||||
; /* NULL */
|
||||
*vals = (struct berval **) ch_realloc( (char *) *vals,
|
||||
(n + nn + 1) * sizeof(struct berval *) );
|
||||
*vals = (BVarray) ch_realloc( (char *) *vals,
|
||||
(n + nn + 1) * sizeof(struct berval) );
|
||||
}
|
||||
|
||||
for ( i = 0, j = 0; i < nn; i++ ) {
|
||||
(*vals)[n + j] = ber_bvdup( addvals[i] );
|
||||
if( (*vals)[n + j++] == NULL ) break;
|
||||
v2 = *vals + n;
|
||||
for ( ; addvals->bv_val; v2++, addvals++ ) {
|
||||
ber_dupbv(v2, addvals);
|
||||
if (v2->bv_val == NULL) break;
|
||||
}
|
||||
(*vals)[n + j] = NULL;
|
||||
v2->bv_val = NULL;
|
||||
v2->bv_len = 0;
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
|
@ -174,7 +176,7 @@ value_match(
|
|||
int value_find_ex(
|
||||
AttributeDescription *ad,
|
||||
unsigned flags,
|
||||
struct berval **vals,
|
||||
BVarray vals,
|
||||
struct berval *val )
|
||||
{
|
||||
int i;
|
||||
|
|
@ -212,12 +214,12 @@ int value_find_ex(
|
|||
}
|
||||
}
|
||||
|
||||
for ( i = 0; vals[i] != NULL; i++ ) {
|
||||
for ( i = 0; vals[i].bv_val != NULL; i++ ) {
|
||||
int match;
|
||||
const char *text;
|
||||
|
||||
rc = value_match( &match, ad, mr, flags,
|
||||
vals[i], nval.bv_val == NULL ? val : &nval, &text );
|
||||
&vals[i], nval.bv_val == NULL ? val : &nval, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match == 0 ) {
|
||||
free( nval.bv_val );
|
||||
|
|
|
|||
Loading…
Reference in a new issue