From: Pierangelo Masarati Date: Fri, 12 Nov 2004 12:49:43 +0000 (+0000) Subject: don't hijack members of op for temporaries... X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~336 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b67eecb45f1e07bff68345c18e1b99828db7747;p=openldap don't hijack members of op for temporaries... --- diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 28044d6993..081b196a28 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -829,6 +829,7 @@ int slap_sasl_match( Operation *opx, struct berval *rule, slap_callback cb = { NULL, sasl_sc_smatch, NULL, NULL }; Operation op = {0}; SlapReply rs = {REP_RESULT}; + struct berval base = BER_BVNULL; sm.dn = assertDN; sm.match = 0; @@ -838,7 +839,7 @@ int slap_sasl_match( Operation *opx, struct berval *rule, "===>slap_sasl_match: comparing DN %s to rule %s\n", assertDN->bv_val, rule->bv_val, 0 ); - rc = slap_parseURI( opx, rule, &op.o_req_dn, + rc = slap_parseURI( opx, rule, &base, &op.o_req_ndn, &op.ors_scope, &op.ors_filter, &op.ors_filterstr ); if( rc != LDAP_SUCCESS ) goto CONCLUDED; @@ -998,7 +999,11 @@ exact_match: op.o_conn = opx->o_conn; op.o_connid = opx->o_connid; /* use req_ndn as req_dn instead of non-pretty base of uri */ - if( !BER_BVISNULL( &op.o_req_dn ) ) ch_free( op.o_req_dn.bv_val ); + if( !BER_BVISNULL( &base ) ) { + ch_free( base.bv_val ); + /* just in case... */ + BER_BVZERO( &base ); + } ber_dupbv_x( &op.o_req_dn, &op.o_req_ndn, op.o_tmpmemctx ); op.ors_slimit = 1; op.ors_tlimit = SLAP_NO_LIMIT; @@ -1081,6 +1086,7 @@ void slap_sasl2dn( Operation *opx, Operation op = {0}; SlapReply rs = {REP_RESULT}; struct berval regout = BER_BVNULL; + struct berval base = BER_BVNULL; Debug( LDAP_DEBUG_TRACE, "==>slap_sasl2dn: " "converting SASL name %s to a DN\n", @@ -1095,7 +1101,7 @@ void slap_sasl2dn( Operation *opx, goto FINISHED; } - rc = slap_parseURI( opx, ®out, &op.o_req_dn, + rc = slap_parseURI( opx, ®out, &base, &op.o_req_ndn, &op.ors_scope, &op.ors_filter, &op.ors_filterstr ); if ( !BER_BVISNULL( ®out ) ) slap_sl_free( regout.bv_val, opx->o_tmpmemctx ); @@ -1165,7 +1171,11 @@ void slap_sasl2dn( Operation *opx, op.ors_attrsonly = 1; op.o_sync_slog_size = -1; /* use req_ndn as req_dn instead of non-pretty base of uri */ - if( !BER_BVISNULL( &op.o_req_dn ) ) ch_free( op.o_req_dn.bv_val ); + if( !BER_BVISNULL( &base ) ) { + ch_free( base.bv_val ); + /* just in case... */ + BER_BVZERO( &base ); + } ber_dupbv_x( &op.o_req_dn, &op.o_req_ndn, op.o_tmpmemctx ); op.o_bd->be_search( &op, &rs );