From owner-p4-projects@FreeBSD.ORG Mon Nov 19 08:32:25 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 76F8A16A419; Mon, 19 Nov 2007 08:32: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 D773E16A46D for ; Mon, 19 Nov 2007 08:32:24 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C4E9613C4C4 for ; Mon, 19 Nov 2007 08:32:24 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lAJ8WO0K054088 for ; Mon, 19 Nov 2007 08:32:24 GMT (envelope-from zhouzhouyi@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lAJ8WO44054085 for perforce@freebsd.org; Mon, 19 Nov 2007 08:32:24 GMT (envelope-from zhouzhouyi@FreeBSD.org) Date: Mon, 19 Nov 2007 08:32:24 GMT Message-Id: <200711190832.lAJ8WO44054085@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zhouzhouyi@FreeBSD.org using -f From: Zhouyi ZHOU To: Perforce Change Reviews Cc: Subject: PERFORCE change 129236 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: Mon, 19 Nov 2007 08:32:25 -0000 http://perforce.freebsd.org/chv.cgi?CH=129236 Change 129236 by zhouzhouyi@zhouzhouyi_mactest on 2007/11/19 08:31:57 edit for good style :) Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#14 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.conf#2 delete .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.h#5 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/sys/security/mac_test/mac_test_log.c#7 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/sys/security/mac_test/mac_test_private.h#8 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#14 (text+ko) ==== @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006-2007 Zhouyi Zhou - * Pawel Jakub Dawidek + * Copyright (c) 2006-2007 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/tools/regression/mactest/mactest.c,v 1.1 2007/01/17 01:42:07 zhouzhouyi Exp $ + * $FreeBSD$ */ #include #include @@ -104,8 +104,6 @@ int sd_args[MAX_ARGS]; }; -int logfd; - static struct syscall_desc syscalls[] = { { "kill", ACTION_KILL, { TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } }, { "system", ACTION_SYSTEM, { TYPE_NONE }}, @@ -611,7 +609,10 @@ } } - logfd = open("/dev/mactest",O_RDWR); + logfd = open(LOGDEV, O_RDWR); + +/*Begin to log + */ ioctl(logfd, BEGINLOG, NULL); for (;;) { ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.h#5 (text+ko) ==== @@ -1,6 +1,5 @@ /*- * Copyright (c) 2006-2007 Zhouyi Zhou - * Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,24 +23,37 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/tools/regression/mactest/mactest.h,v 1.1 2007/06/26 01:42:07 zhouzhouyi Exp $ + * $FreeBSD$ */ #ifndef _REGRESSION_MAC_TEST__H #define _REGRESSION_MAC_TEST__H +/* + *The element record the access modes or flags + *of one mactest log/configure record + */ + struct modes_or_flags { struct modes_or_flags * next; struct modes_or_flags * prev; char * modflagname; }; +/* + *The element record one of the mandatory access control labels + *of one mactest log/configure record + */ struct labelstrings { struct labelstrings * next; struct labelstrings * prev; char * labelstring; }; +/* + * one mactest log/configure record + */ + struct mactestlog_record { struct mactestlog_record * next; @@ -52,12 +64,23 @@ struct labelstrings * labelstrings; }; -FILE *inputfile; -extern struct mactestlog_record *mactestlog_record_chain; +/*Sub routine to match the mactest record between the configuration file + *and the file LOGPATH + */ + int modes_or_flags_compare(struct modes_or_flags * mf_conf, struct modes_or_flags *mf_log); int label_compare(char *conf, char *log); int labelstrings_compare(struct labelstrings *ls_conf, struct labelstrings *ls_log); void machookmatch(const char *macconf_file, pid_t pid); -#define BEGINLOG _IO('m',1) + + +FILE *inputfile; +/*The parsed record chain for mactest records */ +extern struct mactestlog_record *mactestlog_record_chain; + +#define BEGINLOG _IO('m',1) +#define LOGDEV "/dev/mactest" +int logfd; + #endif /* !_REGRESSION_MAC_TEST__H */ ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/sys/security/mac_test/mac_test_log.c#7 (text+ko) ==== @@ -112,7 +112,7 @@ /* copy from kern/vfs_extattr.c */ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_SYSSPACE, - "/var/log/mactest", curthread); + MAC_TEST_LOG_PATH, curthread); flags = O_CREAT|O_TRUNC|FWRITE; error = vn_open(&nd, &flags, S_IRUSR| S_IWUSR, NULL); ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/sys/security/mac_test/mac_test_private.h#8 (text+ko) ==== @@ -40,6 +40,7 @@ #include #define MAC_TEST_LOG_FILENAME "mactest" +#define MAC_TEST_LOG_PATH "/var/log/mactest" void mac_test_log_submit(void *record, u_int record_len);