xref: /freebsd/tests/sys/audit/file-attribute-access.c (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1 /*-
2  * Copyright (c) 2018 Aniket Pandey
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * SUCH DAMAGE.
24  *
25  * $FreeBSD$
26  */
27 
28 #include <sys/param.h>
29 #include <sys/extattr.h>
30 #include <sys/mount.h>
31 #include <sys/stat.h>
32 #include <sys/syscall.h>
33 #include <sys/ucred.h>
34 
35 #include <atf-c.h>
36 #include <errno.h>
37 #include <fcntl.h>
38 #include <string.h>
39 #include <unistd.h>
40 
41 #include "utils.h"
42 
43 static struct pollfd fds[1];
44 static mode_t mode = 0777;
45 static pid_t pid;
46 static fhandle_t fht;
47 static int filedesc, fhdesc;
48 static char extregex[80];
49 static char buff[] = "ezio";
50 static struct stat statbuff;
51 static struct statfs statfsbuff;
52 static const char *auclass = "fa";
53 static const char *name = "authorname";
54 static const char *path = "fileforaudit";
55 static const char *errpath = "dirdoesnotexist/fileforaudit";
56 static const char *successreg = "fileforaudit.*return,success";
57 static const char *failurereg = "fileforaudit.*return,failure";
58 
59 
60 ATF_TC_WITH_CLEANUP(stat_success);
61 ATF_TC_HEAD(stat_success, tc)
62 {
63 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
64 					"stat(2) call");
65 }
66 
67 ATF_TC_BODY(stat_success, tc)
68 {
69 	/* File needs to exist to call stat(2) */
70 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
71 	FILE *pipefd = setup(fds, auclass);
72 	ATF_REQUIRE_EQ(0, stat(path, &statbuff));
73 	check_audit(fds, successreg, pipefd);
74 	close(filedesc);
75 }
76 
77 ATF_TC_CLEANUP(stat_success, tc)
78 {
79 	cleanup();
80 }
81 
82 
83 ATF_TC_WITH_CLEANUP(stat_failure);
84 ATF_TC_HEAD(stat_failure, tc)
85 {
86 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
87 					"stat(2) call");
88 }
89 
90 ATF_TC_BODY(stat_failure, tc)
91 {
92 	FILE *pipefd = setup(fds, auclass);
93 	/* Failure reason: file does not exist */
94 	ATF_REQUIRE_ERRNO(ENOENT, stat(errpath, &statbuff) == -1);
95 	check_audit(fds, failurereg, pipefd);
96 }
97 
98 ATF_TC_CLEANUP(stat_failure, tc)
99 {
100 	cleanup();
101 }
102 
103 
104 ATF_TC_WITH_CLEANUP(lstat_success);
105 ATF_TC_HEAD(lstat_success, tc)
106 {
107 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
108 					"lstat(2) call");
109 }
110 
111 ATF_TC_BODY(lstat_success, tc)
112 {
113 	/* Symbolic link needs to exist to call lstat(2) */
114 	ATF_REQUIRE_EQ(0, symlink("symlink", path));
115 	FILE *pipefd = setup(fds, auclass);
116 	ATF_REQUIRE_EQ(0, lstat(path, &statbuff));
117 	check_audit(fds, successreg, pipefd);
118 }
119 
120 ATF_TC_CLEANUP(lstat_success, tc)
121 {
122 	cleanup();
123 }
124 
125 
126 ATF_TC_WITH_CLEANUP(lstat_failure);
127 ATF_TC_HEAD(lstat_failure, tc)
128 {
129 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
130 					"lstat(2) call");
131 }
132 
133 ATF_TC_BODY(lstat_failure, tc)
134 {
135 	FILE *pipefd = setup(fds, auclass);
136 	/* Failure reason: symbolic link does not exist */
137 	ATF_REQUIRE_ERRNO(ENOENT, lstat(errpath, &statbuff) == -1);
138 	check_audit(fds, failurereg, pipefd);
139 }
140 
141 ATF_TC_CLEANUP(lstat_failure, tc)
142 {
143 	cleanup();
144 }
145 
146 
147 ATF_TC_WITH_CLEANUP(fstat_success);
148 ATF_TC_HEAD(fstat_success, tc)
149 {
150 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
151 					"fstat(2) call");
152 }
153 
154 ATF_TC_BODY(fstat_success, tc)
155 {
156 	/* File needs to exist to call fstat(2) */
157 	ATF_REQUIRE((filedesc = open(path, O_CREAT | O_RDWR, mode)) != -1);
158 	FILE *pipefd = setup(fds, auclass);
159 	ATF_REQUIRE_EQ(0, fstat(filedesc, &statbuff));
160 
161 	snprintf(extregex, sizeof(extregex),
162 		"fstat.*%jd.*return,success", (intmax_t)statbuff.st_ino);
163 	check_audit(fds, extregex, pipefd);
164 	close(filedesc);
165 }
166 
167 ATF_TC_CLEANUP(fstat_success, tc)
168 {
169 	cleanup();
170 }
171 
172 
173 ATF_TC_WITH_CLEANUP(fstat_failure);
174 ATF_TC_HEAD(fstat_failure, tc)
175 {
176 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
177 					"fstat(2) call");
178 }
179 
180 ATF_TC_BODY(fstat_failure, tc)
181 {
182 	FILE *pipefd = setup(fds, auclass);
183 	const char *regex = "fstat.*return,failure : Bad file descriptor";
184 	/* Failure reason: bad file descriptor */
185 	ATF_REQUIRE_ERRNO(EBADF, fstat(-1, &statbuff) == -1);
186 	check_audit(fds, regex, pipefd);
187 }
188 
189 ATF_TC_CLEANUP(fstat_failure, tc)
190 {
191 	cleanup();
192 }
193 
194 
195 ATF_TC_WITH_CLEANUP(fstatat_success);
196 ATF_TC_HEAD(fstatat_success, tc)
197 {
198 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
199 					"fstatat(2) call");
200 }
201 
202 ATF_TC_BODY(fstatat_success, tc)
203 {
204 	/* File or Symbolic link needs to exist to call lstat(2) */
205 	ATF_REQUIRE_EQ(0, symlink("symlink", path));
206 	FILE *pipefd = setup(fds, auclass);
207 	ATF_REQUIRE_EQ(0, fstatat(AT_FDCWD, path, &statbuff,
208 		AT_SYMLINK_NOFOLLOW));
209 	check_audit(fds, successreg, pipefd);
210 }
211 
212 ATF_TC_CLEANUP(fstatat_success, tc)
213 {
214 	cleanup();
215 }
216 
217 
218 ATF_TC_WITH_CLEANUP(fstatat_failure);
219 ATF_TC_HEAD(fstatat_failure, tc)
220 {
221 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
222 					"fstatat(2) call");
223 }
224 
225 ATF_TC_BODY(fstatat_failure, tc)
226 {
227 	FILE *pipefd = setup(fds, auclass);
228 	/* Failure reason: symbolic link does not exist */
229 	ATF_REQUIRE_ERRNO(ENOENT,
230 	    fstatat(AT_FDCWD, path, &statbuff, AT_SYMLINK_NOFOLLOW) == -1);
231 	check_audit(fds, failurereg, pipefd);
232 }
233 
234 ATF_TC_CLEANUP(fstatat_failure, tc)
235 {
236 	cleanup();
237 }
238 
239 
240 ATF_TC_WITH_CLEANUP(statfs_success);
241 ATF_TC_HEAD(statfs_success, tc)
242 {
243 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
244 					"statfs(2) call");
245 }
246 
247 ATF_TC_BODY(statfs_success, tc)
248 {
249 	/* File needs to exist to call statfs(2) */
250 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
251 	FILE *pipefd = setup(fds, auclass);
252 	ATF_REQUIRE_EQ(0, statfs(path, &statfsbuff));
253 	check_audit(fds, successreg, pipefd);
254 	close(filedesc);
255 }
256 
257 ATF_TC_CLEANUP(statfs_success, tc)
258 {
259 	cleanup();
260 }
261 
262 
263 ATF_TC_WITH_CLEANUP(statfs_failure);
264 ATF_TC_HEAD(statfs_failure, tc)
265 {
266 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
267 					"statfs(2) call");
268 }
269 
270 ATF_TC_BODY(statfs_failure, tc)
271 {
272 	FILE *pipefd = setup(fds, auclass);
273 	/* Failure reason: file does not exist */
274 	ATF_REQUIRE_ERRNO(ENOENT, statfs(errpath, &statfsbuff) == -1);
275 	check_audit(fds, failurereg, pipefd);
276 }
277 
278 ATF_TC_CLEANUP(statfs_failure, tc)
279 {
280 	cleanup();
281 }
282 
283 
284 ATF_TC_WITH_CLEANUP(fstatfs_success);
285 ATF_TC_HEAD(fstatfs_success, tc)
286 {
287 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
288 					"fstatfs(2) call");
289 }
290 
291 ATF_TC_BODY(fstatfs_success, tc)
292 {
293 	/* File needs to exist to call fstat(2) */
294 	ATF_REQUIRE((filedesc = open(path, O_CREAT | O_RDWR, mode)) != -1);
295 	/* Call stat(2) to store the Inode number of 'path' */
296 	ATF_REQUIRE_EQ(0, stat(path, &statbuff));
297 	FILE *pipefd = setup(fds, auclass);
298 	ATF_REQUIRE_EQ(0, fstatfs(filedesc, &statfsbuff));
299 
300 	snprintf(extregex, sizeof(extregex), "fstatfs.*%jd.*return,success",
301 			(intmax_t)statbuff.st_ino);
302 	check_audit(fds, extregex, pipefd);
303 	close(filedesc);
304 }
305 
306 ATF_TC_CLEANUP(fstatfs_success, tc)
307 {
308 	cleanup();
309 }
310 
311 
312 ATF_TC_WITH_CLEANUP(fstatfs_failure);
313 ATF_TC_HEAD(fstatfs_failure, tc)
314 {
315 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
316 					"fstatfs(2) call");
317 }
318 
319 ATF_TC_BODY(fstatfs_failure, tc)
320 {
321 	FILE *pipefd = setup(fds, auclass);
322 	const char *regex = "fstatfs.*return,failure : Bad file descriptor";
323 	/* Failure reason: bad file descriptor */
324 	ATF_REQUIRE_ERRNO(EBADF, fstatfs(-1, &statfsbuff) == -1);
325 	check_audit(fds, regex, pipefd);
326 }
327 
328 ATF_TC_CLEANUP(fstatfs_failure, tc)
329 {
330 	cleanup();
331 }
332 
333 
334 ATF_TC_WITH_CLEANUP(getfsstat_success);
335 ATF_TC_HEAD(getfsstat_success, tc)
336 {
337 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
338 					"getfsstat(2) call");
339 }
340 
341 ATF_TC_BODY(getfsstat_success, tc)
342 {
343 	pid = getpid();
344 	snprintf(extregex, sizeof(extregex), "getfsstat.*%d.*success", pid);
345 
346 	FILE *pipefd = setup(fds, auclass);
347 	ATF_REQUIRE(getfsstat(NULL, 0, MNT_NOWAIT) != -1);
348 	check_audit(fds, extregex, pipefd);
349 }
350 
351 ATF_TC_CLEANUP(getfsstat_success, tc)
352 {
353 	cleanup();
354 }
355 
356 
357 ATF_TC_WITH_CLEANUP(getfsstat_failure);
358 ATF_TC_HEAD(getfsstat_failure, tc)
359 {
360 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
361 					"getfsstat(2) call");
362 }
363 
364 ATF_TC_BODY(getfsstat_failure, tc)
365 {
366 	const char *regex = "getfsstat.*return,failure : Invalid argument";
367 	FILE *pipefd = setup(fds, auclass);
368 	/* Failure reason: Invalid value for mode */
369 	ATF_REQUIRE_ERRNO(EINVAL, getfsstat(NULL, 0, -1) == -1);
370 	check_audit(fds, regex, pipefd);
371 }
372 
373 ATF_TC_CLEANUP(getfsstat_failure, tc)
374 {
375 	cleanup();
376 }
377 
378 
379 ATF_TC_WITH_CLEANUP(lgetfh_success);
380 ATF_TC_HEAD(lgetfh_success, tc)
381 {
382 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
383 					"lgetfh(2) call");
384 }
385 
386 ATF_TC_BODY(lgetfh_success, tc)
387 {
388 	/* Symbolic link needs to exist to get a file-handle */
389 	ATF_REQUIRE_EQ(0, symlink("symlink", path));
390 	const char *regex = "lgetfh.*return,success";
391 	FILE *pipefd = setup(fds, "fa");
392 	ATF_REQUIRE_EQ(0, lgetfh(path, &fht));
393 	check_audit(fds, regex, pipefd);
394 }
395 
396 ATF_TC_CLEANUP(lgetfh_success, tc)
397 {
398 	cleanup();
399 }
400 
401 
402 ATF_TC_WITH_CLEANUP(lgetfh_failure);
403 ATF_TC_HEAD(lgetfh_failure, tc)
404 {
405 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
406 					"lgetfh(2) call");
407 }
408 
409 ATF_TC_BODY(lgetfh_failure, tc)
410 {
411 	const char *regex = "lgetfh.*return,failure";
412 	FILE *pipefd = setup(fds, "fa");
413 	/* Failure reason: symbolic link does not exist */
414 	ATF_REQUIRE_ERRNO(ENOENT, lgetfh(errpath, &fht) == -1);
415 	check_audit(fds, regex, pipefd);
416 }
417 
418 ATF_TC_CLEANUP(lgetfh_failure, tc)
419 {
420 	cleanup();
421 }
422 
423 
424 ATF_TC_WITH_CLEANUP(fhopen_success);
425 ATF_TC_HEAD(fhopen_success, tc)
426 {
427 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
428 					"fhopen(2) call");
429 }
430 
431 ATF_TC_BODY(fhopen_success, tc)
432 {
433 	pid = getpid();
434 	snprintf(extregex, sizeof(extregex), "fhopen.*%d.*return,success", pid);
435 
436 	/* File needs to exist to get a file-handle */
437 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
438 	/* Get the file handle to be passed to fhopen(2) */
439 	ATF_REQUIRE_EQ(0, getfh(path, &fht));
440 
441 	FILE *pipefd = setup(fds, auclass);
442 	ATF_REQUIRE((fhdesc = fhopen(&fht, O_RDWR)) != -1);
443 	check_audit(fds, extregex, pipefd);
444 
445 	close(fhdesc);
446 	close(filedesc);
447 }
448 
449 ATF_TC_CLEANUP(fhopen_success, tc)
450 {
451 	cleanup();
452 }
453 
454 
455 ATF_TC_WITH_CLEANUP(fhopen_failure);
456 ATF_TC_HEAD(fhopen_failure, tc)
457 {
458 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
459 					"fhopen(2) call");
460 }
461 
462 ATF_TC_BODY(fhopen_failure, tc)
463 {
464 	const char *regex = "fhopen.*return,failure : Invalid argument";
465 	FILE *pipefd = setup(fds, auclass);
466 	/*
467 	 * Failure reason: NULL does not represent any file handle
468 	 * and O_CREAT is not allowed as the flag for fhopen(2)
469 	 */
470 	ATF_REQUIRE_ERRNO(EINVAL, fhopen(NULL, O_CREAT) == -1);
471 	check_audit(fds, regex, pipefd);
472 }
473 
474 ATF_TC_CLEANUP(fhopen_failure, tc)
475 {
476 	cleanup();
477 }
478 
479 
480 ATF_TC_WITH_CLEANUP(fhstat_success);
481 ATF_TC_HEAD(fhstat_success, tc)
482 {
483 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
484 					"fstat(2) call");
485 }
486 
487 ATF_TC_BODY(fhstat_success, tc)
488 {
489 	pid = getpid();
490 	snprintf(extregex, sizeof(extregex), "fhstat.*%d.*return,success", pid);
491 
492 	/* File needs to exist to get a file-handle */
493 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
494 	/* Get the file handle to be passed to fhstat(2) */
495 	ATF_REQUIRE_EQ(0, getfh(path, &fht));
496 
497 	FILE *pipefd = setup(fds, auclass);
498 	ATF_REQUIRE_EQ(0, fhstat(&fht, &statbuff));
499 	check_audit(fds, extregex, pipefd);
500 	close(filedesc);
501 }
502 
503 ATF_TC_CLEANUP(fhstat_success, tc)
504 {
505 	cleanup();
506 }
507 
508 
509 ATF_TC_WITH_CLEANUP(fhstat_failure);
510 ATF_TC_HEAD(fhstat_failure, tc)
511 {
512 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
513 					"fhstat(2) call");
514 }
515 
516 ATF_TC_BODY(fhstat_failure, tc)
517 {
518 	const char *regex = "fhstat.*return,failure : Bad address";
519 	FILE *pipefd = setup(fds, auclass);
520 	/* Failure reason: NULL does not represent any file handle */
521 	ATF_REQUIRE_ERRNO(EFAULT, fhstat(NULL, NULL) == -1);
522 	check_audit(fds, regex, pipefd);
523 }
524 
525 ATF_TC_CLEANUP(fhstat_failure, tc)
526 {
527 	cleanup();
528 }
529 
530 
531 ATF_TC_WITH_CLEANUP(fhstatfs_success);
532 ATF_TC_HEAD(fhstatfs_success, tc)
533 {
534 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
535 					"fstatfs(2) call");
536 }
537 
538 ATF_TC_BODY(fhstatfs_success, tc)
539 {
540 	pid = getpid();
541 	snprintf(extregex, sizeof(extregex), "fhstatfs.*%d.*success", pid);
542 
543 	/* File needs to exist to get a file-handle */
544 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
545 	/* Get the file handle to be passed to fhstatfs(2) */
546 	ATF_REQUIRE_EQ(0, getfh(path, &fht));
547 
548 	FILE *pipefd = setup(fds, auclass);
549 	ATF_REQUIRE_EQ(0, fhstatfs(&fht, &statfsbuff));
550 	check_audit(fds, extregex, pipefd);
551 	close(filedesc);
552 }
553 
554 ATF_TC_CLEANUP(fhstatfs_success, tc)
555 {
556 	cleanup();
557 }
558 
559 
560 ATF_TC_WITH_CLEANUP(fhstatfs_failure);
561 ATF_TC_HEAD(fhstatfs_failure, tc)
562 {
563 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
564 					"fhstatfs(2) call");
565 }
566 
567 ATF_TC_BODY(fhstatfs_failure, tc)
568 {
569 	const char *regex = "fhstatfs.*return,failure : Bad address";
570 	FILE *pipefd = setup(fds, auclass);
571 	/* Failure reason: NULL does not represent any file handle */
572 	ATF_REQUIRE_ERRNO(EFAULT, fhstatfs(NULL, NULL) == -1);
573 	check_audit(fds, regex, pipefd);
574 }
575 
576 ATF_TC_CLEANUP(fhstatfs_failure, tc)
577 {
578 	cleanup();
579 }
580 
581 
582 ATF_TC_WITH_CLEANUP(access_success);
583 ATF_TC_HEAD(access_success, tc)
584 {
585 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
586 					"access(2) call");
587 }
588 
589 ATF_TC_BODY(access_success, tc)
590 {
591 	/* File needs to exist to call access(2) */
592 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
593 	FILE *pipefd = setup(fds, auclass);
594 	ATF_REQUIRE_EQ(0, access(path, F_OK));
595 	check_audit(fds, successreg, pipefd);
596 	close(filedesc);
597 }
598 
599 ATF_TC_CLEANUP(access_success, tc)
600 {
601 	cleanup();
602 }
603 
604 
605 ATF_TC_WITH_CLEANUP(access_failure);
606 ATF_TC_HEAD(access_failure, tc)
607 {
608 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
609 					"access(2) call");
610 }
611 
612 ATF_TC_BODY(access_failure, tc)
613 {
614 	FILE *pipefd = setup(fds, auclass);
615 	/* Failure reason: file does not exist */
616 	ATF_REQUIRE_ERRNO(ENOENT, access(errpath, F_OK) == -1);
617 	check_audit(fds, failurereg, pipefd);
618 }
619 
620 ATF_TC_CLEANUP(access_failure, tc)
621 {
622 	cleanup();
623 }
624 
625 
626 ATF_TC_WITH_CLEANUP(eaccess_success);
627 ATF_TC_HEAD(eaccess_success, tc)
628 {
629 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
630 					"eaccess(2) call");
631 }
632 
633 ATF_TC_BODY(eaccess_success, tc)
634 {
635 	/* File needs to exist to call eaccess(2) */
636 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
637 	FILE *pipefd = setup(fds, auclass);
638 	ATF_REQUIRE_EQ(0, eaccess(path, F_OK));
639 	check_audit(fds, successreg, pipefd);
640 	close(filedesc);
641 }
642 
643 ATF_TC_CLEANUP(eaccess_success, tc)
644 {
645 	cleanup();
646 }
647 
648 
649 ATF_TC_WITH_CLEANUP(eaccess_failure);
650 ATF_TC_HEAD(eaccess_failure, tc)
651 {
652 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
653 					"eaccess(2) call");
654 }
655 
656 ATF_TC_BODY(eaccess_failure, tc)
657 {
658 	FILE *pipefd = setup(fds, auclass);
659 	/* Failure reason: file does not exist */
660 	ATF_REQUIRE_ERRNO(ENOENT, eaccess(errpath, F_OK) == -1);
661 	check_audit(fds, failurereg, pipefd);
662 }
663 
664 ATF_TC_CLEANUP(eaccess_failure, tc)
665 {
666 	cleanup();
667 }
668 
669 
670 ATF_TC_WITH_CLEANUP(faccessat_success);
671 ATF_TC_HEAD(faccessat_success, tc)
672 {
673 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
674 					"faccessat(2) call");
675 }
676 
677 ATF_TC_BODY(faccessat_success, tc)
678 {
679 	/* File needs to exist to call faccessat(2) */
680 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
681 	FILE *pipefd = setup(fds, auclass);
682 	ATF_REQUIRE_EQ(0, faccessat(AT_FDCWD, path, F_OK, AT_EACCESS));
683 	check_audit(fds, successreg, pipefd);
684 	close(filedesc);
685 }
686 
687 ATF_TC_CLEANUP(faccessat_success, tc)
688 {
689 	cleanup();
690 }
691 
692 
693 ATF_TC_WITH_CLEANUP(faccessat_failure);
694 ATF_TC_HEAD(faccessat_failure, tc)
695 {
696 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
697 					"faccessat(2) call");
698 }
699 
700 ATF_TC_BODY(faccessat_failure, tc)
701 {
702 	FILE *pipefd = setup(fds, auclass);
703 	/* Failure reason: file does not exist */
704 	ATF_REQUIRE_ERRNO(ENOENT,
705 	    faccessat(AT_FDCWD, errpath, F_OK, AT_EACCESS) == -1);
706 	check_audit(fds, failurereg, pipefd);
707 }
708 
709 ATF_TC_CLEANUP(faccessat_failure, tc)
710 {
711 	cleanup();
712 }
713 
714 
715 ATF_TC_WITH_CLEANUP(pathconf_success);
716 ATF_TC_HEAD(pathconf_success, tc)
717 {
718 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
719 					"pathconf(2) call");
720 }
721 
722 ATF_TC_BODY(pathconf_success, tc)
723 {
724 	/* File needs to exist to call pathconf(2) */
725 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
726 	FILE *pipefd = setup(fds, auclass);
727 	/* Get the maximum number of bytes of filename */
728 	ATF_REQUIRE(pathconf(path, _PC_NAME_MAX) != -1);
729 	check_audit(fds, successreg, pipefd);
730 	close(filedesc);
731 }
732 
733 ATF_TC_CLEANUP(pathconf_success, tc)
734 {
735 	cleanup();
736 }
737 
738 
739 ATF_TC_WITH_CLEANUP(pathconf_failure);
740 ATF_TC_HEAD(pathconf_failure, tc)
741 {
742 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
743 					"pathconf(2) call");
744 }
745 
746 ATF_TC_BODY(pathconf_failure, tc)
747 {
748 	FILE *pipefd = setup(fds, auclass);
749 	/* Failure reason: file does not exist */
750 	ATF_REQUIRE_ERRNO(ENOENT, pathconf(errpath, _PC_NAME_MAX) == -1);
751 	check_audit(fds, failurereg, pipefd);
752 }
753 
754 ATF_TC_CLEANUP(pathconf_failure, tc)
755 {
756 	cleanup();
757 }
758 
759 
760 ATF_TC_WITH_CLEANUP(lpathconf_success);
761 ATF_TC_HEAD(lpathconf_success, tc)
762 {
763 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
764 					"lpathconf(2) call");
765 }
766 
767 ATF_TC_BODY(lpathconf_success, tc)
768 {
769 	/* Symbolic link needs to exist to call lpathconf(2) */
770 	ATF_REQUIRE_EQ(0, symlink("symlink", path));
771 	FILE *pipefd = setup(fds, auclass);
772 	/* Get the maximum number of bytes of symlink's name */
773 	ATF_REQUIRE(lpathconf(path, _PC_SYMLINK_MAX) != -1);
774 	check_audit(fds, successreg, pipefd);
775 }
776 
777 ATF_TC_CLEANUP(lpathconf_success, tc)
778 {
779 	cleanup();
780 }
781 
782 
783 ATF_TC_WITH_CLEANUP(lpathconf_failure);
784 ATF_TC_HEAD(lpathconf_failure, tc)
785 {
786 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
787 					"lpathconf(2) call");
788 }
789 
790 ATF_TC_BODY(lpathconf_failure, tc)
791 {
792 	FILE *pipefd = setup(fds, auclass);
793 	/* Failure reason: symbolic link does not exist */
794 	ATF_REQUIRE_ERRNO(ENOENT, lpathconf(errpath, _PC_SYMLINK_MAX) == -1);
795 	check_audit(fds, failurereg, pipefd);
796 }
797 
798 ATF_TC_CLEANUP(lpathconf_failure, tc)
799 {
800 	cleanup();
801 }
802 
803 
804 ATF_TC_WITH_CLEANUP(fpathconf_success);
805 ATF_TC_HEAD(fpathconf_success, tc)
806 {
807 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
808 					"fpathconf(2) call");
809 }
810 
811 ATF_TC_BODY(fpathconf_success, tc)
812 {
813 	pid = getpid();
814 	snprintf(extregex, sizeof(extregex), "fpathconf.*%d.*success", pid);
815 
816 	/* File needs to exist to call fpathconf(2) */
817 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
818 	FILE *pipefd = setup(fds, auclass);
819 	/* Get the maximum number of bytes of filename */
820 	ATF_REQUIRE(fpathconf(filedesc, _PC_NAME_MAX) != -1);
821 	check_audit(fds, extregex, pipefd);
822 	close(filedesc);
823 }
824 
825 ATF_TC_CLEANUP(fpathconf_success, tc)
826 {
827 	cleanup();
828 }
829 
830 
831 ATF_TC_WITH_CLEANUP(fpathconf_failure);
832 ATF_TC_HEAD(fpathconf_failure, tc)
833 {
834 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
835 					"fpathconf(2) call");
836 }
837 
838 ATF_TC_BODY(fpathconf_failure, tc)
839 {
840 	FILE *pipefd = setup(fds, auclass);
841 	const char *regex = "fpathconf.*return,failure : Bad file descriptor";
842 	/* Failure reason: Bad file descriptor */
843 	ATF_REQUIRE_ERRNO(EBADF, fpathconf(-1, _PC_NAME_MAX) == -1);
844 	check_audit(fds, regex, pipefd);
845 }
846 
847 ATF_TC_CLEANUP(fpathconf_failure, tc)
848 {
849 	cleanup();
850 }
851 
852 
853 ATF_TC_WITH_CLEANUP(extattr_get_file_success);
854 ATF_TC_HEAD(extattr_get_file_success, tc)
855 {
856 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
857 					"extattr_get_file(2) call");
858 }
859 
860 ATF_TC_BODY(extattr_get_file_success, tc)
861 {
862 	/* File needs to exist to call extattr_get_file(2) */
863 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
864 	skip_if_extattr_not_supported(path);
865 
866 	/* Set an extended attribute to be retrieved later on */
867 	REQUIRE_EXTATTR_RESULT(sizeof(buff),
868 	    extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, buff,
869 		sizeof(buff)));
870 
871 	/* Prepare the regex to be checked in the audit record */
872 	snprintf(extregex, sizeof(extregex),
873 		"extattr_get_file.*%s.*%s.*return,success", path, name);
874 
875 	FILE *pipefd = setup(fds, auclass);
876 	REQUIRE_EXTATTR_RESULT(sizeof(buff),
877 	    extattr_get_file(path, EXTATTR_NAMESPACE_USER, name, NULL, 0));
878 	check_audit(fds, extregex, pipefd);
879 	close(filedesc);
880 }
881 
882 ATF_TC_CLEANUP(extattr_get_file_success, tc)
883 {
884 	cleanup();
885 }
886 
887 
888 ATF_TC_WITH_CLEANUP(extattr_get_file_failure);
889 ATF_TC_HEAD(extattr_get_file_failure, tc)
890 {
891 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
892 					"extattr_get_file(2) call");
893 }
894 
895 ATF_TC_BODY(extattr_get_file_failure, tc)
896 {
897 	/* Prepare the regex to be checked in the audit record */
898 	snprintf(extregex, sizeof(extregex),
899 		"extattr_get_file.*%s.*%s.*failure", path, name);
900 
901 	FILE *pipefd = setup(fds, auclass);
902 	/* Failure reason: file does not exist */
903 	ATF_REQUIRE_ERRNO(ENOENT,
904 	    extattr_get_file(path, EXTATTR_NAMESPACE_USER, name, NULL, 0) ==
905 		-1);
906 	check_audit(fds, extregex, pipefd);
907 }
908 
909 ATF_TC_CLEANUP(extattr_get_file_failure, tc)
910 {
911 	cleanup();
912 }
913 
914 
915 ATF_TC_WITH_CLEANUP(extattr_get_fd_success);
916 ATF_TC_HEAD(extattr_get_fd_success, tc)
917 {
918 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
919 					"extattr_get_fd(2) call");
920 }
921 
922 ATF_TC_BODY(extattr_get_fd_success, tc)
923 {
924 	/* File needs to exist to call extattr_get_fd(2) */
925 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
926 	skip_if_extattr_not_supported(path);
927 
928 	/* Set an extended attribute to be retrieved later on */
929 	REQUIRE_EXTATTR_RESULT(sizeof(buff),
930 	    extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, buff,
931 		sizeof(buff)));
932 
933 	/* Prepare the regex to be checked in the audit record */
934 	snprintf(extregex, sizeof(extregex),
935 		"extattr_get_fd.*%s.*return,success", name);
936 
937 	FILE *pipefd = setup(fds, auclass);
938 	REQUIRE_EXTATTR_RESULT(sizeof(buff),
939 	    extattr_get_fd(filedesc, EXTATTR_NAMESPACE_USER, name, NULL, 0));
940 	check_audit(fds, extregex, pipefd);
941 	close(filedesc);
942 }
943 
944 ATF_TC_CLEANUP(extattr_get_fd_success, tc)
945 {
946 	cleanup();
947 }
948 
949 
950 ATF_TC_WITH_CLEANUP(extattr_get_fd_failure);
951 ATF_TC_HEAD(extattr_get_fd_failure, tc)
952 {
953 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
954 					"extattr_get_fd(2) call");
955 }
956 
957 ATF_TC_BODY(extattr_get_fd_failure, tc)
958 {
959 	/* Prepare the regex to be checked in the audit record */
960 	snprintf(extregex, sizeof(extregex),
961 	"extattr_get_fd.*%s.*return,failure : Bad file descriptor", name);
962 
963 	FILE *pipefd = setup(fds, auclass);
964 	/* Failure reason: Invalid file descriptor */
965 	ATF_REQUIRE_ERRNO(EBADF,
966 	    extattr_get_fd(-1, EXTATTR_NAMESPACE_USER, name, NULL, 0) == -1);
967 	check_audit(fds, extregex, pipefd);
968 }
969 
970 ATF_TC_CLEANUP(extattr_get_fd_failure, tc)
971 {
972 	cleanup();
973 }
974 
975 
976 ATF_TC_WITH_CLEANUP(extattr_get_link_success);
977 ATF_TC_HEAD(extattr_get_link_success, tc)
978 {
979 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
980 					"extattr_get_link(2) call");
981 }
982 
983 ATF_TC_BODY(extattr_get_link_success, tc)
984 {
985 	/* Symbolic link needs to exist to call extattr_get_link(2) */
986 	ATF_REQUIRE_EQ(0, symlink("symlink", path));
987 	skip_if_extattr_not_supported(".");
988 
989 	/* Set an extended attribute to be retrieved later on */
990 	REQUIRE_EXTATTR_RESULT(sizeof(buff),
991 	    extattr_set_link(path, EXTATTR_NAMESPACE_USER, name, buff,
992 		sizeof(buff)));
993 
994 	/* Prepare the regex to be checked in the audit record */
995 	snprintf(extregex, sizeof(extregex),
996 		"extattr_get_link.*%s.*%s.*return,success", path, name);
997 
998 	FILE *pipefd = setup(fds, auclass);
999 	REQUIRE_EXTATTR_RESULT(sizeof(buff),
1000 	    extattr_get_link(path, EXTATTR_NAMESPACE_USER, name, NULL, 0));
1001 	check_audit(fds, extregex, pipefd);
1002 }
1003 
1004 ATF_TC_CLEANUP(extattr_get_link_success, tc)
1005 {
1006 	cleanup();
1007 }
1008 
1009 
1010 ATF_TC_WITH_CLEANUP(extattr_get_link_failure);
1011 ATF_TC_HEAD(extattr_get_link_failure, tc)
1012 {
1013 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
1014 					"extattr_get_link(2) call");
1015 }
1016 
1017 ATF_TC_BODY(extattr_get_link_failure, tc)
1018 {
1019 	/* Prepare the regex to be checked in the audit record */
1020 	snprintf(extregex, sizeof(extregex),
1021 		"extattr_get_link.*%s.*%s.*failure", path, name);
1022 	FILE *pipefd = setup(fds, auclass);
1023 	/* Failure reason: symbolic link does not exist */
1024 	ATF_REQUIRE_ERRNO(ENOENT,
1025 	    extattr_get_link(path, EXTATTR_NAMESPACE_USER, name, NULL, 0));
1026 	check_audit(fds, extregex, pipefd);
1027 }
1028 
1029 ATF_TC_CLEANUP(extattr_get_link_failure, tc)
1030 {
1031 	cleanup();
1032 }
1033 
1034 
1035 ATF_TC_WITH_CLEANUP(extattr_list_file_success);
1036 ATF_TC_HEAD(extattr_list_file_success, tc)
1037 {
1038 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
1039 					"extattr_list_file(2) call");
1040 }
1041 
1042 ATF_TC_BODY(extattr_list_file_success, tc)
1043 {
1044 	ssize_t readbuff;
1045 	/* File needs to exist to call extattr_list_file(2) */
1046 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
1047 	skip_if_extattr_not_supported(path);
1048 
1049 	FILE *pipefd = setup(fds, auclass);
1050 	readbuff = REQUIRE_EXTATTR_SUCCESS(
1051 	    extattr_list_file(path, EXTATTR_NAMESPACE_USER, NULL, 0));
1052 	/* Prepare the regex to be checked in the audit record */
1053 	snprintf(extregex, sizeof(extregex),
1054 	    "extattr_list_file.*%s.*return,success,%zd", path, readbuff);
1055 	check_audit(fds, extregex, pipefd);
1056 }
1057 
1058 ATF_TC_CLEANUP(extattr_list_file_success, tc)
1059 {
1060 	cleanup();
1061 }
1062 
1063 
1064 ATF_TC_WITH_CLEANUP(extattr_list_file_failure);
1065 ATF_TC_HEAD(extattr_list_file_failure, tc)
1066 {
1067 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
1068 					"extattr_list_file(2) call");
1069 }
1070 
1071 ATF_TC_BODY(extattr_list_file_failure, tc)
1072 {
1073 	/* Prepare the regex to be checked in the audit record */
1074 	snprintf(extregex, sizeof(extregex),
1075 		"extattr_list_file.*%s.*return,failure", path);
1076 
1077 	FILE *pipefd = setup(fds, auclass);
1078 	/* Failure reason: file does not exist */
1079 	ATF_REQUIRE_ERRNO(ENOENT,
1080 	    extattr_list_file(path, EXTATTR_NAMESPACE_USER, NULL, 0));
1081 	check_audit(fds, extregex, pipefd);
1082 }
1083 
1084 ATF_TC_CLEANUP(extattr_list_file_failure, tc)
1085 {
1086 	cleanup();
1087 }
1088 
1089 
1090 ATF_TC_WITH_CLEANUP(extattr_list_fd_success);
1091 ATF_TC_HEAD(extattr_list_fd_success, tc)
1092 {
1093 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
1094 					"extattr_list_fd(2) call");
1095 }
1096 
1097 ATF_TC_BODY(extattr_list_fd_success, tc)
1098 {
1099 	ssize_t readbuff;
1100 	/* File needs to exist to call extattr_list_fd(2) */
1101 	ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
1102 	skip_if_extattr_not_supported(path);
1103 
1104 	FILE *pipefd = setup(fds, auclass);
1105 	readbuff = REQUIRE_EXTATTR_SUCCESS(
1106 	    extattr_list_fd(filedesc, EXTATTR_NAMESPACE_USER, NULL, 0));
1107 	/* Prepare the regex to be checked in the audit record */
1108 	snprintf(extregex, sizeof(extregex),
1109 	    "extattr_list_fd.*return,success,%zd", readbuff);
1110 	check_audit(fds, extregex, pipefd);
1111 	close(filedesc);
1112 }
1113 
1114 ATF_TC_CLEANUP(extattr_list_fd_success, tc)
1115 {
1116 	cleanup();
1117 }
1118 
1119 
1120 ATF_TC_WITH_CLEANUP(extattr_list_fd_failure);
1121 ATF_TC_HEAD(extattr_list_fd_failure, tc)
1122 {
1123 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
1124 					"extattr_list_fd(2) call");
1125 }
1126 
1127 ATF_TC_BODY(extattr_list_fd_failure, tc)
1128 {
1129 	/* Prepare the regex to be checked in the audit record */
1130 	snprintf(extregex, sizeof(extregex),
1131 		"extattr_list_fd.*return,failure : Bad file descriptor");
1132 
1133 	FILE *pipefd = setup(fds, auclass);
1134 	/* Failure reason: Invalid file descriptor */
1135 	ATF_REQUIRE_ERRNO(EBADF,
1136 	    extattr_list_fd(-1, EXTATTR_NAMESPACE_USER, NULL, 0) == -1);
1137 	check_audit(fds, extregex, pipefd);
1138 }
1139 
1140 ATF_TC_CLEANUP(extattr_list_fd_failure, tc)
1141 {
1142 	cleanup();
1143 }
1144 
1145 
1146 ATF_TC_WITH_CLEANUP(extattr_list_link_success);
1147 ATF_TC_HEAD(extattr_list_link_success, tc)
1148 {
1149 	atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
1150 					"extattr_list_link(2) call");
1151 }
1152 
1153 ATF_TC_BODY(extattr_list_link_success, tc)
1154 {
1155 	ssize_t readbuff;
1156 	/* Symbolic link needs to exist to call extattr_list_link(2) */
1157 	ATF_REQUIRE_EQ(0, symlink("symlink", path));
1158 	skip_if_extattr_not_supported(".");
1159 
1160 	FILE *pipefd = setup(fds, auclass);
1161 	readbuff = REQUIRE_EXTATTR_SUCCESS(
1162 	    extattr_list_link(path, EXTATTR_NAMESPACE_USER, NULL, 0));
1163 	/* Prepare the regex to be checked in the audit record */
1164 	snprintf(extregex, sizeof(extregex),
1165 	    "extattr_list_link.*%s.*return,success,%zd", path, readbuff);
1166 	check_audit(fds, extregex, pipefd);
1167 }
1168 
1169 ATF_TC_CLEANUP(extattr_list_link_success, tc)
1170 {
1171 	cleanup();
1172 }
1173 
1174 
1175 ATF_TC_WITH_CLEANUP(extattr_list_link_failure);
1176 ATF_TC_HEAD(extattr_list_link_failure, tc)
1177 {
1178 	atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
1179 					"extattr_list_link(2) call");
1180 }
1181 
1182 ATF_TC_BODY(extattr_list_link_failure, tc)
1183 {
1184 	/* Prepare the regex to be checked in the audit record */
1185 	snprintf(extregex, sizeof(extregex),
1186 		"extattr_list_link.*%s.*failure", path);
1187 	FILE *pipefd = setup(fds, auclass);
1188 	/* Failure reason: symbolic link does not exist */
1189 	ATF_REQUIRE_ERRNO(ENOENT,
1190 	    extattr_list_link(path, EXTATTR_NAMESPACE_USER, NULL, 0) == -1);
1191 	check_audit(fds, extregex, pipefd);
1192 }
1193 
1194 ATF_TC_CLEANUP(extattr_list_link_failure, tc)
1195 {
1196 	cleanup();
1197 }
1198 
1199 
1200 ATF_TP_ADD_TCS(tp)
1201 {
1202 	ATF_TP_ADD_TC(tp, stat_success);
1203 	ATF_TP_ADD_TC(tp, stat_failure);
1204 	ATF_TP_ADD_TC(tp, lstat_success);
1205 	ATF_TP_ADD_TC(tp, lstat_failure);
1206 	ATF_TP_ADD_TC(tp, fstat_success);
1207 	ATF_TP_ADD_TC(tp, fstat_failure);
1208 	ATF_TP_ADD_TC(tp, fstatat_success);
1209 	ATF_TP_ADD_TC(tp, fstatat_failure);
1210 
1211 	ATF_TP_ADD_TC(tp, statfs_success);
1212 	ATF_TP_ADD_TC(tp, statfs_failure);
1213 	ATF_TP_ADD_TC(tp, fstatfs_success);
1214 	ATF_TP_ADD_TC(tp, fstatfs_failure);
1215 
1216 	ATF_TP_ADD_TC(tp, getfsstat_success);
1217 	ATF_TP_ADD_TC(tp, getfsstat_failure);
1218 
1219 	ATF_TP_ADD_TC(tp, lgetfh_success);
1220 	ATF_TP_ADD_TC(tp, lgetfh_failure);
1221 	ATF_TP_ADD_TC(tp, fhopen_success);
1222 	ATF_TP_ADD_TC(tp, fhopen_failure);
1223 	ATF_TP_ADD_TC(tp, fhstat_success);
1224 	ATF_TP_ADD_TC(tp, fhstat_failure);
1225 	ATF_TP_ADD_TC(tp, fhstatfs_success);
1226 	ATF_TP_ADD_TC(tp, fhstatfs_failure);
1227 
1228 	ATF_TP_ADD_TC(tp, access_success);
1229 	ATF_TP_ADD_TC(tp, access_failure);
1230 	ATF_TP_ADD_TC(tp, eaccess_success);
1231 	ATF_TP_ADD_TC(tp, eaccess_failure);
1232 	ATF_TP_ADD_TC(tp, faccessat_success);
1233 	ATF_TP_ADD_TC(tp, faccessat_failure);
1234 
1235 	ATF_TP_ADD_TC(tp, pathconf_success);
1236 	ATF_TP_ADD_TC(tp, pathconf_failure);
1237 	ATF_TP_ADD_TC(tp, lpathconf_success);
1238 	ATF_TP_ADD_TC(tp, lpathconf_failure);
1239 	ATF_TP_ADD_TC(tp, fpathconf_success);
1240 	ATF_TP_ADD_TC(tp, fpathconf_failure);
1241 
1242 	ATF_TP_ADD_TC(tp, extattr_get_file_success);
1243 	ATF_TP_ADD_TC(tp, extattr_get_file_failure);
1244 	ATF_TP_ADD_TC(tp, extattr_get_fd_success);
1245 	ATF_TP_ADD_TC(tp, extattr_get_fd_failure);
1246 	ATF_TP_ADD_TC(tp, extattr_get_link_success);
1247 	ATF_TP_ADD_TC(tp, extattr_get_link_failure);
1248 
1249 	ATF_TP_ADD_TC(tp, extattr_list_file_success);
1250 	ATF_TP_ADD_TC(tp, extattr_list_file_failure);
1251 	ATF_TP_ADD_TC(tp, extattr_list_fd_success);
1252 	ATF_TP_ADD_TC(tp, extattr_list_fd_failure);
1253 	ATF_TP_ADD_TC(tp, extattr_list_link_success);
1254 	ATF_TP_ADD_TC(tp, extattr_list_link_failure);
1255 	return (atf_no_error());
1256 }
1257