On 04/19/2013 09:20 AM, Richard Haines wrote:
checkseapp works fine when consolidating entries, however if they match
exactly then it exits with (using my example):
Error: Duplicate line detected in file: stdout
Lines 6 and 12 match!

Should checkseapp just delete the duplicate entry and carry on.

I think so.  Bill?

Also if I use the -v option checkseapp core dumps whenever it gets
a duplicate entry or even when consolidating an entry. Dies in both
cases with:
Info: Existing entry found!
Segmentation fault (core dumped)

Seems to be due to invalid log_info() calls passing enum values where strings are expected. Possible patch attached, also marks log_msg to detect these kinds of mismatches.


# Example seapp_contexts file:
isSystemServer=true domain=system
user=system domain=system_app type=system_data_file
user=bluetooth domain=bluetooth type=bluetooth_data_file
user=nfc domain=nfc type=nfc_data_file
user=radio domain=radio type=radio_data_file
user=_app domain=untrusted_app type=app_data_file levelFrom=app
user=_app seinfo=platform domain=platform_app type=platform_app_data_file
user=_app seinfo=shared domain=shared_app type=platform_app_data_file
user=_app seinfo=media domain=media_app type=platform_app_data_file
user=_app seinfo=release domain=release_app type=platform_app_data_file
user=_isolated domain=isolated_app
user=_app domain=untrusted_app type=app_data_file levelFrom=app

Richard


--
This message was distributed to subscribers of the seandroid-list mailing list.
If you no longer wish to subscribe, send mail to majord...@tycho.nsa.gov with
the words "unsubscribe seandroid-list" without quotes as the message.


diff --git a/tools/check_seapp.c b/tools/check_seapp.c
index 482d060..bae4601 100644
--- a/tools/check_seapp.c
+++ b/tools/check_seapp.c
@@ -189,7 +189,11 @@ static line_order_list *list_tail = NULL;
  * @param fmt
  * 	The printf style formatter to use, such as "%d"
  */
-static void log_msg(FILE *out, const char *prefix, const char *fmt, ...) {
+static void
+__attribute__ ((format(printf, 3, 4)))
+log_msg(FILE *out, const char *prefix, const char *fmt, ...) 
+
+{
 	fprintf(out, "%s", prefix);
 	va_list args;
 	va_start(args, fmt);
@@ -395,12 +399,12 @@ static map_match rule_map_cmp(rule_map *rmA, rule_map *rmB) {
 			}
 
 			if (input_mode) {
-				log_info("Matched input lines: type=%s name=%s data=%s dir=%d\n", mA->type, mA->name, mA->data, mA->dir);
+				log_info("Matched input lines: name=%s data=%s\n", mA->name, mA->data);
 				num_of_matched_inputs++;
 			}
 
 			/* Match found, move on */
-			log_info("Matched lines: type=%s name=%s data=%s dir=%d\n", mA->type, mA->name, mA->data, mA->dir);
+			log_info("Matched lines: name=%s data=%s\n", mA->name, mA->data);
 			matches++;
 			break;
 		}

Reply via email to