From owner-p4-projects@FreeBSD.ORG Wed Jan 26 01:06:59 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4A4E416A4D0; Wed, 26 Jan 2005 01:06:59 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 223DE16A4CE for ; Wed, 26 Jan 2005 01:06:59 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C549543D2F for ; Wed, 26 Jan 2005 01:06:58 +0000 (GMT) (envelope-from wsalamon@computer.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j0Q16wsp096525 for ; Wed, 26 Jan 2005 01:06:58 GMT (envelope-from wsalamon@computer.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j0Q16wju096522 for perforce@freebsd.org; Wed, 26 Jan 2005 01:06:58 GMT (envelope-from wsalamon@computer.org) Date: Wed, 26 Jan 2005 01:06:58 GMT Message-Id: <200501260106.j0Q16wju096522@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to wsalamon@computer.org using -f From: Wayne Salamon To: Perforce Change Reviews Subject: PERFORCE change 69740 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2005 01:07:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=69740 Change 69740 by wsalamon@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 +#include #include +#include +#include #include #include -#include -#include -#include -#include /* * 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 +#include #include -#include +#include +#include #include #include -#include -#include -#include /* * 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 #include +#include +#include +#include +#include #include #include -#include -#include -#include #include -#include -#include /* * 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 #include +#include +#include +#include #include -#include #include -#include -#include -#include /* * 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 +#include +#include #include -#include -#include -#include /* * 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 #include +#include +#include +#include #include #include -#include -#include -#include -#include -#include /* * 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 #include +#include +#include #include -#include -#include -#include /* * 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 +#include +#include #include -#include -#include -#include -#include /* * 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);