PERFORCE change 78993 for review
Christian S.J. Peron
csjp at FreeBSD.org
Sun Jun 26 15:54:37 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=78993
Change 78993 by csjp at csjp_xor on 2005/06/26 15:54:08
Get rid of DEBUG printfs and switch over to the use of ktr instead.
This makes more sense and makes the code much more cleaner to read.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/security/mac_chkexec/mac_chkexec.c#9 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/security/mac_chkexec/mac_chkexec.c#9 (text+ko) ====
@@ -27,6 +27,7 @@
#include <sys/param.h>
#include <sys/acl.h>
#include <sys/conf.h>
+#include <sys/ktr.h>
#include <sys/kdb.h>
#include <sys/extattr.h>
#include <sys/kernel.h>
@@ -263,9 +264,7 @@
mtx_unlock(&vfc->btree_mtx);
mtx_unlock(&cache_mtx);
uma_zfree(cache_zone, vcp);
-#ifdef DEBUG
- printf("mac_chkexec_cache_vcsum: element collision\n");
-#endif
+ CTR0(KTR_MAC, "mac_chkexec_cache_vcsum: element collision");
return;
}
cache_vec_used++;
@@ -386,10 +385,9 @@
if (error)
return (error);
if (attrlen != sizeof(*vsum)) {
-#ifdef DEBUG
- printf("mac_chkexec_get_vcsum: invalid attribute size %d\n",
+ CTR1(KTR_MAC,
+ "mac_chkexec_get_vcsum: invalid attribute size %d",
attrlen);
-#endif
return (EPERM);
}
return (error);
@@ -574,9 +572,7 @@
return (0);
/* We are only interested in the execution of regular files */
if (vp->v_type != VREG) {
-#ifdef DEBUG
- printf("mac_chkexec_check: File is not VREG, skipping\n");
-#endif
+ CTR0(KTR_MAC, "mac_chkexec_check: File is not VREG, skipping");
return (0);
}
/*
@@ -586,9 +582,7 @@
*/
ha = mac_chkexec_get_algo();
if (ha == NULL) {
-#ifdef DEBUG
- printf("mac_chkexec_check: invalid checksum algorithm\n");
-#endif
+ CTR0(KTR_MAC, "mac_chkexec_check: invalid checksum algorithm");
return (EPERM);
}
/*
@@ -612,9 +606,8 @@
if (mac_chkexec_ignore_untagged)
return (0);
if (mac_chkexec_enforce) {
-#ifdef DEBUG
- printf("mac_chkexec: un-registered vnode while policy enforced\n");
-#endif
+ CTR0(KTR_MAC,
+ "mac_chkexec: un-registered vnode while policy enforced");
return (EPERM);
}
error = ha->crypto_hash(vp, cred, digest);
@@ -656,10 +649,8 @@
if (error && mac_chkexec_enforce)
return (error);
}
-#ifdef DEBUG
if (!match)
- printf("mac_chkexec: checksum mismatch, denying\n");
-#endif
+ CTR0(KTR_MAC, "mac_chkexec: checksum mismatch, denying");
return (!match ? EPERM : 0);
}
@@ -782,9 +773,8 @@
if (attrnamespace != MAC_CHKEXEC_ATTRN)
return (0);
if (mac_chkexec_enforce) {
-#ifdef DEBUG
- printf("mac_chkexec: can not setextattr on namespace while policy is loaded\n");
-#endif
+ CTR0(KTR_MAC, "mac_chkexec: can not setextattr on namespace while "
+ "policy is loaded");
return (EPERM);
}
return (0);
@@ -800,9 +790,8 @@
if (attrnamespace != MAC_CHKEXEC_ATTRN)
return (0);
if (mac_chkexec_enforce) {
-#ifdef DEBUG
- printf("mac_chkexec: can not delextattr on namespace while policy is loaded\n");
-#endif
+ CTR0(KTR_MAC, "mac_chkexec: can not delextattr on namespace "
+ "while policy is loaded");
return (EPERM);
}
return (0);
@@ -848,9 +837,7 @@
return (error);
ha = mac_chkexec_get_algo();
if (ha == NULL) {
-#ifdef DEBUG
- printf("mac_chkexec_check: invalid checksum algorithm\n");
-#endif
+ CTR0(KTR_MAC, "mac_chkexec_check: invalid checksum algorithm");
return (EPERM);
}
NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW,
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list