From: Pierangelo Masarati Date: Mon, 7 Apr 2003 17:18:42 +0000 (+0000) Subject: move to more appropriate file ... X-Git-Tag: AUTOCONF_2_57~10 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=243311d56ab59c12bc0e9c804ab29b98fdb07672;p=openldap move to more appropriate file ... --- diff --git a/servers/slapd/back-ldap/add.c b/servers/slapd/back-ldap/add.c index f4cf8af1e9..3a26ef68cb 100644 --- a/servers/slapd/back-ldap/add.c +++ b/servers/slapd/back-ldap/add.c @@ -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; -} diff --git a/servers/slapd/back-ldap/map.c b/servers/slapd/back-ldap/map.c index b08ca5539e..c74eee875e 100644 --- a/servers/slapd/back-ldap/map.c +++ b/servers/slapd/back-ldap/map.c @@ -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; +} +