Eliminate unnecessary per-operation dn_normalize(o_ndn); it's already

done in do_bind() and there's space in the connection structure for c_ndn
already, just copy it.
This commit is contained in:
Howard Chu 2001-12-09 14:46:29 +00:00
parent d0b1ca692a
commit 45aadbbbba
3 changed files with 15 additions and 4 deletions

View file

@ -277,6 +277,10 @@ do_bind(
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
if( rc == LDAP_SUCCESS ) {
conn->c_dn = edn;
if( edn != NULL ) {
conn->c_ndn = ch_strdup( edn );
dn_normalize( conn->c_ndn );
}
conn->c_authmech = conn->c_sasl_bind_mech;
conn->c_sasl_bind_mech = NULL;
conn->c_sasl_bind_in_progress = 0;
@ -477,9 +481,10 @@ do_bind(
if(edn != NULL) {
conn->c_dn = edn;
} else {
conn->c_dn = ndn;
ndn = NULL;
conn->c_dn = ch_strdup( conn->c_cdn );
}
conn->c_ndn = ndn;
ndn = NULL;
if( conn->c_dn != NULL ) {
ber_len_t max = sockbuf_max_incoming;

View file

@ -414,6 +414,7 @@ long connection_init(
if( c->c_struct_state == SLAP_C_UNINITIALIZED ) {
c->c_authmech = NULL;
c->c_dn = NULL;
c->c_ndn = NULL;
c->c_cdn = NULL;
c->c_groups = NULL;
@ -451,6 +452,7 @@ long connection_init(
assert( c->c_struct_state == SLAP_C_UNUSED );
assert( c->c_authmech == NULL );
assert( c->c_dn == NULL );
assert( c->c_ndn == NULL );
assert( c->c_cdn == NULL );
assert( c->c_groups == NULL );
assert( c->c_listener_url == NULL );
@ -580,6 +582,10 @@ void connection2anonymous( Connection *c )
free(c->c_dn);
c->c_dn = NULL;
}
if(c->c_ndn != NULL) {
free(c->c_ndn);
c->c_ndn = NULL;
}
if(c->c_cdn != NULL) {
free(c->c_cdn);
@ -1460,9 +1466,8 @@ static int connection_op_activate( Connection *conn, Operation *op )
if (!arg->co_op->o_dn) {
arg->co_op->o_authz = conn->c_authz;
arg->co_op->o_dn = ch_strdup( conn->c_dn != NULL ? conn->c_dn : "" );
arg->co_op->o_ndn = ch_strdup( conn->c_ndn != NULL ? conn->c_ndn : "" );
}
arg->co_op->o_ndn = ch_strdup( arg->co_op->o_dn );
(void) dn_normalize( arg->co_op->o_ndn );
arg->co_op->o_authtype = conn->c_authtype;
arg->co_op->o_authmech = conn->c_authmech != NULL
? ch_strdup( conn->c_authmech ) : NULL;

View file

@ -1167,6 +1167,7 @@ struct slap_backend_info {
#define c_authtype c_authz.sai_method
#define c_authmech c_authz.sai_mech
#define c_dn c_authz.sai_dn
#define c_ndn c_authz.sai_ndn
#define c_ssf c_authz.sai_ssf
#define c_transport_ssf c_authz.sai_transport_ssf
#define c_tls_ssf c_authz.sai_tls_ssf