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