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