From: Saulo Moraes Date: Fri, 6 Apr 2018 18:09:02 +0000 (-0300) Subject: Fixes related to issues detected by Coverity tool X-Git-Tag: submit/tizen/20180416.190712~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23829e6ebec2e89e4f94bb2d316dd08bc2a2726d;p=platform%2Fcore%2Fsecurity%2Fprivacy-guard.git Fixes related to issues detected by Coverity tool Change-Id: I24b215fb13420a30f28574945b0dbfd7b2b84f72 --- diff --git a/common/inc/SocketConnection.h b/common/inc/SocketConnection.h index 63c8bc8..334c1b5 100755 --- a/common/inc/SocketConnection.h +++ b/common/inc/SocketConnection.h @@ -187,7 +187,7 @@ public: char* pBuf = new(std::nothrow) char[length + 1]; TryReturn(pBuf != NULL, PRIV_GUARD_ERROR_OUT_OF_MEMORY, , "new : %d", PRIV_GUARD_ERROR_OUT_OF_MEMORY); - m_socketStream.readStream(length, pBuf); + res = m_socketStream.readStream(length, pBuf); TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, delete[] pBuf, "readStream : %d", res); pBuf[length] = 0; @@ -243,7 +243,7 @@ public: TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "readStream : %d", res); pBuf = new(std::nothrow) char[length + 1]; TryReturn(pBuf != NULL, PRIV_GUARD_ERROR_OUT_OF_MEMORY, , "new : %d", PRIV_GUARD_ERROR_OUT_OF_MEMORY); - m_socketStream.readStream(length, pBuf); + res = m_socketStream.readStream(length, pBuf); TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, delete[] pBuf, "readStream : %d", res); pBuf[length] = 0; memset(out.privacy_id, 0x0, LEN_PRIVACY_ID); @@ -268,7 +268,7 @@ public: TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "readStream : %d", res); pBuf = new(std::nothrow) char[length + 1]; TryReturn(pBuf != NULL, PRIV_GUARD_ERROR_OUT_OF_MEMORY, , "new : %d", PRIV_GUARD_ERROR_OUT_OF_MEMORY); - m_socketStream.readStream(length, pBuf); + res = m_socketStream.readStream(length, pBuf); TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, delete[] pBuf, "readStream : %d", res); pBuf[length] = 0; memset(out.package_id, 0x0, LEN_PACKAGE_ID); diff --git a/server/src/service/PrivacyInfoService.cpp b/server/src/service/PrivacyInfoService.cpp index b0fcc37..3720870 100755 --- a/server/src/service/PrivacyInfoService.cpp +++ b/server/src/service/PrivacyInfoService.cpp @@ -332,7 +332,11 @@ PrivacyInfoService::PgForeachLeakLogsByAppName(SocketConnection* pConnector) std::list logList; pConnector->read(&userId); - pConnector->read(appName, LEN_APPLICATION_NAME); + int res = pConnector->read(appName, LEN_APPLICATION_NAME); + if (res != PRIV_GUARD_ERROR_SUCCESS) { + PG_LOGE("fail : pConnector->read(appName, LEN_APPLICATION_NAME) (%d)", res); + return; + } int result = PrivacyGuardDb::getInstance()->PgForeachLeakLogs(userId, appName, 0, logList); @@ -492,7 +496,11 @@ PrivacyInfoService::PgGetDlpCurrentRules(SocketConnection* pConnector) std::list rules; pConnector->read(&userId); - pConnector->read(appId, LEN_PACKAGE_ID); + int res = pConnector->read(appId, LEN_PACKAGE_ID); + if (res != PRIV_GUARD_ERROR_SUCCESS) { + PG_LOGE("fail : pConnector->read(appId, LEN_PACKAGE_ID) (%d)", res); + return; + } pConnector->read(&pId); int result = PrivacyGuardDb::getInstance()->PgGetDlpCurrentRules(userId, appId, pId, templateRules); @@ -589,7 +597,11 @@ PrivacyInfoService::PgDeleteDlpPattern(SocketConnection* pConnector) { int pattern_id = 0; - pConnector->read(pattern_id); + int res = pConnector->read(pattern_id); + if (res != PRIV_GUARD_ERROR_SUCCESS) { + PG_LOGE("fail : pConnector->read(pattern_id) (%d)", res); + return; + } int result = PrivacyGuardDb::getInstance()->PgDeleteDlpPattern(pattern_id); diff --git a/test/tc-dlp-performance.c b/test/tc-dlp-performance.c index 3c1e614..a5a7c17 100644 --- a/test/tc-dlp-performance.c +++ b/test/tc-dlp-performance.c @@ -28,122 +28,122 @@ typedef struct rec { // Packet to match 6 rules: Personal Document, Birth Date, Email, Address, Full Name and PhoneNumber char packet_match_6rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \ - "Host: pr-bh.ybp.yahoo.com" \ - "Connection: keep-alive" - "Accept: image/webp,image/*,*/*;q=0.8" - "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" - "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" - "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" - "Referer: https://br.news.search.yahoo.com/search;" - "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr" - "=p%d02/02/1972%2emailtest@test.orgasdasdCm%3Apivo" - "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo" - "1237123461234567890" - "Accept-Encoding: gzip, deflate" - "Accept-Language: en-US" - "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec6"; + "Host: pr-bh.ybp.yahoo.com" \ + "Connection: keep-alive" + "Accept: image/webp,image/*,*/*;q=0.8" + "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" + "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" + "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" + "Referer: https://br.news.search.yahoo.com/search;" + "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr" + "=p%d02/02/1972%2emailtest@test.orgasdasdCm%3Apivo" + "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo" + "1237123461234567890" + "Accept-Encoding: gzip, deflate" + "Accept-Language: en-US" + "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec6"; // Packet to match 5 rules: Personal Document, Email, Address, Full Name and PhoneNumber char packet_match_5rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \ - "Host: pr-bh.ybp.yahoo.com" \ - "Connection: keep-alive" - "Accept: image/webp,image/*,*/*;q=0.8" - "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" - "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" - "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" - "Referer: https://br.news.search.yahoo.com/search;" - "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr" - "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" - "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo" - "1237123461234567890" - "Accept-Encoding: gzip, deflate" - "Accept-Language: en-US" - "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec5"; + "Host: pr-bh.ybp.yahoo.com" \ + "Connection: keep-alive" + "Accept: image/webp,image/*,*/*;q=0.8" + "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" + "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" + "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" + "Referer: https://br.news.search.yahoo.com/search;" + "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr" + "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" + "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo" + "1237123461234567890" + "Accept-Encoding: gzip, deflate" + "Accept-Language: en-US" + "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec5"; // Packet to match 4 rules: Email, Address, Full Name and PhoneNumber char packet_match_4rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \ - "Host: pr-bh.ybp.yahoo.com" \ - "Connection: keep-alive" - "Accept: image/webp,image/*,*/*;q=0.8" - "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" - "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" - "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" - "Referer: https://br.news.search.yahoo.com/search;" - "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" - "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" - "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo" - "123712346" - "Accept-Encoding: gzip, deflate" - "Accept-Language: en-US" - "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec4"; + "Host: pr-bh.ybp.yahoo.com" \ + "Connection: keep-alive" + "Accept: image/webp,image/*,*/*;q=0.8" + "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" + "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" + "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" + "Referer: https://br.news.search.yahoo.com/search;" + "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" + "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" + "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo" + "123712346" + "Accept-Encoding: gzip, deflate" + "Accept-Language: en-US" + "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec4"; // Packet to match 3 rules: Email, Full Name and PhoneNumber char packet_match_3rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \ - "Host: pr-bh.ybp.yahoo.com" \ - "Connection: keep-alive" - "Accept: image/webp,image/*,*/*;q=0.8" - "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" - "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" - "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" - "Referer: https://br.news.search.yahoo.com/search;" - "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" - "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" - "Chjsad%3As%2Cv%3Ai%2John Doe%25858655sf234546%3vo" - "123712346" - "Accept-Encoding: gzip, deflate" - "Accept-Language: en-US" - "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec3"; + "Host: pr-bh.ybp.yahoo.com" \ + "Connection: keep-alive" + "Accept: image/webp,image/*,*/*;q=0.8" + "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" + "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" + "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" + "Referer: https://br.news.search.yahoo.com/search;" + "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" + "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" + "Chjsad%3As%2Cv%3Ai%2John Doe%25858655sf234546%3vo" + "123712346" + "Accept-Encoding: gzip, deflate" + "Accept-Language: en-US" + "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec3"; // Packet to match 2 rules: Email and PhoneNumber char packet_match_2rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \ - "Host: pr-bh.ybp.yahoo.com" \ - "Connection: keep-alive" - "Accept: image/webp,image/*,*/*;q=0.8" - "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" - "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" - "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" - "Referer: https://br.news.search.yahoo.com/search;" - "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" - "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" - "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo" - "123712346" - "Accept-Encoding: gzip, deflate" - "Accept-Language: en-US" - "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec2"; + "Host: pr-bh.ybp.yahoo.com" \ + "Connection: keep-alive" + "Accept: image/webp,image/*,*/*;q=0.8" + "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" + "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" + "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" + "Referer: https://br.news.search.yahoo.com/search;" + "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" + "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo" + "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo" + "123712346" + "Accept-Encoding: gzip, deflate" + "Accept-Language: en-US" + "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec2"; // Packet to match 1 rules: PhoneNumber char packet_match_1rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \ - "Host: pr-bh.ybp.yahoo.com" \ - "Connection: keep-alive" - "Accept: image/webp,image/*,*/*;q=0.8" - "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" - "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" - "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" - "Referer: https://br.news.search.yahoo.com/search;" - "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" - "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo" - "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo" - "123712346" - "Accept-Encoding: gzip, deflate" - "Accept-Language: en-US" - "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec1"; + "Host: pr-bh.ybp.yahoo.com" \ + "Connection: keep-alive" + "Accept: image/webp,image/*,*/*;q=0.8" + "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" + "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" + "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" + "Referer: https://br.news.search.yahoo.com/search;" + "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" + "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo" + "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo" + "123712346" + "Accept-Encoding: gzip, deflate" + "Accept-Language: en-US" + "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec1"; // Packet to match 0 rules char packet_match_0rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \ - "Host: pr-bh.ybp.yahoo.com" \ - "Connection: keep-alive" - "Accept: image/webp,image/*,*/*;q=0.8" - "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" - "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" - "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" - "Referer: https://br.news.search.yahoo.com/search;" - "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" - "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo" - "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo" - "123715346" - "Accept-Encoding: gzip, deflate" - "Accept-Language: en-US" - "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec0"; + "Host: pr-bh.ybp.yahoo.com" \ + "Connection: keep-alive" + "Accept: image/webp,image/*,*/*;q=0.8" + "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG" + "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu" + "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53" + "Referer: https://br.news.search.yahoo.com/search;" + "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr" + "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo" + "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo" + "123715346" + "Accept-Encoding: gzip, deflate" + "Accept-Language: en-US" + "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec0"; /////////////////////////////////////////////////////////////////////////////// // test utilities @@ -299,56 +299,59 @@ static void __test_privacy_guard_client_dlp_string_match(int number_of_execution __start_test_executions(__FUNCTION__, number_of_executions); - switch (n_rules) { - case 0: - packet = packet_match_0rules; - break; - case 1: - packet = packet_match_1rules; - break; - case 2: - packet = packet_match_2rules; - break; - case 3: - packet = packet_match_3rules; - break; - case 4: - packet = packet_match_4rules; - break; - case 5: - packet = packet_match_5rules; - break; - case 6: - packet = packet_match_6rules; - break; - default: - packet = packet_match_1rules; - break; - } + switch (n_rules) { + case 0: + packet = packet_match_0rules; + break; + case 1: + packet = packet_match_1rules; + break; + case 2: + packet = packet_match_2rules; + break; + case 3: + packet = packet_match_3rules; + break; + case 4: + packet = packet_match_4rules; + break; + case 5: + packet = packet_match_5rules; + break; + case 6: + packet = packet_match_6rules; + break; + default: + packet = packet_match_1rules; + break; + } - packet_to_send = strdup(packet); + packet_to_send = strdup(packet); // If needs to increase payload size... - for (count = 1; count < payload_multiply; count++) { - // ...just duplicate the payload content - char* new_packet_to_send = malloc(strlen(packet_to_send)+strlen(packet_to_send)+1); + for (count = 1; count < payload_multiply; count++) { + // ...just duplicate the payload content + char* new_packet_to_send = malloc(strlen(packet_to_send)+strlen(packet_to_send)+1); - if (new_packet_to_send != NULL) { - pg_strlcpy(new_packet_to_send, packet_to_send, strlen(packet_to_send)); - strncat(new_packet_to_send, packet_to_send, sizeof(new_packet_to_send) - strlen(new_packet_to_send) - 1); + if (new_packet_to_send != NULL) { + pg_strlcpy(new_packet_to_send, packet_to_send, strlen(packet_to_send)); + strncat(new_packet_to_send, packet_to_send, sizeof(new_packet_to_send) - strlen(new_packet_to_send) - 1); packet_to_send = strdup(new_packet_to_send); free(new_packet_to_send); - } - } + } + } - printf("Sending %d bytes\n", strlen(packet_to_send)); + printf("Sending %d bytes\n", strlen(packet_to_send)); for (count = 0; count < number_of_executions; count++) { - if(show_clock) clock_gettime(CLOCK_REALTIME, &tp_before); + if (show_clock) + clock_gettime(CLOCK_REALTIME, &tp_before); privacy_guard_dlp_check_leak("fakehost.net", packet_to_send, strlen(packet_to_send)); - if(show_clock) clock_gettime(CLOCK_REALTIME, &tp_after); - if(show_clock) interval[count] = (tp_after.tv_sec - tp_before.tv_sec) * 1000000000 + tp_after.tv_nsec - tp_before.tv_nsec; + if (show_clock) clock_gettime(CLOCK_REALTIME, &tp_after); + if (show_clock) interval[count] = (tp_after.tv_sec - tp_before.tv_sec) * 1000000000 + tp_after.tv_nsec - tp_before.tv_nsec; } + free(packet_to_send); + __finish_test(); } @@ -417,7 +420,7 @@ int main(int argc, char *argv[]) char *p; n_iterations = strtol(argv[idx+1], &p, 10); - if(n_iterations > 5000) { + if (n_iterations > 5000) { printf("Not allow to execute more than 5000 tests\n"); return -1; } @@ -433,7 +436,7 @@ int main(int argc, char *argv[]) char *p; payload_multiply = strtol(argv[idx+1], &p, 10); - if(payload_multiply > 10) { + if (payload_multiply > 10) { printf("Invalid value for -m parameter\n"); return -1; } @@ -449,7 +452,7 @@ int main(int argc, char *argv[]) char *p; n_rules = strtol(argv[idx+1], &p, 10); - if(n_rules > 6) { + if (n_rules > 6) { printf("Not allow to execute more than 6 rules\n"); return -1; } @@ -475,7 +478,7 @@ int main(int argc, char *argv[]) __change_color_to_origin(); if (show_clock) - for (idx=0; idx < n_iterations; idx++) + for (idx = 0; idx < n_iterations; idx++) printf("req %03d:\t%ld\tns\n", idx, interval[idx]); return 0; diff --git a/test/tc-dlp.c b/test/tc-dlp.c index 4629bb1..6970ee4 100644 --- a/test/tc-dlp.c +++ b/test/tc-dlp.c @@ -95,8 +95,6 @@ static const char* __get_result_string(int ret) } else { return "PRIV_GUARD_ERROR_UNKNOWN"; } - - return "FAIL"; } static void __check_result_error_code(int expected, int actual, int line) @@ -206,10 +204,10 @@ static void __test_string_match() printf("Search match: "); unsigned int i = 0; - for (i = 0; i < (sizeof (search_match) / sizeof (const char *)); i++) { - printf("%s ", search_match[i]); - } - printf("\n"); + for (i = 0; i < (sizeof(search_match) / sizeof(const char *)); i++) { + printf("%s ", search_match[i]); + } + printf("\n"); int res = 0; ac_match *match; @@ -284,7 +282,8 @@ static void __test_string_match() ///////////////////////////////////////////////////////////////////////// // Test Add Pattern -static void __test_privacy_guard_client_add_custom_pattern() { +static void __test_privacy_guard_client_add_custom_pattern() +{ __start_test(__FUNCTION__); @@ -301,13 +300,15 @@ static void __test_privacy_guard_client_add_custom_pattern() { ///////////////////////////////////////////////////////////////////////// // Test for each pattern -static bool __dlp_foreach_pattern(int id, const char *pattern, const char *name, const char *description, PgDlpPatternType type, const char *category, bool undeletable, int leaks_count, void *user_data) { +static bool __dlp_foreach_pattern(int id, const char *pattern, const char *name, const char *description, PgDlpPatternType type, const char *category, bool undeletable, int leaks_count, void *user_data) +{ printf(" - Pattern: id=%d, %s %s %s\n", id, name, description, pattern); return true; } -static void __test_privacy_guard_client_foreach_dlp_patterns() { +static void __test_privacy_guard_client_foreach_dlp_patterns() +{ __start_test(__FUNCTION__); diff --git a/test/tc-privacy-guard.c b/test/tc-privacy-guard.c index ada4df5..862b38f 100644 --- a/test/tc-privacy-guard.c +++ b/test/tc-privacy-guard.c @@ -142,8 +142,6 @@ static const char* __get_result_string(int ret) } else { return "PRIV_GUARD_ERROR_UNKNOWN"; } - - return "FAIL"; } static const char *__get_bool_string(const bool result)