Commit 6b413395 authored by Howard Chu's avatar Howard Chu
Browse files

More struct beral conversion

parent bf5fc544
......@@ -58,7 +58,8 @@ ldap_back_add(
int i;
Attribute *a;
LDAPMod **attrs;
char *mdn = NULL, *mapped;
char *mapped;
struct berval mdn = { 0, NULL };
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY, "ldap_back_add: %s\n",
......@@ -76,18 +77,18 @@ ldap_back_add(
* Rewrite the add dn, if needed
*/
#ifdef ENABLE_REWRITE
switch (rewrite_session( li->rwinfo, "addDn", e->e_dn, conn, &mdn )) {
switch (rewrite_session( li->rwinfo, "addDn", e->e_dn, conn, &mdn.bv_val )) {
case REWRITE_REGEXEC_OK:
if ( mdn == NULL ) {
mdn = e->e_dn;
if ( mdn.bv_val == NULL ) {
mdn.bv_val = e->e_dn;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] addDn: \"%s\" -> \"%s\"\n",
e->e_dn, mdn ));
e->e_dn, mdn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> addDn: \"%s\" -> \"%s\"\n%s",
e->e_dn, mdn, "" );
e->e_dn, mdn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -102,7 +103,7 @@ ldap_back_add(
return( -1 );
}
#else /* !ENABLE_REWRITE */
mdn = ldap_back_dn_massage( li, ch_strdup( e->e_dn ), 0 );
ldap_back_dn_massage( li, &e->e_name, &mdn, 0, 1 );
#endif /* !ENABLE_REWRITE */
/* Count number of attributes in entry */
......@@ -162,17 +163,13 @@ ldap_back_add(
}
attrs[i] = NULL;
ldap_add_s(lc->ld, mdn, attrs);
ldap_add_s(lc->ld, mdn.bv_val, attrs);
for (--i; i>= 0; --i)
free(attrs[i]);
free(attrs);
#ifdef ENABLE_REWRITE
if ( mdn != e->e_dn ) {
#endif /* ENABLE_REWRITE */
free( mdn );
#ifdef ENABLE_REWRITE
if ( mdn.bv_val != e->e_dn ) {
free( mdn.bv_val );
}
#endif /* ENABLE_REWRITE */
return( ldap_back_op_result( lc, op ) );
}
......
......@@ -40,7 +40,8 @@ ldap_back_attribute(
LDAP *ld;
*vals = NULL;
if (target != NULL && strcmp(target->e_ndn, ndn->bv_val) == 0) {
if (target != NULL && target->e_nname.bv_len == ndn->bv_len &&
strcmp(target->e_nname.bv_val, ndn->bv_val) == 0) {
/* we already have a copy of the entry */
/* attribute and objectclass mapping has already been done */
if ((attr = attr_find(target->e_attrs, entry_at)) == NULL)
......
......@@ -53,7 +53,7 @@ struct slap_op;
struct ldapconn {
struct slap_conn *conn;
LDAP *ld;
char *bound_dn;
struct berval bound_dn;
int bound;
};
......@@ -78,7 +78,7 @@ struct ldapinfo {
#ifdef ENABLE_REWRITE
struct rewrite_info *rwinfo;
#else /* !ENABLE_REWRITE */
char **suffix_massage;
struct berval **suffix_massage;
#endif /* !ENABLE_REWRITE */
struct ldapmap oc_map;
......@@ -92,8 +92,8 @@ int ldap_back_map_result(int err);
int ldap_back_op_result(struct ldapconn *lc, Operation *op);
int back_ldap_LTX_init_module(int argc, char *argv[]);
char *ldap_back_dn_massage(struct ldapinfo *li, char *dn, int normalized);
char *ldap_back_dn_restore(struct ldapinfo *li, char *dn, int normalized);
void ldap_back_dn_massage(struct ldapinfo *li, struct berval *dn,
struct berval *res, int normalized, int tofrom);
extern int ldap_back_conn_cmp( const void *c1, const void *c2);
extern int ldap_back_conn_dup( void *c1, void *c2 );
......
......@@ -64,7 +64,7 @@ ldap_back_bind(
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
struct ldapconn *lc;
char *mdn = NULL;
struct berval mdn = { 0, NULL };
int rc = 0;
lc = ldap_back_getconn(li, conn, op);
......@@ -76,17 +76,17 @@ ldap_back_bind(
* Rewrite the bind dn if needed
*/
#ifdef ENABLE_REWRITE
switch ( rewrite_session( li->rwinfo, "bindDn", dn->bv_val, conn, &mdn ) ) {
switch ( rewrite_session( li->rwinfo, "bindDn", dn->bv_val, conn, &mdn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( mdn == NULL ) {
mdn = ( char * )dn->bv_val;
if ( mdn.bv_val == NULL ) {
mdn.bv_val = ( char * )dn->bv_val;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn ));
"[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> bindDn: \"%s\" -> \"%s\"\n%s",
dn->bv_val, mdn, "" );
dn->bv_val, mdn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -101,23 +101,19 @@ ldap_back_bind(
return( -1 );
}
#else /* !ENABLE_REWRITE */
mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 );
ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
#endif /* !ENABLE_REWRITE */
rc = ldap_bind_s(lc->ld, mdn, cred->bv_val, method);
rc = ldap_bind_s(lc->ld, mdn.bv_val, cred->bv_val, method);
if (rc != LDAP_SUCCESS) {
rc = ldap_back_op_result( lc, op );
} else {
lc->bound = 1;
}
#ifdef ENABLE_REWRITE
if ( mdn != dn->bv_val ) {
#endif /* ENABLE_REWRITE */
free( mdn );
#ifdef ENABLE_REWRITE
if ( mdn.bv_val != dn->bv_val ) {
free( mdn.bv_val );
}
#endif /* ENABLE_REWRITE */
return( rc );
}
......@@ -236,13 +232,14 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
* Rewrite the bind dn if needed
*/
#ifdef ENABLE_REWRITE
lc->bound_dn = NULL;
lc->bound_dn.bv_val = NULL;
lc->bound_dn.bv_len = 0;
switch ( rewrite_session( li->rwinfo, "bindDn",
lc->conn->c_cdn, conn,
&lc->bound_dn ) ) {
&lc->bound_dn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( lc->bound_dn == NULL ) {
lc->bound_dn =
if ( lc->bound_dn.bv_val == NULL ) {
lc->bound_dn.bv_val =
ch_strdup( lc->conn->c_cdn );
}
#ifdef NEW_LOGGING
......@@ -250,13 +247,13 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
"[rw] bindDn: \"%s\" ->"
" \"%s\"\n%s",
lc->conn->c_cdn,
lc->bound_dn ));
lc->bound_dn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn: \"%s\" ->"
" \"%s\"\n%s",
lc->conn->c_cdn,
lc->bound_dn, "" );
lc->bound_dn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -275,11 +272,13 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
return( NULL );
}
#else /* !ENABLE_REWRITE */
lc->bound_dn = ldap_back_dn_massage( li,
ch_strdup( lc->conn->c_cdn ), 0 );
struct berval bv;
ber_str2bv( lc->conn->c_cdn, 0, 0, &bv );
ldap_back_dn_massage( li, &bv, &lc->bound_dn, 0, 1 );
#endif /* !ENABLE_REWRITE */
} else {
lc->bound_dn = NULL;
lc->bound_dn.bv_val = NULL;
lc->bound_dn.bv_len = 0;
}
lc->bound = 0;
......@@ -340,7 +339,7 @@ ldap_back_dobind(struct ldapconn *lc, Operation *op)
return( lc->bound );
}
if (ldap_bind_s(lc->ld, lc->bound_dn, NULL, LDAP_AUTH_SIMPLE) !=
if (ldap_bind_s(lc->ld, lc->bound_dn.bv_val, NULL, LDAP_AUTH_SIMPLE) !=
LDAP_SUCCESS) {
ldap_back_op_result(lc, op);
return( 0 );
......
......@@ -57,7 +57,8 @@ ldap_back_compare(
{
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
struct ldapconn *lc;
char *mdn, *mapped_oc, *mapped_at;
char *mapped_oc, *mapped_at;
struct berval mdn = { 0, NULL };
lc = ldap_back_getconn(li, conn, op);
if (!lc || !ldap_back_dobind( lc, op ) ) {
......@@ -68,18 +69,18 @@ ldap_back_compare(
* Rewrite the compare dn, if needed
*/
#ifdef ENABLE_REWRITE
switch ( rewrite_session( li->rwinfo, "compareDn", dn->bv_val, conn, &mdn ) ) {
switch ( rewrite_session( li->rwinfo, "compareDn", dn->bv_val, conn, &mdn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( mdn == NULL ) {
mdn = ( char * )dn->bv_val;
if ( mdn.bv_val == NULL ) {
mdn.bv_val = ( char * )dn->bv_val;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] compareDn: \"%s\" -> \"%s\"\n",
dn->bv_val, mdn ));
dn->bv_val, mdn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> compareDn: \"%s\" -> \"%s\"\n%s",
dn->bv_val, mdn, "" );
dn->bv_val, mdn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -94,8 +95,8 @@ ldap_back_compare(
return( -1 );
}
#else /* !ENABLE_REWRITE */
mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 );
if ( mdn == NULL ) {
ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
if ( mdn.bv_val == NULL ) {
return -1;
}
#endif /* !ENABLE_REWRITE */
......@@ -108,15 +109,11 @@ ldap_back_compare(
if (mapped_at == NULL)
return( -1 );
ldap_compare_s( lc->ld, mdn, mapped_oc, mapped_at );
ldap_compare_s( lc->ld, mdn.bv_val, mapped_oc, mapped_at );
#ifdef ENABLE_REWRITE
if ( mdn != dn->bv_val ) {
#endif /* ENABLE_REWRITE */
free( mdn );
#ifdef ENABLE_REWRITE
if ( mdn.bv_val != dn->bv_val ) {
free( mdn.bv_val );
}
#endif /* ENABLE_REWRITE */
return( ldap_back_op_result( lc, op ) );
}
......@@ -114,7 +114,7 @@ ldap_back_db_config(
/* dn massaging */
} else if ( strcasecmp( argv[0], "suffixmassage" ) == 0 ) {
#ifndef ENABLE_REWRITE
char *dn, *massaged_dn;
struct berval *bd2;
#endif /* ENABLE_REWRITE */
BackendDB *tmp_be;
struct berval bdn, *ndn = NULL;
......@@ -184,18 +184,17 @@ ldap_back_db_config(
*/
return suffix_massage_config( li->rwinfo, argc, argv );
#else /* !ENABLE_REWRITE */
dn = ch_strdup( argv[1] );
charray_add( &li->suffix_massage, dn );
(void) dn_normalize( dn );
charray_add( &li->suffix_massage, dn );
massaged_dn = ch_strdup( argv[2] );
charray_add( &li->suffix_massage, massaged_dn );
(void) dn_normalize( massaged_dn );
charray_add( &li->suffix_massage, massaged_dn );
bd2 = ber_bvstrdup( argv[1] );
ber_bvecadd( &li->suffix_massage, bd2 );
ndn = NULL;
dnNormalize( NULL, bd2, &ndn );
ber_bvecadd( &li->suffix_massage, ndn );
free( dn );
free( massaged_dn );
bd2 = ber_bvstrdup( argv[2] );
ber_bvecadd( &li->suffix_massage, bd2 );
ndn = NULL;
dnNormalize( NULL, bd2, &ndn );
ber_bvecadd( &li->suffix_massage, ndn );
#endif /* !ENABLE_REWRITE */
#ifdef ENABLE_REWRITE
......
......@@ -57,7 +57,7 @@ ldap_back_delete(
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
struct ldapconn *lc;
char *mdn = NULL;
struct berval mdn = { 0, NULL };
lc = ldap_back_getconn( li, conn, op );
......@@ -69,17 +69,17 @@ ldap_back_delete(
* Rewrite the compare dn, if needed
*/
#ifdef ENABLE_REWRITE
switch ( rewrite_session( li->rwinfo, "deleteDn", dn->bv_val, conn, &mdn ) ) {
switch ( rewrite_session( li->rwinfo, "deleteDn", dn->bv_val, conn, &mdn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( mdn == NULL ) {
mdn = ( char * )dn->bv_val;
if ( mdn.bv_val == NULL ) {
mdn.bv_val = ( char * )dn->bv_val;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] deleteDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn ));
"[rw] deleteDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> deleteDn: \"%s\" -> \"%s\"\n%s",
dn->bv_val, mdn, "" );
dn->bv_val, mdn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -94,18 +94,14 @@ ldap_back_delete(
return( -1 );
}
#else /* !ENABLE_REWRITE */
mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 );
ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
#endif /* !ENABLE_REWRITE */
ldap_delete_s( lc->ld, mdn );
ldap_delete_s( lc->ld, mdn.bv_val );
#ifdef ENABLE_REWRITE
if ( mdn != dn->bv_val ) {
#endif /* ENABLE_REWRITE */
free( mdn );
#ifdef ENABLE_REWRITE
if ( mdn.bv_val != dn->bv_val ) {
free( mdn.bv_val );
}
#endif /* ENABLE_REWRITE */
return( ldap_back_op_result( lc, op ) );
}
......@@ -38,9 +38,9 @@ ldap_back_group(
LDAPMessage *result;
char *gattr[2];
char *filter = NULL;
char *filter = NULL, *ptr;
LDAP *ld;
char *mop_ndn, *mgr_ndn;
struct berval mop_ndn = { 0, NULL }, mgr_ndn = { 0, NULL };
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
char *group_oc_name = NULL;
......@@ -52,7 +52,8 @@ ldap_back_group(
group_oc_name = group_oc->soc_oid;
}
if (target != NULL && strcmp(target->e_ndn, gr_ndn->bv_val) == 0) {
if (target != NULL && target->e_nname.bv_len == gr_ndn->bv_len &&
strcmp(target->e_nname.bv_val, gr_ndn->bv_val) == 0) {
/* we already have a copy of the entry */
/* attribute and objectclass mapping has already been done */
......@@ -92,19 +93,19 @@ ldap_back_group(
*/
#ifdef ENABLE_REWRITE
switch ( rewrite_session( li->rwinfo, "bindDn",
op_ndn->bv_val, conn, &mop_ndn ) ) {
op_ndn->bv_val, conn, &mop_ndn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( mop_ndn == NULL ) {
mop_ndn = ( char * )op_ndn->bv_val;
if ( mop_ndn.bv_val == NULL ) {
mop_ndn = *op_ndn;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] bindDn (op ndn in group):"
" \"%s\" -> \"%s\"\n", op_ndn->bv_val, mop_ndn ));
" \"%s\" -> \"%s\"\n", op_ndn->bv_val, mop_ndn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> bindDn (op ndn in group): \"%s\" -> \"%s\"\n%s",
op_ndn->bv_val, mop_ndn, "" );
op_ndn->bv_val, mop_ndn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -118,20 +119,20 @@ ldap_back_group(
* Rewrite the gr ndn if needed
*/
switch ( rewrite_session( li->rwinfo, "searchBase",
gr_ndn->bv_val, conn, &mgr_ndn ) ) {
gr_ndn->bv_val, conn, &mgr_ndn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( mgr_ndn == NULL ) {
mgr_ndn = ( char * )gr_ndn->bv_val;
if ( mgr_ndn.bv_val == NULL ) {
mgr_ndn = *gr_ndn;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] searchBase (gr ndn in group):"
" \"%s\" -> \"%s\"\n%s", gr_ndn->bv_val, mgr_ndn ));
" \"%s\" -> \"%s\"\n%s", gr_ndn->bv_val, mgr_ndn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS,
"rw> searchBase (gr ndn in group):"
" \"%s\" -> \"%s\"\n%s",
gr_ndn->bv_val, mgr_ndn, "" );
gr_ndn->bv_val, mgr_ndn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -141,12 +142,12 @@ ldap_back_group(
goto cleanup;
}
#else /* !ENABLE_REWRITE */
mop_ndn = ldap_back_dn_massage( li, ch_strdup( op_ndn ), 1 );
if ( mop_ndn == NULL ) {
ldap_back_dn_massage( li, op_ndn, &mop_ndn, 1, 1 );
if ( mop_ndn.bv_val == NULL ) {
goto cleanup;
}
mgr_ndn = ldap_back_dn_massage( li, ch_strdup( gr_ndn ), 1 );
if ( mgr_ndn == NULL ) {
ldap_back_dn_massage( li, gr_ndn, &mgr_ndn, 1, 1 );
if ( mgr_ndn.bv_val == NULL ) {
goto cleanup;
}
#endif /* !ENABLE_REWRITE */
......@@ -161,7 +162,7 @@ ldap_back_group(
filter = ch_malloc(sizeof("(&(objectclass=)(=))")
+ strlen(group_oc_name)
+ strlen(group_at_name)
+ strlen(mop_ndn) + 1);
+ mop_ndn.bv_len + 1);
if (filter == NULL)
goto cleanup;
......@@ -174,17 +175,17 @@ ldap_back_group(
goto cleanup;
}
strcpy(filter, "(&(objectclass=");
strcat(filter, group_oc_name);
strcat(filter, ")(");
strcat(filter, group_at_name);
strcat(filter, "=");
strcat(filter, mop_ndn);
strcat(filter, "))");
ptr = slap_strcopy(filter, "(&(objectclass=");
ptr = slap_strcopy(ptr, group_oc_name);
ptr = slap_strcopy(ptr, ")(");
ptr = slap_strcopy(ptr, group_at_name);
ptr = slap_strcopy(ptr, "=");
ptr = slap_strcopy(ptr, mop_ndn.bv_val);
strcpy(ptr, "))");
gattr[0] = "objectclass";
gattr[1] = NULL;
if (ldap_search_ext_s(ld, mgr_ndn, LDAP_SCOPE_BASE, filter,
if (ldap_search_ext_s(ld, mgr_ndn.bv_val, LDAP_SCOPE_BASE, filter,
gattr, 0, NULL, NULL, LDAP_NO_LIMIT,
LDAP_NO_LIMIT, &result) == LDAP_SUCCESS) {
if (ldap_first_entry(ld, result) != NULL)
......@@ -197,18 +198,11 @@ cleanup:;
ldap_unbind(ld);
}
ch_free(filter);
#ifdef ENABLE_REWRITE
if ( mop_ndn != op_ndn->bv_val ) {
#endif /* ENABLE_REWRITE */
free( mop_ndn );
#ifdef ENABLE_REWRITE
if ( mop_ndn.bv_val != op_ndn->bv_val ) {
free( mop_ndn.bv_val );
}
if ( mgr_ndn != gr_ndn->bv_val ) {
#endif /* ENABLE_REWRITE */
free( mgr_ndn );
#ifdef ENABLE_REWRITE
if ( mgr_ndn.bv_val != gr_ndn->bv_val ) {
free( mgr_ndn.bv_val );
}
#endif /* ENABLE_REWRITE */
return(rc);
}
......@@ -144,7 +144,7 @@ conn_free(
)
{
ldap_unbind(lc->ld);
if ( lc->bound_dn) free( lc->bound_dn );
if ( lc->bound_dn.bv_val) free( lc->bound_dn.bv_val );
free( lc );
}
......@@ -189,7 +189,7 @@ ldap_back_db_destroy(
}
#else /* !ENABLE_REWRITE */
if (li->suffix_massage) {
ldap_value_free( li->suffix_massage );
ber_bvecfree( li->suffix_massage );
}
#endif /* !ENABLE_REWRITE */
......
......@@ -61,7 +61,8 @@ ldap_back_modify(
LDAPMod *mods;
Modifications *ml;
int i;
char *mdn = NULL, *mapped;
char *mapped;
struct berval mdn = { 0, NULL };
lc = ldap_back_getconn(li, conn, op);
if ( !lc || !ldap_back_dobind( lc, op ) ) {
......@@ -72,17 +73,17 @@ ldap_back_modify(
* Rewrite the modify dn, if needed
*/
#ifdef ENABLE_REWRITE
switch ( rewrite_session( li->rwinfo, "modifyDn", dn->bv_val, conn, &mdn ) ) {
switch ( rewrite_session( li->rwinfo, "modifyDn", dn->bv_val, conn, &mdn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( mdn == NULL ) {
mdn = ( char * )dn->bv_val;
if ( mdn.bv_val == NULL ) {
mdn.bv_val = ( char * )dn->bv_val;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] modifyDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn ));
"[rw] modifyDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val ));
#else /* !NEW_LOGGING */
Debug( LDAP_DEBUG_ARGS, "rw> modifyDn: \"%s\" -> \"%s\"\n%s",
dn->bv_val, mdn, "" );
dn->bv_val, mdn.bv_val, "" );
#endif /* !NEW_LOGGING */
break;
......@@ -97,7 +98,7 @@ ldap_back_modify(
return( -1 );
}
#else /* !ENABLE_REWRITE */
mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 );
ldap_back_dn_massage( li, dn, &mdn, 0, 1 );
#endif /* !ENABLE_REWRITE */
for (i=0, ml=modlist; ml; i++,ml=ml->sml_next)
......@@ -140,13 +141,13 @@ ldap_back_modify(
}
modv[i] = 0;
ldap_modify_s( lc->ld, mdn, modv );
ldap_modify_s( lc->ld, mdn.bv_val, modv );
cleanup:;
#ifdef ENABLE_REWRITE
if ( mdn != dn->bv_val ) {
if ( mdn.bv_val != dn->bv_val ) {
#endif /* ENABLE_REWRITE */
free( mdn );
free( mdn.bv_val );
#ifdef ENABLE_REWRITE