From owner-p4-projects@FreeBSD.ORG Sun Aug 10 15:43:25 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C3763106567E; Sun, 10 Aug 2008 15:43:25 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8748C106567A for ; Sun, 10 Aug 2008 15:43:25 +0000 (UTC) (envelope-from snagg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7D4E68FC23 for ; Sun, 10 Aug 2008 15:43:25 +0000 (UTC) (envelope-from snagg@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7AFhPr8017589 for ; Sun, 10 Aug 2008 15:43:25 GMT (envelope-from snagg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7AFhPnn017587 for perforce@freebsd.org; Sun, 10 Aug 2008 15:43:25 GMT (envelope-from snagg@FreeBSD.org) Date: Sun, 10 Aug 2008 15:43:25 GMT Message-Id: <200808101543.m7AFhPnn017587@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to snagg@FreeBSD.org using -f From: Vincenzo Iozzo To: Perforce Change Reviews Cc: Subject: PERFORCE change 147085 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2008 15:43:26 -0000 http://perforce.freebsd.org/chv.cgi?CH=147085 Change 147085 by snagg@snagg_macosx on 2008/08/10 15:42:31 Added tests for socket(2), bind(2) and connect(2). Bug fixes in various events, added check_sock to test struct sockaddr_in. Affected files ... .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.c#12 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.h#10 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_bind.c#1 add .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_close.c#4 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_connect.c#1 add .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_fork.c#3 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_kill.c#4 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_open.c#8 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_pipe.c#2 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_rename.c#3 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setauid.c#3 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setgid.c#6 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setresuid.c#3 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setuid.c#6 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_socket.c#1 add .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_stat.c#2 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_symlink.c#3 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_sysctl.c#2 edit .. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_waitpid.c#3 edit Differences ... ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.c#12 (text+ko) ==== @@ -244,6 +244,18 @@ return (0); } + +/* + * Check a sockaddr_in struct + */ +int check_sock(au_socketinet32_t s , struct sockaddr_in a) +{ + if( s.family == a.sin_family && s.port == a.sin_port && + s.addr == a.sin_addr.s_addr) + return (1); + + return (0); +} /* * Check the return value of a bsm-token ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.h#10 (text+ko) ==== @@ -31,12 +31,15 @@ #include #include #include +#include #include #include #include +#include + #include #include #include @@ -121,6 +124,7 @@ char get_c(char *string); FILE *init_log(pid_t pid); void report_error(tokenstr_t tok, FILE *f); +void report_error_string(char *str, FILE *f); int check_exit(au_exit_t ex, int val); int check_text(au_text_t text, char *val); int check_ret(au_ret32_t ret, int r, char *val); @@ -131,3 +135,4 @@ int check_ext_priv(au_proc32_t pr, struct priv p); int check_priv_child(au_proc32ex_t pr, struct priv p); int check_attr_path(au_attr32_t attr, char *path); +int check_sock(au_socketinet32_t s , struct sockaddr_in a); ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_close.c#4 (text+ko) ==== @@ -192,11 +192,11 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_ATTR)) report_error_string("Missing Attribute token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; if(tmp->next != NULL) ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_fork.c#3 (text+ko) ==== @@ -159,9 +159,9 @@ to_parse = WAITING; if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; if(tmp->next != NULL) ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_kill.c#4 (text+ko) ==== @@ -241,11 +241,11 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_PROCESS)) report_error_string("Missing Process token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 2) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 2) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; arg_counter = 0; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_open.c#8 (text+ko) ==== @@ -211,15 +211,15 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_ATTR)) report_error_string("Missing Attribute token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || tmp->arg3 && arg_counter != 2 || !tmp->arg3 && arg_counter != 1) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH)) report_error_string("Missing Path token", f); control_flag = 0; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_pipe.c#2 (text+ko) ==== @@ -164,9 +164,9 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 2) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 2) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; if(tmp->next != NULL) ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_rename.c#3 (text+ko) ==== @@ -208,11 +208,11 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_ATTR)) report_error_string("Missing Attribute token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH) || path_counter != 2) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH) || path_counter != 2) report_error_string("Missing Path token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; path_counter = 0; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setauid.c#3 (text+ko) ==== @@ -182,9 +182,9 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setgid.c#6 (text+ko) ==== @@ -181,9 +181,9 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; if(tmp->next != NULL) ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setresuid.c#3 (text+ko) ==== @@ -189,9 +189,9 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 3) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 3) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; arg_counter = 0; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setuid.c#6 (text+ko) ==== @@ -179,9 +179,9 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; if(tmp->next != NULL) ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_stat.c#2 (text+ko) ==== @@ -164,11 +164,11 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_ATTR)) report_error_string("Missing Attribute token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH)) report_error_string("Missing Path token", f); control_flag = 0; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_symlink.c#3 (text+ko) ==== @@ -193,11 +193,11 @@ to_parse = WAITING; if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_TEXT)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_TEXT)) report_error_string("Missing Text token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_PATH)) report_error_string("Missing Path token", f); control_flag = 0; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_sysctl.c#2 (text+ko) ==== @@ -179,11 +179,12 @@ to_parse = WAITING; if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 2) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG) || arg_counter != 2) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0; + arg_counter = 0; if(tmp->next != NULL) tmp = tmp->next; break; ==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_waitpid.c#3 (text+ko) ==== @@ -161,9 +161,9 @@ to_parse = WAITING; if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_SUBJECT)) report_error_string("Missing Subject token", f); - else if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) + if (!TOKEN_FLAG_ISSET(control_flag, TOKEN_ARG)) report_error_string("Missing Argument token", f); - else if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) + if(!TOKEN_FLAG_ISSET(control_flag, TOKEN_RETURN)) report_error_string("Missing Return token", f); control_flag = 0;