s4-test: check that a weak password is rejected by kpasswd
authorAndrew Tridgell <tridge@samba.org>
Thu, 15 Apr 2010 06:25:50 +0000 (16:25 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 16 Apr 2010 04:12:44 +0000 (14:12 +1000)
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

testprogs/blackbox/test_passwords.sh

index 9a4c1915f66ae9b44c4be3d59a00e1f9c69d7d71..167c1b244f89e9e2e50407fc3ca4882d4380ecaf 100755 (executable)
@@ -71,8 +71,52 @@ test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`exp
 
 
 USERPASS=$NEWUSERPASS
+WEAKPASS=testpass1
 NEWUSERPASS=testPaSS@03%
 
+# password mismatch check doesn't work yet (kpasswd bug, reported to Love)
+#echo "check that password mismatch gives the right error"
+#cat > ./tmpkpasswdscript <<EOF
+#expect Password
+#password ${USERPASS}\n
+#expect New password
+#send ${WEAKPASS}\n
+#expect New password
+#send ${NEWUSERPASS}\n
+#expect password mismatch
+#EOF
+#
+#testit "change user password with kpasswd" $rkpty ./tmpkpasswdscript $samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1`
+
+
+echo "check that a weak password is rejected"
+cat > ./tmpkpasswdscript <<EOF
+expect Password
+password ${USERPASS}\n
+expect New password
+send ${WEAKPASS}\n
+expect New password
+send ${WEAKPASS}\n
+expect Password does not meet complexity requirements
+EOF
+
+testit "change to weak user password with kpasswd" $rkpty ./tmpkpasswdscript $samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1`
+
+echo "check that a short password is rejected"
+cat > ./tmpkpasswdscript <<EOF
+expect Password
+password ${USERPASS}\n
+expect New password
+send xx1\n
+expect New password
+send xx1\n
+expect Password too short
+EOF
+
+testit "change to short user password with kpasswd" $rkpty ./tmpkpasswdscript $samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1`
+
+
+echo "check that a strong new password is accepted"
 cat > ./tmpkpasswdscript <<EOF
 expect Password
 password ${USERPASS}\n