PERFORCE change 129236 for review

Zhouyi ZHOU zhouzhouyi at FreeBSD.org
Mon Nov 19 00:32:25 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=129236

Change 129236 by zhouzhouyi at 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 <zhouzhouyi at FreeBSD.org> 
- * Pawel Jakub Dawidek <pjd at FreeBSD.org>
+ * Copyright (c) 2006-2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * 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 <sys/ioccom.h>
 #include <err.h>
@@ -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 <zhouzhouyi at FreeBSD.org> 
- * Pawel Jakub Dawidek <pjd at FreeBSD.org>
  * 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 <security/mac/mac_framework.h>
 
 #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);


More information about the p4-projects mailing list