chaudit -- Change File Audit Flags (Using Pathname)

SYNOPSIS

#include <sys/types.h> 
#include <sys/stat.h>

 int chaudit(const char *pathname, int auditFlags, int securityType);
 

DESCRIPTION

chaudit changes the audit flags for the file specified by the pathname argument. The audit flags control the type of file requests that the OpenEdition MVS security product audits. The chaudit function can change either user audit flags or security auditor audit flags, depending on the setting of the securityType argument.

The auditFlags argument is formed by ORing any of the following flags, which are defined in <sys/stat.h>:

AUDTREDFAIL
audit failing read requests.
AUDTREADSUCC
audit successful read requests.
AUDTWRITEFAIL
audit failing write requests.
AUDWRITESUCC
audit successful write requests.
AUDTEXECFAIL
audit failing search or execute requests.
AUDTEXECSUCC
audit successful search or execute requests.
The flags for the securityType argument are also defined in <sys/stat.h> and can be either of the following:
AUDT_USER
specifies that the changes should be applied to the user audit flags. In order to change the user audit flags for a file, the user must be either the file owner or have the appropriate authority to make the changes.
AUDT_AUDITOR
specifies that the changes should be applied to the security auditor audit flags. This securityType argument can only be specified by a user with security auditor authority.

PORTABILITY

The chaudit function is useful in OpenEdition applications; however, it is not defined by the POSIX.1 standard and should not be used in portable applications.

RETURN VALUE

chaudit returns 0 if successful and a -1 if unsuccessful.

EXAMPLE

The following example illustrates the use of chaudit to change a file's user audit flags.

Note: You must specify the posix option when compiling this example.

  #include <sys/types.h>
  #include <sys/stat.h>
  #include <fcntl.h>
  #include <string.h>
  #include <stdio.h>
  #include <stdlib.h>

  main()
  {
     int fd;
     char words[] = "Test File";

        /* Create a test file.              */
     if ((fd = creat("test.file", S_IRUSR|S_IWUSR)) == -1)  {
        perror("creat error");
        exit(1);
     }
     else {
        write(fd, words, strlen(words));
        close(fd);
     }
        /* Change the user audit flags.     */
     if (chaudit("test.file", AUDTREADFAIL|AUDTWRITEFAIL, AUDT_USER) != 0)
        perror("chaudit error");
  }

 

RELATED FUNCTIONS

chmod, chown, fchaudit,


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.