PERFORCE change 36681 for review

Chris Vance cvance at FreeBSD.org
Fri Aug 22 10:00:56 PDT 2003


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

Change 36681 by cvance at cvance_osx_laptop on 2003/08/22 10:00:48

	Insert calls to the MAC framework to initialize/destroy cred labels

Affected files ...

.. //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_prot.c#2 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin/apsl/xnu/bsd/kern/kern_prot.c#2 (text+ko) ====

@@ -72,6 +72,7 @@
 #include <sys/timeb.h>
 #include <sys/times.h>
 #include <sys/malloc.h>
+#include <sys/mac.h>
 
 #include <sys/mount.h>
 #include <mach/message.h>
@@ -659,6 +660,9 @@
 	MALLOC_ZONE(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK);
 	bzero((caddr_t)cr, sizeof(*cr));
 	cr->cr_ref = 1;
+#ifdef MAC
+	mac_init_cred(cr);
+#endif
 	return (cr);
 }
 
@@ -674,8 +678,12 @@
 	if (cr == NOCRED || cr == FSCRED)
 		panic("crfree");
 #endif
-	if (--cr->cr_ref == 0)
+	if (--cr->cr_ref == 0) {
+#ifdef MAC
+		mac_destroy_cred(cr);
+#endif
 		FREE_ZONE((caddr_t)cr, sizeof *cr, M_CRED);
+	}
 }
 
 /*


More information about the p4-projects mailing list