getportattr or putportattr Subroutine
Purpose
Accesses the port information in the port database.
Library
Security Library (libc.a)
Syntax
Description
The getportattr or putportattr subroutine accesses port information. The getportattr subroutine reads a specified attribute from the port database. If the database is not already open, the getportattr subroutine implicitly opens the database for reading. The putportattr subroutine writes a specified attribute into the port database. If the database is not already open, the putportattr subroutine implicitly opens the database for reading and writing. The data changed by the putportattr subroutine must be explicitly committed by calling the putportattr subroutine with a Type parameter equal to the SEC_COMMIT value. Until all the data is committed, only these subroutines within the process return the written data.
Values returned by these subroutines are in dynamically allocated buffers. You do not need to move the values prior to the next call.
Use the setuserdb or enduserdb subroutine to open and close the port database.
Parameters
Item | Description |
---|---|
Port | Specifies the name of the port for which an attribute is read. |
Attribute | Specifies the name of the attribute read. This attribute
can be one of the following values defined in the usersec.h file:
|
Value | Specifies the address of a buffer in which the attribute is stored with putportattr or is to be read getportattr. |
Type | Specifies the type of attribute expected. The following types
are valid and defined in the usersec.h file:
|
Security
Access Control: The calling process must have access to the port information in the port database.
File Accessed:
Item | Description |
---|---|
rw | /etc/security/login.cfg |
rw | /etc/security/portlog |
Return Values
The getportattr and putportattr subroutines return a value of 0 if completed successfully. Otherwise, a value of -1 is returned and the errno global value is set to indicate the error.
Error Codes
These subroutines are unsuccessful if the following values are true:
Item | Description |
---|---|
EACCES | Indicates that access permission is denied for the data requested. |
ENOENT | Indicates that the Port parameter does not exist or the attribute is not defined for the specified port. |
ENOATTR | Indicates that the specified port attribute does not exist for the specified port. |
EINVAL | Indicates that the Attribute parameter does not contain one of the defined attributes or is a null value. |
EINVAL | Indicates that the Value parameter does not point to a valid buffer or to valid data for this type of attribute. |
Item | Description |
---|---|
EPERM | Operation is not permitted. |