Commit b7e61597 authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

Merge remote-tracking branch 'origin/master' into OPENLDAP_REL_ENG_2_5

parents bbf249a3 27428b96
...@@ -351,5 +351,5 @@ skip: ...@@ -351,5 +351,5 @@ skip:
/* disconnect from server */ /* disconnect from server */
if ( res ) if ( res )
ldap_msgfree( res ); ldap_msgfree( res );
tool_exit( ld, code == LDAP_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE ); tool_exit( ld, rc );
} }
...@@ -263,6 +263,11 @@ The ...@@ -263,6 +263,11 @@ The
.BR slapo\-dynlist (5) .BR slapo\-dynlist (5)
overlay supports dynamic configuration via overlay supports dynamic configuration via
.BR back-config . .BR back-config .
.SH BUGS
Filtering on dynamic groups may return incomplete results if the
search operation uses the \fIpagedResults\fP control.
.SH ACKNOWLEDGEMENTS .SH ACKNOWLEDGEMENTS
.P .P
This module was written in 2004 by Pierangelo Masarati for SysNet s.n.c. This module was written in 2004 by Pierangelo Masarati for SysNet s.n.c.
......
...@@ -1499,12 +1499,20 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func, ...@@ -1499,12 +1499,20 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func,
for ( tag = ber_first_element( ber, &len, &rdn_end ); for ( tag = ber_first_element( ber, &len, &rdn_end );
tag == LBER_SEQUENCE; tag == LBER_SEQUENCE;
tag = ber_next_element( ber, &len, rdn_end )) { tag = ber_next_element( ber, &len, rdn_end )) {
if ( rdn_end > dn_end )
return LDAP_DECODING_ERROR;
tag = ber_skip_tag( ber, &len ); tag = ber_skip_tag( ber, &len );
ber_skip_data( ber, len ); ber_skip_data( ber, len );
navas++; navas++;
} }
} }
/* Rewind and prepare to extract */
ber_rewind( ber );
tag = ber_first_element( ber, &len, &dn_end );
if ( tag != LBER_SET )
return LDAP_DECODING_ERROR;
/* Allocate the DN/RDN/AVA stuff as a single block */ /* Allocate the DN/RDN/AVA stuff as a single block */
dnsize = sizeof(LDAPRDN) * (nrdns+1); dnsize = sizeof(LDAPRDN) * (nrdns+1);
dnsize += sizeof(LDAPAVA *) * (navas+nrdns); dnsize += sizeof(LDAPAVA *) * (navas+nrdns);
...@@ -1516,16 +1524,12 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func, ...@@ -1516,16 +1524,12 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func,
} else { } else {
newDN = (LDAPDN)(char *)ptrs; newDN = (LDAPDN)(char *)ptrs;
} }
newDN[nrdns] = NULL; newDN[nrdns] = NULL;
newRDN = (LDAPRDN)(newDN + nrdns+1); newRDN = (LDAPRDN)(newDN + nrdns+1);
newAVA = (LDAPAVA *)(newRDN + navas + nrdns); newAVA = (LDAPAVA *)(newRDN + navas + nrdns);
baseAVA = newAVA; baseAVA = newAVA;
/* Rewind and start extracting */
ber_rewind( ber );
tag = ber_first_element( ber, &len, &dn_end );
for ( i = nrdns - 1; i >= 0; i-- ) { for ( i = nrdns - 1; i >= 0; i-- ) {
newDN[i] = newRDN; newDN[i] = newRDN;
...@@ -1619,6 +1623,10 @@ allocd: ...@@ -1619,6 +1623,10 @@ allocd:
/* X.690 bitString value converted to RFC4517 Bit String */ /* X.690 bitString value converted to RFC4517 Bit String */
rc = der_to_ldap_BitString( &Val, &newAVA->la_value ); rc = der_to_ldap_BitString( &Val, &newAVA->la_value );
goto allocd; goto allocd;
case LBER_DEFAULT:
/* decode error */
rc = LDAP_DECODING_ERROR;
goto nomem;
default: default:
/* Not a string type at all */ /* Not a string type at all */
newAVA->la_flags = 0; newAVA->la_flags = 0;
......
...@@ -110,7 +110,8 @@ static ConfigTable mdbcfg[] = { ...@@ -110,7 +110,8 @@ static ConfigTable mdbcfg[] = {
"( OLcfgDbAt:12.5 NAME 'olcDbRtxnSize' " "( OLcfgDbAt:12.5 NAME 'olcDbRtxnSize' "
"DESC 'Number of entries to process in one read transaction' " "DESC 'Number of entries to process in one read transaction' "
"EQUALITY integerMatch " "EQUALITY integerMatch "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL }, "SYNTAX OMsInteger SINGLE-VALUE )", NULL,
{ .v_uint = DEFAULT_RTXN_SIZE } },
{ "searchstack", "depth", 2, 2, 0, ARG_INT|ARG_MAGIC|MDB_SSTACK, { "searchstack", "depth", 2, 2, 0, ARG_INT|ARG_MAGIC|MDB_SSTACK,
mdb_cf_gen, "( OLcfgDbAt:1.9 NAME 'olcDbSearchStack' " mdb_cf_gen, "( OLcfgDbAt:1.9 NAME 'olcDbSearchStack' "
"DESC 'Depth of search stack in IDLs' " "DESC 'Depth of search stack in IDLs' "
......
...@@ -424,11 +424,13 @@ static ConfigTable config_back_cf_table[] = { ...@@ -424,11 +424,13 @@ static ConfigTable config_back_cf_table[] = {
{ "index_substr_any_len", "len", 2, 2, 0, ARG_UINT|ARG_NONZERO, { "index_substr_any_len", "len", 2, 2, 0, ARG_UINT|ARG_NONZERO,
&index_substr_any_len, "( OLcfgGlAt:22 NAME 'olcIndexSubstrAnyLen' " &index_substr_any_len, "( OLcfgGlAt:22 NAME 'olcIndexSubstrAnyLen' "
"EQUALITY integerMatch " "EQUALITY integerMatch "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL }, "SYNTAX OMsInteger SINGLE-VALUE )", NULL,
{ .v_uint = SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT } },
{ "index_substr_any_step", "step", 2, 2, 0, ARG_UINT|ARG_NONZERO, { "index_substr_any_step", "step", 2, 2, 0, ARG_UINT|ARG_NONZERO,
&index_substr_any_step, "( OLcfgGlAt:23 NAME 'olcIndexSubstrAnyStep' " &index_substr_any_step, "( OLcfgGlAt:23 NAME 'olcIndexSubstrAnyStep' "
"EQUALITY integerMatch " "EQUALITY integerMatch "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL }, "SYNTAX OMsInteger SINGLE-VALUE )", NULL,
{ .v_uint = SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT } },
{ "index_intlen", "len", 2, 2, 0, ARG_UINT|ARG_MAGIC|CFG_IX_INTLEN, { "index_intlen", "len", 2, 2, 0, ARG_UINT|ARG_MAGIC|CFG_IX_INTLEN,
&config_generic, "( OLcfgGlAt:84 NAME 'olcIndexIntLen' " &config_generic, "( OLcfgGlAt:84 NAME 'olcIndexIntLen' "
"EQUALITY integerMatch " "EQUALITY integerMatch "
...@@ -461,7 +463,8 @@ static ConfigTable config_back_cf_table[] = { ...@@ -461,7 +463,8 @@ static ConfigTable config_back_cf_table[] = {
{ "localSSF", "ssf", 2, 2, 0, ARG_INT, { "localSSF", "ssf", 2, 2, 0, ARG_INT,
&local_ssf, "( OLcfgGlAt:26 NAME 'olcLocalSSF' " &local_ssf, "( OLcfgGlAt:26 NAME 'olcLocalSSF' "
"EQUALITY integerMatch " "EQUALITY integerMatch "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL }, "SYNTAX OMsInteger SINGLE-VALUE )", NULL,
{ .v_int = LDAP_PVT_SASL_LOCAL_SSF } },
{ "logfile", "file", 2, 2, 0, ARG_STRING|ARG_MAGIC|CFG_LOGFILE, { "logfile", "file", 2, 2, 0, ARG_STRING|ARG_MAGIC|CFG_LOGFILE,
&config_generic, "( OLcfgGlAt:27 NAME 'olcLogFile' " &config_generic, "( OLcfgGlAt:27 NAME 'olcLogFile' "
"EQUALITY caseExactMatch " "EQUALITY caseExactMatch "
...@@ -686,11 +689,13 @@ static ConfigTable config_back_cf_table[] = { ...@@ -686,11 +689,13 @@ static ConfigTable config_back_cf_table[] = {
{ "sockbuf_max_incoming", "max", 2, 2, 0, ARG_BER_LEN_T, { "sockbuf_max_incoming", "max", 2, 2, 0, ARG_BER_LEN_T,
&sockbuf_max_incoming, "( OLcfgGlAt:61 NAME 'olcSockbufMaxIncoming' " &sockbuf_max_incoming, "( OLcfgGlAt:61 NAME 'olcSockbufMaxIncoming' "
"EQUALITY integerMatch " "EQUALITY integerMatch "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL }, "SYNTAX OMsInteger SINGLE-VALUE )", NULL,
{ .v_ber_t = SLAP_SB_MAX_INCOMING_DEFAULT } },
{ "sockbuf_max_incoming_auth", "max", 2, 2, 0, ARG_BER_LEN_T, { "sockbuf_max_incoming_auth", "max", 2, 2, 0, ARG_BER_LEN_T,
&sockbuf_max_incoming_auth, "( OLcfgGlAt:62 NAME 'olcSockbufMaxIncomingAuth' " &sockbuf_max_incoming_auth, "( OLcfgGlAt:62 NAME 'olcSockbufMaxIncomingAuth' "
"EQUALITY integerMatch " "EQUALITY integerMatch "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL }, "SYNTAX OMsInteger SINGLE-VALUE )", NULL,
{ .v_ber_t = SLAP_SB_MAX_INCOMING_AUTH } },
{ "sortvals", "attr", 2, 0, 0, ARG_MAGIC|CFG_SORTVALS, { "sortvals", "attr", 2, 0, 0, ARG_MAGIC|CFG_SORTVALS,
&config_generic, "( OLcfgGlAt:83 NAME 'olcSortVals' " &config_generic, "( OLcfgGlAt:83 NAME 'olcSortVals' "
"DESC 'Attributes whose values will always be sorted' " "DESC 'Attributes whose values will always be sorted' "
...@@ -1417,7 +1422,6 @@ config_generic(ConfigArgs *c) { ...@@ -1417,7 +1422,6 @@ config_generic(ConfigArgs *c) {
case CFG_THREADQS: case CFG_THREADQS:
case CFG_TTHREADS: case CFG_TTHREADS:
case CFG_LTHREADS: case CFG_LTHREADS:
case CFG_RO:
case CFG_AZPOLICY: case CFG_AZPOLICY:
case CFG_DEPTH: case CFG_DEPTH:
case CFG_LASTMOD: case CFG_LASTMOD:
...@@ -1430,6 +1434,10 @@ config_generic(ConfigArgs *c) { ...@@ -1430,6 +1434,10 @@ config_generic(ConfigArgs *c) {
case CFG_SYNC_SUBENTRY: case CFG_SYNC_SUBENTRY:
break; break;
case CFG_RO:
c->be->be_restrictops &= ~SLAP_RESTRICT_READONLY;
break;
#ifdef LDAP_SLAPI #ifdef LDAP_SLAPI
case CFG_PLUGIN: case CFG_PLUGIN:
slapi_int_unregister_plugins(c->be, c->valx); slapi_int_unregister_plugins(c->be, c->valx);
......
...@@ -347,7 +347,7 @@ get_comp_filter( Operation* op, struct berval* bv, ...@@ -347,7 +347,7 @@ get_comp_filter( Operation* op, struct berval* bv,
return rc; return rc;
} }
rc = parse_comp_filter( op, &cav, filt, text ); rc = parse_comp_filter( op, &cav, filt, text );
bv->bv_val = cav.cav_ptr; /* bv->bv_val = cav.cav_ptr; */
return rc; return rc;
} }
...@@ -905,31 +905,37 @@ strip_cav_str( ComponentAssertionValue* cav, char* str) ...@@ -905,31 +905,37 @@ strip_cav_str( ComponentAssertionValue* cav, char* str)
static ber_tag_t static ber_tag_t
strip_cav_tag( ComponentAssertionValue* cav ) strip_cav_tag( ComponentAssertionValue* cav )
{ {
int rc;
eat_whsp( cav ); eat_whsp( cav );
if ( cav_cur_len( cav ) >= 8 && strncmp( cav->cav_ptr, "item", 4 ) == 0 ) { if ( cav_cur_len( cav ) >= 8 && strncmp( cav->cav_ptr, "item", 4 ) == 0 ) {
strip_cav_str( cav , "item:" ); if ( strip_cav_str( cav , "item:" ))
goto fail;
return LDAP_COMP_FILTER_ITEM; return LDAP_COMP_FILTER_ITEM;
} else if ( cav_cur_len( cav ) >= 7 && } else if ( cav_cur_len( cav ) >= 7 &&
strncmp( cav->cav_ptr, "and", 3 ) == 0 ) strncmp( cav->cav_ptr, "and", 3 ) == 0 )
{ {
strip_cav_str( cav , "and:" ); if ( strip_cav_str( cav , "and:" ))
goto fail;
return LDAP_COMP_FILTER_AND; return LDAP_COMP_FILTER_AND;
} else if ( cav_cur_len( cav ) >= 6 && } else if ( cav_cur_len( cav ) >= 6 &&
strncmp( cav->cav_ptr, "or" , 2 ) == 0 ) strncmp( cav->cav_ptr, "or" , 2 ) == 0 )
{ {
strip_cav_str( cav , "or:" ); if ( strip_cav_str( cav , "or:" ))
goto fail;
return LDAP_COMP_FILTER_OR; return LDAP_COMP_FILTER_OR;
} else if ( cav_cur_len( cav ) >= 7 && } else if ( cav_cur_len( cav ) >= 7 &&
strncmp( cav->cav_ptr, "not", 3 ) == 0 ) strncmp( cav->cav_ptr, "not", 3 ) == 0 )
{ {
strip_cav_str( cav , "not:" ); if ( strip_cav_str( cav , "not:" ))
goto fail;
return LDAP_COMP_FILTER_NOT; return LDAP_COMP_FILTER_NOT;
} }
fail:
return LBER_ERROR; return LBER_ERROR;
} }
...@@ -1067,7 +1073,7 @@ parse_comp_filter( Operation* op, ComponentAssertionValue* cav, ...@@ -1067,7 +1073,7 @@ parse_comp_filter( Operation* op, ComponentAssertionValue* cav,
*/ */
ber_tag_t tag; ber_tag_t tag;
int err; int err = LDAP_SUCCESS;
ComponentFilter f; ComponentFilter f;
/* TAG : item, and, or, not in RFC 4515 */ /* TAG : item, and, or, not in RFC 4515 */
tag = strip_cav_tag( cav ); tag = strip_cav_tag( cav );
...@@ -1077,10 +1083,11 @@ parse_comp_filter( Operation* op, ComponentAssertionValue* cav, ...@@ -1077,10 +1083,11 @@ parse_comp_filter( Operation* op, ComponentAssertionValue* cav,
return LDAP_PROTOCOL_ERROR; return LDAP_PROTOCOL_ERROR;
} }
if ( tag != LDAP_COMP_FILTER_NOT ) if ( tag != LDAP_COMP_FILTER_NOT ) {
strip_cav_str( cav, "{"); err = strip_cav_str( cav, "{");
if ( err )
err = LDAP_SUCCESS; goto invalid;
}
f.cf_next = NULL; f.cf_next = NULL;
f.cf_choice = tag; f.cf_choice = tag;
...@@ -1154,13 +1161,14 @@ parse_comp_filter( Operation* op, ComponentAssertionValue* cav, ...@@ -1154,13 +1161,14 @@ parse_comp_filter( Operation* op, ComponentAssertionValue* cav,
break; break;
} }
invalid:
if ( err != LDAP_SUCCESS && err != SLAPD_DISCONNECT ) { if ( err != LDAP_SUCCESS && err != SLAPD_DISCONNECT ) {
*text = "Component Filter Syntax Error"; *text = "Component Filter Syntax Error";
return err; return err;
} }
if ( tag != LDAP_COMP_FILTER_NOT ) if ( tag != LDAP_COMP_FILTER_NOT )
strip_cav_str( cav, "}"); err = strip_cav_str( cav, "}");
if ( err == LDAP_SUCCESS ) { if ( err == LDAP_SUCCESS ) {
if ( op ) { if ( op ) {
......
...@@ -453,14 +453,61 @@ int ...@@ -453,14 +453,61 @@ int
config_del_vals(ConfigTable *cf, ConfigArgs *c) config_del_vals(ConfigTable *cf, ConfigArgs *c)
{ {
int rc = 0; int rc = 0;
void *ptr;
/* If there is no handler, just ignore it */
if ( cf->arg_type & ARG_MAGIC ) { if ( cf->arg_type & ARG_MAGIC ) {
c->argv[0] = cf->ad->ad_cname.bv_val; c->argv[0] = cf->ad->ad_cname.bv_val;
c->op = LDAP_MOD_DELETE; c->op = LDAP_MOD_DELETE;
c->type = cf->arg_type & ARGS_USERLAND; c->type = cf->arg_type & ARGS_USERLAND;
rc = (*((ConfigDriver*)cf->arg_item))(c); rc = (*((ConfigDriver*)cf->arg_item))(c);
return rc;
} }
/* If there is no handler, just zero it */
if ( cf->arg_type & ARG_OFFSET ) {
if ( c->be && c->table == Cft_Database )
ptr = c->be->be_private;
else if ( c->bi )
ptr = c->bi->bi_private;
else {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> offset is missing base pointer",
c->argv[0] );
Debug( LDAP_DEBUG_CONFIG, "%s: %s!\n",
c->log, c->cr_msg );
return ARG_BAD_CONF;
}
ptr = (void *)((char *)ptr + (long)cf->arg_item);
} else if ( cf->arg_type & ARGS_TYPES ) {
ptr = cf->arg_item;
}
if ( cf->arg_type & ARGS_TYPES )
switch ( cf->arg_type & ARGS_TYPES ) {
case ARG_ON_OFF:
case ARG_INT: *(int *)ptr = cf->arg_default.v_int; break;
case ARG_UINT: *(unsigned *)ptr = cf->arg_default.v_uint; break;
case ARG_LONG: *(long *)ptr = cf->arg_default.v_long; break;
case ARG_ULONG: *(size_t *)ptr = cf->arg_default.v_ulong; break;
case ARG_BER_LEN_T: *(ber_len_t *)ptr = cf->arg_default.v_ber_t; break;
case ARG_STRING:
ch_free( *(char**)ptr );
if ( cf->arg_default.v_string ) {
*(char **)ptr = ch_strdup( cf->arg_default.v_string );
} else {
*(char **)ptr = NULL;
}
break;
case ARG_BERVAL:
case ARG_BINARY:
ch_free( ((struct berval *)ptr)->bv_val );
if ( !BER_BVISNULL( &cf->arg_default.v_bv ) ) {
ber_dupbv( (struct berval *)ptr, &cf->arg_default.v_bv );
} else {
BER_BVZERO( (struct berval *)ptr );
}
break;
case ARG_ATDESC:
*(AttributeDescription **)ptr = cf->arg_default.v_ad;
break;
}
return rc; return rc;
} }
......
...@@ -21,6 +21,23 @@ ...@@ -21,6 +21,23 @@
LDAP_BEGIN_DECL LDAP_BEGIN_DECL
typedef union config_values_u {
/* Drop-in to make existing "notify" initialisers quietly work */
void *dummy;
int v_int;
unsigned v_uint;
long v_long;
size_t v_ulong;
ber_len_t v_ber_t;
char *v_string;
struct berval v_bv;
struct {
struct berval vdn_dn;
struct berval vdn_ndn;
} v_dn;
AttributeDescription *v_ad;
} ConfigValues;
typedef struct ConfigTable { typedef struct ConfigTable {
const char *name; const char *name;
const char *what; const char *what;
...@@ -31,7 +48,7 @@ typedef struct ConfigTable { ...@@ -31,7 +48,7 @@ typedef struct ConfigTable {
void *arg_item; void *arg_item;
const char *attribute; const char *attribute;
AttributeDescription *ad; AttributeDescription *ad;
void *notify; ConfigValues arg_default;
} ConfigTable; } ConfigTable;
/* search entries are returned according to this order */ /* search entries are returned according to this order */
...@@ -142,20 +159,7 @@ typedef struct config_args_s { ...@@ -142,20 +159,7 @@ typedef struct config_args_s {
int depth; int depth;
int valx; /* multi-valued value index */ int valx; /* multi-valued value index */
/* parsed first val for simple cases */ /* parsed first val for simple cases */
union { ConfigValues values;
int v_int;
unsigned v_uint;
long v_long;
size_t v_ulong;
ber_len_t v_ber_t;
char *v_string;
struct berval v_bv;
struct {
struct berval vdn_dn;
struct berval vdn_ndn;
} v_dn;
AttributeDescription *v_ad;
} values;
/* return values for emit mode */ /* return values for emit mode */
BerVarray rvalue_vals; BerVarray rvalue_vals;
BerVarray rvalue_nvals; BerVarray rvalue_nvals;
......
...@@ -233,6 +233,7 @@ AVA_Sort( LDAPRDN rdn, int nAVAs ) ...@@ -233,6 +233,7 @@ AVA_Sort( LDAPRDN rdn, int nAVAs )
{ {
LDAPAVA *ava_i; LDAPAVA *ava_i;
int i; int i;
int rc = LDAP_SUCCESS;
assert( rdn != NULL ); assert( rdn != NULL );
...@@ -250,7 +251,7 @@ AVA_Sort( LDAPRDN rdn, int nAVAs ) ...@@ -250,7 +251,7 @@ AVA_Sort( LDAPRDN rdn, int nAVAs )
/* RFC4512 does not allow multiple AVAs /* RFC4512 does not allow multiple AVAs
* with the same attribute type in RDN (ITS#5968) */ * with the same attribute type in RDN (ITS#5968) */
if ( a == 0 ) if ( a == 0 )
return LDAP_INVALID_DN_SYNTAX; rc = LDAP_INVALID_DN_SYNTAX;
if ( a > 0 ) if ( a > 0 )
break; break;
...@@ -259,7 +260,7 @@ AVA_Sort( LDAPRDN rdn, int nAVAs ) ...@@ -259,7 +260,7 @@ AVA_Sort( LDAPRDN rdn, int nAVAs )
} }
rdn[ j+1 ] = ava_i; rdn[ j+1 ] = ava_i;
} }
return LDAP_SUCCESS; return rc;
} }
static int static int
......
...@@ -385,6 +385,50 @@ cleanup:; ...@@ -385,6 +385,50 @@ cleanup:;
return rs->sr_err; return rs->sr_err;
} }
/* extracted from slap_modrdn2mods() */
static int
mod_op_add_val(
Operation *op,
AttributeDescription * const desc,
struct berval * const val,
short const sm_op )
{
int rv = LDAP_SUCCESS;
Modifications *mod_tmp;
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications ) );
mod_tmp->sml_desc = desc;
BER_BVZERO( &mod_tmp->sml_type );
mod_tmp->sml_numvals = 1;
mod_tmp->sml_values = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod_tmp->sml_values[0], val );
mod_tmp->sml_values[1].bv_val = NULL;
if( desc->ad_type->sat_equality && desc->ad_type->sat_equality->smr_normalize) {
mod_tmp->sml_nvalues = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
rv = desc->ad_type->sat_equality->smr_normalize(
SLAP_MR_EQUALITY|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
desc->ad_type->sat_syntax,
desc->ad_type->sat_equality,
&mod_tmp->sml_values[0],
&mod_tmp->sml_nvalues[0], NULL );
if (rv != LDAP_SUCCESS) {
ch_free(mod_tmp->sml_nvalues);
ch_free(mod_tmp->sml_values[0].bv_val);
ch_free(mod_tmp->sml_values);
ch_free(mod_tmp);
goto done;
}
mod_tmp->sml_nvalues[1].bv_val = NULL;
} else {
mod_tmp->sml_nvalues = NULL;
}
mod_tmp->sml_op = sm_op;
mod_tmp->sml_flags = 0;
mod_tmp->sml_next = op->orr_modlist;
op->orr_modlist = mod_tmp;
done:
return rv;
}
int int
slap_modrdn2mods( slap_modrdn2mods(
Operation *op, Operation *op,
...@@ -427,7 +471,6 @@ slap_modrdn2mods( ...@@ -427,7 +471,6 @@ slap_modrdn2mods(
/* Add new attribute values to the entry */ /* Add new attribute values to the entry */
for ( a_cnt = 0; new_rdn[a_cnt]; a_cnt++ ) { for ( a_cnt = 0; new_rdn[a_cnt]; a_cnt++ ) {
AttributeDescription *desc = NULL; AttributeDescription *desc = NULL;
Modifications *mod_tmp;
rs->sr_err = slap_bv2ad( &new_rdn[a_cnt]->la_attr, &desc, &rs->sr_text ); rs->sr_err = slap_bv2ad( &new_rdn[a_cnt]->la_attr, &desc, &rs->sr_text );
...@@ -452,43 +495,15 @@ slap_modrdn2mods( ...@@ -452,43 +495,15 @@ slap_modrdn2mods(
} }
/* Apply modification */ /* Apply modification */
mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications ) ); rs->sr_err = mod_op_add_val( op, desc, &new_rdn[a_cnt]->la_value, SLAP_MOD_SOFTADD );
mod_tmp->sml_desc = desc; if (rs->sr_err != LDAP_SUCCESS)
BER_BVZERO( &mod_tmp->sml_type ); goto done;
mod_tmp->sml_numvals = 1;
mod_tmp->sml_values = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod_tmp->sml_values[0], &new_rdn[a_cnt]->la_value );
mod_tmp->sml_values[1].bv_val = NULL;
if( desc->ad_type->sat_equality->smr_normalize) {
mod_tmp->sml_nvalues = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
rs->sr_err = desc->ad_type->sat_equality->smr_normalize(