From: Pierangelo Masarati Date: Fri, 22 Jul 2005 02:29:49 +0000 (+0000) Subject: fix back-ldap unparsing X-Git-Tag: OPENLDAP_AC_BP~274 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1ac6bf4d1d1ff58bad4cdc2ecad41deca0aa17df;p=openldap fix back-ldap unparsing --- diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c index 16e1cd0a5c..125e2f61a5 100644 --- a/servers/slapd/back-ldap/config.c +++ b/servers/slapd/back-ldap/config.c @@ -362,8 +362,7 @@ ldap_back_cf_gen( ConfigArgs *c ) char *ptr; if ( li->idassert_authmethod != LDAP_AUTH_NONE ) { - ber_len_t len = bv.bv_len - + STRLENOF( "flags=override,non-prescriptive" ); + ber_len_t len; switch ( li->idassert_mode ) { case LDAP_BACK_IDASSERT_OTHERID: @@ -391,7 +390,7 @@ ldap_back_cf_gen( ConfigArgs *c ) } if ( li->idassert_flags & LDAP_BACK_AUTH_NATIVE_AUTHZ ) { - ber_len_t len = bv.bv_len + STRLENOF( "authz=native" ); + len = bv.bv_len + STRLENOF( "authz=native" ); if ( !BER_BVISEMPTY( &bv ) ) { len += STRLENOF( " " ); @@ -399,7 +398,7 @@ ldap_back_cf_gen( ConfigArgs *c ) bv.bv_val = ch_realloc( bv.bv_val, len + 1 ); - ptr = bv.bv_val + bv.bv_len; + ptr = &bv.bv_val[ bv.bv_len ]; if ( !BER_BVISEMPTY( &bv ) ) { ptr = lutil_strcopy( ptr, " " ); @@ -408,6 +407,7 @@ ldap_back_cf_gen( ConfigArgs *c ) (void)lutil_strcopy( ptr, "authz=native" ); } + len = bv.bv_len + STRLENOF( "flags=non-prescriptive,override" ); /* flags */ if ( !BER_BVISEMPTY( &bv ) ) { len += STRLENOF( " " ); @@ -440,15 +440,12 @@ ldap_back_cf_gen( ConfigArgs *c ) bindconf_unparse( &li->idassert_sb, &bc ); if ( !BER_BVISNULL( &bv ) ) { - char *ptr; - c->value_bv.bv_len = bv.bv_len + bc.bv_len; c->value_bv.bv_val = ch_realloc( bv.bv_val, c->value_bv.bv_len + 1 ); assert( bc.bv_val[ 0 ] == ' ' ); - ptr = lutil_strcopy( c->value_bv.bv_val, bv.bv_val ); - (void)lutil_strcopy( ptr, bc.bv_val ); + (void)lutil_strcopy( &c->value_bv.bv_val[ bv.bv_len ], bc.bv_val ); free( bc.bv_val );