PERFORCE change 82115 for review
Wayne Salamon
wsalamon at FreeBSD.org
Wed Aug 17 11:56:04 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=82115
Change 82115 by wsalamon at gretsch on 2005/08/17 11:55:19
Update the test program to use STAT events for the n?stat() calls.
Affected files ...
.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfileaccess.c#5 edit
Differences ...
==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tfileaccess.c#5 (text+ko) ====
@@ -44,8 +44,10 @@
int ret;
int temp_fd;
+ int ntemp_fd;
struct stat tstat;
char tempname[32];
+ char ntempname[32];
char buf[128];
fhandle_t fh;
@@ -81,25 +83,32 @@
AUT_PERROR("lstat()");
aut_assert(AUE_LSTAT);
- /* Generate a AUE_NSTAT audit record */
- if ((nstat(tempname, &tstat)) < 0)
- AUT_PERROR("nstat()");
- aut_assert(AUE_NSTAT);
-
- /* Generate a AUE_NLSTAT audit record */
- if ((nlstat(tempname, &tstat)) < 0)
- AUT_PERROR("nlstat()");
- aut_assert(AUE_NLSTAT);
-
/* Generate a success AUE_FSTAT record */
if ((fstat(temp_fd, &tstat)) < 0)
AUT_PERROR("fstat()");
aut_assert(AUE_FSTAT);
- /* Generate a success AUE_NFSTAT record */
- if ((nfstat(temp_fd, &tstat)) < 0)
+ /* Create a temporary file for the nstat ops */
+ strcpy(ntempname, "nstattemp.XXXX");
+ if ((ntemp_fd = mkstemp(ntempname)) < 0) {
+ AUT_PERROR("ntemp file creation");
+ exit (-1);
+ }
+
+ /* Generate a AUE_STAT audit record for nstat */
+ if ((nstat(ntempname, &tstat)) < 0)
+ AUT_PERROR("nstat()");
+ aut_assert(AUE_STAT);
+
+ /* Generate a AUE_LSTAT audit record for nlstat */
+ if ((nlstat(ntempname, &tstat)) < 0)
+ AUT_PERROR("nlstat()");
+ aut_assert(AUE_LSTAT);
+
+ /* Generate a success AUE_FSTAT record for nfstat */
+ if ((nfstat(ntemp_fd, &tstat)) < 0)
AUT_PERROR("nfstat()");
- aut_assert(AUE_NFSTAT);
+ aut_assert(AUE_FSTAT);
/* Generate a AUE_PATHCONF audit record */
if ((pathconf(tempname, _PC_NAME_MAX)) < 0)
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