getpfileattr Subroutine

Purpose

Accesses the privileged file security information in the privileged file database.

Library

Security Library (libc.a)

Syntax

#include <usersec.h>

int getpfileattr (File, Attribute, Value, Type)
    char *File;
    char *Attribute;
    void *Value;
    int Type;

Description

The getpfileattr subroutine reads a specified attribute from the privileged file database. If the database is not open, this subroutine does an implicit open for reading.

Parameters

Item Description
File Specifies the file name. The value must be the full path to the file on the system. This parameter must be specified unless the value of the Type parameter is SEC_COMMIT.
Attribute Specifies which attribute is read. The following possible attributes are defined in the usersec.h file:
S_READAUTHS
Authorizations required to read the file using the pvi command. A total of eight authorizations can be defined. The attribute type is SEC_LIST.
S_WRITEAUTHS
Authorizations required to write to the file using the pvi command. A total of eight authorizations can be defined. The attribute type is SEC_LIST.
Value Specifies a buffer, a pointer to a buffer, or a pointer to a pointer depending on the Attribute and Type parameters. See the Type parameter for more details.
Type Specifies the type of attribute expected. The usersec.h file defines and includes the following valid types:
SEC_LIST
The format of the attribute is a series of concatenated strings, each null-terminated. The last string in the series is terminated by two successive null characters. For the getpfileattr subroutine, you must supply a pointer to a defined character pointer variable. It is the caller's responsibility to free this memory.
SEC_DELETE
If the Attribute parameter is specified, the corresponding attribute is deleted from the privileged file database. If no Attribute parameter is specified, the entire privileged file definition is deleted from the privileged file database.

Security

Files Accessed:
File Mode
/etc/security/privfiles rw

Return Values

If successful, the getpfileattr subroutine returns a value of zero. Otherwise, a value of -1 is returned and the errno global value is set to indicate the error.

Error Codes

If the getpfileattr subroutine fails, one of the following errno values can be set:

Item Description
EINVAL The File parameter is NULL or default.
EINVAL The Attribute or Type parameter is NULL or does not contain one of the defined values.
EINVAL The Attribute parameter is S_PRIVFILES, but the File parameter is not ALL.
EINVAL The Value parameter does not point to a valid buffer for this type of attribute.
ENOENT The file specified in the File parameter does not exist.
ENOATTR The attribute specified in the Attribute parameter is valid, but no value is defined for the file.
EPERM Operation is not permitted.