PERFORCE change 69740 for review
Wayne Salamon
wsalamon at FreeBSD.org
Wed Jan 26 01:06:58 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=69740
Change 69740 by wsalamon at rickenbacker on 2005/01/26 01:06:57
Update the audit file test programs to match the include paths, etc.
Affected files ...
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tchroot.c#2 edit
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tdir.c#2 edit
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfileaccess.c#2 edit
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfilecreate.c#2 edit
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfileioctl.c#2 edit
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfilemodify.c#2 edit
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tmmap.c#2 edit
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tsharedfile.c#2 edit
Differences ...
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tchroot.c#2 (text+ko) ====
@@ -25,13 +25,13 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
+#include <dirent.h>
#include <fcntl.h>
+#include <bsm/audit.h>
+#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/audit.h>
-#include <dirent.h>
-#include <audittest.h>
/*
* Test the auditing of of path/vnode information when using a chroot'd
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tdir.c#2 (text+ko) ====
@@ -25,13 +25,13 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
+#include <dirent.h>
#include <fcntl.h>
-#include <dirent.h>
+#include <bsm/audit.h>
+#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/audit.h>
-#include <audittest.h>
/*
* Test the auditing of some of the dir-related system calls.
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfileaccess.c#2 (text+ko) ====
@@ -25,15 +25,15 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
#include <fcntl.h>
+#include <bsm/audit.h>
+#include <bsm/audit_record.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/attr.h>
-#include <sys/audit.h>
#include <sys/unistd.h>
-#include <sys/bsm_token.h>
-#include <audittest.h>
/*
* Test the auditing of some of the file-related system calls.
@@ -47,7 +47,6 @@
int ret;
int temp_fd;
struct stat tstat;
- struct attrlist alist;
char tempname[32];
char buf[128];
fhandle_t fh;
@@ -69,19 +68,6 @@
/* Generate a failure AUE_ACCESS record */
access("ANonExisteNtFiLeNaME", F_OK);
- /* Generate a success AUE_GETATTRLIST record */
- bzero((void *)&alist, sizeof(alist));
- alist.bitmapcount = ATTR_BIT_MAP_COUNT;
- /* getattrlist() is not completely implemented. The alist.fileattr
- * field should be set as below, but that will generate a failure.
- * So we fake it for now.
- */
- /* alist.fileattr = ATTR_FILE_VALIDMASK; */
- alist.fileattr = 1;
- if (getattrlist(tempname, &alist, buf, 128, FSOPT_NOFOLLOW))
- AUT_PERROR("getattrlist()");
- aut_assert(AUE_GETATTRLIST);
-
/* Generate a success AUE_GETFH record */
if (getfh(tempname, &fh))
AUT_PERROR("getfh()");
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfilecreate.c#2 (text+ko) ====
@@ -25,13 +25,13 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
#include <fcntl.h>
+#include <bsm/audit.h>
+#include <bsm/audit_record.h>
+#include <sys/stat.h>
#include <sys/syscall.h>
-#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/audit.h>
-#include <sys/bsm_token.h>
-#include <audittest.h>
/*
* Test the auditing of some of the file-related system calls.
@@ -48,10 +48,21 @@
char tempname2[32];
char tempname3[32];
char tempname4[32];
+ char *tempname;
AUT_INIT();
/* Create a temporary file */
+ /* Should create a AUE_OPEN_WC record (no vnode attr info) */
+ strcpy(tempname1, "tempName1.XXXX");
+ tempname = mktemp(tempname1);
+ temp_fd = open(tempname, O_WRONLY | O_CREAT, 0x666);
+ if(temp_fd < 0) {
+ AUT_PERROR("temp file open/create");
+ }
+ aut_assert(AUE_OPEN_WC);
+
+ /* Create a temporary file */
/* Should create a AUE_OPEN_RWC record (no vnode attr info) */
strcpy(tempname1, "tempName1.XXXX");
if ((temp_fd = mkstemp(tempname1)) < 0) {
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfileioctl.c#2 (text+ko) ====
@@ -25,10 +25,10 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
+#include <bsm/audit.h>
+#include <sys/filio.h>
#include <sys/syscall.h>
-#include <sys/audit.h>
-#include <sys/filio.h>
-#include <audittest.h>
/*
* Test the auditing of some of the file ioctl system calls.
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfilemodify.c#2 (text+ko) ====
@@ -25,14 +25,13 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
#include <fcntl.h>
+#include <bsm/audit.h>
+#include <bsm/audit_record.h>
+#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/attr.h>
-#include <sys/audit.h>
-#include <sys/bsm_token.h>
-#include <audittest.h>
/*
* Test the auditing of some of the file-related system calls.
@@ -48,7 +47,6 @@
struct timeval mytime;
char tempname[32];
char tempname2[32];
- struct attrlist alist;
char buf[128];
struct flock tlock;
@@ -66,6 +64,11 @@
AUT_PERROR("chmod()");
aut_assert(AUE_CHMOD);
+ /* The next call should generate a AUE_LCHMOD audit record */
+ if ((lchmod(tempname, S_IRWXU)) < 0)
+ AUT_PERROR("lchmod()");
+ aut_assert(AUE_LCHMOD);
+
/* The next call should generate a AUE_FCHMOD audit record */
if ((fchmod(temp_fd, S_IRWXU|S_IRWXG|S_IRWXO)) < 0)
AUT_PERROR("fchmod()");
@@ -76,6 +79,11 @@
AUT_PERROR("chown()");
aut_assert(AUE_CHOWN);
+ /* The next call should generate a AUE_LCHOWN audit record */
+ if ((lchown(tempname, 9, 9)) < 0)
+ AUT_PERROR("lchown()");
+ aut_assert(AUE_LCHOWN);
+
/* The next call should generate a AUE_FCHOWN audit record */
if ((fchown(temp_fd, 0, 0)) < 0)
AUT_PERROR("fchown()");
@@ -97,6 +105,11 @@
AUT_PERROR("chflags()");
aut_assert(AUE_CHFLAGS);
+ /* Generate a AUE_LCHFLAGS audit record */
+ if ((lchflags(tempname, UF_NODUMP)) < 0)
+ AUT_PERROR("lchflags()");
+ aut_assert(AUE_LCHFLAGS);
+
/* Generate a AUE_TRUNCATE audit record */
if ((truncate(tempname, 0)) < 0)
AUT_PERROR("truncate()");
@@ -142,20 +155,6 @@
AUT_PERROR("temp file two creation");
exit (-1);
}
- bzero((void *)buf, 128);
- bzero((void *)&alist, sizeof(alist));
- alist.bitmapcount = ATTR_BIT_MAP_COUNT;
- alist.fileattr = ATTR_FILE_VALIDMASK;
- getattrlist(tempname2, &alist, (void *)buf, 128, FSOPT_NOFOLLOW);
- /* Generate a success AUE_SETATTRLIST audit record */
- alist.fileattr = ATTR_FILE_SETMASK;
- if (setattrlist(tempname2, &alist, (void *)buf, 128, FSOPT_NOFOLLOW))
- AUT_PERROR("setattrlist()");
-
- /* Generate a success AUE_EXCHANGEDATA record */
- if (exchangedata(tempname, tempname2, FSOPT_NOFOLLOW))
- AUT_PERROR("exchangedata()");
- aut_assert(AUE_EXCHANGEDATA);
/* Generate a failure AUE_UNDELETE record, but with path and vnode
* attr tokens.
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tmmap.c#2 (text+ko) ====
@@ -25,11 +25,11 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
#include <fcntl.h>
+#include <bsm/audit.h>
+#include <sys/mman.h>
#include <sys/syscall.h>
-#include <sys/mman.h>
-#include <sys/audit.h>
-#include <audittest.h>
/*
* Test the auditing of some of the mmap-related system calls.
@@ -83,8 +83,8 @@
aut_assert(AUE_MPROTECT);
/* Create a AUE_MINHERIT record */
- if (minherit(maddr, MAPLEN, VM_INHERIT_SHARE) < 0) {
- AUT_PERROR("minherit(.., .., VM_INHERIT_SHARE)");
+ if (minherit(maddr, MAPLEN, INHERIT_SHARE) < 0) {
+ AUT_PERROR("minherit(.., .., INHERIT_SHARE)");
}
aut_assert(AUE_MINHERIT);
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tsharedfile.c#2 (text+ko) ====
@@ -25,11 +25,10 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <audittest.h>
+#include <bsm/audit.h>
+#include <bsm/audit_record.h>
#include <sys/syscall.h>
-#include <sys/audit.h>
-#include <sys/bsm_token.h>
-#include <mach/shared_memory_server.h>
-#include <audittest.h>
/*
* Test the auditing of some of the shared file mapping system calls.
@@ -44,7 +43,6 @@
char tempname[32];
char buf[MAPSIZE];
int flags;
- sf_mapping_t sf_map;
AUT_INIT();
@@ -58,6 +56,7 @@
AUT_PERROR("write to temp file");
}
+#if 0
/* Generate a AUE_LOADSHFILE audit record. The call will fail
* (which is what we want) but we will get a complete audit record.
*/
@@ -83,6 +82,7 @@
if ((new_system_shared_regions()) < 0)
AUT_PERROR("new_system_shared_regions()");
aut_assert(AUE_NEWSYSTEMSHREG);
+#endif
unlink(tempname);
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