Date: Sun, 10 Aug 2008 15:43:25 GMT From: Vincenzo Iozzo <snagg@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 147085 for review Message-ID: <200808101543.m7AFhPnn017587@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/ipc.h> #include <sys/shm.h> #include <sys/stat.h> +#include <sys/sysctl.h> #include <bsm/libbsm.h> #include <bsm/audit.h> #include <security/audit/audit_ioctl.h> +#include <netinet/in.h> + #include <err.h> #include <fcntl.h> #include <poll.h> @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808101543.m7AFhPnn017587>