[Pkg-shadow-commits] r2636 - in debian/trunk/tests: . newusers newusers/43_create_user_encrypt_SHA256_rounds_3000 newusers/44_create_user_encrypt_SHA256_rounds_300

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sat Apr 11 11:25:12 UTC 2009


Author: nekral-guest
Date: 2009-04-11 11:25:12 +0000 (Sat, 11 Apr 2009)
New Revision: 2636

Added:
   debian/trunk/tests/newusers/43_create_user_encrypt_SHA256_rounds_3000/
   debian/trunk/tests/newusers/44_create_user_encrypt_SHA256_rounds_300/
Modified:
   debian/trunk/tests/newusers/43_create_user_encrypt_SHA256_rounds_3000/newusers.test
   debian/trunk/tests/newusers/44_create_user_encrypt_SHA256_rounds_300/newusers.test
   debian/trunk/tests/run_all
Log:
Added tests for newusers.


Modified: debian/trunk/tests/newusers/43_create_user_encrypt_SHA256_rounds_3000/newusers.test
===================================================================
--- debian/trunk/tests/newusers/41_create_user_encrypt_SHA256/newusers.test	2009-04-11 11:15:13 UTC (rev 2635)
+++ debian/trunk/tests/newusers/43_create_user_encrypt_SHA256_rounds_3000/newusers.test	2009-04-11 11:25:12 UTC (rev 2636)
@@ -7,7 +7,7 @@
 . ../../common/config.sh
 . ../../common/log.sh
 
-log_start "$0" "newusers can encrypt the passwords with the SHA256 algorithm"
+log_start "$0" "newusers can encrypt the passwords with the SHA256 algorithm and a specified number of rounds"
 
 save_config
 
@@ -16,7 +16,8 @@
 
 change_config
 
-newusers -c SHA256 data/newusers.list
+echo "newusers -c SHA256 -s 3000 data/newusers.list"
+newusers -c SHA256 -s 3000 data/newusers.list
 
 echo -n "Check the passwd file..." 
 ../../common/compare_file.pl data/passwd /etc/passwd 
@@ -26,7 +27,16 @@
 echo "OK" 
 echo -n "Check the shadow file..." 
 ../../common/compare_file.pl data/shadow /etc/shadow 
-echo "OK" 
+echo "OK"
+echo -n "Check the number of rounds..."
+rounds=$(sed -n 's/^foo:\$5\$rounds=\([0-9]*\)\$.*$/\1/p' /etc/shadow)
+echo -n "($rounds)..."
+if [ ! "$rounds" = 3000 ]; then
+	echo "Wrong number of rounds"
+	grep "^foo:" /etc/shadow
+	exit 1
+fi
+echo "OK"
 echo -n "Check the gshadow file..." 
 ../../common/compare_file.pl data/gshadow /etc/gshadow 
 echo "OK"

Modified: debian/trunk/tests/newusers/44_create_user_encrypt_SHA256_rounds_300/newusers.test
===================================================================
--- debian/trunk/tests/newusers/41_create_user_encrypt_SHA256/newusers.test	2009-04-11 11:15:13 UTC (rev 2635)
+++ debian/trunk/tests/newusers/44_create_user_encrypt_SHA256_rounds_300/newusers.test	2009-04-11 11:25:12 UTC (rev 2636)
@@ -7,7 +7,7 @@
 . ../../common/config.sh
 . ../../common/log.sh
 
-log_start "$0" "newusers can encrypt the passwords with the SHA256 algorithm"
+log_start "$0" "newusers: the minimum number of rounds for SHA256 is 1000"
 
 save_config
 
@@ -16,7 +16,8 @@
 
 change_config
 
-newusers -c SHA256 data/newusers.list
+echo "newusers -c SHA256 -s 300 data/newusers.list"
+newusers -c SHA256 -s 300 data/newusers.list
 
 echo -n "Check the passwd file..." 
 ../../common/compare_file.pl data/passwd /etc/passwd 
@@ -26,7 +27,16 @@
 echo "OK" 
 echo -n "Check the shadow file..." 
 ../../common/compare_file.pl data/shadow /etc/shadow 
-echo "OK" 
+echo "OK"
+echo -n "Check the number of rounds..."
+rounds=$(sed -n 's/^foo:\$5\$rounds=\([0-9]*\)\$.*$/\1/p' /etc/shadow)
+echo -n "($rounds)..."
+if [ ! "$rounds" = 1000 ]; then
+	echo "Wrong number of rounds"
+	grep "^foo:" /etc/shadow
+	exit 1
+fi
+echo "OK"
 echo -n "Check the gshadow file..." 
 ../../common/compare_file.pl data/gshadow /etc/gshadow 
 echo "OK"

Modified: debian/trunk/tests/run_all
===================================================================
--- debian/trunk/tests/run_all	2009-04-11 11:15:13 UTC (rev 2635)
+++ debian/trunk/tests/run_all	2009-04-11 11:25:12 UTC (rev 2636)
@@ -504,6 +504,8 @@
 run_test ./newusers/40_update_password_encrypted/newusers.test
 run_test ./newusers/41_create_user_encrypt_SHA256/newusers.test
 run_test ./newusers/42_create_user_encrypt_SHA512/newusers.test
+run_test ./newusers/43_create_user_encrypt_SHA256_rounds_3000/newusers.test
+run_test ./newusers/44_create_user_encrypt_SHA256_rounds_300/newusers.test
 run_test ./split_groups/01_useradd_split_group/useradd.test
 run_test ./split_groups/02_useradd_no_split_group/useradd.test
 run_test ./split_groups/03_useradd_split_group_already_split/useradd.test




More information about the Pkg-shadow-commits mailing list