From 01c38dd6ea7f02cfdc9f77f9299771a4ef6ce968 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 18 Dec 2006 22:30:47 +0000 Subject: [PATCH] ITS#4458 re-encode passwd request --- servers/slapd/overlays/rwm.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index dc0d3fe120..9a59a1707e 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -85,6 +85,12 @@ rwm_op_cleanup( Operation *op, SlapReply *rs ) op->ors_filter = ros->ors_filter; op->ors_filterstr = ros->ors_filterstr; break; + case LDAP_REQ_EXTENDED: + if ( op->ore_reqdata != ros->ore_reqdata ) { + ber_bvfree( op->ore_reqdata ); + op->ore_reqdata = ros->ore_reqdata; + } + break; default: break; } op->o_callback = op->o_callback->sc_next; @@ -874,6 +880,7 @@ rwm_exop_passwd( Operation *op, SlapReply *rs ) struct berval id = BER_BVNULL, pwold = BER_BVNULL, pwnew = BER_BVNULL; + BerElement *ber = NULL; if ( !BER_BVISNULL( &op->o_req_ndn ) ) { return LDAP_SUCCESS; @@ -917,7 +924,26 @@ rwm_exop_passwd( Operation *op, SlapReply *rs ) return -1; } - /* TODO: re-encode the request with the massaged DN */ + ber = ber_alloc_t( LBER_USE_DER ); + if ( !ber ) { + rs->sr_err = LDAP_OTHER; + rs->sr_text = "No memory"; + return rs->sr_err; + } + ber_printf( ber, "{" ); + if ( !BER_BVISNULL( &id )) { + ber_printf( ber, "tO", LDAP_TAG_EXOP_MODIFY_PASSWD_ID, + &op->o_req_dn ); + } + if ( !BER_BVISNULL( &pwold )) { + ber_printf( ber, "tO", LDAP_TAG_EXOP_MODIFY_PASSWD_OLD, &pwold ); + } + if ( !BER_BVISNULL( &pwnew )) { + ber_printf( ber, "tO", LDAP_TAG_EXOP_MODIFY_PASSWD_NEW, &pwnew ); + } + ber_printf( ber, "N}" ); + ber_flatten( ber, &op->ore_reqdata ); + ber_free( ber, 1 ); op->o_callback = &roc->cb; -- 2.39.5