PERFORCE change 108515 for review

Todd Miller millert at FreeBSD.org
Thu Oct 26 19:24:39 UTC 2006


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

Change 108515 by millert at millert_macbook on 2006/10/26 19:23:45

	Don't copy unlabeled objects.  Fix some cut and paste errors.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/policies/extattr_test/mac_extattr_test.c#7 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/policies/extattr_test/mac_extattr_test.c#7 (text+ko) ====

@@ -44,7 +44,7 @@
 
 int XA_SIZENAME = XA_FILLLEN;
 
-static mac_policy_handle_t ipctrace_handle;
+static mac_policy_handle_t extattr_test_handle;
 
 static int	extattr_test_slot;
 #define SLOT(l) ((struct xa_label *)LABEL_TO_SLOT((l), extattr_test_slot).l_ptr)  
@@ -194,6 +194,8 @@
 extattr_test_label_copy(struct label *src, struct label *dst)
 {
 	XA_TRACE;
+	if (SLOT(src) == NULL || SLOT(dst) == NULL)
+		return;
 	XA_VALID(src, "copy src");
 	XA_VALID(dst, "copy dst");
 	bcopy(SLOT(src), SLOT(dst), XA_SIZE);
@@ -243,6 +245,7 @@
 	/*XA_TRACE;*/
 	if (!mac_extattr_test_enabled)
 		return(0);
+	XA_VALID(vlabel, "associate");
 	error = mac_vnop_getxattr(vp, MAC_EXTATTR_XATTR_NAME,
 	    (char *)SLOT(vlabel), XA_SIZE, &buflen);
 	if (error != 0) {
@@ -300,7 +303,7 @@
 	XA_TRACE;
 	if (!mac_extattr_test_enabled)
 		return(0);
-	XA_VALID(vlabel, "vnode_label_associate");
+	XA_VALID(vlabel, "vnode_notify_create");
 	xa_filllabel(SLOT(vlabel));
 	error = mac_vnop_setxattr(vp, MAC_EXTATTR_XATTR_NAME,
 	    (char *)SLOT(vlabel), XA_SIZE);
@@ -316,7 +319,7 @@
 	XA_TRACE;
 	if (!mac_extattr_test_enabled)
 		return(0);
-	XA_VALID(vlabel, "vnode_label_update");
+	XA_VALID(vlabel, "vnode_label_store");
 	/*
 	 * Check the label.  If it's good, use it, otherwise return an error.
 	 */
@@ -387,6 +390,6 @@
 	.mpo_vnode_check_setextattr	= extattr_test_vnode_check_setextattr,
 };
 
-MAC_POLICY_SET(ipctrace_handle, &mac_extattr_test_ops, extattr_test,
+MAC_POLICY_SET(extattr_test_handle, &mac_extattr_test_ops, extattr_test,
 	       POLICY_DESC, labelnamespaces, MAC_EXTATTR_LABEL_COUNT,
-	       &extattr_test_slot, 0, 0);
+	       &extattr_test_slot, MPC_LOADTIME_FLAG_UNLOADOK, 0);


More information about the trustedbsd-cvs mailing list