| 445 | } |
| 446 | |
| 447 | void |
| 448 | audit_commit(struct kaudit_record *ar, int error, int retval) |
| 449 | { |
| 450 | au_event_t event; |
| 451 | au_class_t class; |
| 452 | au_id_t auid; |
| 453 | int sorf; |
| 454 | struct au_mask *aumask; |
| 455 | |
| 456 | if (ar == NULL) |
| 457 | return; |
| 458 | |
| 459 | ar->k_ar.ar_errno = error; |
| 460 | ar->k_ar.ar_retval = retval; |
| 461 | nanotime(&ar->k_ar.ar_endtime); |
| 462 | |
| 463 | /* |
| 464 | * Decide whether to commit the audit record by checking the error |
| 465 | * value from the system call and using the appropriate audit mask. |
| 466 | */ |
| 467 | if (ar->k_ar.ar_subj_auid == AU_DEFAUDITID) |
| 468 | aumask = &audit_nae_mask; |
| 469 | else |
| 470 | aumask = &ar->k_ar.ar_subj_amask; |
| 471 | |
| 472 | if (error) |
| 473 | sorf = AU_PRS_FAILURE; |
| 474 | else |
| 475 | sorf = AU_PRS_SUCCESS; |
| 476 | |
| 477 | /* |
| 478 | * syscalls.master sometimes contains a prototype event number, which |
| 479 | * we will transform into a more specific event number now that we |
| 480 | * have more complete information gathered during the system call. |
| 481 | */ |
| 482 | switch(ar->k_ar.ar_event) { |
| 483 | case AUE_OPEN_RWTC: |
| 484 | ar->k_ar.ar_event = audit_flags_and_error_to_openevent( |
| 485 | ar->k_ar.ar_arg_fflags, error); |
| 486 | break; |
| 487 | |
| 488 | case AUE_OPENAT_RWTC: |
| 489 | ar->k_ar.ar_event = audit_flags_and_error_to_openatevent( |
| 490 | ar->k_ar.ar_arg_fflags, error); |
| 491 | break; |
| 492 | |
| 493 | case AUE_SYSCTL: |
| 494 | ar->k_ar.ar_event = audit_ctlname_to_sysctlevent( |
| 495 | ar->k_ar.ar_arg_ctlname, ar->k_ar.ar_valid_arg); |
| 496 | break; |
| 497 | |
| 498 | case AUE_AUDITON: |
| 499 | /* Convert the auditon() command to an event. */ |
| 500 | ar->k_ar.ar_event = auditon_command_event(ar->k_ar.ar_arg_cmd); |
| 501 | break; |
| 502 | |
| 503 | case AUE_MSGSYS: |
| 504 | if (ARG_IS_VALID(ar, ARG_SVIPC_WHICH)) |
no test coverage detected