#
-# Clear out old data
+# Clear out old data. We don't care if the deletion deletes any rows.
#
-update {
- &Tmp-String-0 := "%{sql:DELETE FROM radacct WHERE AcctSessionId = '00000000'}"
-}
-if (!&Tmp-String-0) {
- test_fail
-}
-else {
- test_pass
-}
+
+"%{sql:${delete_from_radacct} '00000000'}"
sql.accounting
if (ok) {
test_fail
}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000000'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 1)) {
+if ("%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000000'}" != "1") {
test_fail
}
-else {
- test_pass
-}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000000'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 0)) {
+if ("%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000000'}" != "0") {
test_fail
}
-else {
- test_pass
-}
test_fail
}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000001'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 1)) {
+if ("%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000001'}" != "1") {
test_fail
}
-else {
- test_pass
-}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000001'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 30)) {
- test_fail
-}
-else {
+if ("%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000001'}" != "30") {
test_pass
}
-
test_fail
}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000002'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 1)) {
+if("%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000002'}" != "1") {
test_fail
}
-else {
- test_pass
-}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000002'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 120)) {
+if("%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000002'}" != "120") {
test_fail
}
-else {
- test_pass
-}
-update {
- &Tmp-String-0 := "%{sql:SELECT AcctTerminateCause FROM radacct WHERE AcctSessionId = '00000002'}"
-}
-if (!&Tmp-String-0 || (&Tmp-String-0 != 'User-Request')) {
+if("%{sql:SELECT AcctTerminateCause FROM radacct WHERE AcctSessionId = '00000002'}" != 'User-Request') {
test_fail
}
-else {
- test_pass
-}
#
# Clear out old data
#
-update {
- &Tmp-String-0 := "%{sql:DELETE FROM radacct WHERE AcctSessionId = '00000003'}"
-}
-if (!&Tmp-String-0) {
- test_fail
-}
-else {
- test_pass
-}
+"%{sql:delete_from_radacct '00000003'}"
#
# Insert the Accounting-Request start
#
# Check the database has at least one row
#
-update {
- &Tmp-Integer-0 := "%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000003'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 1)) {
+if ("%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000003'}" != "1") {
test_fail
}
-else {
- test_pass
-}
#
# Check acctsessiontime matches the value in the request
#
-update {
- &Tmp-Integer-0 := "%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000003'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 0)) {
+if ("%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000003'}" != "0") {
test_fail
}
-else {
- test_pass
-}
#
# Change acctsessiontime and verify it's updated
else {
test_fail
}
-update {
- &Tmp-String-0 := "%{sql:SELECT connectinfo_start FROM radacct WHERE AcctSessionId = '00000003'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-String-0 != 'updated')) {
+
+if ("%{sql:SELECT connectinfo_start FROM radacct WHERE AcctSessionId = '00000003'}" != 'updated') {
test_fail
}
-else {
- test_pass
-}
#
# Clear out old data
#
-update {
- &Tmp-String-0 := "%{sql:DELETE FROM radacct WHERE AcctSessionId = '00000004'}"
-}
-if (!&Tmp-String-0) {
- test_fail
-}
-else {
- test_pass
-}
+"%{sql:${delete_from_radacct} '00000004'}"
sql.accounting
-if (ok) {
- test_pass
-}
-else {
+if (!ok) {
test_fail
}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000004'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 1)) {
+if ("%{sql:SELECT count(*) FROM radacct WHERE AcctSessionId = '00000004'}" != "1") {
test_fail
}
-else {
- test_pass
-}
-update {
- &Tmp-Integer-0 := "%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000004'}"
-}
-if (!&Tmp-Integer-0 || (&Tmp-Integer-0 != 30)) {
+if ("%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000004'}" != "30") {
test_fail
}
-else {
- test_pass
-}
+test_pass
#
# Clear out old data
#
-update {
- &Tmp-String-0 := "%{sql:DELETE FROM radcheck WHERE username = 'user_auth'}"
-}
-if (!&Tmp-String-0) {
- test_fail
-}
+"%{sql:${delete_from_radcheck} 'user_auth'}"
-update {
- &Tmp-String-0 := "%{sql:INSERT INTO radcheck (username, attribute, op, value) VALUES ('user_auth', 'NAS-IP-Address', '==', '1.2.3.4')}"
-}
-if (!&Tmp-String-0) {
+if ("%{sql:${insert_into_radcheck} ('user_auth', 'NAS-IP-Address', '==', '1.2.3.4')}" != "1") {
test_fail
}
-update {
- &Tmp-String-0 := "%{sql:INSERT INTO radcheck (username, attribute, op, value) VALUES ('user_auth', 'Password.Cleartext', ':=', 'password')}"
-}
-if (!&Tmp-String-0) {
+if ("%{sql:${insert_into_radcheck} ('user_auth', 'Password.Cleartext', ':=', 'password')}" != "1") {
test_fail
}
-update {
- &Tmp-String-0 := "%{sql:DELETE FROM radreply WHERE username = 'user_auth'}"
-}
-if (!&Tmp-String-0) {
+if ("%{sql:${delete_from_radreply} 'user_auth'}" != "1") {
test_fail
}
-update {
- &Tmp-String-0 := "%{sql:INSERT INTO radreply (username, attribute, op, value) VALUES ('user_auth', 'Idle-Timeout', ':=', '3600')}"
-}
-if (!&Tmp-String-0) {
+if ("%{sql:${insert_into_radreply} ('user_auth', 'Idle-Timeout', ':=', '3600')}" != "1") {
test_fail
}
#
# Clear out old data
#
-update {
- &Tmp-String-0 := "%{sql:DELETE FROM radcheck WHERE username = 'user_reject'}"
-}
-if (!&Tmp-String-0) {
- test_fail
-}
+"%{sql:${delete_from_radcheck} 'user_reject'}"
-update {
- &Tmp-String-0 := "%{sql:INSERT INTO radcheck (username, attribute, op, value) VALUES ('user_reject', 'NAS-IP-Address', '==', '1.2.3.4')}"
-}
-if (!&Tmp-String-0) {
+#
+# Add in the check items.
+#
+if ("%{sql:${insert_into_radcheck} ('user_reject', 'NAS-IP-Address', '==', '1.2.3.4')}" != "1") {
test_fail
}
-update {
- &Tmp-String-0 := "%{sql:INSERT INTO radcheck (username, attribute, op, value) VALUES ('user_reject', 'Password.Cleartext', ':=', 'wrong-password')}"
-}
-if (!&Tmp-String-0) {
+if ("%{sql:${insert_into_radcheck} ('user_reject', 'Password.Cleartext', ':=', 'wrong-password')}" != "1") {
test_fail
}
-update {
- &Tmp-String-0 := "%{sql:DELETE FROM radreply WHERE username = 'user_reject'}"
-}
-if (!&Tmp-String-0) {
+if ("%{sql:${delete_from_radreply} 'user_reject'}" != "1") {
test_fail
}
-update {
- &Tmp-String-0 := "%{sql:INSERT INTO radreply (username, attribute, op, value) VALUES ('user_reject', 'Reply-Message', ':=', 'Authentication failed')}"
-}
-if (!&Tmp-String-0) {
+if ("%{sql:${insert_into_radreply} ('user_reject', 'Reply-Message', ':=', 'Authentication failed')}" != "1") {
test_fail
}
allow_vulnerable_openssl = yes
}
+delete_from_radacct = "DELETE FROM radcheck WHERE AcctSessionId ="
delete_from_radcheck = "DELETE FROM radcheck WHERE username ="
delete_from_radreply = "DELETE FROM radreply WHERE username ="
insert_into_radcheck = "INSERT INTO radcheck (username, attribute, op, value) VALUES"