diff --git a/gitlab-ci/functional-api-test.sh b/gitlab-ci/functional-api-test.sh
index c443962..a71edd7 100755
--- a/gitlab-ci/functional-api-test.sh
+++ b/gitlab-ci/functional-api-test.sh
@@ -23,6 +23,8 @@ echo "Running the api test cases"
ubus-api-validator -f ./test/api/json/tr069.validation.json > ./api-test-result.log
check_ret $?
+sleep 5
+
echo "Stop all services"
supervisorctl stop icwmpd
@@ -36,14 +38,6 @@ cp ./memory-report.xml ./api-test-memory-report.xml
#report part
exec_cmd tap-junit --input ./api-test-result.log --output report
-echo "Checking memory leaks ..."
-grep -q "UninitCondition" memory-report.xml
-error_on_zero $?
-
-grep -q "Leak_PossiblyLost" memory-report.xml
-error_on_zero $?
-
-grep -q "Leak_DefinitelyLost" memory-report.xml
-error_on_zero $?
+check_valgrind_xml
echo "Functional API test :: PASS"
diff --git a/gitlab-ci/functional-test.sh b/gitlab-ci/functional-test.sh
index 91fa4e2..1eac6a1 100755
--- a/gitlab-ci/functional-test.sh
+++ b/gitlab-ci/functional-test.sh
@@ -72,17 +72,6 @@ cp ./memory-report.xml ./funl-test-memory-report.xml
#report part
exec_cmd tap-junit --input ./funl-test-result.log --output report
-echo "Checking memory leaks..."
-grep -q "UninitCondition" memory-report.xml
-error_on_zero $?
-
-grep -q "Leak_PossiblyLost" memory-report.xml
-error_on_zero $?
-
-grep -q "Leak_DefinitelyLost" memory-report.xml
-error_on_zero $?
-
-grep -q "Leak_StillReachable" memory-report.xml
-error_on_zero $?
+check_valgrind_xml
echo "Functional test :: PASS"
diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh
index f8999e2..0103500 100644
--- a/gitlab-ci/shared.sh
+++ b/gitlab-ci/shared.sh
@@ -138,3 +138,18 @@ function install_uspd()
exec_cmd make
exec_cmd cp uspd /usr/sbin/uspd
}
+
+function check_valgrind_xml() {
+ echo "Checking memory leaks..."
+ grep -q "UninitCondition" memory-report.xml
+ error_on_zero $?
+
+ grep -q "Leak_PossiblyLost" memory-report.xml
+ error_on_zero $?
+
+ grep -q "Leak_DefinitelyLost" memory-report.xml
+ error_on_zero $?
+
+ grep -q "Leak_StillReachable" memory-report.xml
+ error_on_zero $?
+}
diff --git a/http.c b/http.c
index 2e900cc..52cefc9 100644
--- a/http.c
+++ b/http.c
@@ -304,6 +304,7 @@ static void http_cr_new_client(int client, bool service_available)
char *username = cwmp_main.conf.cpe_userid;
char *password = cwmp_main.conf.cpe_passwd;
+ memset(auth_digest_buffer, 0, BUFSIZ);
if (!username || !password) {
// if we dont have username or password configured proceed with connecting to ACS
service_available = false;
@@ -326,6 +327,7 @@ static void http_cr_new_client(int client, bool service_available)
if (!service_available || !method_is_get) {
goto http_end;
}
+
int auth_check = validate_http_digest_auth("GET", "/", auth_digest_buffer + strlen("Authorization: Digest "), REALM, username, password, 300);
if (auth_check == -1) { /* invalid nonce */
internal_error = true;
diff --git a/test/script/verify_custom_notifications.sh b/test/script/verify_custom_notifications.sh
index 98b8aba..8715cdf 100755
--- a/test/script/verify_custom_notifications.sh
+++ b/test/script/verify_custom_notifications.sh
@@ -22,11 +22,13 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_va
uci commit cwmp
supervisorctl start icwmpd
-
-sleep 7
+check_cwmp_status
+sleep 2
supervisorctl stop icwmpd
+check_valgrind_xml
+
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 != *"Device.Users."* ]]; then
echo "FAIL: active notifications list doesn't contain Device.Users. parameter"
@@ -53,9 +55,13 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_in
uci commit cwmp
supervisorctl start icwmpd
-sleep 7
+check_cwmp_status
+sleep 2
+
supervisorctl stop icwmpd
+check_valgrind_xml
+
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 == *"Device.Users."* ]]; then
echo "FAIL: the json file is invalid, the active notifcation list shouldn't contain Device.Users. parameter"
@@ -88,9 +94,12 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_fo
uci commit cwmp
supervisorctl start icwmpd
-sleep 7
+check_cwmp_status
+sleep 2
supervisorctl stop icwmpd
+check_valgrind_xml
+
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 != *"Device.Users."* ]]; then
echo "FAIL: active notifications list doesn't contain Device.Users. parameter"
@@ -123,9 +132,12 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_in
uci commit cwmp
supervisorctl start icwmpd
-sleep 7
+check_cwmp_status
+sleep 2
supervisorctl stop icwmpd
+check_valgrind_xml
+
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 != *"Device.Users."* ]]; then
echo "FAIL: active notifications list doesn't contain Device.Users. parameter"
diff --git a/test/script/verify_download_method.sh b/test/script/verify_download_method.sh
index 8583e71..7d4a58a 100755
--- a/test/script/verify_download_method.sh
+++ b/test/script/verify_download_method.sh
@@ -22,8 +22,12 @@ fi
rm /etc/icwmpd/dm_enabled_notify
remove_icwmp_log
echo "Restarting icwmpd in order to apply the new firmware" >> ./funl-test-debug.log
-supervisorctl restart icwmpd >> ./funl-test-debug.log
-sleep 5
+supervisorctl stop icwmpd >> ./funl-test-debug.log
+check_valgrind_xml
+supervisorctl start icwmpd >> ./funl-test-debug.log
+check_cwmp_status
+sleep 2
+
check_session "TransferComplete"
received_command_key=$(print_tag_value "cwmp:TransferComplete" "CommandKey")
if [ "$sent_command_key" != "$received_command_key" ]; then