mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
move to more appropriate file ...
This commit is contained in:
parent
6dbd7341f9
commit
243311d56a
@ -149,46 +149,3 @@ ldap_back_add(
|
||||
return ldap_back_op_result( lc, op, rs, msgid, 1 ) != LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_dnattr_rewrite(
|
||||
dncookie *dc,
|
||||
BerVarray a_vals
|
||||
)
|
||||
{
|
||||
struct berval bv;
|
||||
int i, last;
|
||||
|
||||
for ( last = 0; a_vals[last].bv_val != NULL; last++ );
|
||||
last--;
|
||||
|
||||
for ( i = 0; a_vals[i].bv_val != NULL; i++ ) {
|
||||
switch ( ldap_back_dn_massage( dc, &a_vals[i], &bv ) ) {
|
||||
case LDAP_SUCCESS:
|
||||
case LDAP_OTHER: /* ? */
|
||||
default: /* ??? */
|
||||
/* leave attr untouched if massage failed */
|
||||
if ( bv.bv_val && bv.bv_val != a_vals[i].bv_val ) {
|
||||
ch_free( a_vals[i].bv_val );
|
||||
a_vals[i] = bv;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_UNWILLING_TO_PERFORM:
|
||||
/*
|
||||
* FIXME: need to check if it may be considered
|
||||
* legal to trim values when adding/modifying;
|
||||
* it should be when searching (see ACLs).
|
||||
*/
|
||||
ch_free( a_vals[i].bv_val );
|
||||
if (last > i ) {
|
||||
a_vals[i] = a_vals[last];
|
||||
}
|
||||
a_vals[last].bv_len = 0;
|
||||
a_vals[last].bv_val = NULL;
|
||||
last--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -468,3 +468,47 @@ ldap_back_filter_map_rewrite(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_dnattr_rewrite(
|
||||
dncookie *dc,
|
||||
BerVarray a_vals
|
||||
)
|
||||
{
|
||||
struct berval bv;
|
||||
int i, last;
|
||||
|
||||
for ( last = 0; a_vals[last].bv_val != NULL; last++ );
|
||||
last--;
|
||||
|
||||
for ( i = 0; a_vals[i].bv_val != NULL; i++ ) {
|
||||
switch ( ldap_back_dn_massage( dc, &a_vals[i], &bv ) ) {
|
||||
case LDAP_SUCCESS:
|
||||
case LDAP_OTHER: /* ? */
|
||||
default: /* ??? */
|
||||
/* leave attr untouched if massage failed */
|
||||
if ( bv.bv_val && bv.bv_val != a_vals[i].bv_val ) {
|
||||
ch_free( a_vals[i].bv_val );
|
||||
a_vals[i] = bv;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_UNWILLING_TO_PERFORM:
|
||||
/*
|
||||
* FIXME: need to check if it may be considered
|
||||
* legal to trim values when adding/modifying;
|
||||
* it should be when searching (see ACLs).
|
||||
*/
|
||||
ch_free( a_vals[i].bv_val );
|
||||
if (last > i ) {
|
||||
a_vals[i] = a_vals[last];
|
||||
}
|
||||
a_vals[last].bv_len = 0;
|
||||
a_vals[last].bv_val = NULL;
|
||||
last--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user