ITS#4049: oldPassword cannot be ignored, error for now

Add tests to confirm proper behavior
This commit is contained in:
Kurt Zeilenga 2005-09-29 08:00:33 +00:00
parent e1029524b6
commit 68ae7408dc
2 changed files with 38 additions and 2 deletions

View File

@ -73,8 +73,8 @@ int passwd_extop(
qpw->rs_mods = NULL;
qpw->rs_modtail = NULL;
rs->sr_err = slap_passwd_parse( op->ore_reqdata, &id, &qpw->rs_old,
&qpw->rs_new, &rs->sr_text );
rs->sr_err = slap_passwd_parse( op->ore_reqdata, &id,
&qpw->rs_old, &qpw->rs_new, &rs->sr_text );
if ( rs->sr_err == LDAP_SUCCESS && !BER_BVISEMPTY( &id ) ) {
Statslog( LDAP_DEBUG_STATS, "%s PASSMOD id=\"%s\"%s%s\n",
@ -200,6 +200,12 @@ int passwd_extop(
goto error_return;
}
if ( qpw->rs_old.bv_val != NULL ) {
rs->sr_text = "unwilling to verify old password";
rc = LDAP_UNWILLING_TO_PERFORM;
goto error_return;
}
ml = ch_malloc( sizeof(Modifications) );
if ( !qpw->rs_modtail ) qpw->rs_modtail = &ml->sml_next;

View File

@ -60,6 +60,36 @@ $LDAPSEARCH -h $LOCALHOST -p $PORT1 \
-b "$BASEDN" \
'objectclass=*' >> $SEARCHOUT 2>&1
echo "Using ldappasswd to test a few error conditions ..."
echo "Pass 0" >> $TESTOUT
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
-w secret -a "" -s newsecret \
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
RC=$?
if test $RC = 0 ; then
echo "ldappasswd unexpectantly passed ($RC)! old empty"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
-w secret -a oldsecret -s "" \
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
RC=$?
if test $RC = 0 ; then
echo "ldappasswd unexpectantly passed ($RC)! new empty"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
-w secret -a oldsecret -s newsecret \
-D "cn=md5, $BASEDN" >> $TESTOUT 2>&1
RC=$?
if test $RC = 0 ; then
echo "ldappasswd unexpectantly passed ($RC)! wrong old"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Using ldappasswd (PASS 1) ..."
echo "Pass 1" >> $TESTOUT
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \